@schukai/monster 1.13.0 → 1.15.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. package/CHANGELOG +46 -1
  2. package/README.md +5 -5
  3. package/dist/modules/constants.js +2 -2
  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 -2
  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 -2
  33. package/dist/modules/i18n/namespace.js +1 -1
  34. package/dist/modules/i18n/provider.js +2 -2
  35. package/dist/modules/i18n/providers/fetch.js +2 -2
  36. package/dist/modules/i18n/providers/namespace.js +1 -1
  37. package/dist/modules/i18n/translations.js +2 -2
  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 +2 -2
  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 -2
  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 +8622 -7709
  72. package/dist/monster.dev.js.map +1 -1
  73. package/dist/monster.js +2 -9
  74. package/package.json +1 -1
  75. package/source/constants.js +7 -6
  76. package/source/constraints/abstract.js +2 -2
  77. package/source/constraints/abstractoperator.js +4 -4
  78. package/source/constraints/andoperator.js +8 -8
  79. package/source/constraints/invalid.js +6 -6
  80. package/source/constraints/isarray.js +7 -7
  81. package/source/constraints/isobject.js +7 -7
  82. package/source/constraints/namespace.js +2 -2
  83. package/source/constraints/oroperator.js +8 -8
  84. package/source/constraints/valid.js +7 -7
  85. package/source/data/buildmap.js +15 -15
  86. package/source/data/diff.js +9 -9
  87. package/source/data/extend.js +55 -13
  88. package/source/data/namespace.js +2 -2
  89. package/source/data/pathfinder.js +13 -14
  90. package/source/data/pipe.js +8 -8
  91. package/source/data/transformer.js +11 -11
  92. package/source/dom/assembler.js +7 -7
  93. package/source/dom/attributes.js +89 -46
  94. package/source/dom/constants.js +9 -2
  95. package/source/dom/customcontrol.js +299 -0
  96. package/source/dom/customelement.js +181 -66
  97. package/source/dom/events.js +58 -8
  98. package/source/dom/locale.js +5 -5
  99. package/source/dom/namespace.js +2 -2
  100. package/source/dom/template.js +24 -19
  101. package/source/dom/theme.js +8 -9
  102. package/source/dom/updater.js +46 -24
  103. package/source/dom/util.js +10 -10
  104. package/source/i18n/locale.js +7 -7
  105. package/source/i18n/namespace.js +1 -1
  106. package/source/i18n/provider.js +6 -6
  107. package/source/i18n/providers/fetch.js +10 -10
  108. package/source/i18n/translations.js +5 -5
  109. package/source/logging/handler/console.js +5 -5
  110. package/source/logging/handler/namespace.js +1 -1
  111. package/source/logging/handler.js +8 -8
  112. package/source/logging/logentry.js +5 -5
  113. package/source/logging/logger.js +5 -5
  114. package/source/logging/namespace.js +2 -2
  115. package/source/math/namespace.js +2 -2
  116. package/source/math/random.js +5 -5
  117. package/source/monster.js +48 -44
  118. package/source/namespace.js +2 -2
  119. package/source/text/formatter.js +6 -7
  120. package/source/text/namespace.js +1 -1
  121. package/source/types/base.js +4 -5
  122. package/source/types/basewithoptions.js +10 -9
  123. package/source/types/global.js +7 -7
  124. package/source/types/id.js +7 -7
  125. package/source/types/is.js +22 -22
  126. package/source/types/namespace.js +2 -2
  127. package/source/types/observer.js +7 -7
  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 +6 -6
  132. package/source/types/stack.js +11 -4
  133. package/source/types/tokenlist.js +9 -9
  134. package/source/types/typeof.js +5 -5
  135. package/source/types/uniquequeue.js +14 -7
  136. package/source/types/validate.js +27 -27
  137. package/source/types/version.js +9 -9
  138. package/source/util/clone.js +6 -6
  139. package/source/util/comparator.js +7 -7
  140. package/source/util/freeze.js +7 -7
  141. package/source/util/namespace.js +2 -2
  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/template.js +40 -1
  148. package/test/cases/monster.js +1 -1
  149. package/test/cases/types/proxyobserver.js +9 -0
  150. package/test/util/jsdom.js +3 -0
  151. package/test/web/import.js +1 -0
  152. package/test/web/monster-dev.html +3 -3
  153. package/test/web/monster.html +2 -2
  154. package/test/web/test.html +3 -3
  155. package/test/web/tests.js +3 -3
