@schukai/monster 3.110.4 → 3.112.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 +25 -0
- package/package.json +1 -1
- package/source/components/content/camera.mjs +488 -0
- package/source/components/content/style/camera-capture.pcss +37 -0
- package/source/components/content/stylesheet/camera-capture.mjs +38 -0
- package/source/components/datatable/status.mjs +175 -177
- package/source/components/form/reload.mjs +1 -2
- package/source/components/form/util/fetch.mjs +5 -2
- package/source/components/layout/popper.mjs +1 -1
- package/source/components/layout/slider.mjs +1 -1
- package/source/components/time/month-calendar.mjs +819 -0
- package/source/components/time/style/month-calendar.pcss +100 -0
- package/source/components/time/stylesheet/month-calendar.mjs +31 -0
- package/source/components/time/timeline/collection.mjs +205 -0
- package/source/components/time/timeline/item.mjs +184 -0
- package/source/components/time/timeline/segment.mjs +169 -0
- package/source/components/time/timeline/style/segment.pcss +18 -0
- package/source/components/time/timeline/stylesheet/segment.mjs +38 -0
- package/source/data/datasource/server/restapi/data-fetch-error.mjs +3 -3
- package/source/data/datasource/server/restapi.mjs +1 -1
- package/source/data/transformer.mjs +60 -0
- package/source/monster.mjs +4 -0
- package/source/text/bracketed-key-value-hash.mjs +187 -187
- package/source/types/base.mjs +6 -5
- package/source/types/basewithoptions.mjs +4 -1
- package/source/types/internal.mjs +1 -1
- 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 +1136 -977
@@ -33,6 +33,7 @@ import {
|
|
33
33
|
import { clone } from "../util/clone.mjs";
|
34
34
|
import { Pathfinder } from "./pathfinder.mjs";
|
35
35
|
import { formatTimeAgo } from "../i18n/time-ago.mjs";
|
36
|
+
import { UUID } from "../types/uuid.mjs";
|
36
37
|
|
37
38
|
export { Transformer };
|
38
39
|
|
@@ -323,6 +324,14 @@ function transform(value) {
|
|
323
324
|
validateString(value);
|
324
325
|
return value.trim();
|
325
326
|
|
327
|
+
case "ltrim":
|
328
|
+
validateString(value);
|
329
|
+
return value.replace(/^\s+/, "");
|
330
|
+
|
331
|
+
case "rtrim":
|
332
|
+
validateString(value);
|
333
|
+
return value.replace(/\s+$/, "");
|
334
|
+
|
326
335
|
case "rawurlencode":
|
327
336
|
validateString(value);
|
328
337
|
return encodeURIComponent(value)
|
@@ -367,6 +376,16 @@ function transform(value) {
|
|
367
376
|
const doc = new DOMParser().parseFromString(value, "text/html");
|
368
377
|
return doc.body.textContent || "";
|
369
378
|
|
379
|
+
case "replace":
|
380
|
+
const search = args.shift();
|
381
|
+
const replace = args.shift();
|
382
|
+
|
383
|
+
validateString(search);
|
384
|
+
validateString(replace);
|
385
|
+
validateString(value);
|
386
|
+
|
387
|
+
return value.replace(new RegExp(search, "g"), replace);
|
388
|
+
|
370
389
|
case "if":
|
371
390
|
case "?":
|
372
391
|
validatePrimitive(value);
|
@@ -395,6 +414,44 @@ function transform(value) {
|
|
395
414
|
},
|
396
415
|
);
|
397
416
|
|
417
|
+
case "gt":
|
418
|
+
case "greaterthan":
|
419
|
+
case "greater-than":
|
420
|
+
case ">":
|
421
|
+
validatePrimitive(value);
|
422
|
+
const compareValue = args.shift();
|
423
|
+
validatePrimitive(compareValue);
|
424
|
+
|
425
|
+
return value > compareValue;
|
426
|
+
|
427
|
+
case "gte":
|
428
|
+
case "greaterthanorequal":
|
429
|
+
case "greater-than-or-equal":
|
430
|
+
validatePrimitive(value);
|
431
|
+
const compareValue3 = args.shift();
|
432
|
+
validatePrimitive(compareValue3);
|
433
|
+
|
434
|
+
return value >= compareValue3;
|
435
|
+
|
436
|
+
case "lt":
|
437
|
+
case "lessthan":
|
438
|
+
case "less-than":
|
439
|
+
case "<":
|
440
|
+
validatePrimitive(value);
|
441
|
+
const compareValue2 = args.shift();
|
442
|
+
validatePrimitive(compareValue2);
|
443
|
+
|
444
|
+
return value < compareValue2;
|
445
|
+
|
446
|
+
case "lte":
|
447
|
+
case "lessthanorequal":
|
448
|
+
case "less-than-or-equal":
|
449
|
+
validatePrimitive(value);
|
450
|
+
const compareValue4 = args.shift();
|
451
|
+
validatePrimitive(compareValue4);
|
452
|
+
|
453
|
+
return value <= compareValue4;
|
454
|
+
|
398
455
|
case "count":
|
399
456
|
case "length":
|
400
457
|
if (
|
@@ -444,6 +501,9 @@ function transform(value) {
|
|
444
501
|
case "uniqid":
|
445
502
|
return new ID().toString();
|
446
503
|
|
504
|
+
case "uuid":
|
505
|
+
return new UUID().toString();
|
506
|
+
|
447
507
|
case "first-key":
|
448
508
|
case "last-key":
|
449
509
|
case "nth-last-key":
|
package/source/monster.mjs
CHANGED
@@ -29,6 +29,10 @@ export * from "./components/layout/details.mjs";
|
|
29
29
|
export * from "./components/layout/slider.mjs";
|
30
30
|
export * from "./components/content/viewer.mjs";
|
31
31
|
export * from "./components/content/copy.mjs";
|
32
|
+
export * from "./components/content/camera.mjs";
|
33
|
+
export * from "./components/time/timeline/segment.mjs";
|
34
|
+
export * from "./components/time/appointment.mjs";
|
35
|
+
export * from "./components/time/month-calendar.mjs";
|
32
36
|
export * from "./components/form/message-state-button.mjs";
|
33
37
|
export * from "./components/form/password.mjs";
|
34
38
|
export * from "./components/form/button-bar.mjs";
|
@@ -12,7 +12,7 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
export {parseBracketedKeyValueHash, createBracketedKeyValueHash};
|
15
|
+
export { parseBracketedKeyValueHash, createBracketedKeyValueHash };
|
16
16
|
|
17
17
|
/**
|
18
18
|
* Parses a string containing bracketed key-value pairs and returns an object representing the parsed result.
|
@@ -51,155 +51,155 @@ export {parseBracketedKeyValueHash, createBracketedKeyValueHash};
|
|
51
51
|
* @return {Object} - An object representing the parsed result, with keys representing the selectors and values representing the key-value pairs associated with each selector.
|
52
52
|
* - Returns an empty object if there was an error during parsing. */
|
53
53
|
function parseBracketedKeyValueHash(hashString) {
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
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
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
54
|
+
const selectors = {};
|
55
|
+
//const selectorStack = [];
|
56
|
+
//const keyValueStack = [];
|
57
|
+
|
58
|
+
const trimmedHashString = hashString.trim();
|
59
|
+
const cleanedHashString =
|
60
|
+
trimmedHashString.charAt(0) === "#"
|
61
|
+
? trimmedHashString.slice(1)
|
62
|
+
: trimmedHashString;
|
63
|
+
|
64
|
+
//const selectors = (keyValueStack.length > 0) ? result[selectorStack[selectorStack.length - 1]] : result;
|
65
|
+
let currentSelector = "";
|
66
|
+
|
67
|
+
function addToResult(key, value) {
|
68
|
+
if (currentSelector && key) {
|
69
|
+
if (!selectors[currentSelector]) {
|
70
|
+
selectors[currentSelector] = {};
|
71
|
+
}
|
72
|
+
|
73
|
+
selectors[currentSelector][key] = value;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
|
77
|
+
let currentKey = "";
|
78
|
+
let currentValue = "";
|
79
|
+
let inKey = true;
|
80
|
+
let inValue = false;
|
81
|
+
let inQuotedValue = false;
|
82
|
+
let inSelector = true;
|
83
|
+
let escaped = false;
|
84
|
+
let quotedValueStartChar = "";
|
85
|
+
|
86
|
+
for (let i = 0; i < cleanedHashString.length; i++) {
|
87
|
+
const c = cleanedHashString[i];
|
88
|
+
const nextChar = cleanedHashString?.[i + 1];
|
89
|
+
|
90
|
+
if (c === "\\" && !escaped) {
|
91
|
+
escaped = true;
|
92
|
+
continue;
|
93
|
+
}
|
94
|
+
|
95
|
+
if (escaped) {
|
96
|
+
if (inSelector) {
|
97
|
+
currentSelector += c;
|
98
|
+
} else if (inKey) {
|
99
|
+
currentKey += c;
|
100
|
+
} else if (inValue) {
|
101
|
+
currentValue += c;
|
102
|
+
}
|
103
|
+
escaped = false;
|
104
|
+
continue;
|
105
|
+
}
|
106
|
+
|
107
|
+
if (inQuotedValue && quotedValueStartChar !== c) {
|
108
|
+
if (inSelector) {
|
109
|
+
currentSelector += c;
|
110
|
+
} else if (inKey) {
|
111
|
+
currentKey += c;
|
112
|
+
} else if (inValue) {
|
113
|
+
currentValue += c;
|
114
|
+
}
|
115
|
+
|
116
|
+
continue;
|
117
|
+
}
|
118
|
+
|
119
|
+
if (c === ";" && inSelector) {
|
120
|
+
inSelector = true;
|
121
|
+
currentSelector = "";
|
122
|
+
continue;
|
123
|
+
}
|
124
|
+
|
125
|
+
if (inSelector === true && c !== "(") {
|
126
|
+
currentSelector += c;
|
127
|
+
continue;
|
128
|
+
}
|
129
|
+
|
130
|
+
if (c === "(" && inSelector) {
|
131
|
+
inSelector = false;
|
132
|
+
inKey = true;
|
133
|
+
|
134
|
+
currentKey = "";
|
135
|
+
continue;
|
136
|
+
}
|
137
|
+
|
138
|
+
if (inKey === true && c !== "=") {
|
139
|
+
currentKey += c;
|
140
|
+
continue;
|
141
|
+
}
|
142
|
+
|
143
|
+
if (c === "=" && inKey) {
|
144
|
+
inKey = false;
|
145
|
+
inValue = true;
|
146
|
+
|
147
|
+
if (nextChar === '"' || nextChar === "'") {
|
148
|
+
inQuotedValue = true;
|
149
|
+
quotedValueStartChar = nextChar;
|
150
|
+
i++;
|
151
|
+
continue;
|
152
|
+
}
|
153
|
+
|
154
|
+
currentValue = "";
|
155
|
+
continue;
|
156
|
+
}
|
157
|
+
|
158
|
+
if (inValue === true) {
|
159
|
+
if (inQuotedValue) {
|
160
|
+
if (c === quotedValueStartChar) {
|
161
|
+
inQuotedValue = false;
|
162
|
+
continue;
|
163
|
+
}
|
164
|
+
|
165
|
+
currentValue += c;
|
166
|
+
continue;
|
167
|
+
}
|
168
|
+
|
169
|
+
if (c === ",") {
|
170
|
+
inValue = false;
|
171
|
+
inKey = true;
|
172
|
+
const decodedCurrentValue = decodeURIComponent(currentValue);
|
173
|
+
addToResult(currentKey, decodedCurrentValue);
|
174
|
+
currentKey = "";
|
175
|
+
currentValue = "";
|
176
|
+
continue;
|
177
|
+
}
|
178
|
+
|
179
|
+
if (c === ")") {
|
180
|
+
inValue = false;
|
181
|
+
//inKey = true;
|
182
|
+
inSelector = true;
|
183
|
+
|
184
|
+
const decodedCurrentValue = decodeURIComponent(currentValue);
|
185
|
+
addToResult(currentKey, decodedCurrentValue);
|
186
|
+
currentKey = "";
|
187
|
+
currentValue = "";
|
188
|
+
currentSelector = "";
|
189
|
+
continue;
|
190
|
+
}
|
191
|
+
|
192
|
+
currentValue += c;
|
193
|
+
|
194
|
+
continue;
|
195
|
+
}
|
196
|
+
}
|
197
|
+
|
198
|
+
if (inSelector) {
|
199
|
+
return selectors;
|
200
|
+
}
|
201
|
+
|
202
|
+
return {};
|
203
203
|
}
|
204
204
|
|
205
205
|
/**
|
@@ -211,41 +211,41 @@ function parseBracketedKeyValueHash(hashString) {
|
|
211
211
|
* @since 3.37.0
|
212
212
|
*/
|
213
213
|
function createBracketedKeyValueHash(object, addHashPrefix = true) {
|
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
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
214
|
+
if (!object) {
|
215
|
+
return addHashPrefix ? "#" : "";
|
216
|
+
}
|
217
|
+
|
218
|
+
let hashString = "";
|
219
|
+
|
220
|
+
function encodeKeyValue(key, value) {
|
221
|
+
return encodeURIComponent(key) + "=" + encodeURIComponent(value);
|
222
|
+
}
|
223
|
+
|
224
|
+
for (const selector in object) {
|
225
|
+
if (object.hasOwnProperty(selector)) {
|
226
|
+
const keyValuePairs = object[selector];
|
227
|
+
let selectorString = selector;
|
228
|
+
let keyValueString = "";
|
229
|
+
|
230
|
+
for (const key in keyValuePairs) {
|
231
|
+
if (keyValuePairs.hasOwnProperty(key)) {
|
232
|
+
const value = keyValuePairs[key];
|
233
|
+
keyValueString += keyValueString.length === 0 ? "" : ",";
|
234
|
+
keyValueString += encodeKeyValue(key, value);
|
235
|
+
}
|
236
|
+
}
|
237
|
+
|
238
|
+
if (keyValueString.length > 0) {
|
239
|
+
selectorString += "(" + keyValueString + ")";
|
240
|
+
hashString += hashString.length === 0 ? "" : ";";
|
241
|
+
hashString += selectorString;
|
242
|
+
}
|
243
|
+
}
|
244
|
+
}
|
245
|
+
|
246
|
+
if (hashString.length > 0 && addHashPrefix) {
|
247
|
+
hashString = "#" + hashString;
|
248
|
+
}
|
249
|
+
|
250
|
+
return hashString;
|
251
251
|
}
|
package/source/types/base.mjs
CHANGED
@@ -22,18 +22,18 @@ export { Base };
|
|
22
22
|
* This class has besides a `toString` which returns the json representation of the object
|
23
23
|
* also a functionality to check if an object is an instance of a class.
|
24
24
|
*
|
25
|
-
* Therefore, the class has a static method
|
25
|
+
* Therefore, the class has a static method <code>[Symbol.hasInstance](that)</code> which returns true if the object
|
26
26
|
* is an instance of the class.
|
27
27
|
*
|
28
|
-
*
|
28
|
+
* <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance">MDN Symbol.hasInstance</a>
|
29
29
|
*
|
30
30
|
* Derived classes should implement a static getter `instanceSymbol` which returns a unique symbol.
|
31
31
|
*
|
32
|
-
*
|
32
|
+
* <code lang="javascript">
|
33
33
|
* static get [instanceSymbol]() {
|
34
34
|
* return Symbol.for("@schukai/monster/types/base");
|
35
35
|
* }
|
36
|
-
*
|
36
|
+
* </code>
|
37
37
|
*
|
38
38
|
* The class was formerly called Object.
|
39
39
|
*
|
@@ -92,7 +92,8 @@ class Base extends Object {
|
|
92
92
|
}
|
93
93
|
|
94
94
|
/**
|
95
|
-
* this function checks if the class has a static getter
|
95
|
+
* this function checks if the class has a static getter <code>instanceSymbol</code>,
|
96
|
+
* and if the value of this getter is equal to the
|
96
97
|
*
|
97
98
|
* @private
|
98
99
|
* @param obj
|
@@ -17,6 +17,7 @@ import { extend } from "../data/extend.mjs";
|
|
17
17
|
import { Pathfinder } from "../data/pathfinder.mjs";
|
18
18
|
import { Base } from "./base.mjs";
|
19
19
|
import { validateObject } from "./validate.mjs";
|
20
|
+
import { isObject } from "./is.mjs";
|
20
21
|
|
21
22
|
export { BaseWithOptions };
|
22
23
|
|
@@ -28,6 +29,8 @@ export { BaseWithOptions };
|
|
28
29
|
* Classes that require the possibility of options can be derived directly from this class.
|
29
30
|
* Derived classes almost always override the `default` getter with their own values.
|
30
31
|
*
|
32
|
+
* This class is deprecated since 3.15.0. Use `BaseWithDefaults` instead.
|
33
|
+
*
|
31
34
|
* @license AGPLv3
|
32
35
|
* @since 1.13.0
|
33
36
|
* @copyright schukai GmbH
|
@@ -41,7 +44,7 @@ class BaseWithOptions extends Base {
|
|
41
44
|
constructor(options) {
|
42
45
|
super();
|
43
46
|
|
44
|
-
if (options
|
47
|
+
if (!isObject(options)) {
|
45
48
|
options = {};
|
46
49
|
}
|
47
50
|
|
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.
|
13
|
-
<div id="lastupdate" style='font-size:0.7em'>last update Mi
|
12
|
+
<h1 style='margin-bottom: 0.1em;'>Monster 3.111.0</h1>
|
13
|
+
<div id="lastupdate" style='font-size:0.7em'>last update Mi 5. Mär 13:29:26 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>
|