@schukai/monster 4.11.1 → 4.13.0

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.
@@ -12,24 +12,24 @@
12
12
  * SPDX-License-Identifier: AGPL-3.0
13
13
  */
14
14
 
15
- import {instanceSymbol} from "../../constants.mjs";
16
- import {ATTRIBUTE_ROLE} from "../../dom/constants.mjs";
17
- import {CustomElement} from "../../dom/customelement.mjs";
15
+ import { instanceSymbol } from "../../constants.mjs";
16
+ import { ATTRIBUTE_ROLE } from "../../dom/constants.mjs";
17
+ import { CustomElement } from "../../dom/customelement.mjs";
18
18
  import {
19
- assembleMethodSymbol,
20
- registerCustomElement,
19
+ assembleMethodSymbol,
20
+ registerCustomElement,
21
21
  } from "../../dom/customelement.mjs";
22
- import {CameraCaptureStyleSheet} from "./stylesheet/camera-capture.mjs";
22
+ import { CameraCaptureStyleSheet } from "./stylesheet/camera-capture.mjs";
23
23
  import "../form/button.mjs";
24
24
  import "../state/state.mjs";
25
- import {getLocaleOfDocument} from "../../dom/locale.mjs";
26
- import {addErrorAttribute} from "../../dom/error.mjs";
27
- import {Queue} from "../../types/queue.mjs";
28
- import {fireCustomEvent} from "../../dom/events.mjs";
25
+ import { getLocaleOfDocument } from "../../dom/locale.mjs";
26
+ import { addErrorAttribute } from "../../dom/error.mjs";
27
+ import { Queue } from "../../types/queue.mjs";
28
+ import { fireCustomEvent } from "../../dom/events.mjs";
29
29
 
30
30
  import "../layout/full-screen.mjs";
31
31
 
32
- export {CameraCapture};
32
+ export { CameraCapture };
33
33
 
34
34
  /**
35
35
  * @private
@@ -86,232 +86,234 @@ const emptyHistoryStateElementSymbol = Symbol("emptyHistoryStateElement");
86
86
  * @fires monster-camera-capture-captured
87
87
  */