@@ -4,8 +4,8 @@
4
4
  * @author schukai GmbH
5
5
  */
6
6
 
7
- import {Monster} from '../namespace.js';
8
- import {validateFunction, validateString, validateObject} from "./validate.js";
7
+ import {assignToNamespace, Monster} from '../namespace.js';
8
+ import {validateFunction, validateObject, validateString} from "./validate.js";
9
9
 
10
10
  /**
11
11
  * @type {objec}
@@ -78,7 +78,7 @@ function getGlobal() {
78
78
  *
79
79
  * ```
80
80
  * <script type="module">
81
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/global.js';
81
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/global.js';
82
82
  * console.log(Monster.Types.getGlobalObject('document')) // ↦ { }
83
83
  * </script>
84
84
  * ```
@@ -87,7 +87,7 @@ function getGlobal() {
87
87
  *
88
88
  * ```
89
89
  * <script type="module">
90
- * import {getGlobalObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/global.js';
90
+ * import {getGlobalObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/global.js';
91
91
  * console.log(getGlobalObject('document')) // ↦ { }
92
92
  * </script>
93
93
  * ```
@@ -115,7 +115,7 @@ function getGlobalObject(name) {
115
115
  *
116
116
  * ```
117
117
  * <script type="module">
118
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/global.js';
118
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/global.js';
119
119
  * console.log(Monster.Types.getGlobalFunction('parseInt')) // ↦ f parseInt() { }
120
120
  * </script>
121
121
  * ```
@@ -124,7 +124,7 @@ function getGlobalObject(name) {
124
124
  *
125
125
  * ```
126
126
  * <script type="module">
127
- * import {getGlobalFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/global.js';
127
+ * import {getGlobalFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/global.js';
128
128
  * console.log(getGlobalFunction('parseInt')) // ↦ f parseInt() { }
129
129
  * </script>
130
130
  * ```
@@ -146,5 +146,5 @@ function getGlobalFunction(name) {
146
146
  }
147
147
 
148
148
 
149
- Monster.assignToNamespace('Monster.Types', getGlobal, getGlobalObject, getGlobalFunction);
149
+ assignToNamespace('Monster.Types', getGlobal, getGlobalObject, getGlobalFunction);
150
150
  export {Monster, getGlobal, getGlobalObject, getGlobalFunction}
@@ -2,9 +2,9 @@
2
2
 
3
3
  /**
4
4
  * @author schukai GmbH
5
- */
6
-
7
- import {Monster, Base} from './base.js';
5
+ */
6
+ import {assignToNamespace, Monster} from '../namespace.js';
7
+ import {Base} from './base.js';
8
8
  import {validateString} from "./validate.js";
9
9
 
10
10
  /**
@@ -23,8 +23,8 @@ let internalCounter = new Map;
23
23
  * You can call the method via the monster namespace `new Monster.Types.ID()`.
24
24
  *
25
25
  * ```
26
- * <script type="module">
27
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/id.js';
26
+ * <script type="module">
27
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/id.js';
28
28
  * console.log(new Monster.Types.ID())
29
29
  * </script>
30
30
  * ```
@@ -33,7 +33,7 @@ let internalCounter = new Map;
33
33
  *
34
34
  * ```
35
35
  * <script type="module">
36
- * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/id.js';
36
+ * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/id.js';
37
37
  * console.log(new ID())
38
38
  * </script>
39
39
  * ```
@@ -77,5 +77,5 @@ class ID extends Base {
77
77
 
78
78
  }
79
79
 
80
- Monster.assignToNamespace('Monster.Types', ID);
80
+ assignToNamespace('Monster.Types', ID);
81
81
  export {Monster, ID}
@@ -4,7 +4,7 @@
4
4
  * @author schukai GmbH
5
5
  */
6
6
 
