@schukai/monster 1.14.1 → 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 (139) hide show
  1. package/CHANGELOG +14 -0
  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 -2
  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 +1 -1
  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 -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 +1096 -844
  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 +6 -5
  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/oroperator.js +8 -8
  83. package/source/constraints/valid.js +6 -6
  84. package/source/data/buildmap.js +15 -15
  85. package/source/data/diff.js +6 -6
  86. package/source/data/extend.js +55 -13
  87. package/source/data/pathfinder.js +6 -7
  88. package/source/data/pipe.js +5 -5
  89. package/source/data/transformer.js +5 -6
  90. package/source/dom/assembler.js +5 -5
  91. package/source/dom/attributes.js +26 -26
  92. package/source/dom/constants.js +1 -2
  93. package/source/dom/customcontrol.js +14 -50
  94. package/source/dom/customelement.js +125 -28
  95. package/source/dom/events.js +7 -7
  96. package/source/dom/locale.js +5 -5
  97. package/source/dom/template.js +7 -7
  98. package/source/dom/theme.js +6 -6
  99. package/source/dom/updater.js +35 -13
  100. package/source/dom/util.js +9 -9
  101. package/source/i18n/locale.js +7 -7
  102. package/source/i18n/provider.js +5 -5
  103. package/source/i18n/providers/fetch.js +10 -10
  104. package/source/i18n/translations.js +5 -5
  105. package/source/logging/handler/console.js +4 -4
  106. package/source/logging/handler.js +4 -4
  107. package/source/logging/logentry.js +4 -4
  108. package/source/logging/logger.js +4 -4
  109. package/source/math/random.js +5 -5
  110. package/source/namespace.js +1 -1
  111. package/source/text/formatter.js +4 -5
  112. package/source/types/base.js +4 -5
  113. package/source/types/basewithoptions.js +9 -8
  114. package/source/types/global.js +6 -6
  115. package/source/types/id.js +6 -6
  116. package/source/types/is.js +22 -22
  117. package/source/types/observer.js +5 -5
  118. package/source/types/observerlist.js +4 -4
  119. package/source/types/proxyobserver.js +32 -26
  120. package/source/types/queue.js +13 -7
  121. package/source/types/randomid.js +5 -5
  122. package/source/types/stack.js +11 -4
  123. package/source/types/tokenlist.js +4 -4
  124. package/source/types/typeof.js +5 -5
  125. package/source/types/uniquequeue.js +11 -4
  126. package/source/types/validate.js +22 -22
  127. package/source/types/version.js +9 -9
  128. package/source/util/clone.js +4 -4
  129. package/source/util/comparator.js +6 -6
  130. package/source/util/freeze.js +4 -4
  131. package/test/cases/data/extend.js +66 -13
  132. package/test/cases/dom/customcontrol.js +16 -2
  133. package/test/cases/dom/customelement.js +64 -6
  134. package/test/cases/monster.js +1 -1
  135. package/test/cases/types/proxyobserver.js +9 -0
  136. package/test/web/monster-dev.html +3 -3
  137. package/test/web/monster.html +2 -2
  138. package/test/web/test.html +3 -3
  139. package/test/web/tests.js +3 -3
@@ -4,7 +4,7 @@
4
4
  * @author schukai GmbH
5
5
  */
6
6
 
7
- import {Monster} from '../namespace.js';
7
+ import {Monster, assignToNamespace} 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.14.1/dist/modules/types/is.js';
16
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
27
+ * import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
54
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
64
+ * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
99
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
109
+ * import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
132
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
143
+ * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
172
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
182
+ * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
208
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
219
+ * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
250
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
261
+ * import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
290
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
300
+ * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
326
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
337
+ * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
369
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/is.js';
380
+ * import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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,
@@ -4,7 +4,7 @@
4
4
  * @author schukai GmbH
5
5
  */
6
6
 
7
- import {Monster} from '../namespace.js';
7
+ import {Monster, assignToNamespace} from '../namespace.js';
8
8
  import {TokenList} from './tokenlist.js';
9
9
  import {isObject} from './is.js';
10
10
  import {Base} from './base.js';
@@ -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.14.1/dist/modules/types/observer.js';
20
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/observer.js';
29
+ * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/observer.js';
63
+ * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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 {Monster, assignToNamespace} 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.14.1/dist/modules/types/observerlist.js';
19
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/observerlist.js';
29
+ * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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,8 +3,8 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, Base} from './base.js';
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import { Base} from './base.js';
8
8
  import {validateObject} from "./validate.js";
9
9
  import {ObserverList} from "./observerlist.js";
10
10
  import {Observer} from "./observer.js";
@@ -13,20 +13,20 @@ import {isObject, isArray, isPrimitive} from "./is.js";
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.14.1/dist/modules/types/proxyobserver.js';
20
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/proxyobserver.js';
29
+ * import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/proxyobserver.js';
41
- * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/types/observer.js';
42
- * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/types/is.js';
40
+ * import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/types/proxyobserver.js';
41
+ * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/types/observer.js';
42
+ * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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');
200
-
201
-
204
+ if(proxy.proxyMap.has(value)) {
205
+ value= proxy.proxyMap.get(value);
206
+ }
207
+
208
+ if(proxy.proxyMap.has(target)) {
209
+ target= proxy.proxyMap.get(target);
210
+ }
211
+
202
212
  let current = Reflect.get(target, key, receiver);
