@schukai/monster 1.12.0 → 1.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/CHANGELOG +40 -1
  2. package/README.md +5 -5
  3. package/dist/modules/constants.js +2 -0
  4. package/dist/modules/constraints/abstract.js +2 -2
  5. package/dist/modules/constraints/abstractoperator.js +2 -2
  6. package/dist/modules/constraints/andoperator.js +2 -2
  7. package/dist/modules/constraints/invalid.js +2 -2
  8. package/dist/modules/constraints/isarray.js +2 -2
  9. package/dist/modules/constraints/isobject.js +2 -2
  10. package/dist/modules/constraints/namespace.js +1 -1
  11. package/dist/modules/constraints/oroperator.js +2 -2
  12. package/dist/modules/constraints/valid.js +2 -2
  13. package/dist/modules/data/buildmap.js +2 -2
  14. package/dist/modules/data/diff.js +2 -2
  15. package/dist/modules/data/extend.js +2 -2
  16. package/dist/modules/data/namespace.js +1 -1
  17. package/dist/modules/data/pathfinder.js +2 -2
  18. package/dist/modules/data/pipe.js +2 -2
  19. package/dist/modules/data/transformer.js +2 -2
  20. package/dist/modules/dom/assembler.js +2 -2
  21. package/dist/modules/dom/attributes.js +2 -2
  22. package/dist/modules/dom/constants.js +2 -2
  23. package/dist/modules/dom/customcontrol.js +2 -0
  24. package/dist/modules/dom/customelement.js +2 -2
  25. package/dist/modules/dom/events.js +2 -2
  26. package/dist/modules/dom/locale.js +2 -0
  27. package/dist/modules/dom/namespace.js +1 -1
  28. package/dist/modules/dom/template.js +2 -2
  29. package/dist/modules/dom/theme.js +2 -2
  30. package/dist/modules/dom/updater.js +2 -2
  31. package/dist/modules/dom/util.js +2 -2
  32. package/dist/modules/i18n/locale.js +2 -0
  33. package/dist/modules/i18n/namespace.js +2 -0
  34. package/dist/modules/i18n/provider.js +2 -0
  35. package/dist/modules/i18n/providers/fetch.js +2 -0
  36. package/dist/modules/i18n/providers/namespace.js +2 -0
  37. package/dist/modules/i18n/translations.js +2 -0
  38. package/dist/modules/logging/handler/console.js +2 -2
  39. package/dist/modules/logging/handler/namespace.js +1 -1
  40. package/dist/modules/logging/handler.js +2 -2
  41. package/dist/modules/logging/logentry.js +2 -2
  42. package/dist/modules/logging/logger.js +2 -2
  43. package/dist/modules/logging/namespace.js +1 -1
  44. package/dist/modules/math/namespace.js +1 -1
  45. package/dist/modules/math/random.js +2 -2
  46. package/dist/modules/monster.js +2 -2
  47. package/dist/modules/namespace.js +1 -1
  48. package/dist/modules/text/formatter.js +2 -2
  49. package/dist/modules/text/namespace.js +1 -1
  50. package/dist/modules/types/base.js +2 -2
  51. package/dist/modules/types/basewithoptions.js +2 -0
  52. package/dist/modules/types/global.js +2 -2
  53. package/dist/modules/types/id.js +2 -2
  54. package/dist/modules/types/is.js +2 -2
  55. package/dist/modules/types/namespace.js +1 -1
  56. package/dist/modules/types/observer.js +2 -2
  57. package/dist/modules/types/observerlist.js +2 -2
  58. package/dist/modules/types/proxyobserver.js +2 -2
  59. package/dist/modules/types/queue.js +2 -2
  60. package/dist/modules/types/randomid.js +2 -2
  61. package/dist/modules/types/stack.js +2 -2
  62. package/dist/modules/types/tokenlist.js +2 -2
  63. package/dist/modules/types/typeof.js +2 -2
  64. package/dist/modules/types/uniquequeue.js +2 -2
  65. package/dist/modules/types/validate.js +2 -2
  66. package/dist/modules/types/version.js +2 -2
  67. package/dist/modules/util/clone.js +2 -2
  68. package/dist/modules/util/comparator.js +2 -2
  69. package/dist/modules/util/freeze.js +2 -2
  70. package/dist/modules/util/namespace.js +1 -1
  71. package/dist/monster.dev.js +8692 -6669
  72. package/dist/monster.dev.js.map +1 -1
  73. package/dist/monster.js +3 -3
  74. package/package.json +1 -1
  75. package/source/constants.js +22 -0
  76. package/source/constraints/abstract.js +2 -2
  77. package/source/constraints/abstractoperator.js +3 -3
  78. package/source/constraints/andoperator.js +7 -7
  79. package/source/constraints/invalid.js +6 -6
  80. package/source/constraints/isarray.js +6 -6
  81. package/source/constraints/isobject.js +6 -6
  82. package/source/constraints/namespace.js +2 -0
  83. package/source/constraints/oroperator.js +8 -8
  84. package/source/constraints/valid.js +6 -6
  85. package/source/data/buildmap.js +15 -15
  86. package/source/data/diff.js +6 -6
  87. package/source/data/extend.js +55 -13
  88. package/source/data/namespace.js +2 -0
  89. package/source/data/pathfinder.js +6 -7
  90. package/source/data/pipe.js +5 -5
  91. package/source/data/transformer.js +6 -6
  92. package/source/dom/assembler.js +5 -5
  93. package/source/dom/attributes.js +89 -45
  94. package/source/dom/constants.js +8 -9
  95. package/source/dom/customcontrol.js +301 -0
  96. package/source/dom/customelement.js +149 -31
  97. package/source/dom/events.js +58 -8
  98. package/source/dom/locale.js +59 -0
  99. package/source/dom/namespace.js +2 -0
  100. package/source/dom/template.js +7 -7
  101. package/source/dom/theme.js +6 -6
  102. package/source/dom/updater.js +38 -11
  103. package/source/dom/util.js +10 -10
  104. package/source/i18n/locale.js +322 -0
  105. package/source/i18n/namespace.js +15 -0
  106. package/source/i18n/provider.js +58 -0
  107. package/source/i18n/providers/fetch.js +121 -0
  108. package/source/i18n/providers/namespace.js +15 -0
  109. package/source/i18n/translations.js +209 -0
  110. package/source/logging/handler/console.js +4 -4
  111. package/source/logging/handler.js +4 -4
  112. package/source/logging/logentry.js +4 -4
  113. package/source/logging/logger.js +4 -4
  114. package/source/logging/namespace.js +2 -0
  115. package/source/math/namespace.js +2 -0
  116. package/source/math/random.js +5 -5
  117. package/source/monster.js +26 -16
  118. package/source/namespace.js +10 -8
  119. package/source/text/formatter.js +4 -5
  120. package/source/text/namespace.js +1 -1
  121. package/source/types/base.js +4 -7
  122. package/source/types/basewithoptions.js +97 -0
  123. package/source/types/global.js +6 -6
  124. package/source/types/id.js +6 -6
  125. package/source/types/is.js +22 -22
  126. package/source/types/namespace.js +3 -1
  127. package/source/types/observer.js +5 -5
  128. package/source/types/observerlist.js +4 -4
  129. package/source/types/proxyobserver.js +32 -26
  130. package/source/types/queue.js +13 -7
  131. package/source/types/randomid.js +5 -5
  132. package/source/types/stack.js +11 -4
  133. package/source/types/tokenlist.js +4 -4
  134. package/source/types/typeof.js +5 -5
  135. package/source/types/uniquequeue.js +11 -4
  136. package/source/types/validate.js +22 -22
  137. package/source/types/version.js +9 -9
  138. package/source/util/clone.js +4 -4
  139. package/source/util/comparator.js +6 -6
  140. package/source/util/freeze.js +4 -4
  141. package/source/util/namespace.js +2 -0
  142. package/test/cases/data/extend.js +66 -13
  143. package/test/cases/dom/attributes.js +56 -1
  144. package/test/cases/dom/customcontrol.js +264 -0
  145. package/test/cases/dom/customelement.js +112 -51
  146. package/test/cases/dom/events.js +32 -14
  147. package/test/cases/dom/locale.js +44 -0
  148. package/test/cases/i18n/locale.js +80 -0
  149. package/test/cases/i18n/provider.js +15 -0
  150. package/test/cases/i18n/providers/fetch.js +65 -0
  151. package/test/cases/i18n/translations.js +57 -0
  152. package/test/cases/monster.js +3 -1
  153. package/test/cases/{util → text}/formatter.js +2 -0
  154. package/test/cases/types/basewithoptions.js +25 -0
  155. package/test/cases/types/proxyobserver.js +9 -0
  156. package/test/cases/{text → util}/clone.js +0 -0
  157. package/test/cases/{text → util}/comparator.js +0 -0
  158. package/test/util/jsdom.js +4 -0
  159. package/test/web/import.js +10 -3
  160. package/test/web/monster-dev.html +3 -3
  161. package/test/web/monster.html +3 -3
  162. package/test/web/test.html +3 -3
  163. package/test/web/tests.js +3 -3