7
- import {Monster} from '../namespace.js';
7
+ import {assignToNamespace, Monster} from '../namespace.js';
8
8
 
9
9
  /**
10
10
  * With this function you can check if a value is iterable
@@ -13,7 +13,7 @@ import {Monster} from '../namespace.js';
13
13
  *
14
14
  * ```
15
15
  * <script type="module">
16
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
16
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
17
17
  * console.log(Monster.Types.isIterable(null)) // ↦ false
18
18
  * console.log(Monster.Types.isIterable('hello')) // ↦ true
19
19
  * console.log(Monster.Types.isIterable([])) // ↦ true
@@ -24,7 +24,7 @@ import {Monster} from '../namespace.js';
24
24
  *
25
25
  * ```
26
26
  * <script type="module">
27
- * import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
27
+ * import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
28
28
  * console.log(isIterable(null)) // ↦ false
29
29
  * console.log(isIterable('hello')) // ↦ true
30
30
  * console.log(isIterable([])) // ↦ true
@@ -51,7 +51,7 @@ function isIterable(value) {
51
51
  *
52
52
  * ```
53
53
  * <script type="module">
54
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
54
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
55
55
  * console.log(Monster.Types.isPrimitive('2')) // ↦ false
56
56
  * console.log(Monster.Types.isPrimitive([])) // ↦ true
57
57
  * </script>
@@ -61,7 +61,7 @@ function isIterable(value) {
61
61
  *
62
62
  * ```
63
63
  * <script type="module">
64
- * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
64
+ * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
65
65
  * console.log(isPrimitive('2')) // ↦ true
66
66
  * console.log(isPrimitive([])) // ↦ false
67
67
  * </script>
@@ -96,7 +96,7 @@ function isPrimitive(value) {
96
96
  *
97
97
  * ```
98
98
  * <script type="module">
99
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
99
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
100
100
  * console.log(Monster.Types.isSymbol('2')) // ↦ false
101
101
  * console.log(Monster.Types.isSymbol(Symbol('test')) // ↦ true
102
102
  * </script>
@@ -106,7 +106,7 @@ function isPrimitive(value) {
106
106
  *
107
107
  * ```
108
108
  * <script type="module">
109
- * import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
109
+ * import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
110
110
  * console.log(isSymbol(Symbol('a'))) // ↦ true
111
111
  * console.log(isSymbol([]) // ↦ false
112
112
  * </script>
@@ -129,7 +129,7 @@ function isSymbol(value) {
129
129
  *
130
130
  * ```
131
131
  * <script type="module">
132
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
132
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
133
133
  * console.log(Monster.Types.isBoolean('2')) // ↦ false
134
134
  * console.log(Monster.Types.isBoolean([])) // ↦ false
135
135
  * console.log(Monster.Types.isBoolean(true)) // ↦ true
@@ -140,7 +140,7 @@ function isSymbol(value) {
140
140
  *
141
141
  * ```
142
142
  * <script type="module">
143
- * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
143
+ * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
144
144
  * console.log(isBoolean('2')) // ↦ false
145
145
  * console.log(isBoolean([])) // ↦ false
146
146
  * console.log(isBoolean(2>4)) // ↦ true
@@ -169,7 +169,7 @@ function isBoolean(value) {
169
169
  *
170
170
  * ```
171
171
  * <script type="module">
172
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
172
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
173
173
  * console.log(Monster.Types.isString('2')) // ↦ true
174
174
  * console.log(Monster.Types.isString([])) // ↦ false
175
175
  * </script>
@@ -179,7 +179,7 @@ function isBoolean(value) {
179
179
  *
180
180
  * ```
181
181
  * <script type="module">
182
- * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
182
+ * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
183
183
  * console.log(isString('2')) // ↦ true
184
184
  * console.log(isString([])) // ↦ false
185
185
  * </script>
@@ -205,7 +205,7 @@ function isString(value) {
205
205
  *
206
206
  * ```
207
207
  * <script type="module">
208
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
208
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
209
209
  * console.log(Monster.Types.isObject('2')) // ↦ false
210
210
  * console.log(Monster.Types.isObject([])) // ↦ false
211
211
  * console.log(Monster.Types.isObject({})) // ↦ true
@@ -216,7 +216,7 @@ function isString(value) {
216
216
  *
217
217
  * ```
218
218
  * <script type="module">
219
- * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
219
+ * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
220
220
  * console.log(isObject('2')) // ↦ false
221
221
  * console.log(isObject([])) // ↦ false
222
222
  * </script>
@@ -247,7 +247,7 @@ function isObject(value) {
247
247
  *
248
248
  * ```
249
249
  * <script type="module">
250
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
250
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
251
251
  * console.log(Monster.Types.isInstance('2')) // ↦ false
252
252
  * console.log(Monster.Types.isInstance([])) // ↦ false
253
253
  * console.log(Monster.Types.isInstance({})) // ↦ true
@@ -258,7 +258,7 @@ function isObject(value) {
258
258
  *
259
259
  * ```
260
260
  * <script type="module">
261
- * import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
261
+ * import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
262
262
  * console.log(isInstance('2')) // ↦ false
263
263
  * console.log(isInstance([])) // ↦ false
264
264
  * </script>
@@ -287,7 +287,7 @@ function isInstance(value, instance) {
287
287
  *
288
288
  * ```
289
289
  * <script type="module">
290
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
290
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
291
291
  * console.log(Monster.Types.isArray('2')) // ↦ false
292
292
  * console.log(Monster.Types.isArray([])) // ↦ true
293
293
  * </script>
@@ -297,7 +297,7 @@ function isInstance(value, instance) {
297
297
  *
298
298
  * ```
299
299
  * <script type="module">
300
- * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
300
+ * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
301
301
  * console.log(isArray('2')) // ↦ false
302
302
  * console.log(isArray([])) // ↦ true
303
303
  * </script>
@@ -323,7 +323,7 @@ function isArray(value) {
323
323
  *
324
324
  * ```
325
325
  * <script type="module">
326
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
326
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
327
327
  * console.log(Monster.Types.isFunction(()=>{})) // ↦ true
328
328
  * console.log(Monster.Types.isFunction('2')) // ↦ false
329
329
  * console.log(Monster.Types.isFunction([])) // ↦ false
@@ -334,7 +334,7 @@ function isArray(value) {
334
334
  *
335
335
  * ```
336
336
  * <script type="module">
337
- * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
337
+ * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
338
338
  * console.log(isFunction(()=>{})) // ↦ true
339
339
  * console.log(isFunction('2')) // ↦ false
340
340
  * console.log(isFunction([])) // ↦ false
@@ -366,7 +366,7 @@ function isFunction(value) {
366
366
  *
367
367
  * ```
368
368
  * <script type="module">
369
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
369
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
370
370
  * console.log(Monster.Types.isInteger(()=>{})) // ↦ true
371
371
  * console.log(Monster.Types.isInteger('2')) // ↦ false
372
372
  * console.log(Monster.Types.isInteger(2)) // ↦ true
@@ -377,7 +377,7 @@ function isFunction(value) {
377
377
  *
378
378
  * ```
379
379
  * <script type="module">
380
- * import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
380
+ * import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
381
381
  * console.log(isInteger(()=>{})) // ↦ true
382
382
  * console.log(isInteger('2')) // ↦ false
383
383
  * console.log(isInteger(2)) // ↦ true
@@ -395,7 +395,7 @@ function isInteger(value) {
395
395
  }
396
396
 
397
397
 
398
- Monster.assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable, isInteger, isSymbol);
398
+ assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable, isInteger, isSymbol);
399
399
  export {
400
400
  Monster,
401
401
  isPrimitive,
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * Namespace for types.
5
- *
5
+ *
6
6
  * @namespace Monster/Types
7
7
  * @author schukai GmbH
8
8
  */