203
-
213
+ if(proxy.proxyMap.has(current)) {
214
+ current= proxy.proxyMap.get(current);
215
+ }
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 {Monster, assignToNamespace} 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.14.1/dist/modules/types/queue.js';
14
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/queue.js';
23
+ * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/queue.js';
30
+ * import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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}
@@ -3,8 +3,8 @@
3
3
  /**
4
4
  * @author schukai GmbH
5
5
  */
6
-
7
- import {Monster, ID} from "./id.js";
6
+ import {Monster, assignToNamespace} from '../namespace.js';
7
+ import {ID} from "./id.js";
8
8
  import {getGlobal} from "./global.js";
9
9
  import {random} from "../math/random.js";
10
10
 
@@ -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.14.1/dist/modules/types/randomid.js';
22
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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.14.1/dist/modules/types/randomid.js';
31
+ * import {RandomID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/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}
@@ -1,11 +1,18 @@
1
- import {Monster, Base} from './base.js';
1
+ 'use strict';
2
+
3
+ /**
4
+ * @author schukai GmbH
5
+ */
6
+
7
+ import {Monster, assignToNamespace} from '../namespace.js';
8
+ import {Base} from './base.js';
2
9
 
3
10
  /**
4
11
  * You can call the method via the monster namespace `new Monster.Types.Queue()`.
5
12
  *
6
13
  * ```
7
14
  * <script type="module">
8
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/types/stack.js';
15
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/types/stack.js';
9
16
  * console.log(new Monster.Types.Stack())
10
17
  * </script>
11
18
  * ```
@@ -14,7 +21,7 @@ import {Monster, Base} from './base.js';
14
21
  *
15
22
  * ```
16
23
  * <script type="module">
17
- * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/types/stack.js';
24
+ * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/types/stack.js';
18
25
  * console.log(new Stack())
19
26
  * </script>
20
27
  * ```
@@ -92,5 +99,5 @@ class Stack extends Base {
92
99
 
93
100
  }
94
101
 
95
- Monster.assignToNamespace('Monster.Types', Stack);
102
+ assignToNamespace('Monster.Types', Stack);
96
103
  export {Monster, Stack}
@@ -4,7 +4,7 @@
4
4
  * @author schukai GmbH
5
5
  */
6
6
 
7
- import {Monster} from '../namespace.js';
7
+ import {Monster, assignToNamespace} from '../namespace.js';
8
8
  import {Base} from './base.js';
9
9
  import {isString, isIterable} from '../types/is.js';
10
10
  import {validateString, validateFunction} from '../types/validate.js';
@@ -18,7 +18,7 @@ import {validateString, validateFunction} from '../types/validate.js';
18
18
  *
19
19
  * ```
20
20
  * <script type="module">
21
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/types/tokenlist.js';
21
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/types/tokenlist.js';
22
22
  * console.log(new Monster.Types.TokenList("myclass row"))
23
23
  * console.log(new Monster.Types.TokenList("myclass row"))
24
24
  * </script>
@@ -28,7 +28,7 @@ import {validateString, validateFunction} from '../types/validate.js';
28
28
  *
29
29
  * ```
30
30
  * <script type="module">
31
- * import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/types/tokenlist.js';
31
+ * import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/types/tokenlist.js';
32
32
  * console.log(new TokenList("myclass row"))
33
33
  * console.log(new TokenList("myclass row"))
34
34
  * </script>
@@ -311,5 +311,5 @@ function toggleValue(token) {
311
311
  return this;
312
312
  }
313
313
 
314
- Monster.assignToNamespace('Monster.Types', TokenList);
314
+ assignToNamespace('Monster.Types', TokenList);
315
315
  export {Monster, TokenList}
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
 
8
- import {Monster} from "../namespace.js";
8
+ import {Monster, assignToNamespace} from '../namespace.js';
9
9
 
10
10
  /**
11
11
  * The built-in typeof method is known to have some historical weaknesses. This function tries to provide a better and more accurate result.
@@ -14,7 +14,7 @@ import {Monster} from "../namespace.js";
14
14
  *
15
15
  * ```
16
16
  * <script type="module">
17
- * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/types/typeof.js';
17
+ * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/types/typeof.js';
18
18
  * console.log(Monster.Types.typeOf())
19
19
  * </script>
20
20
  * ```
@@ -23,14 +23,14 @@ import {Monster} from "../namespace.js";
23
23
  *
24
24
  * ```
25
25
  * <script type="module">
26
- * import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/types/typeof.js';
26
+ * import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/types/typeof.js';
27
27
  * console.log(typeOf())
28
28
  * </script>
29
29
  * ```
30
30
  *
31
31
  * @example
32
32
  *
33
- * import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.14.1/dist/modules/types/typeof.js';
33
+ * import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/types/typeof.js';
34
34
  *
35
35
  * console.log(typeOf(undefined)); // ↦ undefined
36
36
  * console.log(typeOf("")); // ↦ string
@@ -56,7 +56,7 @@ function typeOf(value) {
56
56
  return type.toLowerCase();
57
57
  }
58
58
 
59
- Monster.assignToNamespace('Monster.Types', typeOf);
59
+ assignToNamespace('Monster.Types', typeOf);
60
60
  export {
61
61
  Monster,
62
62
  typeOf