88
88
  class CameraCapture extends CustomElement {
89
- /**
90
- * Constructor for the CameraCapture class.
91
- * Calls the parent class constructor.
92
- */
93
- constructor() {
94
- super();
95
-
96
- this[queueSymbol] = new Queue();
97
- }
98
-
99
- /**
100
- * This method is called by the `instanceof` operator.
101
- * @return {symbol}
102
- */
103
- static get [instanceSymbol]() {
104
- return Symbol.for(
105
- "@schukai/monster/components/content/camera-capture@instance",
106
- );
107
- }
108
-
109
- /**
110
- *
111
- * @return {Components.Content.Copy
112
- */
113
- [assembleMethodSymbol]() {
114
- super[assembleMethodSymbol]();
115
- initControlReferences.call(this);
116
- initEventHandler.call(this);
117
- setupLazyCameraInit.call(this);
118
- return this;
119
- }
120
-
121
- /**
122
- * To set the options via the HTML Tag, the attribute `data-monster-options` must be used.
123
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
124
- *
125
- * The individual configuration values can be found in the table.
126
- *
127
- * @property {Object} templates Template definitions
128
- * @property {string} templates.main Main template
129
- * @property {Object} actions Callbacks
130
- * @property {string} actions.click="throw Error" Callback when clicked
131
- * @property {Object} features Features
132
- * @property {boolean} features.stripTags=true Strip tags from the copied text
133
- * @property {boolean} features.preventOpenEventSent=false Prevent open event from being sent
134
- * @property {Object} popper Popper configuration
135
- * @property {string} popper.placement="top" Popper placement
136
- * @property {string[]} popper.middleware=["autoPlacement", "shift", "offset:15", "arrow"] Popper middleware
137
- * @property {boolean} disabled=false Disabled state
138
- */
139
- get defaults() {
140
- return Object.assign({}, super.defaults, {
141
- templates: {
142
- main: getTemplate(),
143
- },
144
-
145
- disabled: false,
146
- features: {},
147
-
148
- labels: getTranslations(),
149
- });
150
- }
151
-
152
- /**
153
- * @return {string}
154
- */
155
- static getTag() {
156
- return "monster-camera-capture";
157
- }
158
-
159
- /**
160
- * @return {CSSStyleSheet[]}
161
- */
162
- static getCSSStyleSheet() {
163
- return [CameraCaptureStyleSheet];
164
- }
165
-
166
- /**
167
- * Retrieve the next image from the queue.
168
- * If the queue is empty, it returns `null`.
169
- * @returns {string|null}
170
- */
171
- getNextImage() {
172
- if (!this[queueSymbol].isEmpty()) {
173
- const next = this[queueSymbol].poll();
174
- if (!next) {
175
- return null;
176
- }
177
- return next;
178
- }
179
- return null;
180
- }
181
-
182
- /**
183
- * Capture an image from the camera and add it to the queue.
184
- * The image is returned as a data URL.
185
- * @returns {string}
186
- */
187
- capture() {
188
- this[canvasElementSymbol].width = this[videoElementSymbol].videoWidth;
189
- this[canvasElementSymbol].height = this[videoElementSymbol].videoHeight;
190
- const ctx = this[canvasElementSymbol].getContext("2d");
191
- ctx.drawImage(
192
- this[videoElementSymbol],
193
- 0,
194
- 0,
195
- this[canvasElementSymbol].width,
196
- this[canvasElementSymbol].height,
197
- );
198
- const dataURL = this[canvasElementSymbol].toDataURL("image/png");
199
- this[queueSymbol].add(dataURL);
200
- return dataURL;
201
- }
89
+ /**
90
+ * Constructor for the CameraCapture class.
91
+ * Calls the parent class constructor.
92
+ */
93
+ constructor() {
94
+ super();
95
+
96
+ this[queueSymbol] = new Queue();
97
+ }
98
+
99
+ /**
100
+ * This method is called by the `instanceof` operator.
101
+ * @return {symbol}
102
+ */
103
+ static get [instanceSymbol]() {
104
+ return Symbol.for(
105
+ "@schukai/monster/components/content/camera-capture@instance",
106
+ );
107
+ }
108
+
109
+ /**
110
+ *
111
+ * @return {Components.Content.Copy
112
+ */
113
+ [assembleMethodSymbol]() {
114
+ super[assembleMethodSymbol]();
115
+ initControlReferences.call(this);
116
+ initEventHandler.call(this);
117
+ setupLazyCameraInit.call(this);
118
+ return this;
119
+ }
120
+
121
+ /**
122
+ * To set the options via the HTML Tag, the attribute `data-monster-options` must be used.
123
+ * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
124
+ *
125
+ * The individual configuration values can be found in the table.
126
+ *
127
+ * @property {Object} templates Template definitions
128
+ * @property {string} templates.main Main template
129
+ * @property {Object} actions Callbacks
130
+ * @property {string} actions.click="throw Error" Callback when clicked
131
+ * @property {Object} features Features
132
+ * @property {boolean} features.stripTags=true Strip tags from the copied text
133
+ * @property {boolean} features.preventOpenEventSent=false Prevent open event from being sent
134
+ * @property {Object} popper Popper configuration
135
+ * @property {string} popper.placement="top" Popper placement
136
+ * @property {string[]} popper.middleware=["autoPlacement", "shift", "offset:15", "arrow"] Popper middleware
137
+ * @property {boolean} disabled=false Disabled state
138
+ */
139
+ get defaults() {
140
+ return Object.assign({}, super.defaults, {
141
+ templates: {
142
+ main: getTemplate(),
143
+ },
144
+
145
+ disabled: false,
146
+ features: {},
147
+
148
+ labels: getTranslations(),
149
+ });
150
+ }
151
+
152
+ /**
153
+ * @return {string}
154
+ */
155
+ static getTag() {
156
+ return "monster-camera-capture";
157
+ }
158
+
159
+ /**
160
+ * @return {CSSStyleSheet[]}
161
+ */
162
+ static getCSSStyleSheet() {
163
+ return [CameraCaptureStyleSheet];
164
+ }
165
+
166
+ /**
167
+ * Retrieve the next image from the queue.
168
+ * If the queue is empty, it returns `null`.
169
+ * @returns {string|null}
170
+ */
171
+ getNextImage() {
172
+ if (!this[queueSymbol].isEmpty()) {
173
+ const next = this[queueSymbol].poll();
174
+ if (!next) {
175
+ return null;
176
+ }
177
+ return next;
178
+ }
179
+ return null;
180
+ }
181
+
182
+ /**
183
+ * Capture an image from the camera and add it to the queue.
184
+ * The image is returned as a data URL.
185
+ * @returns {string}
186
+ */
187
+ capture() {
188
+ this[canvasElementSymbol].width = this[videoElementSymbol].videoWidth;
189
+ this[canvasElementSymbol].height = this[videoElementSymbol].videoHeight;
190
+ const ctx = this[canvasElementSymbol].getContext("2d");
191
+ ctx.drawImage(
192
+ this[videoElementSymbol],
193
+ 0,
194
+ 0,
195
+ this[canvasElementSymbol].width,
196
+ this[canvasElementSymbol].height,
197
+ );
198
+ const dataURL = this[canvasElementSymbol].toDataURL("image/png");
199
+ this[queueSymbol].add(dataURL);
200
+ return dataURL;
201
+ }
202
202
  }