@@ -12,4 +12,4 @@
12
12
  * @private
13
13
  * @type {string}
14
14
  */
15
- const namespace="Monster.Types";
15
+ const namespace = "Monster.Types";
@@ -4,10 +4,10 @@
4
4
  * @author schukai GmbH
5
5
  */
6
6
 
7
- import {Monster} from '../namespace.js';
8
- import {TokenList} from './tokenlist.js';
9
- import {isObject} from './is.js';
7
+ import {assignToNamespace, Monster} from '../namespace.js';
10
8
  import {Base} from './base.js';
9
+ import {isObject} from './is.js';
10
+ import {TokenList} from './tokenlist.js';
11
11
  import {UniqueQueue} from './uniquequeue.js';
12
12
 
13
13
  /**
@@ -17,7 +17,7 @@ import {UniqueQueue} from './uniquequeue.js';
17
17
  *
18
18
  * ```
19
19
  * <script type="module">
20
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/observer.js';
20
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/observer.js';
21
21
  * console.log(new Monster.Types.Observer())
22
22
  * </script>
23
23
  * ```
@@ -26,7 +26,7 @@ import {UniqueQueue} from './uniquequeue.js';
26
26
  *
27
27
  * ```
28
28
  * <script type="module">
29
- * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/observer.js';
29
+ * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/observer.js';
30
30
  * console.log(new Observer())
31
31
  * </script>
32
32
  * ```
@@ -60,7 +60,7 @@ import {UniqueQueue} from './uniquequeue.js';
60
60
  *
61
61
  * @example
62
62
  *
63
- * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/observer.js';
63
+ * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/observer.js';
64
64
  *
65
65
  * const observer = new Observer(function(a, b, c) {
66
66
  * console.log(this, a, b, c); // ↦ "a", 2, true
@@ -177,7 +177,7 @@ class Observer extends Base {
177
177
 
178
178
  }
179
179
 
180
- Monster.assignToNamespace('Monster.Types', Observer);
180
+ assignToNamespace('Monster.Types', Observer);
181
181
  export {Monster, Observer}
182
182
 
183
183
 
@@ -4,7 +4,7 @@
4
4
  * @author schukai GmbH
5
5
  */
