ablok-components 0.3.136 → 0.3.138
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/ablok-components.css +1 -1
- package/dist/ablok-components.umd.js +2 -2
- package/dist/components/molecules/base-camera/base-camera.js +1 -1
- package/dist/components/molecules/base-camera/base-camera.vue.d.ts +14 -0
- package/dist/components/molecules/base-camera/base-camera.vue_vue_type_script_setup_true_lang.js +154 -145
- package/dist/composables/useCamera.d.ts +5 -0
- package/dist/composables/useCamera.js +5 -0
- package/dist/utilities/camera/CameraManager.d.ts +10 -0
- package/dist/utilities/camera/CameraManager.js +81 -51
- package/dist/utilities/camera/capture.d.ts +0 -2
- package/dist/utilities/camera/capture.js +21 -38
- package/dist/utilities/camera/types.d.ts +6 -0
- package/package.json +1 -1
|
@@ -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-
|
|
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;
|
package/dist/components/molecules/base-camera/base-camera.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -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
|
|
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
|
|
10
|
+
var ie = {
|
|
11
11
|
class: "base-camera position-relative w-100 user-select-none",
|
|
12
12
|
"data-bs-theme": "dark"
|
|
13
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
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
|
-
},
|
|
46
|
+
}, Se = ["data-countdown"], Ce = {
|
|
47
47
|
key: 0,
|
|
48
48
|
class: "base-camera__zoom"
|
|
49
|
-
},
|
|
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:
|
|
188
|
-
let
|
|
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
|
-
}),
|
|
192
|
-
preferredFacing:
|
|
193
|
-
resolution:
|
|
194
|
-
videoRef:
|
|
195
|
-
onWarning: (e) =>
|
|
196
|
-
}),
|
|
197
|
-
|
|
198
|
-
|
|
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 =
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}),
|
|
204
|
-
|
|
205
|
-
}),
|
|
206
|
-
|
|
207
|
-
}),
|
|
208
|
-
e &&
|
|
209
|
-
}),
|
|
210
|
-
e &&
|
|
211
|
-
}),
|
|
212
|
-
|
|
213
|
-
}),
|
|
214
|
-
|
|
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
|
|
217
|
-
|
|
220
|
+
function X() {
|
|
221
|
+
H && clearTimeout(H), H = null, F.value = !1, U?.(), U = null;
|
|
218
222
|
}
|
|
219
|
-
function
|
|
220
|
-
if (!
|
|
221
|
-
|
|
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
|
-
|
|
227
|
+
U = e;
|
|
224
228
|
});
|
|
225
|
-
return
|
|
229
|
+
return H = setTimeout(X, 650), e;
|
|
226
230
|
}
|
|
227
|
-
function
|
|
228
|
-
|
|
231
|
+
function Z() {
|
|
232
|
+
G && clearTimeout(G), G = null, K?.(), K = null;
|
|
229
233
|
}
|
|
230
|
-
function
|
|
231
|
-
if (!
|
|
234
|
+
function ke() {
|
|
235
|
+
if (!z.value) return {
|
|
232
236
|
peak: Promise.resolve(),
|
|
233
237
|
faded: Promise.resolve()
|
|
234
238
|
};
|
|
235
|
-
|
|
239
|
+
W && clearTimeout(W), Z(), R.value++, L.value = !0;
|
|
236
240
|
let e = new Promise((e) => {
|
|
237
|
-
|
|
241
|
+
K = e;
|
|
238
242
|
});
|
|
239
|
-
return
|
|
240
|
-
|
|
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
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
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
|
-
|
|
272
|
+
i && A.setTorch(!1), a && A.setExposureLocked(!1), N.value = !1;
|
|
264
273
|
}
|
|
265
274
|
}
|
|
266
|
-
function
|
|
275
|
+
function Q() {
|
|
267
276
|
return new Promise((e) => {
|
|
268
|
-
|
|
269
|
-
|
|
277
|
+
q = e, V = setTimeout(() => {
|
|
278
|
+
V = null, q = null, e(!0);
|
|
270
279
|
}, 1e3);
|
|
271
280
|
});
|
|
272
281
|
}
|
|
273
|
-
async function
|
|
274
|
-
let e = Number.isFinite(
|
|
275
|
-
for (let t = e; t > 0; t--) if (
|
|
276
|
-
return
|
|
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
|
|
280
|
-
|
|
281
|
-
}),
|
|
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
|
|
292
|
+
function Ne(e) {
|
|
284
293
|
let t = e.target.value;
|
|
285
|
-
t &&
|
|
294
|
+
t && A.selectDevice(t);
|
|
286
295
|
}
|
|
287
|
-
function
|
|
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
|
|
301
|
+
return g({
|
|
293
302
|
onCapture: $,
|
|
294
|
-
camera:
|
|
295
|
-
zoom:
|
|
296
|
-
}), (n, r) => (
|
|
303
|
+
camera: A,
|
|
304
|
+
zoom: Y
|
|
305
|
+
}), (n, r) => (_(), p("div", ie, [h(a, {
|
|
297
306
|
ref_key: "previewRef",
|
|
298
|
-
ref:
|
|
307
|
+
ref: D,
|
|
299
308
|
ratio: s.ratio,
|
|
300
309
|
resolutions: s.resolutions,
|
|
301
|
-
mirror:
|
|
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:
|
|
307
|
-
s.enableGuide && s.guideSrc ? (
|
|
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,
|
|
314
|
-
|
|
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:
|
|
318
|
-
"onUpdate:modelValue": r[0] ||= (e) =>
|
|
319
|
-
disabled:
|
|
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:
|
|
322
|
-
options:
|
|
330
|
+
onChange: Ne,
|
|
331
|
+
options: b(A).devices.value.map((e, t) => ({
|
|
323
332
|
value: e.deviceId,
|
|
324
|
-
text:
|
|
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
|
-
])) : (
|
|
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":
|
|
336
|
-
onClick: r[1] ||= (e) =>
|
|
337
|
-
}, [
|
|
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
|
-
})) : (
|
|
349
|
+
})) : (_(), d(e, {
|
|
341
350
|
key: 1,
|
|
342
351
|
symbol: "zap-off"
|
|
343
|
-
}))], 8, le)) :
|
|
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:
|
|
356
|
+
disabled: b(A).isStarting.value,
|
|
348
357
|
"aria-label": "Switch camera",
|
|
349
|
-
onClick: r[2] ||= (e) =>
|
|
350
|
-
}, [
|
|
351
|
-
|
|
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) =>
|
|
356
|
-
}, " Retry ")) :
|
|
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) =>
|
|
361
|
-
}, "Start camera"))])) :
|
|
362
|
-
|
|
363
|
-
|
|
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:
|
|
367
|
-
"aria-label":
|
|
368
|
-
onClick: r[5] ||= (e) =>
|
|
369
|
-
}, [
|
|
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),
|
|
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)]])) : (
|
|
382
|
-
|
|
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: !
|
|
394
|
+
disabled: !M.value || N.value || P.value > 0,
|
|
386
395
|
"aria-label": "Capture photo",
|
|
387
396
|
onClick: r[6] ||= (e) => $()
|
|
388
|
-
}, [...r[12] ||= [
|
|
389
|
-
|
|
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) =>
|
|
394
|
-
}, [
|
|
395
|
-
])) :
|
|
396
|
-
|
|
397
|
-
key:
|
|
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":
|
|
400
|
-
},
|
|
401
|
-
|
|
402
|
-
key:
|
|
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] ||= [
|
|
406
|
-
(
|
|
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
|
-
}, [
|
|
418
|
+
}, [h(l, {
|
|
410
419
|
name: "base-camera-flash",
|
|
411
|
-
onAfterLeave:
|
|
420
|
+
onAfterLeave: Z
|
|
412
421
|
}, {
|
|
413
|
-
default:
|
|
414
|
-
key:
|
|
415
|
-
class:
|
|
416
|
-
style:
|
|
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)) :
|
|
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
|
-
]),
|
|
431
|
-
modelValue:
|
|
432
|
-
"onUpdate:modelValue": r[8] ||= (e) =>
|
|
433
|
-
min:
|
|
434
|
-
max:
|
|
435
|
-
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
|
-
])])) :
|
|
450
|
+
])])) : f("", !0)]));
|
|
442
451
|
}
|
|
443
452
|
});
|
|
444
453
|
//#endregion
|
|
445
|
-
export {
|
|
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
|
}
|