203
203
 
204
204
  /**
205
205
  * @private
206
206
  */
207
207
  function setupLazyCameraInit() {
208
- const self = this;
209
-
210
- let initialized = false;
211
-
212
- const observer = new IntersectionObserver((entries) => {
213
- for (const entry of entries) {
214
- if (entry.isIntersecting && !initialized) {
215
- initialized = true;
216
- observer.disconnect();
217
- initCameraControl.call(self);
218
- }
219
- }
220
- }, {
221
- root: null,
222
- threshold: 0.1,
223
- });
224
-
225
- observer.observe(this);
208
+ const self = this;
209
+
210
+ let initialized = false;
211
+
212
+ const observer = new IntersectionObserver(
213
+ (entries) => {
214
+ for (const entry of entries) {
215
+ if (entry.isIntersecting && !initialized) {
216
+ initialized = true;
217
+ observer.disconnect();
218
+ initCameraControl.call(self);
219
+ }
220
+ }
221
+ },
222
+ {
223
+ root: null,
224
+ threshold: 0.1,
225
+ },
226
+ );
227
+
228
+ observer.observe(this);
226
229
  }
227
230
 
228
-
229
231
  /**
230
232
  * @private
231
233
  */
232
234
  function initCameraControl() {
233
- const self = this;
234
-
235
- if (
236
- !navigator ||
237
- !navigator.mediaDevices ||
238
- !navigator.mediaDevices.getUserMedia
239
- ) {
240
- self[fullScreenElementSymbol].style.display = "none";
241
- addErrorAttribute(self, "Browser not supported");
242
- return;
243
- }
244
-
245
- navigator.mediaDevices
246
- .getUserMedia({video: true})
247
- .then((stream) => {
248
- stream.getTracks().forEach((track) => track.stop());
249
- return navigator.mediaDevices.enumerateDevices();
250
- })
251
- .then((devices) => {
252
- const cameras = devices.filter((device) => device.kind === "videoinput");
253
-
254
- if (cameras.length === 0) {
255
- addErrorAttribute(
256
- self,
257
- getTranslations().cameraNotSupportedOrNotAllowed,
258
- );
259
- return;
260
- }
261
-
262
- if (cameras.length > 0) {
263
- const select = document.createElement("select");
264
- select.setAttribute("data-monster-role", "cameraSelector");
265
- select.style.marginBottom = "0.5rem";
266
- select.style.width = "100%";
267
- select.style.maxWidth = "100%";
268
- select.style.height = "1.4rem";
269
- select.style.marginTop = "0";
270
- select.style.marginBottom = "0";
271
-
272
- cameras.forEach((camera, index) => {
273
- const option = document.createElement("option");
274
- option.value = camera.deviceId;
275
- option.text = camera.label || `Camera ${index + 1}`;
276
- select.appendChild(option);
277
- });
278
-
279
- select.addEventListener("change", () => {
280
- startCameraWithDeviceId.call(self, select.value);
281
- });
282
-
283
- self[fullScreenElementSymbol].style.top = "2rem";
284
- self[controlElementSymbol].insertBefore(
285
- select,
286
- self[videoElementSymbol],
287
- );
288
- }
289
-
290
- startCameraWithDeviceId.call(self, cameras[0].deviceId);
291
- })
292
- .catch((err) => {
293
- self[fullScreenElementSymbol].style.display = "none";
294
- addErrorAttribute(self, err);
295
- });
235
+ const self = this;
236
+
237
+ if (
238
+ !navigator ||
239
+ !navigator.mediaDevices ||
240
+ !navigator.mediaDevices.getUserMedia
241
+ ) {
242
+ self[fullScreenElementSymbol].style.display = "none";
243
+ addErrorAttribute(self, "Browser not supported");
244
+ return;
245
+ }
246
+
247
+ navigator.mediaDevices
248
+ .getUserMedia({ video: true })
249
+ .then((stream) => {
250
+ stream.getTracks().forEach((track) => track.stop());
251
+ return navigator.mediaDevices.enumerateDevices();
252
+ })
253
+ .then((devices) => {
254
+ const cameras = devices.filter((device) => device.kind === "videoinput");
255
+
256
+ if (cameras.length === 0) {
257
+ addErrorAttribute(
258
+ self,
259
+ getTranslations().cameraNotSupportedOrNotAllowed,
260
+ );
261
+ return;
262
+ }
263
+
264
+ if (cameras.length > 1) {
265
+ const select = document.createElement("select");
266
+ select.setAttribute("data-monster-role", "cameraSelector");
267
+ select.style.marginBottom = "0.5rem";
268
+ select.style.width = "100%";
269
+ select.style.maxWidth = "100%";
270
+ select.style.height = "1.4rem";
271
+ select.style.marginTop = "0";
272
+ select.style.marginBottom = "0";
273
+
274
+ cameras.forEach((camera, index) => {
275
+ const option = document.createElement("option");
276
+ option.value = camera.deviceId;
277
+ option.text = camera.label || `Camera ${index + 1}`;
278
+ select.appendChild(option);
279
+ });
280
+
281
+ select.addEventListener("change", () => {
282
+ startCameraWithDeviceId.call(self, select.value);
283
+ });
284
+
285
+ self[fullScreenElementSymbol].style.top = "2rem";
286
+ self[controlElementSymbol].insertBefore(
287
+ select,
288
+ self[videoElementSymbol],
289
+ );
290
+ }
291
+
292
+ startCameraWithDeviceId.call(self, cameras[0].deviceId);
293
+ })
294
+ .catch((err) => {
295
+ self[fullScreenElementSymbol].style.display = "none";
296
+ addErrorAttribute(self, err);
297
+ });
296
298
  }
