@schukai/monster 3.80.1 → 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 +26 -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/style/space.pcss +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 -2
- 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 -26
- package/source/dom/customelement.mjs +36 -75
- 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 -3
- package/source/i18n/locale.mjs +2 -4
- package/source/i18n/provider.mjs +1 -3
- package/source/i18n/providers/embed.mjs +1 -3
- package/source/i18n/translations.mjs +2 -3
- package/source/logging/handler/console.mjs +1 -2
- package/source/logging/handler.mjs +11 -12
- package/source/logging/logentry.mjs +2 -2
- package/source/logging/logger.mjs +13 -22
- package/source/math/random.mjs +2 -2
- package/source/monster.mjs +1 -0
- package/source/net/webconnect/message.mjs +3 -4
- 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 -5
- 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/noderecursiveiterator.mjs +1 -5
- package/source/types/observablequeue.mjs +7 -11
- package/source/types/observer.mjs +6 -9
- package/source/types/observerlist.mjs +0 -2
- package/source/types/proxyobserver.mjs +8 -8
- package/source/types/queue.mjs +3 -4
- 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/callback.mjs +56 -0
- package/source/util/processing.mjs +4 -42
- package/source/util/runtime.mjs +1 -1
|
@@ -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);
|
|
@@ -32,8 +32,6 @@ const attachedInternalSymbol = Symbol("attachedInternal");
|
|
|
32
32
|
* After defining a `CustomElement`, the `registerCustomElement` method must be called with the new class name. Only then
|
|
33
33
|
* will the tag defined via the `getTag` method be made known to the DOM.
|
|
34
34
|
*
|
|
35
|
-
* <img src="./images/custom-control.png">
|
|
36
|
-
*
|
|
37
35
|
* This control uses `attachInternals()` to integrate the control into a form. If the target environment does not support
|
|
38
36
|
* this method, the [polyfill](https://www.npmjs.com/package/element-internals-polyfill) can be used.
|
|
39
37
|
*
|
|
@@ -48,18 +46,9 @@ const attachedInternalSymbol = Symbol("attachedInternal");
|
|
|
48
46
|
*
|
|
49
47
|
* Read the HTML specification for Custom Element Reactions: {@link https://html.spec.whatwg.org/dev/custom-elements.html#custom-element-reactions|Custom Element Reactions}.
|
|
50
48
|
*
|
|
51
|
-
* @startuml custom-control.png
|
|
52
|
-
* skinparam monochrome true
|
|
53
|
-
* skinparam shadowing false
|
|
54
|
-
* HTMLElement <|-- CustomElement
|
|
55
|
-
* CustomElement <|-- CustomControl
|
|
56
|
-
* @enduml
|
|
57
49
|
* @summary A base class for custom controls based on CustomElement.
|
|
58
|
-
* @copyright schukai GmbH
|
|
59
50
|
* @license AGPLv3
|
|
60
51
|
* @since 1.14.0
|
|
61
|
-
* @memberOf Monster.DOM
|
|
62
|
-
* @extends Monster.DOM.CustomElement
|
|
63
52
|
*/
|
|
64
53
|
class CustomControl extends CustomElement {
|
|
65
54
|
/**
|
|
@@ -74,7 +63,6 @@ class CustomControl extends CustomElement {
|
|
|
74
63
|
*
|
|
75
64
|
* @inheritdoc
|
|
76
65
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
|
77
|
-
* @since 1.7.0
|
|
78
66
|
*/
|
|
79
67
|
constructor() {
|
|
80
68
|
super();
|
|
@@ -95,7 +83,7 @@ class CustomControl extends CustomElement {
|
|
|
95
83
|
|
|
96
84
|
/**
|
|
97
85
|
* This method is called by the `instanceof` operator.
|
|
98
|
-
* @
|
|
86
|
+
* @return {symbol}
|
|
99
87
|
* @since 2.1.0
|
|
100
88
|
*/
|
|
101
89
|
static get [instanceSymbol]() {
|
|
@@ -117,14 +105,12 @@ class CustomControl extends CustomElement {
|
|
|
117
105
|
*
|
|
118
106
|
* @see [attachInternals()]{@link https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals}
|
|
119
107
|
* @see [Custom Elements Face Example]{@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example}
|
|
120
|
-
* @since 1.14.0
|
|
121
108
|
* @return {boolean}
|
|
122
109
|
*/
|
|
123
110
|
static formAssociated = true;
|
|
124
111
|
|
|
125
112
|
/**
|
|
126
113
|
* @inheritdoc
|
|
127
|
-
* @since 1.14.0
|
|
128
114
|
**/
|
|
129
115
|
get defaults() {
|
|
130
116
|
return extend({}, super.defaults);
|
|
@@ -135,7 +121,6 @@ class CustomControl extends CustomElement {
|
|
|
135
121
|
*
|
|
136
122
|
* This is a method of [internal API](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals), which is a part of the web standard for custom elements.
|
|
137
123
|
*
|
|
138
|
-
* @since 1.14.0
|
|
139
124
|
* @throws {Error} the value getter must be overwritten by the derived class
|
|
140
125
|
*/
|
|
141
126
|
get value() {
|
|
@@ -148,7 +133,6 @@ class CustomControl extends CustomElement {
|
|
|
148
133
|
* This is a method of [internal API](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals), which is a part of the web standard for custom elements.
|
|
149
134
|
*
|
|
150
135
|
* @param {*} value The value to set.
|
|
151
|
-
* @since 1.14.0
|
|
152
136
|
* @throws {Error} the value setter must be overwritten by the derived class
|
|
153
137
|
*/
|
|
154
138
|
set value(value) {
|
|
@@ -159,7 +143,6 @@ class CustomControl extends CustomElement {
|
|
|
159
143
|
* This is a method of [internal api](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
|
|
160
144
|
*
|
|
161
145
|
* @return {NodeList}
|
|
162
|
-
* @since 1.14.0
|
|
163
146
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/labels}
|
|
164
147
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
|
165
148
|
*/
|
|
@@ -201,7 +184,6 @@ class CustomControl extends CustomElement {
|
|
|
201
184
|
* This is a method of [internal api](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
|
|
202
185
|
*
|
|
203
186
|
* @return {string}
|
|
204
|
-
* @since 1.14.0
|
|
205
187
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/validationMessage
|
|
206
188
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
|
207
189
|
*/
|
|
@@ -213,7 +195,6 @@ class CustomControl extends CustomElement {
|
|
|
213
195
|
* This is a method of [internal api](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
|
|
214
196
|
*
|
|
215
197
|
* @return {boolean}
|
|
216
|
-
* @since 1.14.0
|
|
217
198
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/willValidate
|
|
218
199
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
|
219
200
|
*/
|
|
@@ -225,7 +206,6 @@ class CustomControl extends CustomElement {
|
|
|
225
206
|
* This is a method of [internal api](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
|
|
226
207
|
*
|
|
227
208
|
* @return {boolean}
|
|
228
|
-
* @since 1.14.0
|
|
229
209
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/states
|
|
230
210
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
|
231
211
|
*/
|
|
@@ -237,7 +217,6 @@ class CustomControl extends CustomElement {
|
|
|
237
217
|
* This is a method of [internal api](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
|
|
238
218
|
*
|
|
239
219
|
* @return {HTMLFontElement|null}
|
|
240
|
-
* @since 1.14.0
|
|
241
220
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/form
|
|
242
221
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
|
243
222
|
*/
|
|
@@ -259,7 +238,6 @@ class CustomControl extends CustomElement {
|
|
|
259
238
|
*
|
|
260
239
|
* @param {File|string|FormData} value
|
|
261
240
|
* @param {File|string|FormData} state
|
|
262
|
-
* @since 1.14.0
|
|
263
241
|
* @return {undefined}
|
|
264
242
|
* @throws {DOMException} NotSupportedError
|
|
265
243
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
|
@@ -275,7 +253,6 @@ class CustomControl extends CustomElement {
|
|
|
275
253
|
* @param {string|undefined} message
|
|
276
254
|
* @param {HTMLElement} anchor
|
|
277
255
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/setValidity
|
|
278
|
-
* @since 1.14.0
|
|
279
256
|
* @return {undefined}
|
|
280
257
|
* @throws {DOMException} NotSupportedError
|
|
281
258
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
|
@@ -288,7 +265,6 @@ class CustomControl extends CustomElement {
|
|
|
288
265
|
* This is a method of [internal api](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
|
|
289
266
|
*
|
|
290
267
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/checkValidity
|
|
291
|
-
* @since 1.14.0
|
|
292
268
|
* @return {boolean}
|
|
293
269
|
* @throws {DOMException} NotSupportedError
|
|
294
270
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
|
@@ -301,7 +277,6 @@ class CustomControl extends CustomElement {
|
|
|
301
277
|
* This is a method of [internal api](https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals)
|
|
302
278
|
*
|
|
303
279
|
* @return {boolean}
|
|
304
|
-
* @since 1.14.0
|
|
305
280
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/ElementInternals/reportValidity
|
|
306
281
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
|
307
282
|
* @throws {DOMException} NotSupportedError
|
|
@@ -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
|
*
|
|
@@ -170,10 +127,6 @@ const scriptHostElementSymbol = Symbol("scriptHostElement");
|
|
|
170
127
|
*
|
|
171
128
|
* You can create an instance of the object via the `document.createElement()` function.
|
|
172
129
|
*
|
|
173
|
-
* ## Interaction
|
|
174
|
-
*
|
|
175
|
-
* <img src="./images/customelement-sequencediagram.png">
|
|
176
|
-
*
|
|
177
130
|
* ## Styling
|
|
178
131
|
*
|
|
179
132
|
* To display custom elements optimally, the `:defined` pseudo-class can be used. To prevent custom elements from being displayed and flickering until the control is registered,
|
|
@@ -234,23 +187,19 @@ const scriptHostElementSymbol = Symbol("scriptHostElement");
|
|
|
234
187
|
* More information about Custom Elements can be found in the [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_custom_elements).
|
|
235
188
|
* And in the [HTML Standard](https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements) or in the [WHATWG Wiki](https://wiki.whatwg.org/wiki/Custom_Elements).
|
|
236
189
|
*
|
|
237
|
-
* @externalExample ../../example/dom/theme.mjs
|
|
238
190
|
* @license AGPLv3
|
|
239
191
|
* @since 1.7.0
|
|
240
192
|
* @copyright schukai GmbH
|
|
241
|
-
* @memberOf Monster.DOM
|
|
242
|
-
* @extends external:HTMLElement
|
|
243
193
|
* @summary A base class for HTML5 custom controls.
|
|
244
194
|
*/
|
|
245
195
|
class CustomElement extends HTMLElement {
|
|
246
196
|
/**
|
|
247
|
-
* 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
|
|
248
198
|
* options can be defined in derived classes. Subsequently, the shadowRoot is initialized.
|
|
249
199
|
*
|
|
250
200
|
* IMPORTANT: CustomControls instances are not created via the constructor, but either via a tag in the HTML or via <code>document.createElement()</code>.
|
|
251
201
|
*
|
|
252
|
-
* @throws {Error} the
|
|
253
|
-
* @since 1.7.0
|
|
202
|
+
* @throws {Error} the option attribute does not contain a valid JSON definition.
|
|
254
203
|
*/
|
|
255
204
|
constructor() {
|
|
256
205
|
super();
|
|
@@ -266,7 +215,8 @@ class CustomElement extends HTMLElement {
|
|
|
266
215
|
|
|
267
216
|
/**
|
|
268
217
|
* This method is called by the `instanceof` operator.
|
|
269
|
-
*
|
|
218
|
+
*
|
|
219
|
+
* @return {symbol}
|
|
270
220
|
* @since 2.1.0
|
|
271
221
|
*/
|
|
272
222
|
static get [instanceSymbol]() {
|
|
@@ -289,7 +239,7 @@ class CustomElement extends HTMLElement {
|
|
|
289
239
|
*
|
|
290
240
|
* @param attribute
|
|
291
241
|
* @param callback
|
|
292
|
-
* @
|
|
242
|
+
* @return {Monster.DOM.CustomElement}
|
|
293
243
|
*/
|
|
294
244
|
addAttributeObserver(attribute, callback) {
|
|
295
245
|
validateFunction(callback);
|
|
@@ -300,7 +250,7 @@ class CustomElement extends HTMLElement {
|
|
|
300
250
|
/**
|
|
301
251
|
*
|
|
302
252
|
* @param attribute
|
|
303
|
-
* @
|
|
253
|
+
* @return {Monster.DOM.CustomElement}
|
|
304
254
|
*/
|
|
305
255
|
removeAttributeObserver(attribute) {
|
|
306
256
|
delete this[attributeObserverSymbol][attribute];
|
|
@@ -362,7 +312,7 @@ class CustomElement extends HTMLElement {
|
|
|
362
312
|
*
|
|
363
313
|
* Before you can use this method, you must have loaded the translations.
|
|
364
314
|
*
|
|
365
|
-
* @
|
|
315
|
+
* @return {Monster.DOM.CustomElement}
|
|
366
316
|
* @throws {Error} Cannot find an element with translations. Add a translation object to the document.
|
|
367
317
|
*/
|
|
368
318
|
updateI18n() {
|
|
@@ -441,10 +391,12 @@ class CustomElement extends HTMLElement {
|
|
|
441
391
|
* Example usage:
|
|
442
392
|
*
|
|
443
393
|
* ```js
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
*
|
|
394
|
+
* class MyElement extends CustomElement {
|
|
395
|
+
* static getCSSStyleSheet() {
|
|
396
|
+
* const sheet = new CSSStyleSheet();
|
|
397
|
+
* sheet.replaceSync("p { color: red; }");
|
|
398
|
+
* return sheet;
|
|
399
|
+
* }
|
|
448
400
|
* }
|
|
449
401
|
* ```
|
|
450
402
|
*
|
|
@@ -470,7 +422,7 @@ class CustomElement extends HTMLElement {
|
|
|
470
422
|
* attach a new observer
|
|
471
423
|
*
|
|
472
424
|
* @param {Observer} observer
|
|
473
|
-
* @
|
|
425
|
+
* @return {CustomElement}
|
|
474
426
|
*/
|
|
475
427
|
attachObserver(observer) {
|
|
476
428
|
this[internalSymbol].attachObserver(observer);
|
|
@@ -481,7 +433,7 @@ class CustomElement extends HTMLElement {
|
|
|
481
433
|
* detach a observer
|
|
482
434
|
*
|
|
483
435
|
* @param {Observer} observer
|
|
484
|
-
* @
|
|
436
|
+
* @return {CustomElement}
|
|
485
437
|
*/
|
|
486
438
|
detachObserver(observer) {
|
|
487
439
|
this[internalSymbol].detachObserver(observer);
|
|
@@ -490,7 +442,7 @@ class CustomElement extends HTMLElement {
|
|
|
490
442
|
|
|
491
443
|
/**
|
|
492
444
|
* @param {Observer} observer
|
|
493
|
-
* @
|
|
445
|
+
* @return {ProxyObserver}
|
|
494
446
|
*/
|
|
495
447
|
containsObserver(observer) {
|
|
496
448
|
return this[internalSymbol].containsObserver(observer);
|
|
@@ -564,13 +516,18 @@ class CustomElement extends HTMLElement {
|
|
|
564
516
|
* This method is called once when the object is equipped with update for the dynamic change of the dom.
|
|
565
517
|
* The functions returned here can be used as pipe functions in the template.
|
|
566
518
|
*
|
|
567
|
-
* 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:
|
|
568
520
|
*
|
|
569
521
|
* ```html
|
|
570
|
-
* <my-element
|
|
522
|
+
* <my-element
|
|
523
|
+
* data-monster-option-transformer="path:my-value | call:my-transformer">
|
|
524
|
+
* </my-element>
|
|
571
525
|
* ```
|
|
572
526
|
*
|
|
573
|
-
*
|
|
527
|
+
* The function `my-transformer` is called with the value of `my-value` as a parameter.
|
|
528
|
+
*
|
|
529
|
+
* ```js
|
|
530
|
+
* class MyElement extends CustomElement {
|
|
574
531
|
* [updaterTransformerMethodsSymbol]() {
|
|
575
532
|
* return {
|
|
576
533
|
* "my-transformer": (value) => {
|
|
@@ -585,6 +542,8 @@ class CustomElement extends HTMLElement {
|
|
|
585
542
|
* }
|
|
586
543
|
* };
|
|
587
544
|
* };
|
|
545
|
+
* }
|
|
546
|
+
* ```
|
|
588
547
|
*
|
|
589
548
|
* @return {object}
|
|
590
549
|
* @since 2.43.0
|
|
@@ -595,11 +554,13 @@ class CustomElement extends HTMLElement {
|
|
|
595
554
|
|
|
596
555
|
/**
|
|
597
556
|
* This method is called once when the object is included in the DOM for the first time. It performs the following actions:
|
|
598
|
-
*
|
|
599
|
-
*
|
|
600
|
-
*
|
|
601
|
-
*
|
|
602
|
-
*
|
|
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>
|
|
603
564
|
*
|
|
604
565
|
* @return {CustomElement} - The updated custom element.
|
|
605
566
|
* @since 1.8.0
|
|
@@ -680,7 +641,7 @@ class CustomElement extends HTMLElement {
|
|
|
680
641
|
* You know what you are doing? This function is only for advanced users.
|
|
681
642
|
* The result is a clone of the internal data.
|
|
682
643
|
*
|
|
683
|
-
* @
|
|
644
|
+
* @return {*}
|
|
684
645
|
*/
|
|
685
646
|
getInternalUpdateCloneData() {
|
|
686
647
|
return clone(this[updateCloneDataSymbol]);
|
|
@@ -772,7 +733,7 @@ class CustomElement extends HTMLElement {
|
|
|
772
733
|
*
|
|
773
734
|
* @param {string} name
|
|
774
735
|
* @param {*} args
|
|
775
|
-
* @
|
|
736
|
+
* @return {*}
|
|
776
737
|
*/
|
|
777
738
|
callCallback(name, args) {
|
|
778
739
|
return callControlCallback.call(this, name, ...args);
|
|
@@ -1074,7 +1035,7 @@ function getOptionsFromAttributes() {
|
|
|
1074
1035
|
*
|
|
1075
1036
|
* @private
|
|
1076
1037
|
* @param {string} data The JSON data to be parsed.
|
|
1077
|
-
* @
|
|
1038
|
+
* @return {Object} The parsed object.
|
|
1078
1039
|
* @throws {error} Throws an error if the JSON data is not valid.
|
|
1079
1040
|
*/
|
|
1080
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
|
*/
|