ablok-components 0.3.134 → 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.
- 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 +23 -0
- package/dist/components/molecules/base-camera/base-camera.vue_vue_type_script_setup_true_lang.js +185 -158
- package/dist/components/molecules/input-dropdown/input-dropdown.vue_vue_type_script_setup_true_lang.js +2 -1
- 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 +33 -3
- 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 };
|
|
@@ -119,6 +119,14 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
|
|
|
119
119
|
type: StringConstructor;
|
|
120
120
|
default: string;
|
|
121
121
|
};
|
|
122
|
+
screenFlashFullscreen: {
|
|
123
|
+
type: BooleanConstructor;
|
|
124
|
+
default: boolean;
|
|
125
|
+
};
|
|
126
|
+
enableTorch: {
|
|
127
|
+
type: BooleanConstructor;
|
|
128
|
+
default: boolean;
|
|
129
|
+
};
|
|
122
130
|
enableShutterAnimation: {
|
|
123
131
|
type: BooleanConstructor;
|
|
124
132
|
default: boolean;
|
|
@@ -137,6 +145,9 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
|
|
|
137
145
|
permission: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../../../utilities/camera/types').CameraPermission>;
|
|
138
146
|
zoom: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<number>;
|
|
139
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>;
|
|
140
151
|
isLive: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
|
|
141
152
|
isPaused: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
|
|
142
153
|
isStarting: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
|
|
@@ -151,6 +162,8 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
|
|
|
151
162
|
selectDevice: (deviceId: string) => Promise<boolean>;
|
|
152
163
|
setResolution: (r: Resolution) => Promise<boolean>;
|
|
153
164
|
setZoom: (z: number) => Promise<boolean>;
|
|
165
|
+
setTorch: (on: boolean) => Promise<boolean>;
|
|
166
|
+
setExposureLocked: (locked: boolean) => Promise<boolean>;
|
|
154
167
|
refreshDevices: () => Promise<void>;
|
|
155
168
|
bindVideo: (el: HTMLVideoElement | null) => void;
|
|
156
169
|
};
|
|
@@ -279,6 +292,14 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
|
|
|
279
292
|
type: StringConstructor;
|
|
280
293
|
default: string;
|
|
281
294
|
};
|
|
295
|
+
screenFlashFullscreen: {
|
|
296
|
+
type: BooleanConstructor;
|
|
297
|
+
default: boolean;
|
|
298
|
+
};
|
|
299
|
+
enableTorch: {
|
|
300
|
+
type: BooleanConstructor;
|
|
301
|
+
default: boolean;
|
|
302
|
+
};
|
|
282
303
|
enableShutterAnimation: {
|
|
283
304
|
type: BooleanConstructor;
|
|
284
305
|
default: boolean;
|
|
@@ -309,6 +330,8 @@ declare const __VLS_export: import('../../../../vue/dist/vue.esm-bundler.js').De
|
|
|
309
330
|
enableControls: boolean;
|
|
310
331
|
enableScreenFlash: boolean;
|
|
311
332
|
screenFlashColor: string;
|
|
333
|
+
screenFlashFullscreen: boolean;
|
|
334
|
+
enableTorch: boolean;
|
|
312
335
|
enableShutterAnimation: boolean;
|
|
313
336
|
}, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, true, {}, any>;
|
|
314
337
|
declare const _default: typeof __VLS_export;
|
package/dist/components/molecules/base-camera/base-camera.vue_vue_type_script_setup_true_lang.js
CHANGED
|
@@ -3,50 +3,50 @@ import t from "../input-dropdown/input-dropdown.js";
|
|
|
3
3
|
import { captureFrame as n, exportCanvas as r } from "../../../utilities/camera/capture.js";
|
|
4
4
|
import { useCamera as i } from "../../../composables/useCamera.js";
|
|
5
5
|
import a from "../camera-preview/camera-preview.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { Transition as
|
|
6
|
+
import o from "../../atoms/zoom-slider/zoom-slider.js";
|
|
7
|
+
import s from "../../../assets/img/guide.js";
|
|
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
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 = {
|
|
17
17
|
key: 0,
|
|
18
18
|
class: "spinner-border text-light",
|
|
19
19
|
role: "status"
|
|
20
|
-
},
|
|
20
|
+
}, pe = {
|
|
21
21
|
key: 1,
|
|
22
22
|
class: "alert alert-danger py-2 px-3 mb-0 small"
|
|
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 },
|
|
@@ -154,7 +154,7 @@ var ie = {
|
|
|
154
154
|
},
|
|
155
155
|
guideSrc: {
|
|
156
156
|
type: String,
|
|
157
|
-
default:
|
|
157
|
+
default: s
|
|
158
158
|
},
|
|
159
159
|
enableControls: {
|
|
160
160
|
type: Boolean,
|
|
@@ -168,6 +168,14 @@ var ie = {
|
|
|
168
168
|
type: String,
|
|
169
169
|
default: "#FFFFFF"
|
|
170
170
|
},
|
|
171
|
+
screenFlashFullscreen: {
|
|
172
|
+
type: Boolean,
|
|
173
|
+
default: !1
|
|
174
|
+
},
|
|
175
|
+
enableTorch: {
|
|
176
|
+
type: Boolean,
|
|
177
|
+
default: !0
|
|
178
|
+
},
|
|
171
179
|
enableShutterAnimation: {
|
|
172
180
|
type: Boolean,
|
|
173
181
|
default: !0
|
|
@@ -180,226 +188,245 @@ var ie = {
|
|
|
180
188
|
"error",
|
|
181
189
|
"state"
|
|
182
190
|
],
|
|
183
|
-
setup(
|
|
184
|
-
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] ?? {
|
|
185
193
|
width: 720,
|
|
186
194
|
height: 960
|
|
187
|
-
}),
|
|
188
|
-
preferredFacing:
|
|
189
|
-
resolution:
|
|
190
|
-
videoRef:
|
|
191
|
-
onWarning: (e) =>
|
|
192
|
-
}),
|
|
193
|
-
|
|
194
|
-
|
|
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;
|
|
195
203
|
});
|
|
196
|
-
let H = null, U = null, W = null, G = null, K = null, q = null, J =
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}),
|
|
200
|
-
|
|
201
|
-
}),
|
|
202
|
-
|
|
203
|
-
}),
|
|
204
|
-
e &&
|
|
205
|
-
}),
|
|
206
|
-
e &&
|
|
207
|
-
}),
|
|
208
|
-
|
|
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();
|
|
209
217
|
}), re(() => {
|
|
210
|
-
|
|
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;
|
|
211
219
|
});
|
|
212
|
-
function
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
220
|
+
function X() {
|
|
221
|
+
H && clearTimeout(H), H = null, F.value = !1, U?.(), U = null;
|
|
222
|
+
}
|
|
223
|
+
function Oe() {
|
|
224
|
+
if (!T.enableShutterAnimation) return Promise.resolve();
|
|
225
|
+
X(), I.value++, F.value = !0;
|
|
226
|
+
let e = new Promise((e) => {
|
|
227
|
+
U = e;
|
|
228
|
+
});
|
|
229
|
+
return H = setTimeout(X, 650), e;
|
|
216
230
|
}
|
|
217
231
|
function Z() {
|
|
218
|
-
|
|
232
|
+
G && clearTimeout(G), G = null, K?.(), K = null;
|
|
219
233
|
}
|
|
220
|
-
function
|
|
221
|
-
if (!
|
|
234
|
+
function ke() {
|
|
235
|
+
if (!z.value) return {
|
|
222
236
|
peak: Promise.resolve(),
|
|
223
237
|
faded: Promise.resolve()
|
|
224
238
|
};
|
|
225
|
-
|
|
239
|
+
W && clearTimeout(W), Z(), R.value++, L.value = !0;
|
|
226
240
|
let e = new Promise((e) => {
|
|
227
|
-
|
|
241
|
+
K = e;
|
|
228
242
|
});
|
|
229
|
-
return
|
|
230
|
-
|
|
243
|
+
return W = setTimeout(() => {
|
|
244
|
+
W = null, L.value = !1, G = setTimeout(Z, 400);
|
|
231
245
|
}, 350), {
|
|
232
246
|
peak: new Promise((e) => setTimeout(e, 120)),
|
|
233
247
|
faded: e
|
|
234
248
|
};
|
|
235
249
|
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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;
|
|
240
258
|
try {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
return await t.faded, Y ? null : (T("update:modelValue", a), T("capture", a, i), a);
|
|
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);
|
|
254
271
|
} finally {
|
|
255
|
-
|
|
272
|
+
i && A.setTorch(!1), a && A.setExposureLocked(!1), N.value = !1;
|
|
256
273
|
}
|
|
257
274
|
}
|
|
258
|
-
function
|
|
275
|
+
function Q() {
|
|
259
276
|
return new Promise((e) => {
|
|
260
|
-
|
|
261
|
-
|
|
277
|
+
q = e, V = setTimeout(() => {
|
|
278
|
+
V = null, q = null, e(!0);
|
|
262
279
|
}, 1e3);
|
|
263
280
|
});
|
|
264
281
|
}
|
|
265
|
-
async function
|
|
266
|
-
let e = Number.isFinite(
|
|
267
|
-
for (let t = e; t > 0; t--) if (
|
|
268
|
-
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();
|
|
269
286
|
}
|
|
270
287
|
function $() {
|
|
271
|
-
return
|
|
272
|
-
|
|
273
|
-
}),
|
|
288
|
+
return B || (!O.value || !M.value ? Promise.resolve(null) : (B = Me().finally(() => {
|
|
289
|
+
P.value = 0, B = null;
|
|
290
|
+
}), B));
|
|
274
291
|
}
|
|
275
|
-
function
|
|
292
|
+
function Ne(e) {
|
|
276
293
|
let t = e.target.value;
|
|
277
|
-
t &&
|
|
294
|
+
t && A.selectDevice(t);
|
|
278
295
|
}
|
|
279
|
-
function
|
|
296
|
+
function Pe(e, t) {
|
|
280
297
|
if (e.label) return e.label;
|
|
281
298
|
let n = e.facing === "user" ? "Front" : e.facing === "environment" ? "Back" : "";
|
|
282
299
|
return n ? `${n} camera` : `Camera ${t + 1}`;
|
|
283
300
|
}
|
|
284
|
-
return
|
|
301
|
+
return g({
|
|
285
302
|
onCapture: $,
|
|
286
|
-
camera:
|
|
287
|
-
zoom:
|
|
288
|
-
}), (n, r) => (
|
|
303
|
+
camera: A,
|
|
304
|
+
zoom: Y
|
|
305
|
+
}), (n, r) => (_(), p("div", ie, [h(a, {
|
|
289
306
|
ref_key: "previewRef",
|
|
290
|
-
ref:
|
|
291
|
-
ratio:
|
|
292
|
-
resolutions:
|
|
293
|
-
mirror:
|
|
294
|
-
filter:
|
|
295
|
-
"tint-color":
|
|
296
|
-
"tint-intensity":
|
|
307
|
+
ref: D,
|
|
308
|
+
ratio: s.ratio,
|
|
309
|
+
resolutions: s.resolutions,
|
|
310
|
+
mirror: j.value,
|
|
311
|
+
filter: s.filter,
|
|
312
|
+
"tint-color": s.tintColor,
|
|
313
|
+
"tint-intensity": s.tintIntensity
|
|
297
314
|
}, {
|
|
298
|
-
default:
|
|
299
|
-
|
|
315
|
+
default: S(() => [
|
|
316
|
+
s.enableGuide && s.guideSrc ? (_(), p("img", {
|
|
300
317
|
key: 0,
|
|
301
|
-
src:
|
|
318
|
+
src: s.guideSrc,
|
|
302
319
|
class: "position-absolute top-0 start-0 w-100 h-100 base-camera__guide",
|
|
303
320
|
alt: "",
|
|
304
321
|
"aria-hidden": "true"
|
|
305
|
-
}, null, 8,
|
|
306
|
-
|
|
322
|
+
}, null, 8, C)) : f("", !0),
|
|
323
|
+
m("div", ae, [m("div", oe, [Te.value && b(A).activeDeviceId ? (_(), d(t, {
|
|
307
324
|
key: 0,
|
|
308
325
|
class: "base-camera__select",
|
|
309
|
-
modelValue:
|
|
310
|
-
"onUpdate:modelValue": r[0] ||= (e) =>
|
|
311
|
-
disabled:
|
|
326
|
+
modelValue: b(A).activeDeviceId.value,
|
|
327
|
+
"onUpdate:modelValue": r[0] ||= (e) => b(A).activeDeviceId.value = e,
|
|
328
|
+
disabled: b(A).isStarting.value,
|
|
312
329
|
"aria-label": "Select camera",
|
|
313
|
-
onChange:
|
|
314
|
-
options:
|
|
330
|
+
onChange: Ne,
|
|
331
|
+
options: b(A).devices.value.map((e, t) => ({
|
|
315
332
|
value: e.deviceId,
|
|
316
|
-
text:
|
|
317
|
-
}))
|
|
333
|
+
text: Pe(e, t)
|
|
334
|
+
})),
|
|
335
|
+
variant: "dark"
|
|
318
336
|
}, null, 8, [
|
|
319
337
|
"modelValue",
|
|
320
338
|
"disabled",
|
|
321
339
|
"options"
|
|
322
|
-
])) : (
|
|
323
|
-
key:
|
|
340
|
+
])) : (_(), p("span", se))]), m("div", ce, [s.enableScreenFlash ? (_(), p("button", {
|
|
341
|
+
key: 0,
|
|
324
342
|
type: "button",
|
|
325
|
-
class: "btn
|
|
326
|
-
|
|
343
|
+
class: "btn btn-dark bg-opacity-50 base-camera__icon-btn",
|
|
344
|
+
"aria-label": z.value ? "Flash On" : "Flash Off",
|
|
345
|
+
onClick: r[1] ||= (e) => z.value = !z.value
|
|
346
|
+
}, [z.value ? (_(), d(e, {
|
|
347
|
+
key: 0,
|
|
348
|
+
symbol: "zap"
|
|
349
|
+
})) : (_(), d(e, {
|
|
350
|
+
key: 1,
|
|
351
|
+
symbol: "zap-off"
|
|
352
|
+
}))], 8, le)) : f("", !0), Ee.value ? (_(), p("button", {
|
|
353
|
+
key: 1,
|
|
354
|
+
type: "button",
|
|
355
|
+
class: "btn btn-dark bg-opacity-50 base-camera__icon-btn",
|
|
356
|
+
disabled: b(A).isStarting.value,
|
|
327
357
|
"aria-label": "Switch camera",
|
|
328
|
-
onClick: r[
|
|
329
|
-
}, [
|
|
330
|
-
|
|
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", {
|
|
331
361
|
key: 0,
|
|
332
362
|
type: "button",
|
|
333
363
|
class: "btn btn-sm btn-outline-light",
|
|
334
|
-
onClick: r[
|
|
335
|
-
}, " Retry ")) :
|
|
364
|
+
onClick: r[3] ||= (e) => b(A).start()
|
|
365
|
+
}, " Retry ")) : f("", !0)])) : (_(), p("button", {
|
|
336
366
|
key: 2,
|
|
337
367
|
type: "button",
|
|
338
368
|
class: "btn btn-light",
|
|
339
|
-
onClick: r[
|
|
340
|
-
}, "Start camera"))])) :
|
|
341
|
-
|
|
342
|
-
|
|
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", {
|
|
343
373
|
type: "button",
|
|
344
374
|
class: "btn btn-dark bg-opacity-50 rounded-circle base-camera__icon-btn",
|
|
345
|
-
disabled:
|
|
346
|
-
"aria-label":
|
|
347
|
-
onClick: r[
|
|
348
|
-
}, [
|
|
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", {
|
|
349
379
|
x: "6",
|
|
350
380
|
y: "5",
|
|
351
381
|
width: "4",
|
|
352
382
|
height: "14",
|
|
353
383
|
rx: "1"
|
|
354
|
-
}, null, -1),
|
|
384
|
+
}, null, -1), m("rect", {
|
|
355
385
|
x: "14",
|
|
356
386
|
y: "5",
|
|
357
387
|
width: "4",
|
|
358
388
|
height: "14",
|
|
359
389
|
rx: "1"
|
|
360
|
-
}, null, -1)]])) : (
|
|
361
|
-
|
|
390
|
+
}, null, -1)]])) : (_(), p("svg", ye, [...r[11] ||= [m("path", { d: "M8 5v14l11-7z" }, null, -1)]]))], 8, _e),
|
|
391
|
+
m("button", {
|
|
362
392
|
type: "button",
|
|
363
393
|
class: "btn btn-light rounded-circle base-camera__shutter",
|
|
364
|
-
disabled: !
|
|
394
|
+
disabled: !M.value || N.value || P.value > 0,
|
|
365
395
|
"aria-label": "Capture photo",
|
|
366
|
-
onClick: r[
|
|
367
|
-
}, [...r[
|
|
368
|
-
|
|
396
|
+
onClick: r[6] ||= (e) => $()
|
|
397
|
+
}, [...r[12] ||= [m("span", { class: "base-camera__shutter-inner" }, null, -1)]], 8, be),
|
|
398
|
+
m("button", {
|
|
369
399
|
type: "button",
|
|
370
400
|
class: "btn btn-dark bg-opacity-50 rounded-circle base-camera__icon-btn",
|
|
371
|
-
"aria-label":
|
|
372
|
-
onClick: r[
|
|
373
|
-
}, [
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
key: 1,
|
|
378
|
-
symbol: "zap-off"
|
|
379
|
-
}))], 8, ye)
|
|
380
|
-
])) : l("", !0)]),
|
|
381
|
-
I.value ? (h(), u("div", be, [(h(), u("p", {
|
|
382
|
-
key: I.value,
|
|
401
|
+
"aria-label": "Stop camera",
|
|
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,
|
|
383
407
|
class: "base-camera__countdown",
|
|
384
|
-
"data-countdown":
|
|
385
|
-
},
|
|
386
|
-
|
|
387
|
-
key:
|
|
408
|
+
"data-countdown": P.value
|
|
409
|
+
}, y(P.value), 9, Se))])) : f("", !0),
|
|
410
|
+
F.value ? (_(), p("div", {
|
|
411
|
+
key: I.value,
|
|
388
412
|
class: "base-camera__shutter-effect",
|
|
389
413
|
"aria-hidden": "true"
|
|
390
|
-
}, [...r[
|
|
391
|
-
|
|
414
|
+
}, [...r[13] ||= [m("span", { class: "base-camera__shutter-aperture" }, null, -1)]])) : f("", !0),
|
|
415
|
+
(_(), d(c, {
|
|
416
|
+
to: "body",
|
|
417
|
+
disabled: !s.screenFlashFullscreen
|
|
418
|
+
}, [h(l, {
|
|
392
419
|
name: "base-camera-flash",
|
|
393
420
|
onAfterLeave: Z
|
|
394
421
|
}, {
|
|
395
|
-
default:
|
|
396
|
-
key:
|
|
397
|
-
class: "base-camera__screen-flash",
|
|
398
|
-
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 }),
|
|
399
426
|
"aria-hidden": "true"
|
|
400
|
-
}, null,
|
|
427
|
+
}, null, 6)) : f("", !0)]),
|
|
401
428
|
_: 1
|
|
402
|
-
})
|
|
429
|
+
})], 8, ["disabled"]))
|
|
403
430
|
]),
|
|
404
431
|
_: 1
|
|
405
432
|
}, 8, [
|
|
@@ -409,19 +436,19 @@ var ie = {
|
|
|
409
436
|
"filter",
|
|
410
437
|
"tint-color",
|
|
411
438
|
"tint-intensity"
|
|
412
|
-
]),
|
|
413
|
-
modelValue:
|
|
414
|
-
"onUpdate:modelValue": r[
|
|
415
|
-
min:
|
|
416
|
-
max:
|
|
417
|
-
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
|
|
418
445
|
}, null, 8, [
|
|
419
446
|
"modelValue",
|
|
420
447
|
"min",
|
|
421
448
|
"max",
|
|
422
449
|
"step"
|
|
423
|
-
])])) :
|
|
450
|
+
])])) : f("", !0)]));
|
|
424
451
|
}
|
|
425
452
|
});
|
|
426
453
|
//#endregion
|
|
427
|
-
export {
|
|
454
|
+
export { w as default };
|
|
@@ -116,7 +116,7 @@ var b = ["id"], x = ["for", "innerHTML"], S = { class: "dropdown" }, C = { class
|
|
|
116
116
|
role: "button",
|
|
117
117
|
type: "button",
|
|
118
118
|
title: L.value,
|
|
119
|
-
class: "btn dropdown-toggle",
|
|
119
|
+
class: u(["btn dropdown-toggle", { [`btn-${e.variant}`]: e.variant }]),
|
|
120
120
|
color: e.color,
|
|
121
121
|
outlined: e.outlined,
|
|
122
122
|
disabled: e.disabled
|
|
@@ -133,6 +133,7 @@ var b = ["id"], x = ["for", "innerHTML"], S = { class: "dropdown" }, C = { class
|
|
|
133
133
|
}, 8, [
|
|
134
134
|
"id",
|
|
135
135
|
"title",
|
|
136
|
+
"class",
|
|
136
137
|
"color",
|
|
137
138
|
"outlined",
|
|
138
139
|
"disabled"
|
|
@@ -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
|
};
|