@@ -3,16 +3,17 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, validateInstance, validateString} from "../types/validate.js";
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import {validateInstance, validateString} from "../types/validate.js";
8
+ import {findClosestByAttribute} from "./attributes.js";
8
9
  import {getDocument} from "./util.js";
9
10
 
10
11
  /**
11
- * You can call the method via the monster namespace `new Monster.DOM.fireEvent()`.
12
+ * You can call the function via the monster namespace `new Monster.DOM.fireEvent()`.
12
13
  *
13
14
  * ```
14
15
  * <script type="module">
15
- * import {CustomElement} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/events.js';
16
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/events.js';
16
17
  * console.log(new Monster.DOM.fireEvent())
17
18
  * </script>
18
19
  * ```
@@ -21,7 +22,7 @@ import {getDocument} from "./util.js";
21
22
  *
22
23
  * ```
23
24
  * <script type="module">
24
- * import {CustomElement} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/events.js';
25
+ * import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/events.js';
25
26
  * console.log(fireEvent())
26
27
  * </script>
27
28
  * ```
@@ -49,7 +50,7 @@ function fireEvent(element, type) {
49
50
  bubbles: true,
50
51
  cancelable: true,
51
52
  });
52
-
53
+
53
54
  element.dispatchEvent(event);
54
55
 
55
56
  } else if (element instanceof HTMLCollection || element instanceof NodeList) {
@@ -62,6 +63,55 @@ function fireEvent(element, type) {
62
63
 
63
64
  }
64
65
 
66
+ /**
67
+ * This function gets the path `Event.composedPath()` from an event and tries to find the next element
68
+ * up the tree `element.closest()` with the attribute and value. If no value is specified, only the attribute is searched.
69
+ *
70
+ * You can call the function via the monster namespace `new Monster.DOM.findTargetElementFromEvent()`.
71
+ *
72
+ * ```
73
+ * <script type="module">
74
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/events.js';
75
+ * console.log(new Monster.DOM.findTargetElementFromEvent())
76
+ * </script>
77
+ * ```
78
+ *
79
+ * Alternatively, you can also integrate this function individually.
80
+ *
81
+ * ```
82
+ * <script type="module">
83
+ * import {findTargetElementFromEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/events.js';
84
+ * console.log(findTargetElementFromEvent())
85
+ * </script>
86
+ * ```
87
+ *
88
+ * @since 1.14.0
89
+ * @param {Event} event
90
+ * @param {string} attributeName
91
+ * @param {string|null} attributeValue
92
+ * @throws {Error} unsupported event
93
+ * @memberOf Monster/DOM
94
+ * @throws {TypeError} value is not a string
95
+ * @throws {TypeError} value is not an instance of HTMLElement
96
+ */
97
+ function findTargetElementFromEvent(event, attributeName, attributeValue) {
98
+ validateInstance(event, Event);
99
+
100
+ if (typeof event.composedPath !== 'function') {
101
+ throw new Error('unsupported event');
102
+ }
103
+
104
+ const path = event.composedPath();
105
+ const element = path?.[0];
106
+
107
+ if (element instanceof HTMLElement) {
108
+ return findClosestByAttribute(element, attributeName, attributeValue);
109
+ }
110
+
111
+ return undefined;
112
+
113
+ }
114
+
65
115
 