297
299
 
298
300
  function startCameraWithDeviceId(deviceId) {
299
- const self = this;
300
- navigator.mediaDevices
301
- .getUserMedia({video: {deviceId: {exact: deviceId}}})
302
- .then(function (stream) {
303
- self[takePictureButtonElementSymbol].style.display = "block";
304
- self[videoElementSymbol].style.display = "block";
305
- self[emptyHistoryStateElementSymbol].style.display = "none";
306
-
307
- self[videoElementSymbol].srcObject = stream;
308
-
309
- self[fullScreenElementSymbol].style.display = "block";
310
- })
311
- .catch(function (e) {
312
- self[fullScreenElementSymbol].style.display = "none";
313
- addErrorAttribute(self, e);
314
- });
301
+ const self = this;
302
+ navigator.mediaDevices
303
+ .getUserMedia({ video: { deviceId: { exact: deviceId } } })
304
+ .then(function (stream) {
305
+ self[takePictureButtonElementSymbol].style.display = "block";
306
+ self[videoElementSymbol].style.display = "block";
307
+ self[emptyHistoryStateElementSymbol].style.display = "none";
308
+
309
+ self[videoElementSymbol].srcObject = stream;
310
+
311
+ self[fullScreenElementSymbol].style.display = "block";
312
+ })
313
+ .catch(function (e) {
314
+ self[fullScreenElementSymbol].style.display = "none";
315
+ addErrorAttribute(self, e);
316
+ });
315
317
  }
316
318
 
317
319
  /**
@@ -319,147 +321,147 @@ function startCameraWithDeviceId(deviceId) {
319
321
  * @returns {{takePicture: string}}
320
322
  */
