@schukai/monster 3.80.2 → 3.80.3
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 +15 -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 +11 -10
- package/source/components/form/shadow-reload.mjs +1 -1
- package/source/components/form/state-button.mjs +1 -1
- 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
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
|
package/source/dom/locale.mjs
CHANGED
|
@@ -64,7 +64,7 @@ function getLocaleOfDocument() {
|
|
|
64
64
|
|
|
65
65
|
/**
|
|
66
66
|
* @private
|
|
67
|
-
* @
|
|
67
|
+
* @return {string|undefined|*}
|
|
68
68
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/language
|
|
69
69
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Navigator/languages
|
|
70
70
|
*/
|
package/source/dom/template.mjs
CHANGED
|
@@ -48,7 +48,7 @@ class Template extends Base {
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* This method is called by the `instanceof` operator.
|
|
51
|
-
* @
|
|
51
|
+
* @return {symbol}
|
|
52
52
|
* @since 2.1.0
|
|
53
53
|
*/
|
|
54
54
|
static get [instanceSymbol]() {
|
|
@@ -57,7 +57,7 @@ class Template extends Base {
|
|
|
57
57
|
|
|
58
58
|
/**
|
|
59
59
|
*
|
|
60
|
-
* @
|
|
60
|
+
* @return {HTMLTemplateElement}
|
|
61
61
|
*/
|
|
62
62
|
getTemplateElement() {
|
|
63
63
|
return this.template;
|
package/source/dom/theme.mjs
CHANGED
|
@@ -43,7 +43,7 @@ class Theme extends Base {
|
|
|
43
43
|
|
|
44
44
|
/**
|
|
45
45
|
* This method is called by the `instanceof` operator.
|
|
46
|
-
* @
|
|
46
|
+
* @return {symbol}
|
|
47
47
|
* @since 2.1.0
|
|
48
48
|
*/
|
|
49
49
|
static get [instanceSymbol]() {
|
|
@@ -52,7 +52,7 @@ class Theme extends Base {
|
|
|
52
52
|
|
|
53
53
|
/**
|
|
54
54
|
*
|
|
55
|
-
* @
|
|
55
|
+
* @return {string}
|
|
56
56
|
*/
|
|
57
57
|
getName() {
|
|
58
58
|
return this.name;
|
package/source/dom/updater.mjs
CHANGED
|
@@ -54,11 +54,11 @@ export { Updater, addObjectWithUpdaterToElement };
|
|
|
54
54
|
* to other values as well, you have to insert the attribute `data-monster-select-this`. This should be
|
|
55
55
|
* done with care, as it can reduce performance.
|
|
56
56
|
*
|
|
57
|
-
* @
|
|
57
|
+
* @example /examples/libraries/dom/updater/simple/ Simple example
|
|
58
|
+
*
|
|
58
59
|
* @license AGPLv3
|
|
59
60
|
* @since 1.8.0
|
|
60
61
|
* @copyright schukai GmbH
|
|
61
|
-
* @memberOf Monster.DOM
|
|
62
62
|
* @throws {Error} the value is not iterable
|
|
63
63
|
* @throws {Error} pipes are not allowed when cloning a node.
|
|
64
64
|
* @throws {Error} no template was found with the specified key.
|
|
@@ -149,7 +149,7 @@ class Updater extends Base {
|
|
|
149
149
|
/**
|
|
150
150
|
* With this method, the eventlisteners are hooked in and the magic begins.
|
|
151
151
|
*
|
|
152
|
-
* ```
|
|
152
|
+
* ```js
|
|
153
153
|
* updater.run().then(() => {
|
|
154
154
|
* updater.enableEventProcessing();
|
|
155
155
|
* });
|
|
@@ -198,7 +198,7 @@ class Updater extends Base {
|
|
|
198
198
|
* The run method must be called for the update to start working.
|
|
199
199
|
* The method ensures that changes are detected.
|
|
200
200
|
*
|
|
201
|
-
* ```
|
|
201
|
+
* ```js
|
|
202
202
|
* updater.run().then(() => {
|
|
203
203
|
* updater.enableEventProcessing();
|
|
204
204
|
* });
|
|
@@ -244,7 +244,7 @@ class Updater extends Base {
|
|
|
244
244
|
*
|
|
245
245
|
* @param {string} name
|
|
246
246
|
* @param {function} callback
|
|
247
|
-
* @
|
|
247
|
+
* @return {Transformer}
|
|
248
248
|
* @throws {TypeError} value is not a string
|
|
249
249
|
* @throws {TypeError} value is not a function
|
|
250
250
|
*/
|
|
@@ -317,7 +317,6 @@ function getControlEventHandler() {
|
|
|
317
317
|
* @throws {Error} the bind argument must start as a value with a path
|
|
318
318
|
* @param {HTMLElement} element
|
|
319
319
|
* @return void
|
|
320
|
-
* @memberOf Monster.DOM
|
|
321
320
|
* @private
|
|
322
321
|
*/
|
|
323
322
|
function retrieveAndSetValue(element) {
|
|
@@ -54,7 +54,7 @@ export { initOptionsFromAttributes };
|
|
|
54
54
|
* @param {Object} options - The options object to be initialized.
|
|
55
55
|
* @param {Object} mapping - A mapping between the attribute value and the property value.
|
|
56
56
|
* @param {string} prefix - The prefix of the attributes to be considered.
|
|
57
|
-
* @
|
|
57
|
+
* @return {Object} - The initialized options object.
|
|
58
58
|
* @this HTMLElement - The context of the DOM element.
|
|
59
59
|
*/
|
|
60
60
|
function initOptionsFromAttributes(
|
|
@@ -46,7 +46,7 @@ export { setOptionFromAttribute };
|
|
|
46
46
|
* @param {Object} options - The options object to be initialized.
|
|
47
47
|
* @param {Object} mapping - A mapping between the attribute value and the property value.
|
|
48
48
|
* @param {string} prefix - The prefix of the attributes to be considered.
|
|
49
|
-
* @
|
|
49
|
+
* @return {Object} - The initialized options object.
|
|
50
50
|
* @this HTMLElement - The context of the DOM element.
|
|
51
51
|
*/
|
|
52
52
|
function setOptionFromAttribute(
|
package/source/dom/util.mjs
CHANGED
|
@@ -55,7 +55,7 @@ export {
|
|
|
55
55
|
* }
|
|
56
56
|
* ```
|
|
57
57
|
*
|
|
58
|
-
* @
|
|
58
|
+
* @return {object}
|
|
59
59
|
* @license AGPLv3
|
|
60
60
|
* @since 1.6.0
|
|
61
61
|
* @copyright schukai GmbH
|
|
@@ -103,7 +103,7 @@ function getDocument() {
|
|
|
103
103
|
* }
|
|
104
104
|
* ```
|
|
105
105
|
*
|
|
106
|
-
* @
|
|
106
|
+
* @return {object}
|
|
107
107
|
* @license AGPLv3
|
|
108
108
|
* @since 1.6.0
|
|
109
109
|
* @copyright schukai GmbH
|
|
@@ -149,7 +149,7 @@ function getWindow() {
|
|
|
149
149
|
* }
|
|
150
150
|
* ```
|
|
151
151
|
*
|
|
152
|
-
* @
|
|
152
|
+
* @return {DocumentFragment}
|
|
153
153
|
* @license AGPLv3
|
|
154
154
|
* @since 1.6.0
|
|
155
155
|
* @copyright schukai GmbH
|
|
@@ -173,7 +173,7 @@ function getDocumentFragmentFromString(html) {
|
|
|
173
173
|
*
|
|
174
174
|
* @param {HTMLElement|ShadowRoot} element - The starting element or shadow root to search from.
|
|
175
175
|
* @param {string} targetId - The ID of the target element to find.
|
|
176
|
-
* @
|
|
176
|
+
* @return {HTMLElement|null} - The ancestor element with the specified ID, or null if not found.
|
|
177
177
|
* @memberOf Monster.DOM
|
|
178
178
|
* @since 3.29.0
|
|
179
179
|
* @license AGPLv3
|
|
@@ -222,7 +222,7 @@ function findElementWithIdUpwards(element, targetId) {
|
|
|
222
222
|
*
|
|
223
223
|
* @param {HTMLElement|ShadowRoot} element - The starting element or shadow root to search from.
|
|
224
224
|
* @param {string} selector - The selector of the target element to find.
|
|
225
|
-
* @
|
|
225
|
+
* @return {HTMLElement|null} - The ancestor element with the specified selector, or null if not found.
|
|
226
226
|
* @memberOf Monster.DOM
|
|
227
227
|
* @since 3.55.0
|
|
228
228
|
*/
|
|
@@ -259,7 +259,7 @@ function findElementWithSelectorUpwards(element, selector) {
|
|
|
259
259
|
/**
|
|
260
260
|
* @private
|
|
261
261
|
* @param {HTMLElement} element
|
|
262
|
-
* @
|
|
262
|
+
* @return {HTMLElement|null}
|
|
263
263
|
*/
|
|
264
264
|
function traverseShadowRoots(element) {
|
|
265
265
|
let currentRoot = element.shadowRoot;
|
|
@@ -296,7 +296,7 @@ function traverseShadowRoots(element) {
|
|
|
296
296
|
* Recursively searches upwards from a given element to find an ancestor element
|
|
297
297
|
*
|
|
298
298
|
* @param {HTMLElement} element
|
|
299
|
-
* @
|
|
299
|
+
* @return {*}
|
|
300
300
|
* @throws {Error} Invalid argument. Expected an HTMLElement.
|
|
301
301
|
* @memberOf Monster.DOM
|
|
302
302
|
* @since 3.36.0
|
|
@@ -318,10 +318,10 @@ function getContainingDocument(element) {
|
|
|
318
318
|
/**
|
|
319
319
|
* Returns a list of all registered custom elements in the current document.
|
|
320
320
|
*
|
|
321
|
-
* @
|
|
321
|
+
* @return {string[]}
|
|
322
322
|
* @since 4.0.0
|
|
323
323
|
* @memberOf Monster.DOM
|
|
324
|
-
* @
|
|
324
|
+
* @return {string[]}
|
|
325
325
|
*/
|
|
326
326
|
function getRegisteredCustomElements() {
|
|
327
327
|
const customElementTags = Array.from(document.querySelectorAll("*"))
|