66
- Monster.assignToNamespace('Monster.DOM', fireEvent);
67
- export {Monster, fireEvent}
116
+ assignToNamespace('Monster.DOM', findTargetElementFromEvent, fireEvent);
117
+ export {Monster, findTargetElementFromEvent, fireEvent}
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @author schukai GmbH
5
+ */
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import { parseLocale} from "../i18n/locale.js";
8
+ import {getDocument} from "./util.js";
9
+
10
+ /**
11
+ * @type {string}
12
+ */
13
+ const DEFAULT_LANGUAGE = 'en';
14
+
15
+ /**
16
+ * With this function you can read the language version set by the document.
17
+ * For this the attibute `lang` in the html tag is read. If no attribute is set, `en` is used as default.
18
+ *
19
+ * You can call the function via the monster namespace `new Monster.DOM.getLocaleOfDocument()`.
20
+ *
21
+ * ```
22
+ * <script type="module">
23
+ * import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/locale.js';
24
+ * console.log(new Monster.DOM.getLocaleOfDocument())
25
+ * </script>
26
+ * ```
27
+ *
28
+ * Alternatively, you can also integrate this function individually.
29
+ *
30
+ * ```
31
+ * <script type="module">
32
+ * import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/locale.js';
33
+ * console.log(new getLocaleOfDocument())
34
+ * </script>
35
+ * ```
36
+ *
37
+ * @since 1.13.0
38
+ * @copyright schukai GmbH
39
+ * @memberOf Monster/DOM
40
+ * @throws {TypeError} value is not a string
41
+ * @throws {Error} unsupported locale
42
+ */
43
+ function getLocaleOfDocument() {
44
+
45
+ const document = getDocument();
46
+
47
+ let html = document.querySelector('html')
48
+ if (html instanceof HTMLElement && html.hasAttribute('lang')) {
49
+ let locale = html.getAttribute('lang');
50
+ if (locale) {
51
+ return new parseLocale(locale)
52
+ }
53
+ }
54
+
55
+ return parseLocale(DEFAULT_LANGUAGE);
56
+ }
57
+
58
+ assignToNamespace('Monster.DOM', getLocaleOfDocument);
59
+ export {Monster, getLocaleOfDocument}
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
+ * In this namespace you will find classes and methods for handling the DOM.
5
+ *
4
6
  * @namespace Monster/DOM
