ablok-components 0.3.73 → 0.3.75

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.
@@ -1,32 +1,32 @@
1
- import { defineComponent as Se, ref as r, computed as d, watch as ie, onMounted as ke, nextTick as Ie, onBeforeUnmount as xe, openBlock as v, createElementBlock as f, normalizeClass as W, createElementVNode as o, createVNode as F, withCtx as De, createCommentVNode as k, withDirectives as le, normalizeStyle as G, vShow as oe, toDisplayString as Z, createBlock as ze, withModifiers as Re } from "vue";
2
- import { debounce as $e } from "lodash";
3
- import Oe from "../../atoms/loading-spinner/loading-spinner.vue.js";
1
+ import { defineComponent as Pe, ref as r, computed as v, watch as ye, onMounted as We, nextTick as je, onBeforeUnmount as Ae, openBlock as g, createElementBlock as w, normalizeClass as ae, createElementVNode as h, createVNode as ie, withCtx as Fe, createCommentVNode as O, withDirectives as be, normalizeStyle as oe, vShow as _e, toDisplayString as ne, createBlock as Ne, withModifiers as qe } from "vue";
2
+ import { debounce as Ze } from "lodash";
3
+ import Ke from "../../atoms/loading-spinner/loading-spinner.vue.js";
4
4
  /* empty css */
5
- import Be from "../../atoms/svg-icon/svg-icon.vue.js";
5
+ import Je from "../../atoms/svg-icon/svg-icon.vue.js";
6
6
  /* empty css */
7
- import Ee from "../input-dropdown/input-dropdown.vue.js";
7
+ import Qe from "../input-dropdown/input-dropdown.vue.js";
8
8
  /* empty css */
9
- import { dataURItoBlob as Ve } from "../../../utilities/helpers.js";
10
- import { useCameraFilter as Me } from "../../../composables/useCameraFilter.js";
11
- import Te from "../../atoms/zoom-slider/zoom-slider.vue.js";
9
+ import { dataURItoBlob as Xe } from "../../../utilities/helpers.js";
10
+ import { useCameraFilter as Ye } from "../../../composables/useCameraFilter.js";
11
+ import et from "../../atoms/zoom-slider/zoom-slider.vue.js";
12
12
  /* empty css */
