@schukai/monster 1.14.1 → 1.15.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG +14 -0
- package/README.md +5 -5
- package/dist/modules/constants.js +2 -2
- package/dist/modules/constraints/abstract.js +2 -2
- package/dist/modules/constraints/abstractoperator.js +2 -2
- package/dist/modules/constraints/andoperator.js +2 -2
- package/dist/modules/constraints/invalid.js +2 -2
- package/dist/modules/constraints/isarray.js +2 -2
- package/dist/modules/constraints/isobject.js +2 -2
- package/dist/modules/constraints/namespace.js +1 -1
- package/dist/modules/constraints/oroperator.js +2 -2
- package/dist/modules/constraints/valid.js +2 -2
- package/dist/modules/data/buildmap.js +2 -2
- package/dist/modules/data/diff.js +2 -2
- package/dist/modules/data/extend.js +2 -2
- package/dist/modules/data/namespace.js +1 -1
- package/dist/modules/data/pathfinder.js +2 -2
- package/dist/modules/data/pipe.js +2 -2
- package/dist/modules/data/transformer.js +2 -2
- package/dist/modules/dom/assembler.js +2 -2
- package/dist/modules/dom/attributes.js +2 -2
- package/dist/modules/dom/constants.js +2 -2
- package/dist/modules/dom/customcontrol.js +2 -2
- package/dist/modules/dom/customelement.js +2 -2
- package/dist/modules/dom/events.js +2 -2
- package/dist/modules/dom/locale.js +2 -2
- package/dist/modules/dom/namespace.js +1 -1
- package/dist/modules/dom/template.js +2 -2
- package/dist/modules/dom/theme.js +2 -2
- package/dist/modules/dom/updater.js +2 -2
- package/dist/modules/dom/util.js +2 -2
- package/dist/modules/i18n/locale.js +2 -2
- package/dist/modules/i18n/namespace.js +1 -1
- package/dist/modules/i18n/provider.js +2 -2
- package/dist/modules/i18n/providers/fetch.js +2 -2
- package/dist/modules/i18n/providers/namespace.js +1 -1
- package/dist/modules/i18n/translations.js +2 -2
- package/dist/modules/logging/handler/console.js +2 -2
- package/dist/modules/logging/handler/namespace.js +1 -1
- package/dist/modules/logging/handler.js +2 -2
- package/dist/modules/logging/logentry.js +2 -2
- package/dist/modules/logging/logger.js +2 -2
- package/dist/modules/logging/namespace.js +1 -1
- package/dist/modules/math/namespace.js +1 -1
- package/dist/modules/math/random.js +2 -2
- package/dist/modules/monster.js +1 -1
- package/dist/modules/namespace.js +1 -1
- package/dist/modules/text/formatter.js +2 -2
- package/dist/modules/text/namespace.js +1 -1
- package/dist/modules/types/base.js +2 -2
- package/dist/modules/types/basewithoptions.js +2 -2
- package/dist/modules/types/global.js +2 -2
- package/dist/modules/types/id.js +2 -2
- package/dist/modules/types/is.js +2 -2
- package/dist/modules/types/namespace.js +1 -1
- package/dist/modules/types/observer.js +2 -2
- package/dist/modules/types/observerlist.js +2 -2
- package/dist/modules/types/proxyobserver.js +2 -2
- package/dist/modules/types/queue.js +2 -2
- package/dist/modules/types/randomid.js +2 -2
- package/dist/modules/types/stack.js +2 -2
- package/dist/modules/types/tokenlist.js +2 -2
- package/dist/modules/types/typeof.js +2 -2
- package/dist/modules/types/uniquequeue.js +2 -2
- package/dist/modules/types/validate.js +2 -2
- package/dist/modules/types/version.js +2 -2
- package/dist/modules/util/clone.js +2 -2
- package/dist/modules/util/comparator.js +2 -2
- package/dist/modules/util/freeze.js +2 -2
- package/dist/modules/util/namespace.js +1 -1
- package/dist/monster.dev.js +1096 -844
- package/dist/monster.dev.js.map +1 -1
- package/dist/monster.js +3 -3
- package/package.json +1 -1
- package/source/constants.js +6 -5
- package/source/constraints/abstract.js +2 -2
- package/source/constraints/abstractoperator.js +3 -3
- package/source/constraints/andoperator.js +7 -7
- package/source/constraints/invalid.js +6 -6
- package/source/constraints/isarray.js +6 -6
- package/source/constraints/isobject.js +6 -6
- package/source/constraints/oroperator.js +8 -8
- package/source/constraints/valid.js +6 -6
- package/source/data/buildmap.js +15 -15
- package/source/data/diff.js +6 -6
- package/source/data/extend.js +55 -13
- package/source/data/pathfinder.js +6 -7
- package/source/data/pipe.js +5 -5
- package/source/data/transformer.js +5 -6
- package/source/dom/assembler.js +5 -5
- package/source/dom/attributes.js +26 -26
- package/source/dom/constants.js +1 -2
- package/source/dom/customcontrol.js +14 -50
- package/source/dom/customelement.js +125 -28
- package/source/dom/events.js +7 -7
- package/source/dom/locale.js +5 -5
- package/source/dom/template.js +7 -7
- package/source/dom/theme.js +6 -6
- package/source/dom/updater.js +35 -13
- package/source/dom/util.js +9 -9
- package/source/i18n/locale.js +7 -7
- package/source/i18n/provider.js +5 -5
- package/source/i18n/providers/fetch.js +10 -10
- package/source/i18n/translations.js +5 -5
- package/source/logging/handler/console.js +4 -4
- package/source/logging/handler.js +4 -4
- package/source/logging/logentry.js +4 -4
- package/source/logging/logger.js +4 -4
- package/source/math/random.js +5 -5
- package/source/namespace.js +1 -1
- package/source/text/formatter.js +4 -5
- package/source/types/base.js +4 -5
- package/source/types/basewithoptions.js +9 -8
- package/source/types/global.js +6 -6
- package/source/types/id.js +6 -6
- package/source/types/is.js +22 -22
- package/source/types/observer.js +5 -5
- package/source/types/observerlist.js +4 -4
- package/source/types/proxyobserver.js +32 -26
- package/source/types/queue.js +13 -7
- package/source/types/randomid.js +5 -5
- package/source/types/stack.js +11 -4
- package/source/types/tokenlist.js +4 -4
- package/source/types/typeof.js +5 -5
- package/source/types/uniquequeue.js +11 -4
- package/source/types/validate.js +22 -22
- package/source/types/version.js +9 -9
- package/source/util/clone.js +4 -4
- package/source/util/comparator.js +6 -6
- package/source/util/freeze.js +4 -4
- package/test/cases/data/extend.js +66 -13
- package/test/cases/dom/customcontrol.js +16 -2
- package/test/cases/dom/customelement.js +64 -6
- package/test/cases/monster.js +1 -1
- package/test/cases/types/proxyobserver.js +9 -0
- package/test/web/monster-dev.html +3 -3
- package/test/web/monster.html +2 -2
- package/test/web/test.html +3 -3
- package/test/web/tests.js +3 -3
package/source/data/pipe.js
CHANGED
@@ -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 {Transformer} from './transformer.js';
|
9
9
|
import {Base} from '../types/base.js';
|
10
10
|
import {validateFunction, validateString} from '../types/validate.js';
|
@@ -19,7 +19,7 @@ const DELIMITER = '|';
|
|
19
19
|
*
|
20
20
|
* ```
|
21
21
|
* <script type="module">
|
22
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
22
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/pipe.js';
|
23
23
|
* console.log(new Monster.Data.Pipe())
|
24
24
|
* </script>
|
25
25
|
* ```
|
@@ -28,7 +28,7 @@ const DELIMITER = '|';
|
|
28
28
|
*
|
29
29
|
* ```
|
30
30
|
* <script type="module">
|
31
|
-
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
31
|
+
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/pipe.js';
|
32
32
|
* console.log(new Pipe())
|
33
33
|
* </script>
|
34
34
|
* ```
|
@@ -39,7 +39,7 @@ const DELIMITER = '|';
|
|
39
39
|
* the word is then converted to uppercase letters and a prefix Hello is added. the two backslash safe the space char.
|
40
40
|
*
|
41
41
|
* @example
|
42
|
-
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
42
|
+
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/pipe.js';
|
43
43
|
*
|
44
44
|
* let obj = {
|
45
45
|
* a: {
|
@@ -106,5 +106,5 @@ class Pipe extends Base {
|
|
106
106
|
}
|
107
107
|
}
|
108
108
|
|
109
|
-
|
109
|
+
assignToNamespace('Monster.Data', Pipe);
|
110
110
|
export {Monster, Pipe}
|
@@ -3,8 +3,7 @@
|
|
3
3
|
/**
|
4
4
|
* @author schukai GmbH
|
5
5
|
*/
|
6
|
-
|
7
|
-
import {Monster} from '../namespace.js';
|
6
|
+
import {Monster, assignToNamespace} from '../namespace.js';
|
8
7
|
import {Base} from '../types/base.js';
|
9
8
|
import {getGlobal} from "../types/global.js";
|
10
9
|
import {
|
@@ -26,7 +25,7 @@ import {Pathfinder} from "./pathfinder.js";
|
|
26
25
|
*
|
27
26
|
* ```
|
28
27
|
* <script type="module">
|
29
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
28
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/transformer.js';
|
30
29
|
* console.log(new Monster.Data.Transformer())
|
31
30
|
* </script>
|
32
31
|
* ```
|
@@ -35,7 +34,7 @@ import {Pathfinder} from "./pathfinder.js";
|
|
35
34
|
*
|
36
35
|
* ```
|
37
36
|
* <script type="module">
|
38
|
-
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
37
|
+
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/transformer.js';
|
39
38
|
* console.log(new Transformer())
|
40
39
|
* </script>
|
41
40
|
* ```
|
@@ -114,7 +113,7 @@ import {Pathfinder} from "./pathfinder.js";
|
|
114
113
|
*
|
115
114
|
* @example
|
116
115
|
*
|
117
|
-
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
116
|
+
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/data/transformer.js';
|
118
117
|
*
|
119
118
|
* const transformer = new Transformer("tolower")
|
120
119
|
*
|
@@ -181,7 +180,7 @@ class Transformer extends Base {
|
|
181
180
|
}
|
182
181
|
}
|
183
182
|
|
184
|
-
|
183
|
+
assignToNamespace('Monster.Data', Transformer);
|
185
184
|
export {Monster, Transformer}
|
186
185
|
|
187
186
|
/**
|
package/source/dom/assembler.js
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
/**
|
4
4
|
* @author schukai GmbH
|
5
5
|
*/
|
6
|
-
|
7
|
-
import {
|
6
|
+
import {Monster, assignToNamespace} from '../namespace.js';
|
7
|
+
import { Base} from '../types/base.js';
|
8
8
|
import {validateInstance, validateString} from "../types/validate.js";
|
9
9
|
import {getGlobalFunction} from "../types/global.js";
|
10
10
|
import {ProxyObserver} from "../types/proxyobserver.js";
|
@@ -23,7 +23,7 @@ const ATTRIBUTEPREFIX = "data-monster-";
|
|
23
23
|
*
|
24
24
|
* ```
|
25
25
|
* <script type="module">
|
26
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
26
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/assembler.js';
|
27
27
|
* console.log(new Monster.DOM.Assembler())
|
28
28
|
* </script>
|
29
29
|
* ```
|
@@ -32,7 +32,7 @@ const ATTRIBUTEPREFIX = "data-monster-";
|
|
32
32
|
*
|
33
33
|
* ```
|
34
34
|
* <script type="module">
|
35
|
-
* import {Assembler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
35
|
+
* import {Assembler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/assembler.js';
|
36
36
|
* console.log(new Assembler())
|
37
37
|
* </script>
|
38
38
|
* ```
|
@@ -95,5 +95,5 @@ class Assembler extends Base {
|
|
95
95
|
|
96
96
|
}
|
97
97
|
|
98
|
-
|
98
|
+
assignToNamespace('Monster.DOM', Assembler);
|
99
99
|
export {Monster, ATTRIBUTEPREFIX, Assembler}
|
package/source/dom/attributes.js
CHANGED
@@ -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 {getGlobalFunction} from "../types/global.js";
|
9
9
|
import {isInstance} from "../types/is.js";
|
10
10
|
import {TokenList} from "../types/tokenlist.js";
|
@@ -21,7 +21,7 @@ import {ATTRIBUTE_OBJECTLINK} from "./constants.js";
|
|
21
21
|
*
|
22
22
|
* ```
|
23
23
|
* <script type="module">
|
24
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
24
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/updater.js';
|
25
25
|
* console.log(Monster.DOM.findClosestObjectLink())
|
26
26
|
* </script>
|
27
27
|
* ```
|
@@ -30,7 +30,7 @@ import {ATTRIBUTE_OBJECTLINK} from "./constants.js";
|
|
30
30
|
*
|
31
31
|
* ```
|
32
32
|
* <script type="module">
|
33
|
-
* import {getUpdaterFromNode} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
33
|
+
* import {getUpdaterFromNode} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/updater.js';
|
34
34
|
* console.log(findClosestObjectLink())
|
35
35
|
* </script>
|
36
36
|
* ```
|
@@ -51,7 +51,7 @@ function findClosestObjectLink(element) {
|
|
51
51
|
*
|
52
52
|
* ```
|
53
53
|
* <script type="module">
|
54
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
54
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
55
55
|
* Monster.DOM.addToObjectLink();
|
56
56
|
* </script>
|
57
57
|
* ```
|
@@ -60,7 +60,7 @@ function findClosestObjectLink(element) {
|
|
60
60
|
*
|
61
61
|
* ```
|
62
62
|
* <script type="module">
|
63
|
-
* import {addToObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
63
|
+
* import {addToObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
64
64
|
* addToObjectLink();
|
65
65
|
* </script>
|
66
66
|
* ```
|
@@ -93,7 +93,7 @@ function addToObjectLink(element, symbol, object) {
|
|
93
93
|
*
|
94
94
|
* ```
|
95
95
|
* <script type="module">
|
96
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
96
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
97
97
|
* Monster.DOM.removeObjectLink();
|
98
98
|
* </script>
|
99
99
|
* ```
|
@@ -102,7 +102,7 @@ function addToObjectLink(element, symbol, object) {
|
|
102
102
|
*
|
103
103
|
* ```
|
104
104
|
* <script type="module">
|
105
|
-
* import {removeObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
105
|
+
* import {removeObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
106
106
|
* removeObjectLink();
|
107
107
|
* </script>
|
108
108
|
* ```
|
@@ -135,7 +135,7 @@ function removeObjectLink(element, symbol) {
|
|
135
135
|
*
|
136
136
|
* ```
|
137
137
|
* <script type="module">
|
138
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
138
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
139
139
|
* Monster.DOM.hasObjectLink();
|
140
140
|
* </script>
|
141
141
|
* ```
|
@@ -144,7 +144,7 @@ function removeObjectLink(element, symbol) {
|
|
144
144
|
*
|
145
145
|
* ```
|
146
146
|
* <script type="module">
|
147
|
-
* import {hasObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
147
|
+
* import {hasObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
148
148
|
* hasObjectLink();
|
149
149
|
* </script>
|
150
150
|
* ```
|
@@ -181,7 +181,7 @@ function hasObjectLink(element, symbol) {
|
|
181
181
|
*
|
182
182
|
* ```
|
183
183
|
* <script type="module">
|
184
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
184
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
185
185
|
* Monster.DOM.getLinkedObjects();
|
186
186
|
* </script>
|
187
187
|
* ```
|
@@ -190,7 +190,7 @@ function hasObjectLink(element, symbol) {
|
|
190
190
|
*
|
191
191
|
* ```
|
192
192
|
* <script type="module">
|
193
|
-
* import {getLinkedObjects} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
193
|
+
* import {getLinkedObjects} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
194
194
|
* getLinkedObjects();
|
195
195
|
* </script>
|
196
196
|
* ```
|
@@ -226,7 +226,7 @@ function getLinkedObjects(element, symbol) {
|
|
226
226
|
*
|
227
227
|
* ```
|
228
228
|
* <script type="module">
|
229
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
229
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
230
230
|
* Monster.DOM.toggleAttributeToken();
|
231
231
|
* </script>
|
232
232
|
* ```
|
@@ -235,7 +235,7 @@ function getLinkedObjects(element, symbol) {
|
|
235
235
|
*
|
236
236
|
* ```
|
237
237
|
* <script type="module">
|
238
|
-
* import {toggleAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
238
|
+
* import {toggleAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
239
239
|
* toggleAttributeToken();
|
240
240
|
* </script>
|
241
241
|
* ```
|
@@ -270,7 +270,7 @@ function toggleAttributeToken(element, key, token) {
|
|
270
270
|
*
|
271
271
|
* ```
|
272
272
|
* <script type="module">
|
273
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
273
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
274
274
|
* Monster.DOM.addAttributeToken();
|
275
275
|
* </script>
|
276
276
|
* ```
|
@@ -279,7 +279,7 @@ function toggleAttributeToken(element, key, token) {
|
|
279
279
|
*
|
280
280
|
* ```
|
281
281
|
* <script type="module">
|
282
|
-
* import {addAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
282
|
+
* import {addAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
283
283
|
* addAttributeToken();
|
284
284
|
* </script>
|
285
285
|
* ```
|
@@ -316,7 +316,7 @@ function addAttributeToken(element, key, token) {
|
|
316
316
|
*
|
317
317
|
* ```
|
318
318
|
* <script type="module">
|
319
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
319
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
320
320
|
* Monster.DOM.removeAttributeToken();
|
321
321
|
* </script>
|
322
322
|
* ```
|
@@ -325,7 +325,7 @@ function addAttributeToken(element, key, token) {
|
|
325
325
|
*
|
326
326
|
* ```
|
327
327
|
* <script type="module">
|
328
|
-
* import {removeAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
328
|
+
* import {removeAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
329
329
|
* removeAttributeToken();
|
330
330
|
* </script>
|
331
331
|
* ```
|
@@ -361,7 +361,7 @@ function removeAttributeToken(element, key, token) {
|
|
361
361
|
*
|
362
362
|
* ```
|
363
363
|
* <script type="module">
|
364
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
364
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
365
365
|
* Monster.DOM.containsAttributeToken();
|
366
366
|
* </script>
|
367
367
|
* ```
|
@@ -370,7 +370,7 @@ function removeAttributeToken(element, key, token) {
|
|
370
370
|
*
|
371
371
|
* ```
|
372
372
|
* <script type="module">
|
373
|
-
* import {containsAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
373
|
+
* import {containsAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
374
374
|
* containsAttributeToken();
|
375
375
|
* </script>
|
376
376
|
* ```
|
@@ -403,7 +403,7 @@ function containsAttributeToken(element, key, token) {
|
|
403
403
|
*
|
404
404
|
* ```
|
405
405
|
* <script type="module">
|
406
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
406
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
407
407
|
* Monster.DOM.replaceAttributeToken();
|
408
408
|
* </script>
|
409
409
|
* ```
|
@@ -412,7 +412,7 @@ function containsAttributeToken(element, key, token) {
|
|
412
412
|
*
|
413
413
|
* ```
|
414
414
|
* <script type="module">
|
415
|
-
* import {replaceAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
415
|
+
* import {replaceAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
416
416
|
* replaceAttributeToken();
|
417
417
|
* </script>
|
418
418
|
* ```
|
@@ -448,7 +448,7 @@ function replaceAttributeToken(element, key, from, to) {
|
|
448
448
|
*
|
449
449
|
* ```
|
450
450
|
* <script type="module">
|
451
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
451
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
452
452
|
* Monster.DOM.clearAttributeTokens();
|
453
453
|
* </script>
|
454
454
|
* ```
|
@@ -457,7 +457,7 @@ function replaceAttributeToken(element, key, from, to) {
|
|
457
457
|
*
|
458
458
|
* ```
|
459
459
|
* <script type="module">
|
460
|
-
* import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
460
|
+
* import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
461
461
|
* clearAttributeTokens();
|
462
462
|
* </script>
|
463
463
|
* ```
|
@@ -487,7 +487,7 @@ function clearAttributeTokens(element, key) {
|
|
487
487
|
*
|
488
488
|
* ```
|
489
489
|
* <script type="module">
|
490
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
490
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
491
491
|
* Monster.DOM.findClosestByAttribute();
|
492
492
|
* </script>
|
493
493
|
* ```
|
@@ -496,7 +496,7 @@ function clearAttributeTokens(element, key) {
|
|
496
496
|
*
|
497
497
|
* ```
|
498
498
|
* <script type="module">
|
499
|
-
* import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
499
|
+
* import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/attributes.js';
|
500
500
|
* findClosestByAttribute();
|
501
501
|
* </script>
|
502
502
|
* ```
|
@@ -536,7 +536,7 @@ function findClosestByAttribute(element, key, value) {
|
|
536
536
|
}
|
537
537
|
|
538
538
|
// exports
|
539
|
-
|
539
|
+
assignToNamespace('Monster.DOM', getLinkedObjects, addToObjectLink, removeObjectLink, findClosestByAttribute, hasObjectLink, clearAttributeTokens, replaceAttributeToken, containsAttributeToken, removeAttributeToken, addAttributeToken, toggleAttributeToken);
|
540
540
|
export {
|
541
541
|
Monster,
|
542
542
|
addToObjectLink,
|
package/source/dom/constants.js
CHANGED
@@ -3,11 +3,9 @@
|
|
3
3
|
/**
|
4
4
|
* @author schukai GmbH
|
5
5
|
*/
|
6
|
-
|
6
|
+
import {Monster, assignToNamespace} from '../namespace.js';
|
7
7
|
import {extend} from "../data/extend.js";
|
8
|
-
import {
|
9
|
-
import {OBJECTLINK_KEY_UPDATER} from "./constants.js";
|
10
|
-
import {Monster, CustomElement} from "./customelement.js";
|
8
|
+
import { CustomElement} from "./customelement.js";
|
11
9
|
|
12
10
|
|
13
11
|
/**
|
@@ -29,7 +27,7 @@ const internalSymbol = Symbol('internalSymbol');
|
|
29
27
|
*
|
30
28
|
* ```
|
31
29
|
* <script type="module">
|
32
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
30
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/customcontrol.js';
|
33
31
|
* console.log(new Monster.DOM.CustomControl())
|
34
32
|
* </script>
|
35
33
|
* ```
|
@@ -38,7 +36,7 @@ const internalSymbol = Symbol('internalSymbol');
|
|
38
36
|
*
|
39
37
|
* ```
|
40
38
|
* <script type="module">
|
41
|
-
* import {CustomControl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
39
|
+
* import {CustomControl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.15.0/dist/modules/dom/customcontrol.js';
|
42
40
|
* console.log(new CustomControl())
|
43
41
|
* </script>
|
44
42
|
* ```
|
@@ -59,7 +57,7 @@ class CustomControl extends CustomElement {
|
|
59
57
|
constructor() {
|
60
58
|
super();
|
61
59
|
|
62
|
-
if (typeof this['attachInternals'] === 'function'
|
60
|
+
if (typeof this['attachInternals'] === 'function') {
|
63
61
|
// currently only supported by chrome
|
64
62
|
this[internalSymbol] = this.attachInternals();
|
65
63
|
}
|
@@ -67,15 +65,15 @@ class CustomControl extends CustomElement {
|
|
67
65
|
}
|
68
66
|
|
69
67
|
/**
|
70
|
-
* | option | description
|
71
|
-
*
|
72
|
-
* |
|
68
|
+
* | option | description |
|
69
|
+
* |----------------|---------------------------------|
|
70
|
+
* | | |
|
73
71
|
*
|
74
72
|
* Derived classes can override and extend this method as follows.
|
75
73
|
*
|
76
74
|
* ```
|
77
75
|
* get defaults() {
|
78
|
-
* return
|
76
|
+
* return extends{}, super.defaults, {
|
79
77
|
* myValue:true
|
80
78
|
* });
|
81
79
|
* }
|
@@ -83,45 +81,11 @@ class CustomControl extends CustomElement {
|
|
83
81
|
*
|
84
82
|
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-face-example
|
85
83
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/attachInternals
|
86
|
-
* @return {
|
84
|
+
* @return {object}
|
87
85
|
* @since 1.14.0
|
88
86
|
*/
|
89
87
|
get defaults() {
|
90
|
-
|
91
|
-
return Object.assign({}, super.defaults, {
|
92
|
-
formAssociated: true
|
93
|
-
});
|
94
|
-
|
95
|
-
}
|
96
|
-
|
97
|
-
/**
|
98
|
-
* This method determines which attributes are to be monitored by `attributeChangedCallback()`.
|
99
|
-
*
|
100
|
-
* @return {string[]}
|
101
|
-
* @since 1.14.0
|
102
|
-
*/
|
103
|
-
static get observedAttributes() {
|
104
|
-
return [];
|
105
|
-
}
|
106
|
-
|
107
|
-
/**
|
108
|
-
* This method can be implemented in a derived class. The attributes must be defined in `observedAttributes()`.
|
109
|
-
*
|
110
|
-
* @param {string} name
|
111
|
-
* @param {string} oldValue
|
112
|
-
* @param {string} newValue
|
113
|
-
* @since 1.14.0
|
114
|
-
* @throws {Error} attributes but no handles have been defined
|
115
|
-
*/
|
116
|
-
attributeChangedCallback(name, oldValue, newValue) {
|
117
|
-
|
118
|
-
const a = this.constructor.observedAttributes();
|
119
|
-
|
120
|
-
if (!a || (isArray(a) && a.length > 0)) {
|
121
|
-
throw new Error('attributes but no handles have been defined');
|
122
|
-
}
|
123
|
-
|
124
|
-
|
88
|
+
return extend({}, super.defaults);
|
125
89
|
}
|
126
90
|
|
127
91
|
/**
|
@@ -325,13 +289,13 @@ class CustomControl extends CustomElement {
|
|
325
289
|
*/
|
326
290
|
function getInternal() {
|
327
291
|
const self = this;
|
328
|
-
|
292
|
+
|
329
293
|
if (!(internalSymbol in this)) {
|
330
|
-
throw new Error('
|
294
|
+
throw new Error('ElementInternals is not supported and a polyfill is necessary');
|
331
295
|
}
|
332
296
|
|
333
297
|
return this[internalSymbol];
|
334
298
|
}
|
335
299
|
|
336
|
-
|
300
|
+
assignToNamespace('Monster.DOM', CustomControl);
|
337
301
|
export {Monster, CustomControl}
|