321
323
  function getTranslations() {
322
- const locale = getLocaleOfDocument();
323
- switch (locale.language) {
324
- case "de":
325
- return {
326
- takePicture: "Bild aufnehmen",
327
- cameraNotSupportedOrNotAllowed:
328
- "Die Kamera wird nicht unterstützt oder die Berechtigung wurde nicht erteilt.",
329
- };
330
-
331
- case "es":
332
- return {
333
- takePicture: "Tomar una foto",
334
- cameraNotSupportedOrNotAllowed:
335
- "La cámara no es compatible o no se ha otorgado permiso.",
336
- };
337
-
338
- case "zh":
339
- return {
340
- takePicture: "拍照",
341
- cameraNotSupportedOrNotAllowed: "相机不受支持或未授予权限。",
342
- };
343
-
344
- case "hi":
345
- return {
346
- takePicture: "तस्वीर खींचें",
347
- cameraNotSupportedOrNotAllowed:
348
- "कैमरा समर्थित नहीं है या अनुमति नहीं दी गई है।",
349
- };
350
-
351
- case "bn":
352
- return {
353
- takePicture: "ছবি তুলুন",
354
- cameraNotSupportedOrNotAllowed: "ক্যামেরা সমর্থিত নয় বা অনুমতি দেয়া হয়নি।",
355
- };
356
-
357
- case "pt":
358
- return {
359
- takePicture: "Tirar uma foto",
360
- cameraNotSupportedOrNotAllowed:
361
- "A câmera não é suportada ou a permissão não foi concedida.",
362
- };
363
-
364
- case "ru":
365
- return {
366
- takePicture: "Сделать фото",
367
- cameraNotSupportedOrNotAllowed:
368
- "Камера не поддерживается или разрешение не предоставлено.",
369
- };
370
-
371
- case "ja":
372
- return {
373
- takePicture: "写真を撮る",
374
- cameraNotSupportedOrNotAllowed:
375
- "カメラがサポートされていないか、許可が付与されていません。",
376
- };
377
-
378
- case "pa":
379
- return {
380
- takePicture: "ਤਸਵੀਰ ਖਿੱਚੋ",
381
- cameraNotSupportedOrNotAllowed:
382
- "ਕੈਮਰਾ ਦਾ ਸਮਰਥਨ ਨਹੀਂ ਹੈ ਜਾਂ ਅਨੁਮਤੀ ਨਹੀਂ ਦਿੱਤੀ ਗਈ ਹੈ।",
383
- };
384
-
385
- case "mr":
386
- return {
387
- takePicture: "फोटो घ्या",
388
- cameraNotSupportedOrNotAllowed:
389
- "कॅमेरा समर्थित नाही किंवा परवानगी दिलेली नाही.",
390
- };
391
-
392
- case "fr":
393
- return {
394
- takePicture: "Prendre une photo",
395
- cameraNotSupportedOrNotAllowed:
396
- "La caméra n'est pas prise en charge ou l'autorisation n'a pas été accordée.",
397
- };
398
-
399
- case "it":
400
- return {
401
- takePicture: "Scattare una foto",
402
- cameraNotSupportedOrNotAllowed:
403
- "La fotocamera non è supportata o l'autorizzazione non è stata concessa.",
404
- };
405
-
406
- case "nl":
407
- return {
408
- takePicture: "Maak een foto",
409
- cameraNotSupportedOrNotAllowed:
410
- "De camera wordt niet ondersteund of er is geen toestemming verleend.",
411
- };
412
-
413
- case "sv":
414
- return {
415
- takePicture: "Ta ett foto",
416
- cameraNotSupportedOrNotAllowed:
417
- "Kameran stöds inte eller tillståndet har inte beviljats.",
418
- };
419
-
420
- case "pl":
421
- return {
422
- takePicture: "Zrób zdjęcie",
423
- cameraNotSupportedOrNotAllowed:
424
- "Kamera nie jest obsługiwana lub nie udzielono zgody.",
425
- };
426
-
427
- case "da":
428
- return {
429
- takePicture: "Tag et billede",
430
- cameraNotSupportedOrNotAllowed:
431
- "Kameraen understøttes ikke eller tilladelsen er ikke givet.",
432
- };
433
-
434
- case "fi":
435
- return {
436
- takePicture: "Ota kuva",
437
- cameraNotSupportedOrNotAllowed:
438
- "Kameraa ei tueta tai lupaa ei ole myönnetty.",
439
- };
440
-
441
- case "no":
442
- return {
443
- takePicture: "Ta et bilde",
444
- cameraNotSupportedOrNotAllowed:
445
- "Kameraen støttes ikke eller tillatelsen er ikke gitt.",
446
- };
447
-
448
- case "cs":
449
- return {
450
- takePicture: "Vyfotit",
451
- cameraNotSupportedOrNotAllowed:
452
- "Fotoaparát není podporován nebo povolení nebylo uděleno.",
453
- };
454
-
455
- case "en":
456
- default:
457
- return {
458
- takePicture: "Take a picture",
459
- cameraNotSupportedOrNotAllowed:
460
- "The camera is not supported or permission has not been granted.",
461
- };
462
- }
324
+ const locale = getLocaleOfDocument();
325
+ switch (locale.language) {
326
+ case "de":
327
+ return {
328
+ takePicture: "Bild aufnehmen",
329
+ cameraNotSupportedOrNotAllowed:
330
+ "Die Kamera wird nicht unterstützt oder die Berechtigung wurde nicht erteilt.",
331
+ };
332
+
333
+ case "es":
334
+ return {
335
+ takePicture: "Tomar una foto",
336
+ cameraNotSupportedOrNotAllowed:
337
+ "La cámara no es compatible o no se ha otorgado permiso.",
338
+ };
339
+
340
+ case "zh":
341
+ return {
342
+ takePicture: "拍照",
343
+ cameraNotSupportedOrNotAllowed: "相机不受支持或未授予权限。",
344
+ };
345
+
346
+ case "hi":
347
+ return {
348
+ takePicture: "तस्वीर खींचें",
349
+ cameraNotSupportedOrNotAllowed:
350
+ "कैमरा समर्थित नहीं है या अनुमति नहीं दी गई है।",
351
+ };
352
+
353
+ case "bn":
354
+ return {
355
+ takePicture: "ছবি তুলুন",
356
+ cameraNotSupportedOrNotAllowed: "ক্যামেরা সমর্থিত নয় বা অনুমতি দেয়া হয়নি।",
357
+ };
358
+
359
+ case "pt":
360
+ return {
361
+ takePicture: "Tirar uma foto",
362
+ cameraNotSupportedOrNotAllowed:
363
+ "A câmera não é suportada ou a permissão não foi concedida.",
364
+ };
365
+
366
+ case "ru":
367
+ return {
368
+ takePicture: "Сделать фото",
369
+ cameraNotSupportedOrNotAllowed:
370
+ "Камера не поддерживается или разрешение не предоставлено.",
371
+ };
372
+
373
+ case "ja":
374
+ return {
375
+ takePicture: "写真を撮る",
376
+ cameraNotSupportedOrNotAllowed:
377
+ "カメラがサポートされていないか、許可が付与されていません。",
378
+ };
379
+
380
+ case "pa":
381
+ return {
382
+ takePicture: "ਤਸਵੀਰ ਖਿੱਚੋ",
383
+ cameraNotSupportedOrNotAllowed:
384
+ "ਕੈਮਰਾ ਦਾ ਸਮਰਥਨ ਨਹੀਂ ਹੈ ਜਾਂ ਅਨੁਮਤੀ ਨਹੀਂ ਦਿੱਤੀ ਗਈ ਹੈ।",
385
+ };
386
+
387
+ case "mr":
388
+ return {
389
+ takePicture: "फोटो घ्या",
390
+ cameraNotSupportedOrNotAllowed:
391
+ "कॅमेरा समर्थित नाही किंवा परवानगी दिलेली नाही.",
392
+ };
393
+
394
+ case "fr":
395
+ return {
396
+ takePicture: "Prendre une photo",
397
+ cameraNotSupportedOrNotAllowed:
398
+ "La caméra n'est pas prise en charge ou l'autorisation n'a pas été accordée.",
399
+ };
400
+
401
+ case "it":
402
+ return {
403
+ takePicture: "Scattare una foto",
404
+ cameraNotSupportedOrNotAllowed:
405
+ "La fotocamera non è supportata o l'autorizzazione non è stata concessa.",
406
+ };
407
+
408
+ case "nl":
409
+ return {
410
+ takePicture: "Maak een foto",
411
+ cameraNotSupportedOrNotAllowed:
412
+ "De camera wordt niet ondersteund of er is geen toestemming verleend.",
413
+ };
414
+
415
+ case "sv":
416
+ return {
417
+ takePicture: "Ta ett foto",
418
+ cameraNotSupportedOrNotAllowed:
419
+ "Kameran stöds inte eller tillståndet har inte beviljats.",
420
+ };
421
+
422
+ case "pl":
423
+ return {
424
+ takePicture: "Zrób zdjęcie",
425
+ cameraNotSupportedOrNotAllowed:
426
+ "Kamera nie jest obsługiwana lub nie udzielono zgody.",
427
+ };
428
+
429
+ case "da":
430
+ return {
431
+ takePicture: "Tag et billede",
432
+ cameraNotSupportedOrNotAllowed:
433
+ "Kameraen understøttes ikke eller tilladelsen er ikke givet.",
434
+ };
435
+
436
+ case "fi":
437
+ return {
438
+ takePicture: "Ota kuva",
439
+ cameraNotSupportedOrNotAllowed:
440
+ "Kameraa ei tueta tai lupaa ei ole myönnetty.",
441
+ };
442
+
443
+ case "no":
444
+ return {
445
+ takePicture: "Ta et bilde",
446
+ cameraNotSupportedOrNotAllowed:
447
+ "Kameraen støttes ikke eller tillatelsen er ikke gitt.",
448
+ };
449
+
450
+ case "cs":
451
+ return {
452
+ takePicture: "Vyfotit",
453
+ cameraNotSupportedOrNotAllowed:
454
+ "Fotoaparát není podporován nebo povolení nebylo uděleno.",
455
+ };
456
+
457
+ case "en":
458
+ default:
459
+ return {
460
+ takePicture: "Take a picture",
461
+ cameraNotSupportedOrNotAllowed:
462
+ "The camera is not supported or permission has not been granted.",
463
+ };
464
+ }
463
465
  }