6
6
 
7
- import {Monster} from '../namespace.js';
7
+ import {assignToNamespace, Monster} from '../namespace.js';
8
8
  import {Base} from './base.js';
9
9
  import {Observer} from "./observer.js";
10
10
  import {validateInstance} from "./validate.js";
@@ -16,7 +16,7 @@ import {validateInstance} from "./validate.js";
16
16
  *
17
17
  * ```
18
18
  * <script type="module">
19
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/observerlist.js';
19
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/observerlist.js';
20
20
  * console.log(new Monster.Types.ObserverList())
21
21
  * console.log(new Monster.Types.ObserverList())
22
22
  * </script>
@@ -26,7 +26,7 @@ import {validateInstance} from "./validate.js";
26
26
  *
27
27
  * ```
28
28
  * <script type="module">
29
- * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/observerlist.js';
29
+ * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/observerlist.js';
30
30
  * console.log(ObserverList())
31
31
  * console.log(ObserverList())
32
32
  * </script>
@@ -114,5 +114,5 @@ class ObserverList extends Base {
114
114
 
115
115
  }
116
116
 
117
- Monster.assignToNamespace('Monster.Types', ObserverList);
117
+ assignToNamespace('Monster.Types', ObserverList);
118
118
  export {Monster, ObserverList}
@@ -3,30 +3,30 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, Base} from './base.js';
8
- import {validateObject} from "./validate.js";
9
- import {ObserverList} from "./observerlist.js";
6
+ import {assignToNamespace, Monster} from '../namespace.js';
7
+ import {Base} from './base.js';
8
+ import {isArray, isObject, isPrimitive} from "./is.js";
10
9
  import {Observer} from "./observer.js";
11
- import {isObject, isArray, isPrimitive} from "./is.js";
10
+ import {ObserverList} from "./observerlist.js";
11
+ import {validateObject} from "./validate.js";
12
12
 
