ablok-components 0.3.128 → 0.3.131
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/atoms/canvas-confetti/canvas-confetti.vue.d.ts +1 -1
- package/dist/components/molecules/base-camera/base-camera.js +5 -4
- package/dist/components/molecules/base-camera/base-camera.vue.d.ts +204 -66
- package/dist/components/molecules/base-camera/base-camera.vue_vue_type_script_setup_true_lang.js +410 -0
- package/dist/components/molecules/base-map/base-map.vue.d.ts +2 -2
- package/dist/components/molecules/camera-preview/camera-preview.js +7 -0
- package/dist/components/molecules/camera-preview/camera-preview.vue.d.ts +32 -0
- package/dist/components/molecules/camera-preview/camera-preview.vue_vue_type_script_setup_true_lang.js +67 -0
- package/dist/components/molecules/popover-tooltip/popover-tooltip.vue.d.ts +1 -1
- package/dist/composables/useCamera.d.ts +37 -0
- package/dist/composables/useCamera.js +44 -0
- package/dist/index.js +34 -34
- package/dist/symbol-defs.svg +6 -0
- package/dist/utilities/camera/CameraManager.d.ts +91 -0
- package/dist/utilities/camera/CameraManager.js +345 -0
- package/dist/utilities/camera/capture.d.ts +35 -0
- package/dist/utilities/camera/capture.js +82 -0
- package/dist/utilities/camera/constraints.d.ts +29 -0
- package/dist/utilities/camera/constraints.js +96 -0
- package/dist/utilities/camera/platform.d.ts +11 -0
- package/dist/utilities/camera/platform.js +20 -0
- package/dist/utilities/camera/types.d.ts +48 -0
- package/dist/utilities/camera/types.js +9 -0
- package/dist/utilities/helpers.js +10 -15
- package/package.json +1 -1
- package/dist/components/molecules/base-camera/base-camera.vue_vue_type_script_async_true_setup_true_lang.js +0 -537
package/dist/components/molecules/base-camera/base-camera.vue_vue_type_script_setup_true_lang.js
ADDED
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
import e from "../../atoms/svg-icon/svg-icon.js";
|
|
2
|
+
import t from "../input-dropdown/input-dropdown.js";
|
|
3
|
+
import { captureFrame as n, exportCanvas as r } from "../../../utilities/camera/capture.js";
|
|
4
|
+
import { useCamera as i } from "../../../composables/useCamera.js";
|
|
5
|
+
import a from "../camera-preview/camera-preview.js";
|
|
6
|
+
import o from "../../atoms/zoom-slider/zoom-slider.js";
|
|
7
|
+
import s from "../../../assets/img/guide.js";
|
|
8
|
+
import { Transition as ee, computed as c, createBlock as l, createCommentVNode as u, createElementBlock as d, createElementVNode as f, createVNode as p, defineComponent as m, normalizeStyle as te, onMounted as ne, onScopeDispose as re, openBlock as h, ref as g, toDisplayString as _, unref as v, watch as y, withCtx as b } from "vue";
|
|
9
|
+
//#region src/components/molecules/base-camera/base-camera.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
+
var x = {
|
|
11
|
+
class: "base-camera position-relative w-100 user-select-none",
|
|
12
|
+
"data-bs-theme": "dark"
|
|
13
|
+
}, ie = ["src"], ae = { class: "position-absolute top-0 start-0 end-0 d-flex justify-content-between align-items-start p-2 gap-2" }, oe = { key: 1 }, se = ["disabled"], ce = {
|
|
14
|
+
key: 1,
|
|
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
|
+
}, le = {
|
|
17
|
+
key: 0,
|
|
18
|
+
class: "spinner-border text-light",
|
|
19
|
+
role: "status"
|
|
20
|
+
}, ue = {
|
|
21
|
+
key: 1,
|
|
22
|
+
class: "alert alert-danger py-2 px-3 mb-0 small"
|
|
23
|
+
}, S = { class: "mb-2" }, C = { class: "position-absolute bottom-0 start-0 end-0 p-3 d-flex flex-column gap-2 align-items-center" }, w = {
|
|
24
|
+
key: 0,
|
|
25
|
+
class: "d-flex align-items-center justify-content-center gap-4 w-100"
|
|
26
|
+
}, T = ["disabled", "aria-label"], E = {
|
|
27
|
+
key: 0,
|
|
28
|
+
viewBox: "0 0 24 24",
|
|
29
|
+
width: "22",
|
|
30
|
+
height: "22",
|
|
31
|
+
fill: "currentColor",
|
|
32
|
+
"aria-hidden": "true"
|
|
33
|
+
}, de = {
|
|
34
|
+
key: 1,
|
|
35
|
+
viewBox: "0 0 24 24",
|
|
36
|
+
width: "22",
|
|
37
|
+
height: "22",
|
|
38
|
+
fill: "currentColor",
|
|
39
|
+
"aria-hidden": "true"
|
|
40
|
+
}, fe = ["disabled"], pe = ["aria-label"], me = {
|
|
41
|
+
key: 2,
|
|
42
|
+
class: "base-camera__countdown-overlay",
|
|
43
|
+
role: "status",
|
|
44
|
+
"aria-live": "polite",
|
|
45
|
+
"aria-atomic": "true"
|
|
46
|
+
}, he = ["data-countdown"], ge = {
|
|
47
|
+
key: 0,
|
|
48
|
+
class: "base-camera__zoom"
|
|
49
|
+
}, D = /*@__PURE__*/ m({
|
|
50
|
+
__name: "base-camera",
|
|
51
|
+
props: {
|
|
52
|
+
modelValue: { type: null },
|
|
53
|
+
enableSelectDevice: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: !1
|
|
56
|
+
},
|
|
57
|
+
enableSwitchCamera: {
|
|
58
|
+
type: Boolean,
|
|
59
|
+
default: !0
|
|
60
|
+
},
|
|
61
|
+
defaultRearCamera: {
|
|
62
|
+
type: Boolean,
|
|
63
|
+
default: !1
|
|
64
|
+
},
|
|
65
|
+
enableMirrorCamera: {
|
|
66
|
+
type: Boolean,
|
|
67
|
+
default: !1
|
|
68
|
+
},
|
|
69
|
+
ratio: {
|
|
70
|
+
type: String,
|
|
71
|
+
default: "3x4"
|
|
72
|
+
},
|
|
73
|
+
resolutions: {
|
|
74
|
+
type: Object,
|
|
75
|
+
default: () => ({
|
|
76
|
+
"1x1": {
|
|
77
|
+
width: 720,
|
|
78
|
+
height: 720
|
|
79
|
+
},
|
|
80
|
+
"2x3": {
|
|
81
|
+
width: 720,
|
|
82
|
+
height: 1080
|
|
83
|
+
},
|
|
84
|
+
"3x2": {
|
|
85
|
+
width: 1080,
|
|
86
|
+
height: 720
|
|
87
|
+
},
|
|
88
|
+
"3x4": {
|
|
89
|
+
width: 720,
|
|
90
|
+
height: 960
|
|
91
|
+
},
|
|
92
|
+
"4x3": {
|
|
93
|
+
width: 960,
|
|
94
|
+
height: 720
|
|
95
|
+
},
|
|
96
|
+
"4x5": {
|
|
97
|
+
width: 960,
|
|
98
|
+
height: 1200
|
|
99
|
+
},
|
|
100
|
+
"5x4": {
|
|
101
|
+
width: 1200,
|
|
102
|
+
height: 960
|
|
103
|
+
},
|
|
104
|
+
"16x9": {
|
|
105
|
+
width: 1280,
|
|
106
|
+
height: 720
|
|
107
|
+
},
|
|
108
|
+
"9x16": {
|
|
109
|
+
width: 720,
|
|
110
|
+
height: 1280
|
|
111
|
+
}
|
|
112
|
+
})
|
|
113
|
+
},
|
|
114
|
+
zoom: {
|
|
115
|
+
type: Number,
|
|
116
|
+
default: 1
|
|
117
|
+
},
|
|
118
|
+
enableZoomSlider: {
|
|
119
|
+
type: Boolean,
|
|
120
|
+
default: !1
|
|
121
|
+
},
|
|
122
|
+
filter: {
|
|
123
|
+
type: String,
|
|
124
|
+
default: "none",
|
|
125
|
+
validator: (e) => [
|
|
126
|
+
"none",
|
|
127
|
+
"grayscale",
|
|
128
|
+
"sepia"
|
|
129
|
+
].includes(e)
|
|
130
|
+
},
|
|
131
|
+
tintColor: {
|
|
132
|
+
type: String,
|
|
133
|
+
default: "#FF000080"
|
|
134
|
+
},
|
|
135
|
+
tintIntensity: {
|
|
136
|
+
type: Number,
|
|
137
|
+
default: .3
|
|
138
|
+
},
|
|
139
|
+
countdown: {
|
|
140
|
+
type: Number,
|
|
141
|
+
default: 0
|
|
142
|
+
},
|
|
143
|
+
emitBlob: {
|
|
144
|
+
type: Boolean,
|
|
145
|
+
default: !1
|
|
146
|
+
},
|
|
147
|
+
autoStart: {
|
|
148
|
+
type: Boolean,
|
|
149
|
+
default: !0
|
|
150
|
+
},
|
|
151
|
+
enableGuide: {
|
|
152
|
+
type: Boolean,
|
|
153
|
+
default: !0
|
|
154
|
+
},
|
|
155
|
+
guideSrc: {
|
|
156
|
+
type: String,
|
|
157
|
+
default: s
|
|
158
|
+
},
|
|
159
|
+
enableControls: {
|
|
160
|
+
type: Boolean,
|
|
161
|
+
default: !0
|
|
162
|
+
},
|
|
163
|
+
enableScreenFlash: {
|
|
164
|
+
type: Boolean,
|
|
165
|
+
default: !1
|
|
166
|
+
},
|
|
167
|
+
screenFlashColor: {
|
|
168
|
+
type: String,
|
|
169
|
+
default: "#FFFFFF"
|
|
170
|
+
},
|
|
171
|
+
enableShutterAnimation: {
|
|
172
|
+
type: Boolean,
|
|
173
|
+
default: !0
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
emits: [
|
|
177
|
+
"update:modelValue",
|
|
178
|
+
"update:zoom",
|
|
179
|
+
"capture",
|
|
180
|
+
"error",
|
|
181
|
+
"state"
|
|
182
|
+
],
|
|
183
|
+
setup(s, { expose: m, emit: D }) {
|
|
184
|
+
let O = s, k = D, A = g(null), j = c(() => A.value?.videoEl ?? null), M = c(() => O.resolutions[O.ratio] ?? {
|
|
185
|
+
width: 720,
|
|
186
|
+
height: 960
|
|
187
|
+
}), N = i({
|
|
188
|
+
preferredFacing: O.defaultRearCamera ? "environment" : "user",
|
|
189
|
+
resolution: M.value,
|
|
190
|
+
videoRef: j,
|
|
191
|
+
onWarning: (e) => k("error", e)
|
|
192
|
+
}), P = c(() => O.enableMirrorCamera && N.activeFacing.value !== "environment"), F = c(() => O.enableSelectDevice && N.devices.value.length > 1), I = c(() => O.enableSwitchCamera && N.canSwitch.value), L = c(() => O.enableZoomSlider && N.zoomCapability.value !== null), R = c(() => N.isLive.value || N.isPaused.value), z = g(!1), B = g(0), V = g(!1), H = g(0), U = g(!1), W = g(0), G = g(O.enableScreenFlash);
|
|
193
|
+
y(() => O.enableScreenFlash, (e) => {
|
|
194
|
+
G.value = e;
|
|
195
|
+
});
|
|
196
|
+
let K = null, q = null, J = null, Y = null, X = null, Z = !1, Q = g(O.zoom);
|
|
197
|
+
y(() => O.zoom, (e) => {
|
|
198
|
+
Q.value = e;
|
|
199
|
+
}), y(Q, (e) => {
|
|
200
|
+
N.setZoom(e), e !== O.zoom && k("update:zoom", e);
|
|
201
|
+
}), y(N.zoom, (e) => {
|
|
202
|
+
N.zoomCapability.value && e !== Q.value && (Q.value = e);
|
|
203
|
+
}), y(N.zoomCapability, (e) => {
|
|
204
|
+
e && N.setZoom(Q.value);
|
|
205
|
+
}), y(N.state, (e) => k("state", e)), y(N.error, (e) => {
|
|
206
|
+
e && k("error", e);
|
|
207
|
+
}), y(M, (e) => void N.setResolution(e)), ne(() => {
|
|
208
|
+
O.autoStart && N.start();
|
|
209
|
+
}), re(() => {
|
|
210
|
+
Z = !0, q && clearTimeout(q), J && clearTimeout(J), Y && clearTimeout(Y), q = null, J = null, Y = null, X?.(!1), X = null, B.value = 0, V.value = !1, U.value = !1;
|
|
211
|
+
});
|
|
212
|
+
function _e() {
|
|
213
|
+
O.enableShutterAnimation && (J && clearTimeout(J), H.value++, V.value = !0, J = setTimeout(() => {
|
|
214
|
+
J = null, V.value = !1;
|
|
215
|
+
}, 650));
|
|
216
|
+
}
|
|
217
|
+
function ve() {
|
|
218
|
+
return G.value ? (Y && clearTimeout(Y), W.value++, U.value = !0, new Promise((e) => {
|
|
219
|
+
Y = setTimeout(() => {
|
|
220
|
+
Y = null, U.value = !1, e();
|
|
221
|
+
}, 350);
|
|
222
|
+
})) : Promise.resolve();
|
|
223
|
+
}
|
|
224
|
+
async function ye() {
|
|
225
|
+
let e = j.value;
|
|
226
|
+
if (!e || !R.value || z.value) return null;
|
|
227
|
+
z.value = !0;
|
|
228
|
+
try {
|
|
229
|
+
let t = n(e, {
|
|
230
|
+
width: M.value.width,
|
|
231
|
+
height: M.value.height,
|
|
232
|
+
mirror: P.value,
|
|
233
|
+
filter: O.filter,
|
|
234
|
+
tintColor: O.tintColor,
|
|
235
|
+
tintIntensity: O.tintIntensity
|
|
236
|
+
});
|
|
237
|
+
G.value && await ve(), _e();
|
|
238
|
+
let i = await r(t, { asBlob: O.emitBlob });
|
|
239
|
+
return k("update:modelValue", i), k("capture", i, t), i;
|
|
240
|
+
} finally {
|
|
241
|
+
z.value = !1;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function be() {
|
|
245
|
+
return new Promise((e) => {
|
|
246
|
+
X = e, q = setTimeout(() => {
|
|
247
|
+
q = null, X = null, e(!0);
|
|
248
|
+
}, 1e3);
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
async function xe() {
|
|
252
|
+
let e = Number.isFinite(O.countdown) ? Math.max(0, Math.floor(O.countdown)) : 0;
|
|
253
|
+
for (let t = e; t > 0; t--) if (B.value = t, !await be()) return null;
|
|
254
|
+
return B.value = 0, Z ? null : ye();
|
|
255
|
+
}
|
|
256
|
+
function $() {
|
|
257
|
+
return K || (!j.value || !R.value ? Promise.resolve(null) : (K = xe().finally(() => {
|
|
258
|
+
B.value = 0, K = null;
|
|
259
|
+
}), K));
|
|
260
|
+
}
|
|
261
|
+
function Se(e) {
|
|
262
|
+
let t = e.target.value;
|
|
263
|
+
t && N.selectDevice(t);
|
|
264
|
+
}
|
|
265
|
+
function Ce(e, t) {
|
|
266
|
+
if (e.label) return e.label;
|
|
267
|
+
let n = e.facing === "user" ? "Front" : e.facing === "environment" ? "Back" : "";
|
|
268
|
+
return n ? `${n} camera` : `Camera ${t + 1}`;
|
|
269
|
+
}
|
|
270
|
+
return m({
|
|
271
|
+
onCapture: $,
|
|
272
|
+
camera: N,
|
|
273
|
+
zoom: Q
|
|
274
|
+
}), (n, r) => (h(), d("div", x, [p(a, {
|
|
275
|
+
ref_key: "previewRef",
|
|
276
|
+
ref: A,
|
|
277
|
+
ratio: s.ratio,
|
|
278
|
+
resolutions: s.resolutions,
|
|
279
|
+
mirror: P.value,
|
|
280
|
+
filter: s.filter,
|
|
281
|
+
"tint-color": s.tintColor,
|
|
282
|
+
"tint-intensity": s.tintIntensity
|
|
283
|
+
}, {
|
|
284
|
+
default: b(() => [
|
|
285
|
+
s.enableGuide && s.guideSrc ? (h(), d("img", {
|
|
286
|
+
key: 0,
|
|
287
|
+
src: s.guideSrc,
|
|
288
|
+
class: "position-absolute top-0 start-0 w-100 h-100 base-camera__guide",
|
|
289
|
+
alt: "",
|
|
290
|
+
"aria-hidden": "true"
|
|
291
|
+
}, null, 8, ie)) : u("", !0),
|
|
292
|
+
f("div", ae, [F.value && v(N).activeDeviceId ? (h(), l(t, {
|
|
293
|
+
key: 0,
|
|
294
|
+
class: "base-camera__select",
|
|
295
|
+
modelValue: v(N).activeDeviceId.value,
|
|
296
|
+
"onUpdate:modelValue": r[0] ||= (e) => v(N).activeDeviceId.value = e,
|
|
297
|
+
disabled: v(N).isStarting.value,
|
|
298
|
+
"aria-label": "Select camera",
|
|
299
|
+
onChange: Se,
|
|
300
|
+
options: v(N).devices.value.map((e, t) => ({
|
|
301
|
+
value: e.deviceId,
|
|
302
|
+
text: Ce(e, t)
|
|
303
|
+
}))
|
|
304
|
+
}, null, 8, [
|
|
305
|
+
"modelValue",
|
|
306
|
+
"disabled",
|
|
307
|
+
"options"
|
|
308
|
+
])) : (h(), d("span", oe)), I.value ? (h(), d("button", {
|
|
309
|
+
key: 2,
|
|
310
|
+
type: "button",
|
|
311
|
+
class: "btn d-grid place-content-center px-2",
|
|
312
|
+
disabled: v(N).isStarting.value,
|
|
313
|
+
"aria-label": "Switch camera",
|
|
314
|
+
onClick: r[1] ||= (e) => v(N).switchCamera()
|
|
315
|
+
}, [p(e, { symbol: "switch-camera" })], 8, se)) : u("", !0)]),
|
|
316
|
+
v(N).isStarting.value || v(N).state.value === "error" || v(N).state.value === "idle" && !s.autoStart ? (h(), d("div", ce, [v(N).isStarting.value ? (h(), d("div", le, [...r[8] ||= [f("span", { class: "visually-hidden" }, "Starting camera…", -1)]])) : v(N).state.value === "error" ? (h(), d("div", ue, [f("div", S, _(v(N).error.value?.message ?? "Camera error"), 1), v(N).error.value?.code !== "not-allowed" && v(N).error.value?.code !== "unsupported" ? (h(), d("button", {
|
|
317
|
+
key: 0,
|
|
318
|
+
type: "button",
|
|
319
|
+
class: "btn btn-sm btn-outline-light",
|
|
320
|
+
onClick: r[2] ||= (e) => v(N).start()
|
|
321
|
+
}, " Retry ")) : u("", !0)])) : (h(), d("button", {
|
|
322
|
+
key: 2,
|
|
323
|
+
type: "button",
|
|
324
|
+
class: "btn btn-light",
|
|
325
|
+
onClick: r[3] ||= (e) => v(N).start()
|
|
326
|
+
}, "Start camera"))])) : u("", !0),
|
|
327
|
+
f("div", C, [s.enableControls ? (h(), d("div", w, [
|
|
328
|
+
f("button", {
|
|
329
|
+
type: "button",
|
|
330
|
+
class: "btn btn-dark bg-opacity-50 rounded-circle base-camera__icon-btn",
|
|
331
|
+
disabled: v(N).isStarting.value,
|
|
332
|
+
"aria-label": v(N).isLive.value ? "Pause" : "Start",
|
|
333
|
+
onClick: r[4] ||= (e) => v(N).toggle()
|
|
334
|
+
}, [v(N).isLive.value ? (h(), d("svg", E, [...r[9] ||= [f("rect", {
|
|
335
|
+
x: "6",
|
|
336
|
+
y: "5",
|
|
337
|
+
width: "4",
|
|
338
|
+
height: "14",
|
|
339
|
+
rx: "1"
|
|
340
|
+
}, null, -1), f("rect", {
|
|
341
|
+
x: "14",
|
|
342
|
+
y: "5",
|
|
343
|
+
width: "4",
|
|
344
|
+
height: "14",
|
|
345
|
+
rx: "1"
|
|
346
|
+
}, null, -1)]])) : (h(), d("svg", de, [...r[10] ||= [f("path", { d: "M8 5v14l11-7z" }, null, -1)]]))], 8, T),
|
|
347
|
+
f("button", {
|
|
348
|
+
type: "button",
|
|
349
|
+
class: "btn btn-light rounded-circle base-camera__shutter",
|
|
350
|
+
disabled: !R.value || z.value || B.value > 0,
|
|
351
|
+
"aria-label": "Capture photo",
|
|
352
|
+
onClick: r[5] ||= (e) => $()
|
|
353
|
+
}, [...r[11] ||= [f("span", { class: "base-camera__shutter-inner" }, null, -1)]], 8, fe),
|
|
354
|
+
f("button", {
|
|
355
|
+
type: "button",
|
|
356
|
+
class: "btn btn-dark bg-opacity-50 rounded-circle base-camera__icon-btn",
|
|
357
|
+
"aria-label": G.value ? "Flash On" : "Flash Off",
|
|
358
|
+
onClick: r[6] ||= (e) => G.value = !G.value
|
|
359
|
+
}, [G.value ? (h(), l(e, {
|
|
360
|
+
key: 0,
|
|
361
|
+
symbol: "zap"
|
|
362
|
+
})) : (h(), l(e, {
|
|
363
|
+
key: 1,
|
|
364
|
+
symbol: "zap-off"
|
|
365
|
+
}))], 8, pe)
|
|
366
|
+
])) : u("", !0)]),
|
|
367
|
+
B.value ? (h(), d("div", me, [(h(), d("p", {
|
|
368
|
+
key: B.value,
|
|
369
|
+
class: "base-camera__countdown",
|
|
370
|
+
"data-countdown": B.value
|
|
371
|
+
}, _(B.value), 9, he))])) : u("", !0),
|
|
372
|
+
V.value ? (h(), d("div", {
|
|
373
|
+
key: H.value,
|
|
374
|
+
class: "base-camera__shutter-effect",
|
|
375
|
+
"aria-hidden": "true"
|
|
376
|
+
}, [...r[12] ||= [f("span", { class: "base-camera__shutter-aperture" }, null, -1)]])) : u("", !0),
|
|
377
|
+
p(ee, { name: "base-camera-flash" }, {
|
|
378
|
+
default: b(() => [U.value ? (h(), d("div", {
|
|
379
|
+
key: W.value,
|
|
380
|
+
class: "base-camera__screen-flash",
|
|
381
|
+
style: te({ background: s.screenFlashColor }),
|
|
382
|
+
"aria-hidden": "true"
|
|
383
|
+
}, null, 4)) : u("", !0)]),
|
|
384
|
+
_: 1
|
|
385
|
+
})
|
|
386
|
+
]),
|
|
387
|
+
_: 1
|
|
388
|
+
}, 8, [
|
|
389
|
+
"ratio",
|
|
390
|
+
"resolutions",
|
|
391
|
+
"mirror",
|
|
392
|
+
"filter",
|
|
393
|
+
"tint-color",
|
|
394
|
+
"tint-intensity"
|
|
395
|
+
]), L.value ? (h(), d("div", ge, [p(o, {
|
|
396
|
+
modelValue: Q.value,
|
|
397
|
+
"onUpdate:modelValue": r[7] ||= (e) => Q.value = e,
|
|
398
|
+
min: v(N).zoomCapability.value.min,
|
|
399
|
+
max: v(N).zoomCapability.value.max,
|
|
400
|
+
step: v(N).zoomCapability.value.step
|
|
401
|
+
}, null, 8, [
|
|
402
|
+
"modelValue",
|
|
403
|
+
"min",
|
|
404
|
+
"max",
|
|
405
|
+
"step"
|
|
406
|
+
])])) : u("", !0)]));
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
//#endregion
|
|
410
|
+
export { D as default };
|
|
@@ -124,8 +124,8 @@ declare const __VLS_base: import('../../../../vue/dist/vue.esm-bundler.js').Defi
|
|
|
124
124
|
};
|
|
125
125
|
}>, {}, {}, {}, {}, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, {
|
|
126
126
|
"update:modelValue": (...args: any[]) => void;
|
|
127
|
-
"update:center": (...args: any[]) => void;
|
|
128
127
|
"update:zoom": (...args: any[]) => void;
|
|
128
|
+
"update:center": (...args: any[]) => void;
|
|
129
129
|
"map-click": (...args: any[]) => void;
|
|
130
130
|
"marker-click": (...args: any[]) => void;
|
|
131
131
|
}, string, import('../../../../vue/dist/vue.esm-bundler.js').PublicProps, Readonly<import('../../../../vue/dist/vue.esm-bundler.js').ExtractPropTypes<{
|
|
@@ -238,8 +238,8 @@ declare const __VLS_base: import('../../../../vue/dist/vue.esm-bundler.js').Defi
|
|
|
238
238
|
};
|
|
239
239
|
}>> & Readonly<{
|
|
240
240
|
"onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
|
|
241
|
-
"onUpdate:center"?: ((...args: any[]) => any) | undefined;
|
|
242
241
|
"onUpdate:zoom"?: ((...args: any[]) => any) | undefined;
|
|
242
|
+
"onUpdate:center"?: ((...args: any[]) => any) | undefined;
|
|
243
243
|
"onMap-click"?: ((...args: any[]) => any) | undefined;
|
|
244
244
|
"onMarker-click"?: ((...args: any[]) => any) | undefined;
|
|
245
245
|
}>, {
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import e from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
2
|
+
import t from "./camera-preview.vue_vue_type_script_setup_true_lang.js";
|
|
3
|
+
/* empty css */
|
|
4
|
+
//#region src/components/molecules/camera-preview/camera-preview.vue
|
|
5
|
+
var n = /*#__PURE__*/ e(t, [["__scopeId", "data-v-b26bcd08"]]);
|
|
6
|
+
//#endregion
|
|
7
|
+
export { n as default };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Filter, Resolution } from '../../../utilities/camera/types';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
ratio?: string;
|
|
4
|
+
resolutions?: Record<string, Resolution>;
|
|
5
|
+
mirror?: boolean;
|
|
6
|
+
filter?: Filter;
|
|
7
|
+
tintColor?: string;
|
|
8
|
+
tintIntensity?: number;
|
|
9
|
+
};
|
|
10
|
+
declare var __VLS_1: {};
|
|
11
|
+
type __VLS_Slots = {} & {
|
|
12
|
+
default?: (props: typeof __VLS_1) => any;
|
|
13
|
+
};
|
|
14
|
+
declare const __VLS_base: import('../../../../vue/dist/vue.esm-bundler.js').DefineComponent<__VLS_Props, {
|
|
15
|
+
videoEl: import('../../../../vue/dist/vue.esm-bundler.js').Ref<HTMLVideoElement | null, HTMLVideoElement | null>;
|
|
16
|
+
resolution: import('../../../../vue/dist/vue.esm-bundler.js').ComputedRef<Resolution>;
|
|
17
|
+
}, {}, {}, {}, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, import('../../../../vue/dist/vue.esm-bundler.js').ComponentOptionsMixin, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
|
|
18
|
+
filter: Filter;
|
|
19
|
+
ratio: string;
|
|
20
|
+
resolutions: Record<string, Resolution>;
|
|
21
|
+
mirror: boolean;
|
|
22
|
+
tintColor: string;
|
|
23
|
+
tintIntensity: number;
|
|
24
|
+
}, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, false, {}, any>;
|
|
25
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
26
|
+
declare const _default: typeof __VLS_export;
|
|
27
|
+
export default _default;
|
|
28
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
29
|
+
new (): {
|
|
30
|
+
$slots: S;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { cssFilter as e, resolveTintPaint as t } from "../../../utilities/camera/capture.js";
|
|
2
|
+
import { computed as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, defineComponent as o, normalizeStyle as s, openBlock as c, ref as l, renderSlot as u } from "vue";
|
|
3
|
+
//#region src/components/molecules/camera-preview/camera-preview.vue?vue&type=script&setup=true&lang.ts
|
|
4
|
+
var d = /*@__PURE__*/ o({
|
|
5
|
+
__name: "camera-preview",
|
|
6
|
+
props: {
|
|
7
|
+
ratio: { default: "3x4" },
|
|
8
|
+
resolutions: { default: () => ({}) },
|
|
9
|
+
mirror: {
|
|
10
|
+
type: Boolean,
|
|
11
|
+
default: !1
|
|
12
|
+
},
|
|
13
|
+
filter: { default: "none" },
|
|
14
|
+
tintColor: { default: "#FF000080" },
|
|
15
|
+
tintIntensity: { default: .3 }
|
|
16
|
+
},
|
|
17
|
+
setup(o, { expose: d }) {
|
|
18
|
+
let f = o, p = l(null), m = n(() => {
|
|
19
|
+
let e = f.resolutions[f.ratio];
|
|
20
|
+
if (e) return e;
|
|
21
|
+
let [t, n] = f.ratio.split(/[x:/]/).map(Number);
|
|
22
|
+
return t && n ? {
|
|
23
|
+
width: t,
|
|
24
|
+
height: n
|
|
25
|
+
} : {
|
|
26
|
+
width: 3,
|
|
27
|
+
height: 4
|
|
28
|
+
};
|
|
29
|
+
}), h = n(() => ({ aspectRatio: `${m.value.width} / ${m.value.height}` })), g = n(() => ({
|
|
30
|
+
transform: f.mirror ? "scaleX(-1)" : "none",
|
|
31
|
+
filter: e(f.filter)
|
|
32
|
+
})), _ = n(() => {
|
|
33
|
+
let e = t(f.tintColor, f.tintIntensity);
|
|
34
|
+
return {
|
|
35
|
+
backgroundColor: e.color,
|
|
36
|
+
opacity: e.opacity
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
return d({
|
|
40
|
+
videoEl: p,
|
|
41
|
+
resolution: m
|
|
42
|
+
}), (e, t) => (c(), i("div", {
|
|
43
|
+
class: "camera-preview position-relative overflow-hidden bg-black w-100",
|
|
44
|
+
style: s(h.value)
|
|
45
|
+
}, [
|
|
46
|
+
a("video", {
|
|
47
|
+
ref_key: "videoEl",
|
|
48
|
+
ref: p,
|
|
49
|
+
class: "camera-preview__video position-absolute top-0 start-0 w-100 h-100",
|
|
50
|
+
style: s(g.value),
|
|
51
|
+
playsinline: "",
|
|
52
|
+
muted: "",
|
|
53
|
+
autoplay: "",
|
|
54
|
+
disablepictureinpicture: ""
|
|
55
|
+
}, null, 4),
|
|
56
|
+
o.tintIntensity > 0 ? (c(), i("div", {
|
|
57
|
+
key: 0,
|
|
58
|
+
class: "position-absolute top-0 start-0 w-100 h-100 pe-none",
|
|
59
|
+
style: s(_.value),
|
|
60
|
+
"aria-hidden": "true"
|
|
61
|
+
}, null, 4)) : r("", !0),
|
|
62
|
+
u(e.$slots, "default", {}, void 0, !0)
|
|
63
|
+
], 4));
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
//#endregion
|
|
67
|
+
export { d as default };
|
|
@@ -120,10 +120,10 @@ declare const __VLS_export: __VLS_WithSlots<import('../../../../vue/dist/vue.esm
|
|
|
120
120
|
modelValue: boolean;
|
|
121
121
|
disabled: boolean;
|
|
122
122
|
content: string;
|
|
123
|
+
ariaLabel: string;
|
|
123
124
|
hover: boolean;
|
|
124
125
|
hoverDelay: number;
|
|
125
126
|
exclusive: boolean;
|
|
126
|
-
ariaLabel: string;
|
|
127
127
|
}, {}, {}, {}, string, import('../../../../vue/dist/vue.esm-bundler.js').ComponentProvideOptions, true, {}, any>, {
|
|
128
128
|
button?: (props: {}) => any;
|
|
129
129
|
} & {
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Ref } from '../../vue/dist/vue.esm-bundler.js';
|
|
2
|
+
import { CameraManager, CameraManagerOptions } from '../utilities/camera/CameraManager';
|
|
3
|
+
import { Resolution, StartOptions } from '../utilities/camera/types';
|
|
4
|
+
export interface UseCameraOptions extends CameraManagerOptions {
|
|
5
|
+
/** Video element to bind; may become available after setup. */
|
|
6
|
+
videoRef?: Ref<HTMLVideoElement | null | undefined>;
|
|
7
|
+
}
|
|
8
|
+
export declare function useCamera(options?: UseCameraOptions): {
|
|
9
|
+
manager: CameraManager;
|
|
10
|
+
state: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../utilities/camera/types').CameraState>;
|
|
11
|
+
intent: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../utilities/camera/types').CameraIntent>;
|
|
12
|
+
stream: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<MediaStream | null>;
|
|
13
|
+
devices: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../utilities/camera/types').CameraDevice[]>;
|
|
14
|
+
activeDeviceId: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<string | null>;
|
|
15
|
+
activeFacing: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../utilities/camera/types').Facing | null>;
|
|
16
|
+
error: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../utilities/camera/types').CameraError | null>;
|
|
17
|
+
permission: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../utilities/camera/types').CameraPermission>;
|
|
18
|
+
zoom: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<number>;
|
|
19
|
+
zoomCapability: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<import('../utilities/camera/types').ZoomCapability | null>;
|
|
20
|
+
isLive: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
|
|
21
|
+
isPaused: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
|
|
22
|
+
isStarting: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
|
|
23
|
+
canSwitch: import('../../vue/dist/vue.esm-bundler.js').ComputedRef<boolean>;
|
|
24
|
+
isSupported: boolean;
|
|
25
|
+
start: (opts?: StartOptions) => Promise<boolean>;
|
|
26
|
+
stop: () => void;
|
|
27
|
+
pause: () => void;
|
|
28
|
+
resume: () => Promise<boolean>;
|
|
29
|
+
toggle: () => Promise<boolean>;
|
|
30
|
+
switchCamera: () => Promise<boolean>;
|
|
31
|
+
selectDevice: (deviceId: string) => Promise<boolean>;
|
|
32
|
+
setResolution: (r: Resolution) => Promise<boolean>;
|
|
33
|
+
setZoom: (z: number) => Promise<boolean>;
|
|
34
|
+
refreshDevices: () => Promise<void>;
|
|
35
|
+
bindVideo: (el: HTMLVideoElement | null) => void;
|
|
36
|
+
};
|
|
37
|
+
export type UseCameraReturn = ReturnType<typeof useCamera>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { CameraManager as e } from "../utilities/camera/CameraManager.js";
|
|
2
|
+
import { computed as t, onScopeDispose as n, shallowRef as r, watch as i } from "vue";
|
|
3
|
+
//#region src/composables/useCamera.ts
|
|
4
|
+
function a(a = {}) {
|
|
5
|
+
let { videoRef: o, ...s } = a, c = new e(s), l = r(c.snapshot()), u = c.subscribe((e) => {
|
|
6
|
+
l.value = e;
|
|
7
|
+
});
|
|
8
|
+
return o && i(o, (e) => c.attachVideo(e ?? null), {
|
|
9
|
+
immediate: !0,
|
|
10
|
+
flush: "post"
|
|
11
|
+
}), n(() => {
|
|
12
|
+
u(), c.dispose();
|
|
13
|
+
}), {
|
|
14
|
+
manager: c,
|
|
15
|
+
state: t(() => l.value.state),
|
|
16
|
+
intent: t(() => l.value.intent),
|
|
17
|
+
stream: t(() => l.value.stream),
|
|
18
|
+
devices: t(() => l.value.devices),
|
|
19
|
+
activeDeviceId: t(() => l.value.activeDeviceId),
|
|
20
|
+
activeFacing: t(() => l.value.activeFacing),
|
|
21
|
+
error: t(() => l.value.error),
|
|
22
|
+
permission: t(() => l.value.permission),
|
|
23
|
+
zoom: t(() => l.value.zoom),
|
|
24
|
+
zoomCapability: t(() => l.value.zoomCapability),
|
|
25
|
+
isLive: t(() => l.value.state === "live"),
|
|
26
|
+
isPaused: t(() => l.value.state === "paused"),
|
|
27
|
+
isStarting: t(() => l.value.state === "starting"),
|
|
28
|
+
canSwitch: t(() => l.value.devices.length > 1),
|
|
29
|
+
isSupported: e.isSupported(),
|
|
30
|
+
start: (e) => c.start(e),
|
|
31
|
+
stop: () => c.stop(),
|
|
32
|
+
pause: () => c.pause(),
|
|
33
|
+
resume: () => c.resume(),
|
|
34
|
+
toggle: () => c.toggle(),
|
|
35
|
+
switchCamera: () => c.switchCamera(),
|
|
36
|
+
selectDevice: (e) => c.selectDevice(e),
|
|
37
|
+
setResolution: (e) => c.setResolution(e),
|
|
38
|
+
setZoom: (e) => c.setZoom(e),
|
|
39
|
+
refreshDevices: () => c.refreshDevices(),
|
|
40
|
+
bindVideo: (e) => c.attachVideo(e)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { a as useCamera };
|