464
466
 
465
467
  /**
@@ -468,17 +470,17 @@ function getTranslations() {
468
470
  * @fires monster-camera-capture-captured
469
471
  */
470
472
  function initEventHandler() {
471
- const self = this;
473
+ const self = this;
472
474
 
473
- this[takePictureButtonElementSymbol].setOption("actions.click", function () {
474
- self.capture();
475
+ this[takePictureButtonElementSymbol].setOption("actions.click", function () {
476
+ self.capture();
475
477
 
476
- fireCustomEvent(self, "monster-camera-capture-captured", {
477
- element: self,
478
- });
479
- });
478
+ fireCustomEvent(self, "monster-camera-capture-captured", {
479
+ element: self,
480
+ });
481
+ });
480
482
 
481
- return this;
483
+ return this;
482
484
  }
483
485
 
484
486
  /**
@@ -486,25 +488,25 @@ function initEventHandler() {
486
488
  * @return {void}
487
489
  */
488
490
  function initControlReferences() {
489
- this[controlElementSymbol] = this.shadowRoot.querySelector(
490
- `[${ATTRIBUTE_ROLE}="control"]`,
491
- );
491
+ this[controlElementSymbol] = this.shadowRoot.querySelector(
492
+ `[${ATTRIBUTE_ROLE}="control"]`,
493
+ );
492
494
 
493
- this[takePictureButtonElementSymbol] = this.shadowRoot.querySelector(
494
- `[data-monster-role="takePicture"]`,
495
- );
495
+ this[takePictureButtonElementSymbol] = this.shadowRoot.querySelector(
496
+ `[data-monster-role="takePicture"]`,
497
+ );
496
498
 
497
- this[videoElementSymbol] = this.shadowRoot.querySelector(`video`);
499
+ this[videoElementSymbol] = this.shadowRoot.querySelector(`video`);
498
500
 
499
- this[canvasElementSymbol] = this.shadowRoot.querySelector(`canvas`);
501
+ this[canvasElementSymbol] = this.shadowRoot.querySelector(`canvas`);
500
502
 
501
- this[emptyHistoryStateElementSymbol] = this.shadowRoot.querySelector(
502
- `[data-monster-role="emptyHistoryState"]`,
503
- );
503
+ this[emptyHistoryStateElementSymbol] = this.shadowRoot.querySelector(
504
+ `[data-monster-role="emptyHistoryState"]`,
505
+ );
504
506
 
505
- this[fullScreenElementSymbol] = this.shadowRoot.querySelector(
506
- `[data-monster-role="full-screen"]`,
507
- );
507
+ this[fullScreenElementSymbol] = this.shadowRoot.querySelector(
508
+ `[data-monster-role="full-screen"]`,
509
+ );
508
510
  }
509
511
 
510
512
  /**
@@ -512,8 +514,8 @@ function initControlReferences() {
512
514
  * @return {string}
513
515
  */
514
516
  function getTemplate() {
515
- // language=HTML
516
- return `
517
+ // language=HTML
518
+ return `
517
519
  <div data-monster-role="control" part="control">
518
520
  <monster-full-screen part="full-screen" style="display: none" data-monster-role="full-screen"
519
521
  data-monster-option-selector="[data-monster-role=control]"></monster-full-screen>