13
13
  /**
14
14
  * An observer manages a callback function
15
15
  *
16
- * You can call the method via the monster namespace `new Monster.Types.ProxyObserver()`.
16
+ * You can call create the class via the monster namespace `new Monster.Types.ProxyObserver()`.
17
17
  *
18
18
  * ```
19
19
  * <script type="module">
20
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/proxyobserver.js';
20
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/proxyobserver.js';
21
21
  * console.log(new Monster.Types.ProxyObserver())
22
22
  * </script>
23
23
  * ```
24
24
  *
25
- * Alternatively, you can also integrate this function individually.
25
+ * Alternatively, you can also integrate this class individually.
26
26
  *
27
27
  * ```
28
28
  * <script type="module">
29
- * import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/proxyobserver.js';
29
+ * import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/proxyobserver.js';
30
30
  * console.log(new ProxyObserver())
31
31
  * </script>
32
32
  * ```
@@ -37,9 +37,9 @@ import {isObject, isArray, isPrimitive} from "./is.js";
37
37
  *
38
38
  * @example
39
39
  *
40
- * import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/proxyobserver.js';
41
- * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/observer.js';
42
- * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/is.js';
40
+ * import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/proxyobserver.js';
41
+ * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/observer.js';
42
+ * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/is.js';
43
43
  *
44
44
  * const o = new Observer(function () {
45
45
  * if (isObject(this) && this instanceof ProxyObserver) {
@@ -76,13 +76,16 @@ class ProxyObserver extends Base {
76
76
  */
77
77
  constructor(object) {
78
78
  super();
79
- validateObject(object);
80
- this.realSubject = object
79
+
80
+ this.realSubject = validateObject(object);
81
81
  this.subject = new Proxy(object, getHandler.call(this));
82
82
 
83
83
  this.objectMap = new WeakMap();
84
84
  this.objectMap.set(this.realSubject, this.subject);
85
85
 
86
+ this.proxyMap = new WeakMap();
87
+ this.proxyMap.set(this.subject, this.realSubject);
88
+
86
89
  this.observers = new ObserverList;
87
90
  }
88
91
 