13
- import He from "../../../assets/img/guide.png.js";
14
- const Le = { class: "camera__preview" }, Ue = {
13
+ import tt from "../../../assets/img/guide.png.js";
14
+ const at = { class: "camera__preview" }, it = {
15
15
  key: 0,
16
16
  class: "camera__bg-notification"
17
- }, Ne = ["innerHTML"], je = ["width", "height"], Ae = {
17
+ }, ot = ["innerHTML"], nt = ["width", "height"], lt = {
18
18
  key: 1,
19
19
  class: "camera__countdown-overlay"
20
- }, We = ["innerHTML", "data-countdown"], Fe = ["src"], Ge = {
20
+ }, rt = ["innerHTML", "data-countdown"], st = ["src"], ct = {
21
21
  key: 3,
22
22
  class: "camera__zoom-slider"
23
- }, Ze = { class: "camera__controls" }, Ke = { class: "container" }, Pe = { class: "row" }, qe = { class: "col" }, Je = { class: "btn-group" }, Qe = { key: 0 }, Xe = { key: 1 }, Ye = {
23
+ }, ut = { class: "camera__controls" }, dt = { class: "container" }, vt = { class: "row" }, ht = { class: "col" }, mt = { class: "btn-group" }, ft = { key: 0 }, gt = { key: 1 }, wt = {
24
24
  key: 0,
25
25
  class: "camera__select-device"
26
- }, et = { class: "col" }, tt = { class: "" }, at = {
26
+ }, pt = { class: "col" }, yt = { class: "" }, bt = {
27
27
  name: "BaseCamera",
28
28
  inheritAttrs: !1
29
- }, ne = {
29
+ }, Ce = {
30
30
  "1x1": { width: 720, height: 720 },
31
31
  "2x3": { width: 720, height: 1080 },
32
32
  "3x2": { width: 1080, height: 720 },
@@ -36,8 +36,8 @@ const Le = { class: "camera__preview" }, Ue = {
36
36
  "5x4": { width: 1200, height: 960 },
37
37
  "16x9": { width: 1280, height: 720 },
38
38
  "9x16": { width: 720, height: 1280 }
39
- }, pt = /* @__PURE__ */ Se({
40
- ...at,
39
+ }, $t = /* @__PURE__ */ Pe({
40
+ ...bt,
41
41
  props: {
42
42
  modelValue: {
43
43
  type: null
@@ -60,7 +60,7 @@ const Le = { class: "camera__preview" }, Ue = {
60
60
  },
61
61
  guideSrc: {
62
62
  type: String,
63
- default: () => He
63
+ default: () => tt
64
64
  },
65
65
  countdown: {
66
66
  type: Number,
@@ -73,7 +73,7 @@ const Le = { class: "camera__preview" }, Ue = {
73
73
  filter: {
74
74
  type: String,
75
75
  default: "none",
76
- validator: (n) => ["none", "grayscale", "sepia"].includes(n)
76
+ validator: (c) => ["none", "grayscale", "sepia"].includes(c)
77
77
  },
78
78
  tintColor: {
79
79
  type: String,
@@ -97,7 +97,7 @@ const Le = { class: "camera__preview" }, Ue = {
97
97
  },
98
98
  resolutions: {
99
99
  type: Object,
100
- default: () => ne
100
+ default: () => Ce
101
101
  },
102
102
  zoom: {
103
103
  type: Number,
@@ -106,287 +106,368 @@ const Le = { class: "camera__preview" }, Ue = {
106
106
  enableZoomSlider: {
107
107
  type: Boolean,
108
108
  default: !1
109
+ },
110
+ correctOrientation: {
111
+ type: Boolean,
112
+ default: !1
109
113
  }
110
114
  },
111
115
  emits: ["update:modelValue"],
112
- setup(n, { expose: se, emit: ue }) {
113
- const i = n, ce = ue, c = r(), a = r(), T = r(!1), D = r([]), s = r(), I = r(), z = r(!1), H = r(!1), L = r(0), U = r(0), _ = r(), u = r(i.zoom || 1), $ = d(() => ({ ...ne, ...i.resolutions })), re = d(() => Object.values($.value)[0]);
114
- function de(e) {
116
+ setup(c, { expose: ke, emit: Se }) {
117
+ const i = c, De = Se, s = r(), a = r(), le = r(!1), V = r([]), m = r(), x = r(), R = r(!1), W = r(!1), j = r(0), A = r(0), C = r(), l = r(i.zoom || 1), re = r(!1), z = r(!1), Z = r(null), K = r(!1);
118
+ let L, k;
119
+ const Ie = typeof window < "u" && "DeviceMotionEvent" in window && (window.matchMedia?.("(pointer: coarse)")?.matches || "ontouchstart" in window), se = v(() => i.correctOrientation && Ie), J = v(() => le.value && (!se.value || K.value));
120
+ function Q() {
121
+ k && (window.removeEventListener("pointerdown", k, !0), window.removeEventListener("touchend", k, !0), k = void 0);
122
+ }
123
+ function F() {
124
+ K.value = !0, L && (clearTimeout(L), L = void 0), Q();
125
+ }
126
+ function Ee() {
127
+ k || (k = () => {
128
+ X();
129
+ }, window.addEventListener("pointerdown", k, !0), window.addEventListener("touchend", k, !0));
130
+ }
131
+ function ce(e) {
132
+ const t = e.accelerationIncludingGravity;
133
+ if (!t || t.x == null || t.y == null) return;
134
+ const o = Math.round(Math.atan2(t.x, t.y) * 180 / Math.PI);
135
+ if (Z.value = o, !(typeof screen < "u" && screen.orientation && screen.orientation.type || "portrait-primary").startsWith("portrait"))
136
+ z.value = !1;
137
+ else {
138
+ const E = Math.abs(Math.abs(o) - 90);
139
+ !z.value && E < 40 ? z.value = !0 : z.value && E > 50 && (z.value = !1);
140
+ }
141
+ K.value || F();
142
+ }
143
+ async function X() {
144
+ if (!(!i.correctOrientation || re.value))
145
+ try {
146
+ const e = window.DeviceOrientationEvent, t = window.DeviceMotionEvent;
147
+ if (e && typeof e.requestPermission == "function" && await e.requestPermission() !== "granted") {
148
+ F();
149
+ return;
150
+ }
151
+ t && typeof t.requestPermission == "function" && await t.requestPermission().catch(() => {
152
+ }), window.addEventListener("devicemotion", ce, !0), re.value = !0, Q();
153
+ } catch (e) {
154
+ console.error(e, "enableMotion: failed"), F();
155
+ }
156
+ }
157
+ const H = v(() => ({ ...Ce, ...i.resolutions })), Me = v(() => Object.values(H.value)[0]);
158
+ function Oe(e) {
115
159
  return String(e || "").trim().toLowerCase().replace(/\s+/g, "").replace(/[:/]/g, "x");
116
160
  }
117
- const g = d(() => {
118
- if ($.value[i.ratio])
161
+ const S = v(() => {
162
+ if (H.value[i.ratio])
119
163
  return i.ratio;
120
- const e = de(i.ratio);
121
- if ($.value[e])
164
+ const e = Oe(i.ratio);
165
+ if (H.value[e])
122
166
  return e;
123
- }), x = d(() => g.value ? $.value[g.value] : re.value), ve = d(() => {
124
- const e = g.value ? $.value[g.value] : void 0;
167
+ }), T = v(() => S.value ? H.value[S.value] : Me.value), xe = v(() => {
168
+ const e = S.value ? H.value[S.value] : void 0;
125
169
  return e ? `${e.width} / ${e.height}` : void 0;
126
- }), y = d(() => D.value.filter((e) => e.kind === "videoinput")), K = d(() => D.value.filter((e) => e.kind === "audioinput")), me = d(() => y.value.map((e, t) => ({
170
+ }), f = v(() => V.value.filter((e) => e.kind === "videoinput")), ue = v(() => V.value.filter((e) => e.kind === "audioinput")), Re = v(() => f.value.map((e, t) => ({
127
171
  text: e.label.slice(0, e.label.indexOf("(")) || `Camera ${t + 1}`,
128
172
  value: e.deviceId
129
- }))), P = d({
173
+ }))), de = v({
130
174
  get() {
131
- return s.value && s.value.deviceId;
175
+ return m.value && m.value.deviceId;
132
176
  },
133
177
  set(e) {
134
- s.value = y.value.find((t) => t.deviceId === e);
178
+ m.value = f.value.find((t) => t.deviceId === e);
135
179
  }
136
180
  });
137
- d({
181
+ v({
138
182
  get() {
139
- return I.value && I.value.deviceId;
183
+ return x.value && x.value.deviceId;
140
184
  },
141
185
  set(e) {
142
- I.value = K.value.find((t) => t.deviceId === e);
186
+ x.value = ue.value.find((t) => t.deviceId === e);
143
187
  }
144
188
  });
145
- const O = d(() => {
146
- const e = s.value && y.value.findIndex((t) => t.deviceId === s.value.deviceId);
189
+ const $ = v(() => {
190
+ const e = m.value && f.value.findIndex((t) => t.deviceId === m.value.deviceId);
147
191
  return i.enableMirrorCamera && e === 0 ? "mirror-cam" : "";
148
- }), he = d(() => {
149
- const e = s.value && D.value.findIndex((t) => t.deviceId === s.value.deviceId);
150
- return O.value ? `${O.value} mirror-device-${e}` : "";
151
- }), { tintRgb: it, applyFilterToCanvas: fe } = Me(i);
152
- function q() {
153
- if (g.value && x.value) {
154
- L.value = x.value.width, U.value = x.value.height;
192
+ }), Te = v(() => {
193
+ const e = m.value && V.value.findIndex((t) => t.deviceId === m.value.deviceId);
194
+ return $.value ? `${$.value} mirror-device-${e}` : "";
195
+ }), { tintRgb: _t, applyFilterToCanvas: ve } = Ye(i);
196
+ function he() {
197
+ if (S.value && T.value) {
198
+ j.value = T.value.width, A.value = T.value.height;
155
199
  return;
156
200
  }
157
- L.value = c.value.parentElement && c.value.parentElement.clientWidth, U.value = c.value.parentElement && c.value.parentElement.clientHeight;
201
+ j.value = s.value.parentElement && s.value.parentElement.clientWidth, A.value = s.value.parentElement && s.value.parentElement.clientHeight;
158
202
  }
159
- const J = $e(() => {
160
- q();
203
+ const me = Ze(() => {
204
+ he();
161
205
  }, 300, { trailing: !0, leading: !1 });
162
- async function ge() {
163
- const e = x.value ? { width: x.value.width, height: x.value.height } : void 0, t = e ? e.width / e.height : void 0, b = {
164
- audio: i.enableAudio && {
165
- ...I.value ? { deviceId: I.value.deviceId } : {}
166
- // deviceId: activeAudioDevice.value ? { exact: activeAudioDevice.value } : undefined
167
- },
168
- // audio: false,
169
- video: {
170
- ...s.value ? { deviceId: s.value.deviceId } : {},
171
- width: { ideal: e?.width },
172
- ...g.value && e?.height ? { height: { ideal: e.height } } : {},
173
- ...g.value && t ? {
174
- aspectRatio: { ideal: t }
175
- } : {}
176
- }
206
+ async function ze() {
207
+ const e = T.value ? { width: T.value.width, height: T.value.height } : void 0, t = e ? Math.max(e.width, e.height) : void 0, o = e ? Math.min(e.width, e.height) : void 0, D = i.enableAudio && {
208
+ ...x.value ? { deviceId: x.value.deviceId } : {}
209
+ // deviceId: activeAudioDevice.value ? { exact: activeAudioDevice.value } : undefined
210
+ }, I = {
211
+ ...m.value ? { deviceId: { exact: m.value.deviceId } } : {}
177
212
  };
178
- return navigator.mediaDevices.getUserMedia(b).catch((j) => {
179
- console.error(j, "navigator.mediaDevices.getUserMedia: failed");
180
- });
213
+ try {
214
+ return await navigator.mediaDevices.getUserMedia({
215
+ audio: D,
216
+ video: {
217
+ ...I,
218
+ ...t ? { width: { ideal: t } } : {},
219
+ ...o ? { height: { ideal: o } } : {}
220
+ }
221
+ });
222
+ } catch {
223
+ try {
224
+ return await navigator.mediaDevices.getUserMedia({ audio: D, video: I });
225
+ } catch (n) {
226
+ console.error(n, "navigator.mediaDevices.getUserMedia: failed");
227
+ }
228
+ }
181
229
  }
182
- function B() {
183
- c.value && c.value.srcObject && c.value.srcObject.getTracks().forEach((t) => {
230
+ function Y() {
231
+ s.value && s.value.srcObject && (s.value.srcObject.getTracks().forEach((t) => {
184
232
  t.stop();
185
- });
233
+ }), s.value.srcObject = null);
186
234
  }
187
- async function E() {
188
- return c.value.srcObject = await ge(), D.value = await navigator.mediaDevices.enumerateDevices(), { stream: c.value.srcObject, devices: D.value };
235
+ let fe = 0;
236
+ async function N() {
237
+ const e = ++fe;
238
+ Y();
239
+ const t = await ze();
240
+ if (e !== fe) {
241
+ t?.getTracks?.().forEach((o) => o.stop());
242
+ return;
243
+ }
244
+ return t && s.value && (s.value.srcObject = t), V.value = await navigator.mediaDevices.enumerateDevices(), { stream: s.value && s.value.srcObject, devices: V.value };
189
245
  }
190
- function Q() {
191
- z.value ? (z.value = !1, H.value = !1, B()) : (z.value = !0, E());
246
+ function Le() {
247
+ R.value ? (R.value = !1, W.value = !1, Y()) : (R.value = !0, N());
192
248
  }
193
- function X() {
194
- if (D.value.length > 1) {
195
- B();
196
- const e = y.value.findIndex((t) => t.deviceId === s.value.deviceId);
197
- s.value = y.value[e === y.value.length - 1 ? 0 : e + 1], E();
249
+ function $e() {
250
+ if (f.value.length > 1) {
251
+ const e = f.value.findIndex((t) => t.deviceId === m.value?.deviceId);
252
+ m.value = f.value[e === f.value.length - 1 ? 0 : e + 1];
198
253
  }
199
254
  }
200
- async function Y(e, t) {
201
- B(), e && (!t || e.deviceId !== t.deviceId) && await E();
202
- }
203
- ie(() => s.value, Y), ie(() => I.value, Y);
204
- function N() {
205
- i.countdown ? (_.value = _.value ? _.value - 1 : i.countdown, _.value ? setTimeout(N, 1e3) : ee()) : ee();
255
+ async function ge(e, t) {
256
+ e && (!t || e.deviceId !== t.deviceId) && await N();
206
257
  }
207
- se({ onCapture: N, camera: c.value, zoom: u });
258
+ ye(() => m.value, ge), ye(() => x.value, ge);
208
259
  function ee() {
209
- H.value = !0;
210
- const e = a.value.getContext("2d"), t = c.value, b = t && t.srcObject && t.srcObject.getTracks(), { aspectRatio: j, width: we, height: ye } = b.length && b[0].getSettings(), m = t?.videoWidth || we || L.value, h = t?.videoHeight || ye || U.value, C = m && h ? m / h : j, te = x.value || { width: m, height: h }, A = te?.width || m, ae = g.value ? te?.height || h : Math.round(A / C), R = A / ae;
211
- if (a.value.width = A, a.value.height = ae, !m || !h || !C)
260
+ i.countdown ? (C.value = C.value ? C.value - 1 : i.countdown, C.value ? setTimeout(ee, 1e3) : we()) : we();
261
+ }
262
+ ke({ onCapture: ee, enableMotion: X, camera: s.value, zoom: l });
263
+ function Be() {
264
+ if (!i.correctOrientation || Z.value == null) return 0;
265
+ const e = ((Z.value - 180) % 360 + 360) % 360;
266
+ return (-1 * (Math.round(e / 90) * 90 % 360) % 360 + 360) % 360;
267
+ }
268
+ function Ve(e, t, o, D, I) {
269
+ const E = a.value.width, n = a.value.height;
270
+ e.translate(E / 2, n / 2), $.value && e.scale(-1, 1), e.rotate(o * Math.PI / 180);
271
+ const u = n, p = E, B = Math.max(u / D, p / I) * (l.value && l.value > 0 ? l.value : 1), U = D * B, _ = I * B;
272
+ e.drawImage(t, -U / 2, -_ / 2, U, _);
273
+ }
274
+ function we() {
275
+ W.value = !0;
276
+ const e = a.value.getContext("2d"), t = s.value, o = t && t.srcObject && t.srcObject.getTracks(), { aspectRatio: D, width: I, height: E } = o.length && o[0].getSettings(), n = t?.videoWidth || I || j.value, u = t?.videoHeight || E || A.value, p = n && u ? n / u : D, te = T.value || { width: n, height: u }, B = te?.width || n, U = S.value ? te?.height || u : Math.round(B / p), _ = B / U;
277
+ if (a.value.width = B, a.value.height = U, !n || !u || !p)
212
278
  return;
213
- if (e.save(), O.value && (e.translate(a.value.width, 0), e.scale(-1, 1)), i.enableCropImage) {
214
- let p = 0, S = 0, l = m, w = h;
215
- if (C > R ? (l = h * R, p = (m - l) / 2) : C < R && (w = m / R, S = (h - w) / 2), u.value && u.value !== 1) {
216
- const V = l / u.value, M = w / u.value;
217
- p += (l - V) / 2, S += (w - M) / 2, l = V, w = M;
279
+ const q = Be();
280
+ if (e.save(), q === 90 || q === 270) {
281
+ Ve(e, t, q, n, u), e.restore(), ve(e, a.value.width, a.value.height), pe(a.value.toDataURL("image/png"));
282
+ return;
283
+ }
284
+ if (q === 180 && (e.translate(a.value.width, a.value.height), e.scale(-1, -1)), $.value && (e.translate(a.value.width, 0), e.scale(-1, 1)), i.enableCropImage) {
285
+ let y = 0, M = 0, d = n, b = u;
286
+ if (p > _ ? (d = u * _, y = (n - d) / 2) : p < _ && (b = n / _, M = (u - b) / 2), l.value && l.value !== 1) {
287
+ const G = d / l.value, P = b / l.value;
288
+ y += (d - G) / 2, M += (b - P) / 2, d = G, b = P;
218
289
  }
219
290
  e.drawImage(
220
291
  t,
221
- p,
222
- S,
223
- l,
224
- w,
292
+ y,
293
+ M,
294
+ d,
295
+ b,
225
296
  0,
226
297
  0,
227
298
  a.value.width,
228
299
  a.value.height
229
300
  );
230
301
  } else {
231
- let p = a.value.width, S = a.value.height, l = 0, w = 0;
232
- if (C > R ? (S = a.value.width / C, w = (a.value.height - S) / 2) : C < R && (p = a.value.height * C, l = (a.value.width - p) / 2), u.value && u.value !== 1) {
233
- const V = m / u.value, M = h / u.value, be = (m - V) / 2, Ce = (h - M) / 2;
234
- O.value && (l = a.value.width - l - p), e.drawImage(
302
+ let y = a.value.width, M = a.value.height, d = 0, b = 0;
303
+ if (p > _ ? (M = a.value.width / p, b = (a.value.height - M) / 2) : p < _ && (y = a.value.height * p, d = (a.value.width - y) / 2), l.value && l.value !== 1) {
304
+ const G = n / l.value, P = u / l.value, Ue = (n - G) / 2, Ge = (u - P) / 2;
305
+ $.value && (d = a.value.width - d - y), e.drawImage(
235
306
  t,
236
- be,
237
- Ce,
238
- V,
239
- M,
240
- l,
241
- w,
242
- p,
243
- S
307
+ Ue,
308
+ Ge,
309
+ G,
310
+ P,
311
+ d,
312
+ b,
313
+ y,
314
+ M
244
315
  );
245
316
  } else
246
- O.value && (l = a.value.width - l - p), e.drawImage(
317
+ $.value && (d = a.value.width - d - y), e.drawImage(
247
318
  t,
248
319
  0,
249
320
  0,
250
- m,
251
- h,
252
- l,
253
- w,
254
- p,
255
- S
321
+ n,
322
+ u,
323
+ d,
324
+ b,
325
+ y,
326
+ M
256
327
  );
257
328
  }
258
- e.restore(), fe(e, a.value.width, a.value.height);
259
- const _e = a.value.toDataURL("image/png");
260
- pe(_e);
329
+ e.restore(), ve(e, a.value.width, a.value.height);
330
+ const He = a.value.toDataURL("image/png");
331
+ pe(He);
261
332
  }
262
333
  function pe(e) {
263
- const t = Ve(e);
264
- ce("update:modelValue", {
334
+ const t = Xe(e);
335
+ De("update:modelValue", {
265
336
  name: `cam-pic-${(/* @__PURE__ */ new Date()).toISOString()}`,
266
337
  id: `cam-pic-${(/* @__PURE__ */ new Date()).toISOString()}`,
267
338
  blob: t,
268
339
  size: t.size
269
340
  });
270
341
  }
271
- return ke(async () => {
272
- B(), await E(), s.value = y.value[0], i.enableAudio && (I.value = K.value[0]), navigator.mediaDevices.addEventListener("devicechange", async (e) => {
273
- await E();
274
- }), i.defaultRearCamera && X(), Q(), window.addEventListener("resize", J), q(), await Ie(), T.value = !0;
275
- }), xe(() => {
276
- z.value = !1, H.value = !1, B(), window.removeEventListener("resize", J);
277
- }), (e, t) => (v(), f("div", {
278
- class: W(["camera", he.value])
342
+ return We(async () => {
343
+ await N(), R.value = !0;
344
+ const e = i.defaultRearCamera && f.value.length > 1 ? f.value[f.value.length - 1] : f.value[0];
345
+ if (m.value = e, i.enableAudio && (x.value = ue.value[0]), navigator.mediaDevices.addEventListener("devicechange", async (t) => {
346
+ await N();
347
+ }), window.addEventListener("resize", me), he(), se.value) {
348
+ L = setTimeout(F, 3e3);
349
+ const t = window.DeviceOrientationEvent;
350
+ t && typeof t.requestPermission == "function" ? Ee() : X();
351
+ }
352
+ await je(), le.value = !0;
353
+ }), Ae(() => {
354
+ R.value = !1, W.value = !1, Y(), window.removeEventListener("resize", me), window.removeEventListener("devicemotion", ce, !0), L && clearTimeout(L), Q();
355
+ }), (e, t) => (g(), w("div", {
356
+ class: ae(["camera", Te.value])
279
357
  }, [
280
- o("div", Le, [
281
- T.value ? k("", !0) : (v(), f("div", Ue, [
282
- F(Oe, { color: "#000" }, {
283
- default: De(() => [
284
- o("span", {
285
- class: W("d-block text-center"),
358
+ h("div", at, [
359
+ J.value ? O("", !0) : (g(), w("div", it, [
360
+ ie(Ke, { color: "#000" }, {
361
+ default: Fe(() => [
362
+ h("span", {
363
+ class: ae("d-block text-center"),
286
364
  innerHTML: e.$t("camera.waitForCameraNotification")
287
- }, null, 8, Ne)
365
+ }, null, 8, ot)
288
366
  ]),
289
367
  _: 1
290
368
  })
291
369
  ])),
292
- le(o("div", {
293
- class: W(["camera__video-wrapper", g.value ? `aspect-ratio--${g.value}` : ""]),
294
- style: G({ aspectRatio: ve.value || void 0, transform: u.value !== 1 ? `scale(${u.value})` : void 0 })
370
+ be(h("div", {
371
+ class: ae(["camera__video-wrapper", S.value ? `aspect-ratio--${S.value}` : ""]),
372
+ style: oe({ aspectRatio: xe.value || void 0, transform: l.value !== 1 ? `scale(${l.value})` : void 0 })
295
373
  }, [
296
- o("video", {
374
+ h("video", {
297
375
  ref_key: "camera",
298
- ref: c,
376
+ ref: s,
299
377
  class: "camera__video",
300
- style: G({ filter: i.filter === "grayscale" ? "grayscale(100%)" : i.filter === "sepia" ? "sepia(100%)" : "none" }),
378
+ style: oe({
379
+ filter: i.filter === "grayscale" ? "grayscale(100%)" : i.filter === "sepia" ? "sepia(100%)" : "none",
380
+ transform: c.correctOrientation && z.value ? "rotate(180deg)" : void 0
381
+ }),
301
382
  autoplay: "",
302
383
  playsinline: ""
303
384
  }, null, 4),
304
- n.tintColor ? (v(), f("div", {
385
+ c.tintColor ? (g(), w("div", {
305
386
  key: 0,
306
387
  class: "camera__tint-overlay",
307
- style: G({
308
- backgroundColor: n.tintColor,
309
- opacity: n.tintIntensity,
388
+ style: oe({
389
+ backgroundColor: c.tintColor,
390
+ opacity: c.tintIntensity,
310
391
  mixBlendMode: "multiply"
311
392
  })
312
- }, null, 4)) : k("", !0)
393
+ }, null, 4)) : O("", !0)
313
394
  ], 6), [
314
- [oe, T.value]
395
+ [_e, J.value]
315
396
  ]),
316
- le(o("canvas", {
397
+ be(h("canvas", {
317
398
  ref_key: "canvas",
318
399
  ref: a,
319
400
  class: "camera__canvas",
320
- width: L.value,
321
- height: U.value
322
- }, null, 8, je), [
323
- [oe, H.value]
401
+ width: j.value,
402
+ height: A.value
403
+ }, null, 8, nt), [
404
+ [_e, W.value]
324
405
  ]),
325
- _.value ? (v(), f("div", Ae, [
326
- (v(), f("p", {
406
+ C.value ? (g(), w("div", lt, [
407
+ (g(), w("p", {
327
408
  class: "countdown",
328
- key: _.value,
329
- innerHTML: _.value,
330
- "data-countdown": _.value
331
- }, null, 8, We))
332
- ])) : k("", !0),
333
- n.enableGuide && z.value && T.value ? (v(), f("img", {
409
+ key: C.value,
410
+ innerHTML: C.value,
411
+ "data-countdown": C.value
412
+ }, null, 8, rt))
413
+ ])) : O("", !0),
414
+ c.enableGuide && R.value && J.value ? (g(), w("img", {
334
415
  key: 2,
335
416
  class: "camera__guide",
336
- src: n.guideSrc
337
- }, null, 8, Fe)) : k("", !0),
338
- n.enableZoomSlider ? (v(), f("div", Ge, [
339
- F(Te, {
340
- modelValue: u.value,
341
- "onUpdate:modelValue": t[0] || (t[0] = (b) => u.value = b)
417
+ src: c.guideSrc
418
+ }, null, 8, st)) : O("", !0),
419
+ c.enableZoomSlider ? (g(), w("div", ct, [
420
+ ie(et, {
421
+ modelValue: l.value,
422
+ "onUpdate:modelValue": t[0] || (t[0] = (o) => l.value = o)
342
423
  }, null, 8, ["modelValue"])
343
- ])) : k("", !0)
424
+ ])) : O("", !0)
344
425
  ]),
345
- o("div", Ze, [
346
- o("div", Ke, [
347
- o("div", Pe, [
348
- o("div", qe, [
349
- o("div", Je, [
350
- o("button", {
426
+ h("div", ut, [
427
+ h("div", dt, [
428
+ h("div", vt, [
429
+ h("div", ht, [
430
+ h("div", mt, [
431
+ h("button", {
351
432
  type: "button",
352
433
  class: "camera__toggle btn btn-primary",
353
- onClick: Q
434
+ onClick: Le
354
435
  }, [
355
- z.value ? (v(), f("span", Xe, Z(e.$t("common.pause")), 1)) : (v(), f("span", Qe, Z(e.$t("common.play")), 1))
436
+ R.value ? (g(), w("span", gt, ne(e.$t("common.pause")), 1)) : (g(), w("span", ft, ne(e.$t("common.play")), 1))
356
437
  ]),
357
- o("button", {
438
+ h("button", {
358
439
  type: "button",
359
440
  class: "camera__capture btn btn-primary",
360
- onClick: N
361
- }, Z(e.$t("camera.capture")), 1)
441
+ onClick: ee
442
+ }, ne(e.$t("camera.capture")), 1)
362
443
  ])
363
444
  ])
364
445
  ])
365
446
  ])
366
447
  ]),
367
- (n.enableSwitchCamera || n.enableSelectDevice) && y.value && y.value.length > 1 ? (v(), f("div", Ye, [
368
- o("div", et, [
369
- n.enableSelectDevice ? (v(), ze(Ee, {
448
+ (c.enableSwitchCamera || c.enableSelectDevice) && f.value && f.value.length > 1 ? (g(), w("div", wt, [
449
+ h("div", pt, [
450
+ c.enableSelectDevice ? (g(), Ne(Qe, {
370
451
  key: 0,
371
- modelValue: P.value,
372
- "onUpdate:modelValue": t[1] || (t[1] = (b) => P.value = b),
373
- options: me.value,
452
+ modelValue: de.value,
453
+ "onUpdate:modelValue": t[1] || (t[1] = (o) => de.value = o),
454
+ options: Re.value,
374
455
  class: "w-100"
375
- }, null, 8, ["modelValue", "options"])) : k("", !0)
456
+ }, null, 8, ["modelValue", "options"])) : O("", !0)
376
457
  ]),
377
- o("div", tt, [
378
- n.enableSwitchCamera ? (v(), f("button", {
458
+ h("div", yt, [
459
+ c.enableSwitchCamera ? (g(), w("button", {
379
460
  key: 0,
380
461
  class: "btn",
381
- onClick: Re(X, ["prevent"])
462
+ onClick: qe($e, ["prevent"])
382
463
  }, [
383
- F(Be, { symbol: "switch-camera" })
384
- ])) : k("", !0)
464
+ ie(Je, { symbol: "switch-camera" })
465
+ ])) : O("", !0)
385
466
  ])
386
- ])) : k("", !0)
467
+ ])) : O("", !0)
387
468
  ], 2));
388
469
  }
389
470
  });
390
471
  export {
391
- pt as default
472
+ $t as default
392
473
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "ablok-components",
3
3
  "private": false,
4
- "version": "0.3.73",
4
+ "version": "0.3.75",
5
5
  "dependencies": {
6
6
  "date-fns": "^3.0.0",
7
7
  "dompurify": "^3.3.1",