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