@schukai/monster 3.110.4 → 3.111.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.
- package/CHANGELOG.md +9 -0
- package/package.json +1 -1
- package/source/components/content/camera.mjs +478 -0
- package/source/components/content/style/camera-capture.pcss +37 -0
- package/source/components/content/stylesheet/camera-capture.mjs +31 -0
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/web/test.html +2 -2
- package/test/web/tests.js +4 -4
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,15 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
## [3.111.0] - 2025-02-22
|
6
|
+
|
7
|
+
### Add Features
|
8
|
+
|
9
|
+
- new camera capture control [#295](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/295)
|
10
|
+
- new camera capture control [#295](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/295)
|
11
|
+
|
12
|
+
|
13
|
+
|
5
14
|
## [3.110.4] - 2025-02-20
|
6
15
|
|
7
16
|
### Bug Fixes
|
package/package.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@popperjs/core":"^2.11.8","buffer":"^6.0.3"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.
|
1
|
+
{"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@popperjs/core":"^2.11.8","buffer":"^6.0.3"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"3.111.0"}
|
@@ -0,0 +1,478 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, {{copyRightYear}}. All rights reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
*
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
7
|
+
*
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
11
|
+
*
|
12
|
+
* SPDX-License-Identifier: AGPL-3.0
|
13
|
+
*/
|
14
|
+
|
15
|
+
import {instanceSymbol} from "../../constants.mjs";
|
16
|
+
import {
|
17
|
+
ATTRIBUTE_ROLE,
|
18
|
+
} from "../../dom/constants.mjs";
|
19
|
+
import {CustomElement} from "../../dom/customelement.mjs";
|
20
|
+
import {
|
21
|
+
assembleMethodSymbol,
|
22
|
+
registerCustomElement,
|
23
|
+
} from "../../dom/customelement.mjs";
|
24
|
+
import {CameraCaptureStyleSheet} from "./stylesheet/camera-capture.mjs";
|
25
|
+
import "../form/button.mjs";
|
26
|
+
import "../state/state.mjs";
|
27
|
+
import {getLocaleOfDocument} from "../../dom/locale.mjs";
|
28
|
+
import {addErrorAttribute} from "../../dom/error.mjs";
|
29
|
+
import {Queue} from "../../types/queue.mjs";
|
30
|
+
|
31
|
+
export {CameraCapture};
|
32
|
+
|
33
|
+
/**
|
34
|
+
* @private
|
35
|
+
* @type {symbol}
|
36
|
+
*/
|
37
|
+
const controlElementSymbol = Symbol("copyElement");
|
38
|
+
|
39
|
+
/**
|
40
|
+
* @private
|
41
|
+
* @type {symbol}
|
42
|
+
*/
|
43
|
+
const videoElementSymbol = Symbol("videoElement");
|
44
|
+
|
45
|
+
/**
|
46
|
+
* @private
|
47
|
+
* @type {symbol}
|
48
|
+
*/
|
49
|
+
const takePictureButtonElementSymbol = Symbol("takePictureButtonElement");
|
50
|
+
|
51
|
+
/**
|
52
|
+
* @private
|
53
|
+
* @type {symbol}
|
54
|
+
*/
|
55
|
+
const canvasElementSymbol = Symbol("canvasElement");
|
56
|
+
|
57
|
+
/**
|
58
|
+
* @private
|
59
|
+
* @type {symbol}
|
60
|
+
*/
|
61
|
+
const queueSymbol = Symbol("queue");
|
62
|
+
|
63
|
+
/**
|
64
|
+
* @private
|
65
|
+
* @type {symbol}
|
66
|
+
*/
|
67
|
+
const emptyHistoryStateElementSymbol = Symbol("emptyHistoryStateElement");
|
68
|
+
|
69
|
+
/**
|
70
|
+
* This is a camera capture component.
|
71
|
+
*
|
72
|
+
* @fragments /fragments/components/content/camera-capture/
|
73
|
+
*
|
74
|
+
* @example /examples/components/content/camera-capture/
|
75
|
+
*
|
76
|
+
* @since 3.111.0
|
77
|
+
* @copyright schukai GmbH
|
78
|
+
* @summary A simple but powerful camera capture component. It can be used to capture images from the camera.
|
79
|
+
*/
|
80
|
+
class CameraCapture extends CustomElement {
|
81
|
+
|
82
|
+
|
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("@schukai/monster/components/content/camera-capture@instance");
|
99
|
+
}
|
100
|
+
|
101
|
+
/**
|
102
|
+
*
|
103
|
+
* @return {Components.Content.Copy
|
104
|
+
*/
|
105
|
+
[assembleMethodSymbol]() {
|
106
|
+
super[assembleMethodSymbol]();
|
107
|
+
initControlReferences.call(this);
|
108
|
+
initEventHandler.call(this);
|
109
|
+
initCameraControl.call(this);
|
110
|
+
return this;
|
111
|
+
}
|
112
|
+
|
113
|
+
/**
|
114
|
+
* This method is called when the element is connected to the dom.
|
115
|
+
*
|
116
|
+
* @return {void}
|
117
|
+
*/
|
118
|
+
connectedCallback() {
|
119
|
+
super.connectedCallback();
|
120
|
+
|
121
|
+
// const document = getDocument();
|
122
|
+
//
|
123
|
+
// for (const [, type] of Object.entries(["click", "touch"])) {
|
124
|
+
// // close on outside ui-events
|
125
|
+
// document.addEventListener(type, this[closeEventHandler]);
|
126
|
+
// }
|
127
|
+
//
|
128
|
+
// updatePopper.call(this);
|
129
|
+
// attachResizeObserver.call(this);
|
130
|
+
}
|
131
|
+
|
132
|
+
/**
|
133
|
+
* This method is called when the element is disconnected from the dom.
|
134
|
+
*
|
135
|
+
* @return {void}
|
136
|
+
*/
|
137
|
+
disconnectedCallback() {
|
138
|
+
super.disconnectedCallback();
|
139
|
+
|
140
|
+
// // close on outside ui-events
|
141
|
+
// for (const [, type] of Object.entries(["click", "touch"])) {
|
142
|
+
// document.removeEventListener(type, this[closeEventHandler]);
|
143
|
+
// }
|
144
|
+
|
145
|
+
|
146
|
+
}
|
147
|
+
|
148
|
+
/**
|
149
|
+
* To set the options via the HTML Tag, the attribute `data-monster-options` must be used.
|
150
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
151
|
+
*
|
152
|
+
* The individual configuration values can be found in the table.
|
153
|
+
*
|
154
|
+
* @property {Object} templates Template definitions
|
155
|
+
* @property {string} templates.main Main template
|
156
|
+
* @property {Object} actions Callbacks
|
157
|
+
* @property {string} actions.click="throw Error" Callback when clicked
|
158
|
+
* @property {Object} features Features
|
159
|
+
* @property {boolean} features.stripTags=true Strip tags from the copied text
|
160
|
+
* @property {boolean} features.preventOpenEventSent=false Prevent open event from being sent
|
161
|
+
* @property {Object} popper Popper configuration
|
162
|
+
* @property {string} popper.placement="top" Popper placement
|
163
|
+
* @property {string[]} popper.middleware=["autoPlacement", "shift", "offset:15", "arrow"] Popper middleware
|
164
|
+
* @property {boolean} disabled=false Disabled state
|
165
|
+
*/
|
166
|
+
get defaults() {
|
167
|
+
return Object.assign({}, super.defaults, {
|
168
|
+
|
169
|
+
templates: {
|
170
|
+
main: getTemplate(),
|
171
|
+
},
|
172
|
+
|
173
|
+
disabled: false,
|
174
|
+
features: {},
|
175
|
+
|
176
|
+
labels: getTranslations(),
|
177
|
+
});
|
178
|
+
}
|
179
|
+
|
180
|
+
/**
|
181
|
+
* @return {string}
|
182
|
+
*/
|
183
|
+
static getTag() {
|
184
|
+
return "monster-camera-capture";
|
185
|
+
}
|
186
|
+
|
187
|
+
/**
|
188
|
+
* @return {CSSStyleSheet[]}
|
189
|
+
*/
|
190
|
+
static getCSSStyleSheet() {
|
191
|
+
return [CameraCaptureStyleSheet];
|
192
|
+
}
|
193
|
+
|
194
|
+
|
195
|
+
/**
|
196
|
+
* Retrieve the next image from the queue.
|
197
|
+
* If the queue is empty, it returns `null`.
|
198
|
+
* @returns {string|null}
|
199
|
+
*/
|
200
|
+
getNextImage() {
|
201
|
+
if (!this[queueSymbol].isEmpty()) {
|
202
|
+
const next = this[queueSymbol].poll();
|
203
|
+
if (!next) {
|
204
|
+
return null;
|
205
|
+
}
|
206
|
+
return next;
|
207
|
+
}
|
208
|
+
return null;
|
209
|
+
}
|
210
|
+
|
211
|
+
/**
|
212
|
+
* Capture an image from the camera and add it to the queue.
|
213
|
+
* The image is returned as a data URL.
|
214
|
+
* @returns {string}
|
215
|
+
*/
|
216
|
+
capture() {
|
217
|
+
|
218
|
+
this[canvasElementSymbol].width = this[videoElementSymbol].videoWidth;
|
219
|
+
this[canvasElementSymbol].height = this[videoElementSymbol].videoHeight;
|
220
|
+
const ctx = this[canvasElementSymbol].getContext('2d');
|
221
|
+
ctx.drawImage(this[videoElementSymbol], 0, 0, this[canvasElementSymbol].width, this[canvasElementSymbol].height);
|
222
|
+
const dataURL = this[canvasElementSymbol].toDataURL('image/png');
|
223
|
+
this[queueSymbol].add(dataURL);
|
224
|
+
return dataURL;
|
225
|
+
|
226
|
+
}
|
227
|
+
|
228
|
+
}
|
229
|
+
|
230
|
+
function initCameraControl() {
|
231
|
+
const self = this;
|
232
|
+
|
233
|
+
if (!navigator || !navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
|
234
|
+
addErrorAttribute(self, "Browser not supported");
|
235
|
+
return;
|
236
|
+
}
|
237
|
+
|
238
|
+
navigator.mediaDevices.getUserMedia({video: true})
|
239
|
+
.then(function (stream) {
|
240
|
+
|
241
|
+
self[takePictureButtonElementSymbol].style.display = "block";
|
242
|
+
self[videoElementSymbol].style.display = "block";
|
243
|
+
self[emptyHistoryStateElementSymbol].style.display = "none";
|
244
|
+
|
245
|
+
self[videoElementSymbol].srcObject = stream;
|
246
|
+
})
|
247
|
+
.catch(function (e) {
|
248
|
+
addErrorAttribute(self, e);
|
249
|
+
});
|
250
|
+
|
251
|
+
}
|
252
|
+
|
253
|
+
/**
|
254
|
+
* @private
|
255
|
+
* @returns {{takePicture: string}}
|
256
|
+
*/
|
257
|
+
function getTranslations() {
|
258
|
+
const locale = getLocaleOfDocument();
|
259
|
+
switch (locale.language) {
|
260
|
+
case "de":
|
261
|
+
return {
|
262
|
+
takePicture: "Bild aufnehmen",
|
263
|
+
cameraNotSupportedOrNotAllowed: "Die Kamera wird nicht unterstützt oder die Berechtigung wurde nicht erteilt.",
|
264
|
+
};
|
265
|
+
|
266
|
+
case "es":
|
267
|
+
return {
|
268
|
+
takePicture: "Tomar una foto",
|
269
|
+
cameraNotSupportedOrNotAllowed: "La cámara no es compatible o no se ha otorgado permiso.",
|
270
|
+
}
|
271
|
+
|
272
|
+
case "zh":
|
273
|
+
return {
|
274
|
+
takePicture: "拍照",
|
275
|
+
cameraNotSupportedOrNotAllowed: "相机不受支持或未授予权限。",
|
276
|
+
}
|
277
|
+
|
278
|
+
case "hi":
|
279
|
+
return {
|
280
|
+
takePicture: "तस्वीर खींचें",
|
281
|
+
cameraNotSupportedOrNotAllowed: "कैमरा समर्थित नहीं है या अनुमति नहीं दी गई है।",
|
282
|
+
}
|
283
|
+
|
284
|
+
case "bn":
|
285
|
+
return {
|
286
|
+
takePicture: "ছবি তুলুন",
|
287
|
+
cameraNotSupportedOrNotAllowed: "ক্যামেরা সমর্থিত নয় বা অনুমতি দেয়া হয়নি।",
|
288
|
+
}
|
289
|
+
|
290
|
+
case "pt":
|
291
|
+
return {
|
292
|
+
takePicture: "Tirar uma foto",
|
293
|
+
cameraNotSupportedOrNotAllowed: "A câmera não é suportada ou a permissão não foi concedida.",
|
294
|
+
}
|
295
|
+
|
296
|
+
case "ru":
|
297
|
+
return {
|
298
|
+
takePicture: "Сделать фото",
|
299
|
+
cameraNotSupportedOrNotAllowed: "Камера не поддерживается или разрешение не предоставлено.",
|
300
|
+
}
|
301
|
+
|
302
|
+
case "ja":
|
303
|
+
return {
|
304
|
+
takePicture: "写真を撮る",
|
305
|
+
cameraNotSupportedOrNotAllowed: "カメラがサポートされていないか、許可が付与されていません。",
|
306
|
+
}
|
307
|
+
|
308
|
+
case "pa":
|
309
|
+
return {
|
310
|
+
takePicture: "ਤਸਵੀਰ ਖਿੱਚੋ",
|
311
|
+
cameraNotSupportedOrNotAllowed: "ਕੈਮਰਾ ਦਾ ਸਮਰਥਨ ਨਹੀਂ ਹੈ ਜਾਂ ਅਨੁਮਤੀ ਨਹੀਂ ਦਿੱਤੀ ਗਈ ਹੈ।",
|
312
|
+
}
|
313
|
+
|
314
|
+
case "mr":
|
315
|
+
return {
|
316
|
+
takePicture: "फोटो घ्या",
|
317
|
+
cameraNotSupportedOrNotAllowed: "कॅमेरा समर्थित नाही किंवा परवानगी दिलेली नाही.",
|
318
|
+
}
|
319
|
+
|
320
|
+
case "fr":
|
321
|
+
return {
|
322
|
+
takePicture: "Prendre une photo",
|
323
|
+
cameraNotSupportedOrNotAllowed: "La caméra n'est pas prise en charge ou l'autorisation n'a pas été accordée.",
|
324
|
+
}
|
325
|
+
|
326
|
+
case "it":
|
327
|
+
return {
|
328
|
+
takePicture: "Scattare una foto",
|
329
|
+
cameraNotSupportedOrNotAllowed: "La fotocamera non è supportata o l'autorizzazione non è stata concessa.",
|
330
|
+
}
|
331
|
+
|
332
|
+
case "nl":
|
333
|
+
return {
|
334
|
+
takePicture: "Maak een foto",
|
335
|
+
cameraNotSupportedOrNotAllowed: "De camera wordt niet ondersteund of er is geen toestemming verleend.",
|
336
|
+
}
|
337
|
+
|
338
|
+
case "sv":
|
339
|
+
return {
|
340
|
+
takePicture: "Ta ett foto",
|
341
|
+
cameraNotSupportedOrNotAllowed: "Kameran stöds inte eller tillståndet har inte beviljats.",
|
342
|
+
}
|
343
|
+
|
344
|
+
case "pl":
|
345
|
+
return {
|
346
|
+
takePicture: "Zrób zdjęcie",
|
347
|
+
cameraNotSupportedOrNotAllowed: "Kamera nie jest obsługiwana lub nie udzielono zgody.",
|
348
|
+
}
|
349
|
+
|
350
|
+
case "da":
|
351
|
+
return {
|
352
|
+
takePicture: "Tag et billede",
|
353
|
+
cameraNotSupportedOrNotAllowed: "Kameraen understøttes ikke eller tilladelsen er ikke givet.",
|
354
|
+
}
|
355
|
+
|
356
|
+
case "fi":
|
357
|
+
return {
|
358
|
+
takePicture: "Ota kuva",
|
359
|
+
cameraNotSupportedOrNotAllowed: "Kameraa ei tueta tai lupaa ei ole myönnetty.",
|
360
|
+
}
|
361
|
+
|
362
|
+
case "no":
|
363
|
+
return {
|
364
|
+
takePicture: "Ta et bilde",
|
365
|
+
cameraNotSupportedOrNotAllowed: "Kameraen støttes ikke eller tillatelsen er ikke gitt.",
|
366
|
+
}
|
367
|
+
|
368
|
+
case "cs":
|
369
|
+
return {
|
370
|
+
takePicture: "Vyfotit",
|
371
|
+
cameraNotSupportedOrNotAllowed: "Fotoaparát není podporován nebo povolení nebylo uděleno.",
|
372
|
+
}
|
373
|
+
|
374
|
+
case "en":
|
375
|
+
default:
|
376
|
+
return {
|
377
|
+
takePicture: "Take a picture",
|
378
|
+
cameraNotSupportedOrNotAllowed: "The camera is not supported or permission has not been granted.",
|
379
|
+
};
|
380
|
+
}
|
381
|
+
}
|
382
|
+
|
383
|
+
/**
|
384
|
+
* @private
|
385
|
+
* @return {initEventHandler}
|
386
|
+
*/
|
387
|
+
function initEventHandler() {
|
388
|
+
const self = this;
|
389
|
+
|
390
|
+
|
391
|
+
this[takePictureButtonElementSymbol].setOption("actions.click", function () {
|
392
|
+
self.capture();
|
393
|
+
});
|
394
|
+
|
395
|
+
|
396
|
+
return this;
|
397
|
+
}
|
398
|
+
|
399
|
+
/**
|
400
|
+
* @private
|
401
|
+
* @return {void}
|
402
|
+
*/
|
403
|
+
function initControlReferences() {
|
404
|
+
this[controlElementSymbol] = this.shadowRoot.querySelector(
|
405
|
+
`[${ATTRIBUTE_ROLE}="control"]`,
|
406
|
+
);
|
407
|
+
|
408
|
+
this[takePictureButtonElementSymbol] = this.shadowRoot.querySelector(
|
409
|
+
`[data-monster-role="takePicture"]`,
|
410
|
+
);
|
411
|
+
|
412
|
+
this[videoElementSymbol] = this.shadowRoot.querySelector(
|
413
|
+
`video`,
|
414
|
+
);
|
415
|
+
|
416
|
+
this[canvasElementSymbol] = this.shadowRoot.querySelector(
|
417
|
+
`canvas`,
|
418
|
+
);
|
419
|
+
|
420
|
+
// data-monster-role="emptyHistoryState"
|
421
|
+
this[emptyHistoryStateElementSymbol] = this.shadowRoot.querySelector(
|
422
|
+
`[data-monster-role="emptyHistoryState"]`,
|
423
|
+
);
|
424
|
+
|
425
|
+
|
426
|
+
}
|
427
|
+
|
428
|
+
/**
|
429
|
+
* @private
|
430
|
+
* @return {string}
|
431
|
+
*/
|
432
|
+
function getTemplate() {
|
433
|
+
// language=HTML
|
434
|
+
return `
|
435
|
+
<div data-monster-role="control" part="control">
|
436
|
+
<monster-state data-monster-role="emptyHistoryState">
|
437
|
+
<svg slot="visual" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
438
|
+
width="350"
|
439
|
+
height="350" viewBox="0 0 92.604 92.604">
|
440
|
+
<defs>
|
441
|
+
<linearGradient id="a" x1="336.587" x2="372.879" y1="218.625" y2="218.625"
|
442
|
+
gradientUnits="userSpaceOnUse" spreadMethod="pad">
|
443
|
+
<stop offset="0" style="stop-color:#fefe00"/>
|
444
|
+
<stop offset="1" style="stop-color:#ff43c6"/>
|
445
|
+
</linearGradient>
|
446
|
+
<linearGradient xlink:href="#a" id="p" x1="-2894.157" x2="-805.215" y1="-4285.143"
|
447
|
+
y2="-2196.201" gradientTransform="translate(135.207 194.415)scale(.04433)"
|
448
|
+
gradientUnits="userSpaceOnUse" spreadMethod="pad"/>
|
449
|
+
<linearGradient xlink:href="#a" id="q" x1="-2894.157" x2="-805.215" y1="-4285.143"
|
450
|
+
y2="-2196.201" gradientTransform="translate(135.207 194.415)scale(.04433)"
|
451
|
+
gradientUnits="userSpaceOnUse" spreadMethod="pad"/>
|
452
|
+
<linearGradient xlink:href="#a" id="o" x1="-2894.157" x2="-805.215" y1="-4285.143"
|
453
|
+
y2="-2196.201" gradientTransform="translate(135.207 194.415)scale(.04433)"
|
454
|
+
gradientUnits="userSpaceOnUse" spreadMethod="pad"/>
|
455
|
+
</defs>
|
456
|
+
<g style="font-variation-settings:normal;opacity:1;vector-effect:none;fill:url(#o);fill-opacity:1;stroke-width:.0440952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000;stop-opacity:1">
|
457
|
+
<path d="M8.983 34.64a9.33 9.33 0 0 1 9.33-9.33H74.29a9.33 9.33 0 0 1 9.33 9.33v13.995a9.33 9.33 0 0 1-9.33 9.33h-22.07c.673.755 1.54 1.51 2.478 2.215a32.7 32.7 0 0 0 4.23 2.66l.066.027.014.01a2.332 2.332 0 0 1-1.045 4.417H34.64a2.332 2.332 0 0 1-1.045-4.417l.014-.01.065-.033a23 23 0 0 0 1.25-.69 33 33 0 0 0 2.981-1.965c.933-.7 1.806-1.46 2.477-2.215h-22.07a9.33 9.33 0 0 1-9.329-9.33Zm9.33-4.665a4.665 4.665 0 0 0-4.665 4.665v13.995a4.665 4.665 0 0 0 4.665 4.664H74.29a4.665 4.665 0 0 0 4.665-4.664V34.64a4.665 4.665 0 0 0-4.665-4.665z"
|
458
|
+
style="font-variation-settings:normal;vector-effect:none;fill:url(#p);fill-opacity:1;stroke-width:.0440952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000;stop-opacity:1"/>
|
459
|
+
<path d="M46.302 36.972a4.665 4.665 0 1 0 0 9.33 4.665 4.665 0 0 0 0-9.33m-9.33 4.665a9.33 9.33 0 1 1 18.66 0 9.33 9.33 0 0 1-18.66 0m32.655 0a2.332 2.332 0 1 1-4.665 0 2.332 2.332 0 0 1 4.665 0"
|
460
|
+
style="font-variation-settings:normal;vector-effect:none;fill:url(#q);fill-opacity:1;stroke-width:.0440952;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;-inkscape-stroke:none;stop-color:#000;stop-opacity:1"/>
|
461
|
+
</g>
|
462
|
+
</svg>
|
463
|
+
|
464
|
+
<p data-monster-replace="path:labels.cameraNotSupportedOrNotAllowed | default:there was an error:string"></p>
|
465
|
+
</monster-state>
|
466
|
+
|
467
|
+
|
468
|
+
<video autoplay style="display:none"></video>
|
469
|
+
<canvas style="display:none;"></canvas>
|
470
|
+
<div>
|
471
|
+
<monster-button part="takePictureButton" style="display:none"
|
472
|
+
data-monster-role="takePicture" data-monster-attributes="classes.takePictureButton"
|
473
|
+
data-monster-replace="path:labels.takePicture"></monster-button>
|
474
|
+
</div>
|
475
|
+
</div>`;
|
476
|
+
}
|
477
|
+
|
478
|
+
registerCustomElement(CameraCapture);
|
@@ -0,0 +1,37 @@
|
|
1
|
+
@import "../../style/control.pcss";
|
2
|
+
@import "../../style/property.pcss";
|
3
|
+
@import "../../style/floating-ui.pcss";
|
4
|
+
|
5
|
+
|
6
|
+
[data-monster-role="control"] {
|
7
|
+
display: flex;
|
8
|
+
justify-content: space-between;
|
9
|
+
margin: 0;
|
10
|
+
padding: 0;
|
11
|
+
flex-direction: column;
|
12
|
+
|
13
|
+
box-shadow: var(--monster-box-shadow-1);
|
14
|
+
|
15
|
+
background-color: var(--monster-color-primary-4);
|
16
|
+
border-color: var(--monster-bg-color-primary-4);
|
17
|
+
border-radius: var(--monster-border-radius);
|
18
|
+
border-style: var(--monster-border-style);
|
19
|
+
border-width: var(--monster-border-width);
|
20
|
+
color: var(--monster-bg-color-primary-4);
|
21
|
+
|
22
|
+
}
|
23
|
+
|
24
|
+
video, canvas {
|
25
|
+
max-width: 100%;
|
26
|
+
max-height: 100%;
|
27
|
+
display: block;
|
28
|
+
}
|
29
|
+
|
30
|
+
monster-button::part(button) {
|
31
|
+
border: none;
|
32
|
+
}
|
33
|
+
|
34
|
+
|
35
|
+
monster-state {
|
36
|
+
|
37
|
+
}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
/**
|
2
|
+
* Copyright © schukai GmbH and all contributing authors, 2025. All rights reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
*
|
5
|
+
* This source code is licensed under the GNU Affero General Public License version 3 (AGPLv3).
|
6
|
+
* The full text of the license can be found at: https://www.gnu.org/licenses/agpl-3.0.en.html
|
7
|
+
*
|
8
|
+
* For those who do not wish to adhere to the AGPLv3, a commercial license is available.
|
9
|
+
* Acquiring a commercial license allows you to use this software without complying with the AGPLv3 terms.
|
10
|
+
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
11
|
+
*/
|
12
|
+
|
13
|
+
import {addAttributeToken} from "../../../dom/attributes.mjs";
|
14
|
+
import {ATTRIBUTE_ERRORMESSAGE} from "../../../dom/constants.mjs";
|
15
|
+
|
16
|
+
export {CameraCaptureStyleSheet}
|
17
|
+
|
18
|
+
/**
|
19
|
+
* @private
|
20
|
+
* @type {CSSStyleSheet}
|
21
|
+
*/
|
22
|
+
const CameraCaptureStyleSheet = new CSSStyleSheet();
|
23
|
+
|
24
|
+
try {
|
25
|
+
CameraCaptureStyleSheet.insertRule(`
|
26
|
+
@layer cameracapture {
|
27
|
+
[data-monster-role=control]{box-sizing:border-box;outline:none;width:100%}[data-monster-role=control].flex{align-items:center;display:flex;flex-direction:row}:host{box-sizing:border-box;display:block}:after,:before,:root{--monster-font-family:-apple-system,BlinkMacSystemFont,\"Quicksand\",\"Segoe UI\",\"Roboto\",\"Oxygen\",\"Ubuntu\",\"Cantarell\",\"Fira Sans\",\"Droid Sans\",\"Helvetica Neue\",Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\",\"Segoe UI Symbol\";--monster-font-family-monospace:\"Consolas\",\"Courier New\",\"Roboto Mono\",\"Source Code Pro\",\"Fira Mono\",monospace;--monster-color-primary-1:var(--monster-color-gray-6);--monster-color-primary-2:var(--monster-color-gray-6);--monster-color-primary-3:var(--monster-color-cinnamon-1);--monster-color-primary-4:var(--monster-color-cinnamon-1);--monster-bg-color-primary-1:var(--monster-color-gray-1);--monster-bg-color-primary-2:var(--monster-color-gray-2);--monster-bg-color-primary-3:var(--monster-color-gray-6);--monster-bg-color-primary-4:var(--monster-color-gray-4)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-primary-1:var(--monster-color-gray-1);--monster-color-primary-2:var(--monster-color-gray-1);--monster-color-primary-3:var(--monster-color-gray-6);--monster-color-primary-4:var(--monster-color-gray-6);--monster-bg-color-primary-1:var(--monster-color-gray-6);--monster-bg-color-primary-2:var(--monster-color-gray-3);--monster-bg-color-primary-3:var(--monster-color-gray-2);--monster-bg-color-primary-4:var(--monster-color-gray-1)}}:after,:before,:root{--monster-color-secondary-1:var(--monster-color-red-4);--monster-color-secondary-2:var(--monster-color-red-4);--monster-color-secondary-3:var(--monster-color-red-1);--monster-color-secondary-4:var(--monster-color-red-1);--monster-bg-color-secondary-1:var(--monster-color-gray-1);--monster-bg-color-secondary-2:var(--monster-color-red-2);--monster-bg-color-secondary-3:var(--monster-color-red-3);--monster-bg-color-secondary-4:var(--monster-color-red-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-secondary-1:var(--monster-color-red-1);--monster-color-secondary-2:var(--monster-color-red-1);--monster-color-secondary-3:var(--monster-color-red-6);--monster-color-secondary-4:var(--monster-color-red-4);--monster-bg-color-secondary-1:var(--monster-color-gray-6);--monster-bg-color-secondary-2:var(--monster-color-red-3);--monster-bg-color-secondary-3:var(--monster-color-red-2);--monster-bg-color-secondary-4:var(--monster-color-red-1)}}:after,:before,:root{--monster-color-tertiary-1:var(--monster-color-magenta-4);--monster-color-tertiary-2:var(--monster-color-magenta-4);--monster-color-tertiary-3:var(--monster-color-magenta-6);--monster-color-tertiary-4:var(--monster-color-magenta-1);--monster-bg-color-tertiary-1:var(--monster-color-gray-1);--monster-bg-color-tertiary-2:var(--monster-color-magenta-1);--monster-bg-color-tertiary-3:var(--monster-color-magenta-2);--monster-bg-color-tertiary-4:var(--monster-color-magenta-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-tertiary-1:var(--monster-color-magenta-1);--monster-color-tertiary-2:var(--monster-color-magenta-6);--monster-color-tertiary-3:var(--monster-color-magenta-4);--monster-color-tertiary-4:var(--monster-color-magenta-4);--monster-bg-color-tertiary-1:var(--monster-color-gray-6);--monster-bg-color-tertiary-2:var(--monster-color-magenta-2);--monster-bg-color-tertiary-3:var(--monster-color-magenta-1);--monster-bg-color-tertiary-4:var(--monster-color-magenta-1)}}:after,:before,:root{--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-4);--monster-color-destructive-3:var(--monster-color-red-6);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-4);--monster-bg-color-destructive-2:var(--monster-color-gray-1);--monster-bg-color-destructive-3:var(--monster-color-red-2);--monster-bg-color-destructive-4:var(--monster-color-red-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-destructive-1:var(--monster-color-red-1);--monster-color-destructive-2:var(--monster-color-red-3);--monster-color-destructive-3:var(--monster-color-red-4);--monster-color-destructive-4:var(--monster-color-red-1);--monster-bg-color-destructive-1:var(--monster-color-red-5);--monster-bg-color-destructive-2:var(--monster-color-gray-6);--monster-bg-color-destructive-3:var(--monster-color-red-1);--monster-bg-color-destructive-4:var(--monster-color-red-4)}}:after,:before,:root{--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-4);--monster-color-success-3:var(--monster-color-green-6);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-3);--monster-bg-color-success-2:var(--monster-color-gray-1);--monster-bg-color-success-3:var(--monster-color-green-2);--monster-bg-color-success-4:var(--monster-color-green-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-success-1:var(--monster-color-green-1);--monster-color-success-2:var(--monster-color-green-2);--monster-color-success-3:var(--monster-color-green-4);--monster-color-success-4:var(--monster-color-green-1);--monster-bg-color-success-1:var(--monster-color-green-5);--monster-bg-color-success-2:var(--monster-color-gray-6);--monster-bg-color-success-3:var(--monster-color-green-1);--monster-bg-color-success-4:var(--monster-color-green-3)}}:after,:before,:root{--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-4);--monster-color-warning-3:var(--monster-color-orange-6);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-3);--monster-bg-color-warning-2:var(--monster-color-gray-1);--monster-bg-color-warning-3:var(--monster-color-orange-2);--monster-bg-color-warning-4:var(--monster-color-orange-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-warning-1:var(--monster-color-orange-1);--monster-color-warning-2:var(--monster-color-orange-3);--monster-color-warning-3:var(--monster-color-orange-4);--monster-color-warning-4:var(--monster-color-orange-1);--monster-bg-color-warning-1:var(--monster-color-orange-5);--monster-bg-color-warning-2:var(--monster-color-gray-6);--monster-bg-color-warning-3:var(--monster-color-orange-1);--monster-bg-color-warning-4:var(--monster-color-orange-3)}}:after,:before,:root{--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-4);--monster-color-error-3:var(--monster-color-red-6);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-4);--monster-bg-color-error-2:var(--monster-color-gray-1);--monster-bg-color-error-3:var(--monster-color-red-2);--monster-bg-color-error-4:var(--monster-color-red-5)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-error-1:var(--monster-color-red-1);--monster-color-error-2:var(--monster-color-red-3);--monster-color-error-3:var(--monster-color-red-4);--monster-color-error-4:var(--monster-color-red-1);--monster-bg-color-error-1:var(--monster-color-red-5);--monster-bg-color-error-2:var(--monster-color-gray-6);--monster-bg-color-error-3:var(--monster-color-red-1);--monster-bg-color-error-4:var(--monster-color-red-4)}}:after,:before,:root{--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-selection-1:var(--monster-color-gray-6);--monster-color-selection-2:var(--monster-color-gray-6);--monster-color-selection-3:var(--monster-color-gray-6);--monster-color-selection-4:var(--monster-color-gray-1);--monster-bg-color-selection-1:var(--monster-color-yellow-2);--monster-bg-color-selection-2:var(--monster-color-yellow-1);--monster-bg-color-selection-3:var(--monster-color-yellow-2);--monster-bg-color-selection-4:var(--monster-color-yellow-6)}}:after,:before,:root{--monster-color-primary-disabled-1:var(--monster-color-gray-4);--monster-color-primary-disabled-2:var(--monster-color-gray-4);--monster-color-primary-disabled-3:var(--monster-color-gray-4);--monster-color-primary-disabled-4:var(--monster-color-gray-4);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-1);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-6)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-color-primary-disabled-1:var(--monster-color-gray-4);--monster-color-primary-disabled-2:var(--monster-color-gray-4);--monster-color-primary-disabled-3:var(--monster-color-gray-3);--monster-color-primary-disabled-4:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-1:var(--monster-color-gray-6);--monster-bg-color-primary-disabled-2:var(--monster-color-gray-3);--monster-bg-color-primary-disabled-3:var(--monster-color-gray-2);--monster-bg-color-primary-disabled-4:var(--monster-color-gray-1)}}:after,:before,:root{--monster-color-gradient-1:#833ab4;--monster-color-gradient-2:#fd1d1d;--monster-color-gradient-3:#fcb045;--monster-box-shadow-1:none;--monster-box-shadow-2:-1px 1px 10px 1px hsla(0,0%,76%,.61);--monster-text-shadow:none;--monster-theme-control-bg-color:var(--monster-color-seashell-1);--monster-theme-control-color:var(--monster-color-seashell-6);--monster-theme-control-hover-color:var(--monster-color-seashell-6);--monster-theme-control-hover-bg-color:var(--monster-color-seashell-2);--monster-theme-control-border-width:2px;--monster-theme-control-border-style:solid;--monster-theme-control-border-radius:0;--monster-theme-control-border-color:var(--monster-color-primary-1)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-theme-control-bg-color:var(--monster-color-gray-5);--monster-theme-control-color:var(--monster-color-gray-1);--monster-theme-control-border-color:var(--monster-color-gray-3);--monster-theme-control-hover-color:var(--monster-color-gray-1);--monster-theme-control-hover-bg-color:var(--monster-color-gray-6)}}:after,:before,:root{--monster-theme-on-color:var(--monster-color-green-1);--monster-theme-on-bg-color:var(--monster-color-green-5);--monster-theme-off-color:var(--monster-color-gray-1);--monster-theme-off-bg-color:var(--monster-color-gray-4)}@media (prefers-color-scheme:dark){:after,:before,:root{--monster-theme-on-color:var(--monster-color-gray-6);--monster-theme-on-bg-color:var(--monster-color-gray-1);--monster-theme-off-color:var(--monster-color-gray-1);--monster-theme-off-bg-color:var(--monster-color-gray-5)}}:after,:before,:root{--monster-border-style:solid;--monster-border-width:3px;--monster-border-radius:0;--monster-outline-width:1px;--monster-popper-witharrrow-distance:-4px;--monster-z-index-default:0;--monster-z-index-outline:10;--monster-z-index-dropdown:200;--monster-z-index-dropdown-overlay:210;--monster-z-index-sticky:300;--monster-z-index-sticky-overlay:310;--monster-z-index-fixed:400;--monster-z-index-fixed-overlay:410;--monster-z-index-modal-backdrop:500;--monster-z-index-modal-backdrop-overlay:510;--monster-z-index-offcanvas:600;--monster-z-index-offcanvas-overlay:610;--monster-z-index-modal:700;--monster-z-index-modal-overlay:710;--monster-z-index-popover:800;--monster-z-index-popover-overlay:810;--monster-z-index-tooltip:800;--monster-z-index-tooltip-overlay:910;--monster-space-0:0;--monster-space-1:2px;--monster-space-2:4px;--monster-space-3:6px;--monster-space-4:10px;--monster-space-5:16px;--monster-space-6:26px;--monster-space-7:42px;--monster-breakpoint-0:480px;--monster-breakpoint-4:480px;--monster-breakpoint-7:768px;--monster-breakpoint-9:992px;--monster-breakpoint-12:1200px;--monster-dragger-width:2px;--monster-dragger-handle-width:4px;--monster-dragger-handle-height:50px}div[data-monster-role=popper]{align-content:center;background:var(--monster-bg-color-primary-1);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);box-sizing:border-box;color:var(--monster-color-primary-1);display:none;justify-content:space-between;left:0;padding:1.1em;position:absolute;top:0;width:-moz-max-content;width:max-content;z-index:var(--monster-z-index-modal)}div[data-monster-role=popper] div[data-monster-role=arrow]{background:var(--monster-bg-color-primary-1);height:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);pointer-events:none;position:absolute;width:calc(max(var(--monster-popper-witharrrow-distance), -1 * var(--monster-popper-witharrrow-distance))*2);z-index:-1}[data-monster-role=control]{background-color:var(--monster-color-primary-4);border-color:var(--monster-bg-color-primary-4);border-radius:var(--monster-border-radius);border-style:var(--monster-border-style);border-width:var(--monster-border-width);box-shadow:var(--monster-box-shadow-1);color:var(--monster-bg-color-primary-4);display:flex;flex-direction:column;justify-content:space-between;margin:0;padding:0}canvas,video{display:block;max-height:100%;max-width:100%}monster-button::part(button){border:none}
|
28
|
+
}`, 0);
|
29
|
+
} catch (e) {
|
30
|
+
addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
|
31
|
+
}
|
package/source/types/version.mjs
CHANGED
package/test/cases/monster.mjs
CHANGED
package/test/web/test.html
CHANGED
@@ -9,8 +9,8 @@
|
|
9
9
|
</head>
|
10
10
|
<body>
|
11
11
|
<div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
|
12
|
-
<h1 style='margin-bottom: 0.1em;'>Monster 3.110.
|
13
|
-
<div id="lastupdate" style='font-size:0.7em'>last update
|
12
|
+
<h1 style='margin-bottom: 0.1em;'>Monster 3.110.4</h1>
|
13
|
+
<div id="lastupdate" style='font-size:0.7em'>last update Sa 22. Feb 23:01:02 CET 2025</div>
|
14
14
|
</div>
|
15
15
|
<div id="mocha-errors"
|
16
16
|
style="color: red;font-weight: bold;display: flex;align-items: center;justify-content: center;flex-direction: column;margin:20px;"></div>
|