@schukai/monster 3.80.2 → 3.80.4
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +24 -0
- package/package.json +1 -1
- package/source/components/content/copy.mjs +7 -4
- package/source/components/datatable/change-button.mjs +1 -1
- package/source/components/datatable/columnbar.mjs +1 -1
- package/source/components/datatable/dataset.mjs +3 -3
- package/source/components/datatable/datasource/dom.mjs +2 -2
- package/source/components/datatable/datasource/rest.mjs +7 -7
- package/source/components/datatable/datasource.mjs +3 -3
- package/source/components/datatable/datatable/header.mjs +11 -11
- package/source/components/datatable/datatable.mjs +15 -15
- package/source/components/datatable/embedded-pagination.mjs +2 -2
- package/source/components/datatable/filter/date-range.mjs +5 -5
- package/source/components/datatable/filter/input.mjs +2 -2
- package/source/components/datatable/filter/range.mjs +3 -3
- package/source/components/datatable/filter/settings.mjs +5 -5
- package/source/components/datatable/filter/util.mjs +3 -3
- package/source/components/datatable/filter-button.mjs +1 -1
- package/source/components/datatable/filter.mjs +11 -11
- package/source/components/datatable/pagination.mjs +3 -3
- package/source/components/datatable/save-button.mjs +1 -1
- package/source/components/datatable/status.mjs +1 -1
- package/source/components/form/action-button.mjs +2 -2
- package/source/components/form/api-button.mjs +1 -1
- package/source/components/form/button-bar.mjs +3 -3
- package/source/components/form/confirm-button.mjs +4 -4
- package/source/components/form/context-error.mjs +4 -4
- package/source/components/form/context-help.mjs +1 -1
- package/source/components/form/field-set.mjs +2 -2
- package/source/components/form/form.mjs +3 -3
- package/source/components/form/message-state-button.mjs +6 -6
- package/source/components/form/popper-button.mjs +1 -1
- package/source/components/form/reload.mjs +5 -22
- package/source/components/form/select.mjs +2015 -1958
- package/source/components/form/shadow-reload.mjs +1 -1
- package/source/components/form/state-button.mjs +1 -1
- package/source/components/form/style/select.pcss +3 -1
- package/source/components/form/stylesheet/select.mjs +7 -14
- package/source/components/form/template.mjs +4 -4
- package/source/components/form/toggle-switch.mjs +1 -1
- package/source/components/form/tree-select.mjs +1 -1
- package/source/components/form/util/floating-ui.mjs +1 -1
- package/source/components/host/call-button.mjs +1 -1
- package/source/components/host/config-manager.mjs +6 -6
- package/source/components/host/host.mjs +8 -8
- package/source/components/host/overlay.mjs +13 -13
- package/source/components/host/toggle-button.mjs +1 -1
- package/source/components/host/util.mjs +1 -1
- package/source/components/host/viewer.mjs +5 -5
- package/source/components/layout/collapse.mjs +20 -19
- package/source/components/layout/details.mjs +5 -5
- package/source/components/layout/iframe.mjs +2 -2
- package/source/components/layout/panel.mjs +3 -3
- package/source/components/layout/popper.mjs +1 -1
- package/source/components/layout/slider.mjs +6 -6
- package/source/components/layout/split-panel.mjs +3 -3
- package/source/components/layout/tabs.mjs +3 -9
- package/source/components/layout/width-toggle.mjs +4 -4
- package/source/components/navigation/table-of-content.mjs +3 -3
- package/source/components/notify/message.mjs +0 -1
- package/source/components/state/log/entry.mjs +6 -6
- package/source/components/state/log.mjs +3 -39
- package/source/components/state/state.mjs +1 -1
- package/source/components/tree-menu/dragable-tree-menu.mjs +2 -2
- package/source/components/tree-menu/tree-menu.mjs +1 -1
- package/source/constraints/abstract.mjs +2 -2
- package/source/constraints/abstractoperator.mjs +1 -1
- package/source/constraints/andoperator.mjs +5 -5
- package/source/constraints/invalid.mjs +5 -5
- package/source/constraints/isarray.mjs +5 -5
- package/source/constraints/isobject.mjs +5 -5
- package/source/constraints/oroperator.mjs +5 -5
- package/source/constraints/valid.mjs +4 -4
- package/source/data/buildmap.mjs +2 -1
- package/source/data/datasource/dom.mjs +1 -1
- package/source/data/datasource/server/restapi/data-fetch-error.mjs +1 -1
- package/source/data/datasource/server/restapi/writeerror.mjs +1 -1
- package/source/data/datasource/server/restapi.mjs +2 -2
- package/source/data/datasource/server/webconnect.mjs +4 -4
- package/source/data/datasource/server.mjs +5 -5
- package/source/data/datasource/storage/localstorage.mjs +1 -1
- package/source/data/datasource/storage/sessionstorage.mjs +1 -1
- package/source/data/datasource/storage.mjs +1 -1
- package/source/data/datasource.mjs +4 -5
- package/source/data/pathfinder.mjs +10 -9
- package/source/data/pipe.mjs +5 -4
- package/source/data/transformer.mjs +23 -11
- package/source/dom/assembler.mjs +2 -2
- package/source/dom/attributes.mjs +2 -2
- package/source/dom/customcontrol.mjs +1 -1
- package/source/dom/customelement.mjs +36 -67
- package/source/dom/dimension.mjs +3 -3
- package/source/dom/focusmanager.mjs +1 -1
- package/source/dom/locale.mjs +1 -1
- package/source/dom/resource/data.mjs +1 -1
- package/source/dom/resource/link/stylesheet.mjs +1 -1
- package/source/dom/resource/link.mjs +1 -1
- package/source/dom/resource/script.mjs +1 -1
- package/source/dom/template.mjs +2 -2
- package/source/dom/theme.mjs +2 -2
- package/source/dom/updater.mjs +5 -6
- package/source/dom/util/extract-keys.mjs +1 -1
- package/source/dom/util/init-options-from-attributes.mjs +1 -1
- package/source/dom/util/set-option-from-attribute.mjs +1 -1
- package/source/dom/util.mjs +9 -9
- package/source/i18n/formatter.mjs +1 -1
- package/source/i18n/locale.mjs +2 -2
- package/source/i18n/provider.mjs +1 -1
- package/source/i18n/providers/embed.mjs +1 -3
- package/source/i18n/translations.mjs +2 -2
- package/source/logging/handler/console.mjs +1 -1
- package/source/logging/handler.mjs +11 -11
- package/source/logging/logentry.mjs +2 -2
- package/source/logging/logger.mjs +11 -11
- package/source/math/random.mjs +2 -2
- package/source/monster.mjs +1 -0
- package/source/net/webconnect/message.mjs +3 -3
- package/source/net/webconnect.mjs +10 -10
- package/source/text/bracketed-key-value-hash.mjs +2 -2
- package/source/text/generate-range-comparison-expression.mjs +1 -1
- package/source/types/base.mjs +4 -4
- package/source/types/basewithoptions.mjs +3 -4
- package/source/types/dataurl.mjs +6 -8
- package/source/types/global.mjs +2 -2
- package/source/types/internal.mjs +3 -3
- package/source/types/is.mjs +10 -20
- package/source/types/mediatype.mjs +1 -1
- package/source/types/node.mjs +1 -1
- package/source/types/nodelist.mjs +7 -7
- package/source/types/observablequeue.mjs +7 -7
- package/source/types/observer.mjs +6 -6
- package/source/types/proxyobserver.mjs +8 -8
- package/source/types/queue.mjs +3 -3
- package/source/types/stack.mjs +3 -3
- package/source/types/tokenlist.mjs +12 -12
- package/source/types/uniquequeue.mjs +2 -2
- package/source/types/version.mjs +4 -4
- package/source/util/clone.mjs +2 -2
- package/source/util/comparator.mjs +1 -2
- package/source/util/deadmansswitch.mjs +7 -5
- package/source/util/freeze.mjs +1 -1
- package/source/util/processing.mjs +2 -2
- package/source/util/runtime.mjs +1 -1
@@ -56,7 +56,7 @@ class RestAPI extends Server {
|
|
56
56
|
|
57
57
|
/**
|
58
58
|
* This method is called by the `instanceof` operator.
|
59
|
-
* @
|
59
|
+
* @return {symbol}
|
60
60
|
* @since 2.1.0
|
61
61
|
*/
|
62
62
|
static get [instanceSymbol]() {
|
@@ -189,7 +189,7 @@ class RestAPI extends Server {
|
|
189
189
|
* @param init
|
190
190
|
* @param key
|
191
191
|
* @param callback
|
192
|
-
* @
|
192
|
+
* @return {Promise<string>}
|
193
193
|
*/
|
194
194
|
function fetchData(init, key, callback) {
|
195
195
|
let response;
|
@@ -67,14 +67,14 @@ class WebConnect extends Server {
|
|
67
67
|
|
68
68
|
/**
|
69
69
|
*
|
70
|
-
* @
|
70
|
+
* @return {Promise}
|
71
71
|
*/
|
72
72
|
connect() {
|
73
73
|
return this[webConnectSymbol].connect();
|
74
74
|
}
|
75
75
|
|
76
76
|
/**
|
77
|
-
* @
|
77
|
+
* @return {boolean}
|
78
78
|
*/
|
79
79
|
isConnected() {
|
80
80
|
return this[webConnectSymbol].isConnected();
|
@@ -82,7 +82,7 @@ class WebConnect extends Server {
|
|
82
82
|
|
83
83
|
/**
|
84
84
|
* This method is called by the `instanceof` operator.
|
85
|
-
* @
|
85
|
+
* @return {symbol}
|
86
86
|
*/
|
87
87
|
static get [instanceSymbol]() {
|
88
88
|
return Symbol.for("@schukai/monster/data/datasource/server/webconnect");
|
@@ -142,7 +142,7 @@ class WebConnect extends Server {
|
|
142
142
|
/**
|
143
143
|
* This method closes the connection.
|
144
144
|
*
|
145
|
-
* @
|
145
|
+
* @return {Promise}
|
146
146
|
*/
|
147
147
|
close() {
|
148
148
|
return this[webConnectSymbol].close();
|
@@ -39,7 +39,7 @@ const serverVersionSymbol = Symbol("serverVersion");
|
|
39
39
|
class Server extends Datasource {
|
40
40
|
/**
|
41
41
|
* This method is called by the `instanceof` operator.
|
42
|
-
* @
|
42
|
+
* @return {symbol}
|
43
43
|
*/
|
44
44
|
static get [instanceSymbol]() {
|
45
45
|
return Symbol.for("@schukai/monster/data/datasource/server");
|
@@ -51,7 +51,7 @@ class Server extends Datasource {
|
|
51
51
|
*
|
52
52
|
* @private
|
53
53
|
* @param {Object} payload
|
54
|
-
* @
|
54
|
+
* @return {Object}
|
55
55
|
*/
|
56
56
|
transformServerPayload(payload) {
|
57
57
|
payload = doTransform.call(this, "read", payload);
|
@@ -70,7 +70,7 @@ class Server extends Datasource {
|
|
70
70
|
*
|
71
71
|
* @private
|
72
72
|
* @param {Object} payload
|
73
|
-
* @
|
73
|
+
* @return {Object}
|
74
74
|
*/
|
75
75
|
prepareServerPayload(payload) {
|
76
76
|
payload = doTransform.call(this, "write", payload);
|
@@ -92,7 +92,7 @@ class Server extends Datasource {
|
|
92
92
|
/**
|
93
93
|
*
|
94
94
|
* @param obj
|
95
|
-
* @
|
95
|
+
* @return {*}
|
96
96
|
*/
|
97
97
|
function doDiff(obj) {
|
98
98
|
if (
|
@@ -122,7 +122,7 @@ function doDiff(obj) {
|
|
122
122
|
* @private
|
123
123
|
* @param {string} type
|
124
124
|
* @param {Object} obj
|
125
|
-
* @
|
125
|
+
* @return {Object}
|
126
126
|
*/
|
127
127
|
function doTransform(type, obj) {
|
128
128
|
const transformation = this.getOption(`${type}.mapping.transformer`);
|
@@ -52,7 +52,6 @@ const internalDataSymbol = Symbol.for(
|
|
52
52
|
* @license AGPLv3
|
53
53
|
* @since 1.22.0
|
54
54
|
* @copyright schukai GmbH
|
55
|
-
* @memberOf Monster.Data
|
56
55
|
* @summary The datasource class encapsulates the access to data objects.
|
57
56
|
*/
|
58
57
|
class Datasource extends Base {
|
@@ -74,7 +73,7 @@ class Datasource extends Base {
|
|
74
73
|
* attach a new observer
|
75
74
|
*
|
76
75
|
* @param {Observer} observer
|
77
|
-
* @
|
76
|
+
* @return {Datasource}
|
78
77
|
*/
|
79
78
|
attachObserver(observer) {
|
80
79
|
this[internalDataSymbol].attachObserver(observer);
|
@@ -85,7 +84,7 @@ class Datasource extends Base {
|
|
85
84
|
* detach a observer
|
86
85
|
*
|
87
86
|
* @param {Observer} observer
|
88
|
-
* @
|
87
|
+
* @return {Datasource}
|
89
88
|
*/
|
90
89
|
detachObserver(observer) {
|
91
90
|
this[internalDataSymbol].detachObserver(observer);
|
@@ -94,7 +93,7 @@ class Datasource extends Base {
|
|
94
93
|
|
95
94
|
/**
|
96
95
|
* @param {Observer} observer
|
97
|
-
* @
|
96
|
+
* @return {boolean}
|
98
97
|
*/
|
99
98
|
containsObserver(observer) {
|
100
99
|
return this[internalDataSymbol].containsObserver(observer);
|
@@ -204,7 +203,7 @@ class Datasource extends Base {
|
|
204
203
|
|
205
204
|
/**
|
206
205
|
* This method is called by the `instanceof` operator.
|
207
|
-
* @
|
206
|
+
* @return {symbol}
|
208
207
|
* @since 2.1.0
|
209
208
|
*/
|
210
209
|
static get [instanceSymbol]() {
|
@@ -81,12 +81,13 @@ const WILDCARD = "*";
|
|
81
81
|
* new Pathfinder(obj).setVia('a.b.0.c', true); // ↦ {a:{b:[{c:true}]}}
|
82
82
|
* ```
|
83
83
|
*
|
84
|
-
* @
|
85
|
-
* @
|
84
|
+
* @example /examples/libraries/pathfinder/example-1/ Example 1
|
85
|
+
* @example /examples/libraries/pathfinder/example-2/ Example 2
|
86
|
+
*
|
86
87
|
* @license AGPLv3
|
87
88
|
* @since 1.4.0
|
88
89
|
* @copyright schukai GmbH
|
89
|
-
* @
|
90
|
+
* @summary Pathfinder is a class to find a path to an object.
|
90
91
|
*/
|
91
92
|
class Pathfinder extends Base {
|
92
93
|
/**
|
@@ -124,7 +125,7 @@ class Pathfinder extends Base {
|
|
124
125
|
*
|
125
126
|
* @param {string|array} path
|
126
127
|
* @since 1.4.0
|
127
|
-
* @
|
128
|
+
* @return {*}
|
128
129
|
* @throws {TypeError} unsupported type
|
129
130
|
* @throws {Error} the journey is not at its end
|
130
131
|
* @throws {TypeError} value is not a string
|
@@ -139,7 +140,7 @@ class Pathfinder extends Base {
|
|
139
140
|
*
|
140
141
|
* @param {string|array} path
|
141
142
|
* @param {*} value
|
142
|
-
* @
|
143
|
+
* @return {Pathfinder}
|
143
144
|
* @since 1.4.0
|
144
145
|
* @throws {TypeError} unsupported type
|
145
146
|
* @throws {TypeError} value is not a string
|
@@ -155,7 +156,7 @@ class Pathfinder extends Base {
|
|
155
156
|
* Delete Via Path
|
156
157
|
*
|
157
158
|
* @param {string|array} path
|
158
|
-
* @
|
159
|
+
* @return {Pathfinder}
|
159
160
|
* @since 1.6.0
|
160
161
|
* @throws {TypeError} unsupported type
|
161
162
|
* @throws {TypeError} value is not a string
|
@@ -226,7 +227,7 @@ function iterate(subject, path, check) {
|
|
226
227
|
* @param subject
|
227
228
|
* @param path
|
228
229
|
* @param check
|
229
|
-
* @
|
230
|
+
* @return {V|*|Map}
|
230
231
|
* @throws {TypeError} unsupported type
|
231
232
|
* @throws {Error} the journey is not at its end
|
232
233
|
* @throws {Error} unsupported action for this data type
|
@@ -306,7 +307,7 @@ function getValueViaPath(subject, path, check) {
|
|
306
307
|
* @param {object} subject
|
307
308
|
* @param {string|array} path
|
308
309
|
* @param {*} value
|
309
|
-
* @
|
310
|
+
* @return {void}
|
310
311
|
* @throws {TypeError} unsupported type
|
311
312
|
* @throws {TypeError} unsupported type
|
312
313
|
* @throws {Error} the journey is not at its end
|
@@ -405,7 +406,7 @@ function assignProperty(object, key, value) {
|
|
405
406
|
*
|
406
407
|
* @param {object} subject
|
407
408
|
* @param {string} path
|
408
|
-
* @
|
409
|
+
* @return {void}
|
409
410
|
* @throws {TypeError} unsupported type
|
410
411
|
* @throws {TypeError} unsupported type
|
411
412
|
* @throws {Error} the journey is not at its end
|
package/source/data/pipe.mjs
CHANGED
@@ -32,11 +32,12 @@ const DELIMITER = "|";
|
|
32
32
|
* With the Pipe, processing steps can be combined. Here, the value of an object is accessed via the pathfinder (path command).
|
33
33
|
* the word is then converted to uppercase letters and a prefix Hello is added. the two backslash safe the space char.
|
34
34
|
*
|
35
|
-
* @
|
35
|
+
* @example /examples/libraries/pipe/example-1/
|
36
|
+
*
|
36
37
|
* @license AGPLv3
|
37
38
|
* @since 1.5.0
|
38
39
|
* @copyright schukai GmbH
|
39
|
-
* @
|
40
|
+
* @summary The pipe class makes it possible to combine several processing steps.
|
40
41
|
*/
|
41
42
|
class Pipe extends Base {
|
42
43
|
/**
|
@@ -56,7 +57,7 @@ class Pipe extends Base {
|
|
56
57
|
* @param {string} name
|
57
58
|
* @param {function} callback
|
58
59
|
* @param {object} context
|
59
|
-
* @
|
60
|
+
* @return {Transformer}
|
60
61
|
* @throws {TypeError} value is not a string
|
61
62
|
* @throws {TypeError} value is not a function
|
62
63
|
*/
|
@@ -72,7 +73,7 @@ class Pipe extends Base {
|
|
72
73
|
* run a pipe
|
73
74
|
*
|
74
75
|
* @param {*} value
|
75
|
-
* @
|
76
|
+
* @return {*}
|
76
77
|
*/
|
77
78
|
run(value) {
|
78
79
|
return this.pipe.reduce((accumulator, transformer, currentIndex, array) => {
|
@@ -35,21 +35,21 @@ import { Pathfinder } from "./pathfinder.mjs";
|
|
35
35
|
export { Transformer };
|
36
36
|
|
37
37
|
/**
|
38
|
-
* The transformer class is a swiss army knife for manipulating values.
|
38
|
+
* The transformer class is a swiss army knife for manipulating values.
|
39
39
|
*
|
40
40
|
* A simple example is the conversion of all characters to lowercase. for this purpose the command `tolower` must be used.
|
41
41
|
*
|
42
|
-
* ```
|
42
|
+
* ```js
|
43
43
|
* let t = new Transformer('tolower').run('ABC'); // ↦ abc
|
44
44
|
* ```
|
45
45
|
*
|
46
|
-
* @
|
46
|
+
* @fragments /fragments/libraries/transformer
|
47
|
+
*
|
48
|
+
* @example /examples/libraries/transformer/simple
|
47
49
|
*
|
48
|
-
* @externalExample ../../example/data/transformer.mjs
|
49
|
-
* @license AGPLv3
|
50
50
|
* @since 1.5.0
|
51
51
|
* @copyright schukai GmbH
|
52
|
-
* @
|
52
|
+
* @summary The transformer class is a swiss army knife for manipulating values. especially in combination with the pipe, processing chains can be built up.
|
53
53
|
*/
|
54
54
|
class Transformer extends Base {
|
55
55
|
/**
|
@@ -68,7 +68,7 @@ class Transformer extends Base {
|
|
68
68
|
* @param {string} name
|
69
69
|
* @param {function} callback
|
70
70
|
* @param {object} context
|
71
|
-
* @
|
71
|
+
* @return {Transformer}
|
72
72
|
* @throws {TypeError} value is not a string
|
73
73
|
* @throws {TypeError} value is not a function
|
74
74
|
*/
|
@@ -91,7 +91,7 @@ class Transformer extends Base {
|
|
91
91
|
/**
|
92
92
|
*
|
93
93
|
* @param {*} value
|
94
|
-
* @
|
94
|
+
* @return {*}
|
95
95
|
* @throws {Error} unknown command
|
96
96
|
* @throws {TypeError} unsupported type
|
97
97
|
* @throws {Error} type not supported
|
@@ -104,7 +104,7 @@ class Transformer extends Base {
|
|
104
104
|
/**
|
105
105
|
*
|
106
106
|
* @param {string} command
|
107
|
-
* @
|
107
|
+
* @return {array}
|
108
108
|
* @private
|
109
109
|
*/
|
110
110
|
function disassemble(command) {
|
@@ -149,7 +149,7 @@ function disassemble(command) {
|
|
149
149
|
* tries to make a string out of value and if this succeeds to return it back
|
150
150
|
*
|
151
151
|
* @param {*} value
|
152
|
-
* @
|
152
|
+
* @return {string}
|
153
153
|
* @private
|
154
154
|
*/
|
155
155
|
function convertToString(value) {
|
@@ -164,7 +164,7 @@ function convertToString(value) {
|
|
164
164
|
/**
|
165
165
|
*
|
166
166
|
* @param {*} value
|
167
|
-
* @
|
167
|
+
* @return {*}
|
168
168
|
* @private
|
169
169
|
* @throws {Error} unknown command
|
170
170
|
* @throws {TypeError} unsupported type
|
@@ -835,6 +835,13 @@ function transform(value) {
|
|
835
835
|
}
|
836
836
|
}
|
837
837
|
|
838
|
+
/**
|
839
|
+
* converts special strings to their values
|
840
|
+
* @private
|
841
|
+
* @param input
|
842
|
+
* @param value
|
843
|
+
* @return {undefined|*|null|string}
|
844
|
+
*/
|
838
845
|
function convertSpecialStrings(input, value) {
|
839
846
|
switch (input) {
|
840
847
|
case "value":
|
@@ -850,6 +857,11 @@ function convertSpecialStrings(input, value) {
|
|
850
857
|
}
|
851
858
|
}
|
852
859
|
|
860
|
+
/**
|
861
|
+
* checks if a value is true or not
|
862
|
+
* @param value
|
863
|
+
* @return {boolean}
|
864
|
+
*/
|
853
865
|
function evaluateCondition(value) {
|
854
866
|
const lowerValue = typeof value === "string" ? value.toLowerCase() : value;
|
855
867
|
|
package/source/dom/assembler.mjs
CHANGED
@@ -53,7 +53,7 @@ class Assembler extends Base {
|
|
53
53
|
/**
|
54
54
|
*
|
55
55
|
* @param {string} prefix
|
56
|
-
* @
|
56
|
+
* @return {Assembler}
|
57
57
|
* @throws {TypeError} value is not a string
|
58
58
|
*/
|
59
59
|
setAttributePrefix(prefix) {
|
@@ -64,7 +64,7 @@ class Assembler extends Base {
|
|
64
64
|
|
65
65
|
/**
|
66
66
|
*
|
67
|
-
* @
|
67
|
+
* @return {string}
|
68
68
|
*/
|
69
69
|
getAttributePrefix() {
|
70
70
|
return this.attributePrefix;
|
@@ -65,7 +65,7 @@ function findClosestObjectLink(element) {
|
|
65
65
|
* @param element
|
66
66
|
* @param symbol
|
67
67
|
* @param object
|
68
|
-
* @
|
68
|
+
* @return {*}
|
69
69
|
*/
|
70
70
|
function addToObjectLink(element, symbol, object) {
|
71
71
|
validateInstance(element, HTMLElement);
|
@@ -89,7 +89,7 @@ function addToObjectLink(element, symbol, object) {
|
|
89
89
|
* @memberOf Monster.DOM
|
90
90
|
* @param {HTMLElement} element
|
91
91
|
* @param {Symbol} symbol
|
92
|
-
* @
|
92
|
+
* @return {*}
|
93
93
|
*/
|
94
94
|
function removeObjectLink(element, symbol) {
|
95
95
|
validateInstance(element, HTMLElement);
|
@@ -119,49 +119,6 @@ const updateCloneDataSymbol = Symbol("@schukai/monster/dom/@@updateCloneData");
|
|
119
119
|
*/
|
120
120
|
const scriptHostElementSymbol = Symbol("scriptHostElement");
|
121
121
|
|
122
|
-
/**
|
123
|
-
* HTMLElement
|
124
|
-
* @external HTMLElement
|
125
|
-
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
126
|
-
*
|
127
|
-
* @startuml customelement-sequencediagram.png
|
128
|
-
* skinparam monochrome true
|
129
|
-
* skinparam shadowing false
|
130
|
-
*
|
131
|
-
* autonumber
|
132
|
-
*
|
133
|
-
* Script -> DOM: element = document.createElement('my-element')
|
134
|
-
* DOM -> CustomElement: constructor()
|
135
|
-
* CustomElement -> CustomElement: [initMethodSymbol]()
|
136
|
-
*
|
137
|
-
* CustomElement --> DOM: Element
|
138
|
-
* DOM --> Script : element
|
139
|
-
*
|
140
|
-
*
|
141
|
-
* Script -> DOM: document.querySelector('body').append(element)
|
142
|
-
*
|
143
|
-
* DOM -> CustomElement : connectedCallback()
|
144
|
-
*
|
145
|
-
* note right CustomElement: is only called at\nthe first connection
|
146
|
-
* CustomElement -> CustomElement : [assembleMethodSymbol]()
|
147
|
-
*
|
148
|
-
* ... ...
|
149
|
-
*
|
150
|
-
* autonumber
|
151
|
-
*
|
152
|
-
* Script -> DOM: document.querySelector('monster-confirm-button').parentNode.removeChild(element)
|
153
|
-
* DOM -> CustomElement: disconnectedCallback()
|
154
|
-
*
|
155
|
-
*
|
156
|
-
* @enduml
|
157
|
-
*
|
158
|
-
* @startuml customelement-class.png
|
159
|
-
* skinparam monochrome true
|
160
|
-
* skinparam shadowing false
|
161
|
-
* HTMLElement <|-- CustomElement
|
162
|
-
* @enduml
|
163
|
-
*/
|
164
|
-
|
165
122
|
/**
|
166
123
|
* The `CustomElement` class provides a way to define a new HTML element using the power of Custom Elements.
|
167
124
|
*
|
@@ -237,12 +194,12 @@ const scriptHostElementSymbol = Symbol("scriptHostElement");
|
|
237
194
|
*/
|
238
195
|
class CustomElement extends HTMLElement {
|
239
196
|
/**
|
240
|
-
* A new object is created. First the `initOptions` method is called. Here the
|
197
|
+
* A new object is created. First, the `initOptions` method is called. Here the
|
241
198
|
* options can be defined in derived classes. Subsequently, the shadowRoot is initialized.
|
242
199
|
*
|
243
200
|
* IMPORTANT: CustomControls instances are not created via the constructor, but either via a tag in the HTML or via <code>document.createElement()</code>.
|
244
201
|
*
|
245
|
-
* @throws {Error} the
|
202
|
+
* @throws {Error} the option attribute does not contain a valid JSON definition.
|
246
203
|
*/
|
247
204
|
constructor() {
|
248
205
|
super();
|
@@ -258,7 +215,8 @@ class CustomElement extends HTMLElement {
|
|
258
215
|
|
259
216
|
/**
|
260
217
|
* This method is called by the `instanceof` operator.
|
261
|
-
*
|
218
|
+
*
|
219
|
+
* @return {symbol}
|
262
220
|
* @since 2.1.0
|
263
221
|
*/
|
264
222
|
static get [instanceSymbol]() {
|
@@ -281,7 +239,7 @@ class CustomElement extends HTMLElement {
|
|
281
239
|
*
|
282
240
|
* @param attribute
|
283
241
|
* @param callback
|
284
|
-
* @
|
242
|
+
* @return {Monster.DOM.CustomElement}
|
285
243
|
*/
|
286
244
|
addAttributeObserver(attribute, callback) {
|
287
245
|
validateFunction(callback);
|
@@ -292,7 +250,7 @@ class CustomElement extends HTMLElement {
|
|
292
250
|
/**
|
293
251
|
*
|
294
252
|
* @param attribute
|
295
|
-
* @
|
253
|
+
* @return {Monster.DOM.CustomElement}
|
296
254
|
*/
|
297
255
|
removeAttributeObserver(attribute) {
|
298
256
|
delete this[attributeObserverSymbol][attribute];
|
@@ -354,7 +312,7 @@ class CustomElement extends HTMLElement {
|
|
354
312
|
*
|
355
313
|
* Before you can use this method, you must have loaded the translations.
|
356
314
|
*
|
357
|
-
* @
|
315
|
+
* @return {Monster.DOM.CustomElement}
|
358
316
|
* @throws {Error} Cannot find an element with translations. Add a translation object to the document.
|
359
317
|
*/
|
360
318
|
updateI18n() {
|
@@ -433,10 +391,12 @@ class CustomElement extends HTMLElement {
|
|
433
391
|
* Example usage:
|
434
392
|
*
|
435
393
|
* ```js
|
436
|
-
*
|
437
|
-
*
|
438
|
-
*
|
439
|
-
*
|
394
|
+
* class MyElement extends CustomElement {
|
395
|
+
* static getCSSStyleSheet() {
|
396
|
+
* const sheet = new CSSStyleSheet();
|
397
|
+
* sheet.replaceSync("p { color: red; }");
|
398
|
+
* return sheet;
|
399
|
+
* }
|
440
400
|
* }
|
441
401
|
* ```
|
442
402
|
*
|
@@ -462,7 +422,7 @@ class CustomElement extends HTMLElement {
|
|
462
422
|
* attach a new observer
|
463
423
|
*
|
464
424
|
* @param {Observer} observer
|
465
|
-
* @
|
425
|
+
* @return {CustomElement}
|
466
426
|
*/
|
467
427
|
attachObserver(observer) {
|
468
428
|
this[internalSymbol].attachObserver(observer);
|
@@ -473,7 +433,7 @@ class CustomElement extends HTMLElement {
|
|
473
433
|
* detach a observer
|
474
434
|
*
|
475
435
|
* @param {Observer} observer
|
476
|
-
* @
|
436
|
+
* @return {CustomElement}
|
477
437
|
*/
|
478
438
|
detachObserver(observer) {
|
479
439
|
this[internalSymbol].detachObserver(observer);
|
@@ -482,7 +442,7 @@ class CustomElement extends HTMLElement {
|
|
482
442
|
|
483
443
|
/**
|
484
444
|
* @param {Observer} observer
|
485
|
-
* @
|
445
|
+
* @return {ProxyObserver}
|
486
446
|
*/
|
487
447
|
containsObserver(observer) {
|
488
448
|
return this[internalSymbol].containsObserver(observer);
|
@@ -556,13 +516,18 @@ class CustomElement extends HTMLElement {
|
|
556
516
|
* This method is called once when the object is equipped with update for the dynamic change of the dom.
|
557
517
|
* The functions returned here can be used as pipe functions in the template.
|
558
518
|
*
|
559
|
-
* In the example, the function `my-transformer` is defined. In the template you can use it as follows:
|
519
|
+
* In the example, the function `my-transformer` is defined. In the template, you can use it as follows:
|
560
520
|
*
|
561
521
|
* ```html
|
562
|
-
* <my-element
|
522
|
+
* <my-element
|
523
|
+
* data-monster-option-transformer="path:my-value | call:my-transformer">
|
524
|
+
* </my-element>
|
563
525
|
* ```
|
564
526
|
*
|
565
|
-
*
|
527
|
+
* The function `my-transformer` is called with the value of `my-value` as a parameter.
|
528
|
+
*
|
529
|
+
* ```js
|
530
|
+
* class MyElement extends CustomElement {
|
566
531
|
* [updaterTransformerMethodsSymbol]() {
|
567
532
|
* return {
|
568
533
|
* "my-transformer": (value) => {
|
@@ -577,6 +542,8 @@ class CustomElement extends HTMLElement {
|
|
577
542
|
* }
|
578
543
|
* };
|
579
544
|
* };
|
545
|
+
* }
|
546
|
+
* ```
|
580
547
|
*
|
581
548
|
* @return {object}
|
582
549
|
* @since 2.43.0
|
@@ -587,11 +554,13 @@ class CustomElement extends HTMLElement {
|
|
587
554
|
|
588
555
|
/**
|
589
556
|
* This method is called once when the object is included in the DOM for the first time. It performs the following actions:
|
590
|
-
*
|
591
|
-
*
|
592
|
-
*
|
593
|
-
*
|
594
|
-
*
|
557
|
+
*
|
558
|
+
* <ol>
|
559
|
+
* <li>Extracts the options from the attributes and the script tag of the element and sets them.</li>
|
560
|
+
* <li>Initializes the shadow root and its CSS stylesheet (if specified).</li>
|
561
|
+
* <li>Initializes the HTML content of the element.</li>
|
562
|
+
* <li>Initializes the custom elements inside the shadow root and the slotted elements.</li>
|
563
|
+
* <li>Attaches a mutation observer to observe changes to the attributes of the element.</li>
|
595
564
|
*
|
596
565
|
* @return {CustomElement} - The updated custom element.
|
597
566
|
* @since 1.8.0
|
@@ -672,7 +641,7 @@ class CustomElement extends HTMLElement {
|
|
672
641
|
* You know what you are doing? This function is only for advanced users.
|
673
642
|
* The result is a clone of the internal data.
|
674
643
|
*
|
675
|
-
* @
|
644
|
+
* @return {*}
|
676
645
|
*/
|
677
646
|
getInternalUpdateCloneData() {
|
678
647
|
return clone(this[updateCloneDataSymbol]);
|
@@ -764,7 +733,7 @@ class CustomElement extends HTMLElement {
|
|
764
733
|
*
|
765
734
|
* @param {string} name
|
766
735
|
* @param {*} args
|
767
|
-
* @
|
736
|
+
* @return {*}
|
768
737
|
*/
|
769
738
|
callCallback(name, args) {
|
770
739
|
return callControlCallback.call(this, name, ...args);
|
@@ -1066,7 +1035,7 @@ function getOptionsFromAttributes() {
|
|
1066
1035
|
*
|
1067
1036
|
* @private
|
1068
1037
|
* @param {string} data The JSON data to be parsed.
|
1069
|
-
* @
|
1038
|
+
* @return {Object} The parsed object.
|
1070
1039
|
* @throws {error} Throws an error if the JSON data is not valid.
|
1071
1040
|
*/
|
1072
1041
|
function parseOptionsJSON(data) {
|
package/source/dom/dimension.mjs
CHANGED
@@ -21,7 +21,7 @@ export { convertToPixels, getDeviceDPI };
|
|
21
21
|
* Stores the DPI of the device.
|
22
22
|
*
|
23
23
|
* @private
|
24
|
-
* @
|
24
|
+
* @return {number}
|
25
25
|
* @since 3.34.0
|
26
26
|
* @type {number|function}
|
27
27
|
*/
|
@@ -40,7 +40,7 @@ let CURRENT_DEVICE_DPI = function () {
|
|
40
40
|
*
|
41
41
|
* @since 3.34.0
|
42
42
|
* @memberOf Monster.DOM
|
43
|
-
* @
|
43
|
+
* @return {number}
|
44
44
|
*/
|
45
45
|
function getDeviceDPI() {
|
46
46
|
// only call the function once
|
@@ -72,7 +72,7 @@ function getDeviceDPI() {
|
|
72
72
|
* @param {string} value
|
73
73
|
* @param {HTMLElement} [parentElement=document.documentElement]
|
74
74
|
* @param {HTMLElement} [fontSizeElement=document.documentElement]
|
75
|
-
* @
|
75
|
+
* @return {number}
|
76
76
|
* @license AGPLv3
|
77
77
|
* @since 3.34.0
|
78
78
|
* @copyright schukai GmbH
|