5
7
  * @author schukai GmbH
6
8
  */
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, Base} from '../types/base.js';
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import { Base} from '../types/base.js';
8
8
  import {validateString} from "../types/validate.js";
9
9
  import {getGlobalFunction, getGlobalObject} from '../types/global.js';
10
10
  import {validateInstance} from "../types/validate.js";
@@ -15,7 +15,7 @@ import {getDocumentTheme} from "./theme.js";
15
15
  *
16
16
  * ```
17
17
  * <script type="module">
18
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/template.js';
18
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/template.js';
19
19
  * console.log(new Monster.DOM.Template())
20
20
  * </script>
21
21
  * ```
@@ -24,7 +24,7 @@ import {getDocumentTheme} from "./theme.js";
24
24
  *
25
25
  * ```
26
26
  * <script type="module">
27
- * import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/template.js';
27
+ * import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/template.js';
28
28
  * console.log(new Template())
29
29
  * </script>
30
30
  * ```
@@ -74,7 +74,7 @@ class Template extends Base {
74
74
  *
75
75
  * ```
76
76
  * <script type="module">
77
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/template.js';
77
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/template.js';
78
78
  * console.log(Monster.DOM.findDocumentTemplate())
79
79
  * </script>
80
80
  * ```
@@ -83,7 +83,7 @@ class Template extends Base {
83
83
  *
84
84
  * ```
85
85
  * <script type="module">
86
- * import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/template.js';
86
+ * import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/template.js';
87
87
  * console.log(findDocumentTemplate())
88
88
  * </script>
89
89
  * ```
@@ -127,7 +127,7 @@ function findDocumentTemplate(id, root) {
127
127
  }
128
128
 
129
129
 
130
- Monster.assignToNamespace('Monster.DOM', Template, findDocumentTemplate);
130
+ assignToNamespace('Monster.DOM', Template, findDocumentTemplate);
131
131
  export {Monster, Template, findDocumentTemplate}
132
132
 
133
133
 
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, Base} from '../types/base.js';
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import { Base} from '../types/base.js';
8
8
  import {validateString} from "../types/validate.js";
9
9
  import {getGlobalObject} from '../types/global.js';
10
10
  import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js";
@@ -16,7 +16,7 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js";
16
16
  *
17
17
  * ```
18
18
  * <script type="module">
19
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/theme.js';
19
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/theme.js';
20
20
  * console.log(new Monster.DOM.Theme())
21
21
  * </script>
22
22
  * ```
@@ -25,14 +25,14 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js";
25
25
  *
26
26
  * ```
27
27
  * <script type="module">
28
- * import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/theme.js';
28
+ * import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/theme.js';
29
29
  * console.log(new Theme())
30
30
  * </script>
31
31
  * ```
32
32
  *
33
33
  * @example
34
34
  *
35
- * import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/theme.js';
35
+ * import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/theme.js';
36
36
  *
37
37
  * const theme = getDocumentTheme();
38
38
  * console.log(theme.getName());
@@ -96,5 +96,5 @@ function getDocumentTheme() {
96
96
 
97
97
  }
98
98
 
99
- Monster.assignToNamespace('Monster.DOM', Theme, getDocumentTheme);
99
+ assignToNamespace('Monster.DOM', Theme, getDocumentTheme);
100
100
  export {Monster, Theme, getDocumentTheme}
@@ -1,9 +1,13 @@
1
1
  'use strict';
2
2
 
3
+ /**
4
+ * @author schukai GmbH
5
+ */
6
+ import {Monster, assignToNamespace} from '../namespace.js';
3
7
  import {Pathfinder} from "../data/pathfinder.js";
4
8
  import {Pipe} from "../data/pipe.js";
5
- import {Base, Monster} from "../types/base.js";
6
- import {isInstance, isArray} from "../types/is.js";
9
+ import {Base} from "../types/base.js";
10
+ import {isInstance, isArray, isIterable} from "../types/is.js";
7
11
  import {Observer} from "../types/observer.js";
8
12
  import {ProxyObserver} from "../types/proxyobserver.js";
9
13
  import {validateInstance, validateArray} from "../types/validate.js";
@@ -20,10 +24,6 @@ import {
20
24
  import {findDocumentTemplate} from "./template.js";
21
25
  import {getDocument} from "./util.js";
22
26
 
23
- /**
24
- * @author schukai GmbH
25
- */
26
-
27
27
 
28
28
  /**
29
29
  * The updater class connects an object with the dom. in this way, structures and contents in the DOM can be programmatically adapted via attributes.
@@ -34,7 +34,7 @@ import {getDocument} from "./util.js";
34
34
  *
35
35
  * ```
36
36
  * <script type="module">
37
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/updater.js';
37
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/updater.js';
38
38
  * console.log(new Monster.DOM.Updater())
39
39
  * </script>
40
40
  * ```
@@ -43,14 +43,14 @@ import {getDocument} from "./util.js";
43
43
  *
44
44
  * ```
45
45
  * <script type="module">
46
- * import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/updater.js';
46
+ * import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/updater.js';
47
47
  * console.log(new Updater())
48
48
  * </script>
49
49
  * ```
50
50
  *
51
51
  * @example
52
52
  *
53
- * import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/updater.js';
53
+ * import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/updater.js';
54
54
  *
55
55
  * // First we prepare the html document.
56
56
  * // This is done here via script, but can also be inserted into the document as pure html.
@@ -102,6 +102,7 @@ class Updater extends Base {
102
102
  this.element = validateInstance(element, HTMLElement);
103
103
 
104
104
  if (subject === undefined) subject = {}
105
+ let a = subject;
105
106
  if (!isInstance(subject, ProxyObserver)) {
106
107
  subject = new ProxyObserver(subject);
107
108
  }
@@ -114,7 +115,9 @@ class Updater extends Base {
114
115
  * @type {object}
115
116
  */
116
117
  this.subject = subject.attachObserver(new Observer(() => {
118
+
117
119
  const s = this.subject.getRealSubject();
120
+
118
121
  const diff = Diff(this.last, s)
119
122
  this.last = clone(s);
120
123
 
@@ -174,6 +177,26 @@ class Updater extends Base {
174
177
 
175
178
  }
176
179
 
180
+ // /**
181
+ // *
182
+ // * @param {string} path
183
+ // * @param {*} value
184
+ // * @param {boolean} notifyAnyway
185
+ // * @return {Updater}
186
+ // * @since 1.15.0
187
+ // */
188
+ // setVia(path, value, notifyAnyway) {
189
+ // if(isBoolean(notifyAnyway)&&notifyAnyway===true) {
190
+ // // the key __init__has no further meaning and is only
191
+ // // used to create the diff for empty objects.
192
+ // new Pathfinder(this.last).setVia(path, {'__init__': true});
193
+ //
194
+ // }
195
+ //
196
+ // new Pathfinder(this.subject.getSubject()).setVia(path, value);
197
+ // return this;
198
+ // }
199
+
177
200
  /**
178
201
  * Let the magic begin
179
202
  *
@@ -284,6 +307,7 @@ function getControlEventHandler() {
284
307
  path = path.substr(5);
285
308
 
286
309
  let value;
310
+
287
311
  if (element instanceof HTMLInputElement) {
288
312
  switch (element.type) {
289
313
 
@@ -316,6 +340,9 @@ function getControlEventHandler() {
316
340
  }
317
341
 
318
342
 
343
+ // values from customelements
344
+ } else if ((element?.constructor?.prototype && !!Object.getOwnPropertyDescriptor(element.constructor.prototype, 'value')?.['get']) || element.hasOwnProperty('value')) {
345
+ value = element?.['value'];
319
346
  } else {
320
347
  throw new Error("unsupported object");
321
348
  }
@@ -411,7 +438,7 @@ function insertElement(change) {
411
438
  insertPoint = containerElement.lastChild;
412
439
  }
413
440
 
414
- if (!isArray(value)) {
441
+ if (!isIterable(value)) {
415
442
  throw new Error('the value is not iterable');
416
443
  }
417
444
 
@@ -723,5 +750,5 @@ function handleInputControlAttributeUpdate(element, name, value) {
723
750
 
724
751
  }
725
752
 
726
- Monster.assignToNamespace('Monster.DOM', Updater);
753
+ assignToNamespace('Monster.DOM', Updater);
727
754
  export {Monster, Updater}
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, getGlobal} from "../types/global.js";
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import { getGlobal} from "../types/global.js";
8
8
  import {validateString} from "../types/validate.js";
9
9
 
10
10
 
@@ -13,7 +13,7 @@ import {validateString} from "../types/validate.js";
13
13
  *
14
14
  * ```
15
15
  * <script type="module">
16
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/util.js';
16
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/util.js';
17
17
  * console.log(Monster.DOM.getDocument())
18
18
  * </script>
19
19
  * ```
@@ -22,7 +22,7 @@ import {validateString} from "../types/validate.js";
22
22
  *
23
23
  * ```
24
24
  * <script type="module">
25
- * import {getDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/util.js';
25
+ * import {getDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/util.js';
26
26
  * console.log(getDocument())
27
27
  * </script>
28
28
  * ```
@@ -62,7 +62,7 @@ import {validateString} from "../types/validate.js";
62
62
  */
63
63
  function getDocument() {
64
64
  let document = getGlobal()?.['document'];
65
- if (typeof document !== 'object') {
65
+ if (typeof document !== 'object') {
66
66
  throw new Error("not supported environment")
67
67
  }
68
68
 
@@ -74,7 +74,7 @@ function getDocument() {
74
74
  *
75
75
  * ```
76
76
  * <script type="module">
77
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/util.js';
77
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/util.js';
78
78
  * console.log(Monster.DOM.getWindow())
79
79
  * </script>
80
80
  * ```
@@ -83,7 +83,7 @@ function getDocument() {
83
83
  *
84
84
  * ```
85
85
  * <script type="module">
86
- * import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/util.js';
86
+ * import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/util.js';
87
87
  * console.log(getWindow(null))
88
88
  * </script>
89
89
  * ```
@@ -140,7 +140,7 @@ function getWindow() {
140
140
  *
141
141
  * ```
142
142
  * <script type="module">
143
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/util.js';
143
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/util.js';
144
144
  * console.log(Monster.DOM.getDocumentFragmentFromString())
145
145
  * </script>
146
146
  * ```
@@ -149,7 +149,7 @@ function getWindow() {
149
149
  *
150
150
  * ```
151
151
  * <script type="module">
152
- * import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.12.0/dist/modules/dom/util.js';
152
+ * import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/util.js';
153
153
  * console.log(getDocumentFragmentFromString('<div></div>'))
154
154
  * </script>
155
155
  * ```
@@ -199,5 +199,5 @@ function getDocumentFragmentFromString(html) {
199
199
  }
200
200
 
201
201
 
202
- Monster.assignToNamespace('Monster.DOM', getWindow, getDocument, getDocumentFragmentFromString);
202
+ assignToNamespace('Monster.DOM', getWindow, getDocument, getDocumentFragmentFromString);
203
203
  export {Monster, getWindow, getDocument, getDocumentFragmentFromString}