@@ -139,7 +142,7 @@ class ProxyObserver extends Base {
139
142
 
140
143
  /**
141
144
  * @param {Observer} observer
142
- * @returns {ProxyObserver}
145
+ * @returns {boolean}
143
146
  */
144
147
  containsObserver(observer) {
145
148
  return this.observers.contains(observer)
@@ -147,7 +150,7 @@ class ProxyObserver extends Base {
147
150
 
148
151
  }
149
152
 
150
- Monster.assignToNamespace('Monster.Types', ProxyObserver);
153
+ assignToNamespace('Monster.Types', ProxyObserver);
151
154
  export {Monster, ProxyObserver}
152
155
 
153
156
  /**
@@ -180,9 +183,12 @@ function getHandler() {
180
183
  if ((isArray(value) || isObject(value))) {
181
184
  if (proxy.objectMap.has(value)) {
182
185
  return proxy.objectMap.get(value);
186
+ } else if (proxy.proxyMap.has(value)) {
187
+ return value;
183
188
  } else {
184
189
  let p = new Proxy(value, handler);
185
190
  proxy.objectMap.set(value, p);
191
+ proxy.proxyMap.set(p, value);
186
192
  return p;
187
193
  }
188
194
 
@@ -195,18 +201,24 @@ function getHandler() {
195
201
  // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-set-p-v-receiver
196
202
  set: function (target, key, value, receiver) {
197
203
 
198
- // let descriptor2 = Reflect.getOwnPropertyDescriptor(target, key);
199
- // console.log(descriptor2, 'descriptor2');
204
+ if (proxy.proxyMap.has(value)) {
205
+ value = proxy.proxyMap.get(value);
206
+ }
200
207
 
208
+ if (proxy.proxyMap.has(target)) {
209
+ target = proxy.proxyMap.get(target);
210
+ }
201
211
 
202
212
  let current = Reflect.get(target, key, receiver);
213
+ if (proxy.proxyMap.has(current)) {
214
+ current = proxy.proxyMap.get(current);
215
+ }
203
216
 
204
217
  if (current === value) {
205
218
  return true;
206
219
  }
207
220
 
208
221
  let result;
209
- //if (value === undefined) {
210
222
  let descriptor = Reflect.getOwnPropertyDescriptor(target, key);
211
223
 
212
224
  if (descriptor === undefined) {
@@ -217,15 +229,8 @@ function getHandler() {
217
229
  }
218
230
  }
219
231
 
220
- //delete target[key];
221
232
  descriptor['value'] = value;
222
233
  result = Reflect.defineProperty(target, key, descriptor);
223
- // } else {
224
- // result = Reflect.set(target, key, value, receiver);
225
- // }
226
-
227
- // let descriptor3 = Reflect.getOwnPropertyDescriptor(target, key);
228
- // console.log(descriptor3, 'descriptor3');
229
234
 
230
235
  if (typeof key !== "symbol") {
231
236
  proxy.observers.notify(proxy);
@@ -234,6 +239,7 @@ function getHandler() {
234
239
  return result;
235
240
  },
236
241
 
242
+
237
243
  // https://262.ecma-international.org/9.0/#sec-proxy-object-internal-methods-and-internal-slots-delete-p
238
244
  deleteProperty: function (target, key) {
239
245
  if (key in target) {
@@ -1,11 +1,17 @@
1
- import {Monster, Base} from './base.js';
1
+ 'use strict';
2
+
3
+ /**
4
+ * @author schukai GmbH
5
+ */
6
+ import {assignToNamespace, Monster} from '../namespace.js';
7
+ import {Base} from './base.js';
2
8
 
3
9
  /**
4
10
  * You can call the method via the monster namespace `new Monster.Types.Queue()`.
5
11
  *
6
12
  * ```
7
13
  * <script type="module">
8
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/queue.js';
14
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/queue.js';
9
15
  * console.log(new Monster.Types.Queue())
10
16
  * </script>
11
17
  * ```
@@ -14,14 +20,14 @@ import {Monster, Base} from './base.js';
14
20
  *
15
21
  * ```
16
22
  * <script type="module">
17
- * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/queue.js';
23
+ * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/queue.js';
18
24
  * console.log(new Queue())
19
25
  * </script>
20
26
  * ```
21
- *
27
+ *
22
28
  * @example
23
29
  *
24
- * import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/queue.js';
30
+ * import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/queue.js';
25
31
  *
26
32
  * const queue = new Queue;
27
33
  *
@@ -46,7 +52,7 @@ import {Monster, Base} from './base.js';
46
52
  * @copyright schukai GmbH
47
53
  * @memberOf Monster/Types
48
54
  */
49
- class Queue extends Base {
55
+ class Queue extends Base {
50
56
 
51
57
  /**
52
58
  *
@@ -114,5 +120,5 @@ class Queue extends Base {
114
120
 
115
121
  }
116
122
 
117
- Monster.assignToNamespace('Monster.Types', Queue);
123
+ assignToNamespace('Monster.Types', Queue);
118
124
  export {Monster, Queue}
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
+ import {random} from "../math/random.js";
3
4
  /**
4
5
  * @author schukai GmbH
5
6
  */
6
-
7
- import {Monster, ID} from "./id.js";
7
+ import {assignToNamespace, Monster} from '../namespace.js';
8
8
  import {getGlobal} from "./global.js";
9
- import {random} from "../math/random.js";
9
+ import {ID} from "./id.js";
10
10
 
11
11
  /**
12
12
  * @private
@@ -19,7 +19,7 @@ let internalCounter = 0;
19
19
  *
20
20
  * ```
21
21
  * <script type="module">
22
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/randomid.js';
22
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/randomid.js';
23
23
  * console.log(new Monster.Types.RandomID())
24
24
  * </script>
25
25
  * ```
@@ -28,7 +28,7 @@ let internalCounter = 0;
28
28
  *
29
29
  * ```
30
30
  * <script type="module">
31
- * import {RandomID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.13.0/dist/modules/types/randomid.js';
31
+ * import {RandomID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.2/dist/modules/types/randomid.js';
32
32
  * console.log(new RandomID())
33
33
  * </script>
34
34
  * ```
@@ -55,5 +55,5 @@ class RandomID extends ID {
55
55
 
56
56
  }
57
57
 
58
- Monster.assignToNamespace('Monster.Types', RandomID);
58
+ assignToNamespace('Monster.Types', RandomID);
59
59
  export {Monster, RandomID}