@schukai/monster 1.15.5 → 1.17.1
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG +25 -0
- package/README.md +4 -4
- package/dist/modules/constants.js +1 -1
- package/dist/modules/constraints/abstract.js +1 -1
- package/dist/modules/constraints/abstractoperator.js +1 -1
- package/dist/modules/constraints/andoperator.js +1 -1
- package/dist/modules/constraints/invalid.js +1 -1
- package/dist/modules/constraints/isarray.js +1 -1
- package/dist/modules/constraints/isobject.js +1 -1
- package/dist/modules/constraints/namespace.js +2 -2
- package/dist/modules/constraints/oroperator.js +1 -1
- package/dist/modules/constraints/valid.js +1 -1
- package/dist/modules/data/buildmap.js +2 -2
- package/dist/modules/data/diff.js +2 -2
- package/dist/modules/data/extend.js +1 -1
- package/dist/modules/data/namespace.js +2 -2
- package/dist/modules/data/pathfinder.js +2 -2
- package/dist/modules/data/pipe.js +1 -1
- package/dist/modules/data/transformer.js +1 -1
- package/dist/modules/dom/assembler.js +1 -1
- package/dist/modules/dom/attributes.js +1 -1
- package/dist/modules/dom/constants.js +1 -1
- package/dist/modules/dom/customcontrol.js +1 -1
- package/dist/modules/dom/customelement.js +1 -1
- package/dist/modules/dom/events.js +1 -1
- package/dist/modules/dom/locale.js +1 -1
- package/dist/modules/dom/namespace.js +2 -2
- package/dist/modules/dom/template.js +1 -1
- package/dist/modules/dom/theme.js +1 -1
- package/dist/modules/dom/updater.js +1 -1
- package/dist/modules/dom/util.js +1 -1
- package/dist/modules/i18n/locale.js +1 -1
- package/dist/modules/i18n/namespace.js +2 -2
- package/dist/modules/i18n/provider.js +1 -1
- package/dist/modules/i18n/providers/fetch.js +1 -1
- package/dist/modules/i18n/providers/namespace.js +2 -2
- package/dist/modules/i18n/translations.js +1 -1
- package/dist/modules/logging/handler/console.js +2 -2
- package/dist/modules/logging/handler/namespace.js +2 -2
- package/dist/modules/logging/handler.js +1 -1
- package/dist/modules/logging/logentry.js +1 -1
- package/dist/modules/logging/logger.js +1 -1
- package/dist/modules/logging/namespace.js +2 -2
- package/dist/modules/math/namespace.js +2 -2
- package/dist/modules/math/random.js +1 -1
- package/dist/modules/monster.js +1 -1
- package/dist/modules/namespace.js +1 -1
- package/dist/modules/text/formatter.js +1 -1
- package/dist/modules/text/namespace.js +2 -2
- package/dist/modules/types/base.js +1 -1
- package/dist/modules/types/basewithoptions.js +1 -1
- package/dist/modules/types/global.js +1 -1
- package/dist/modules/types/id.js +1 -1
- package/dist/modules/types/is.js +1 -1
- package/dist/modules/types/namespace.js +2 -2
- package/dist/modules/types/observer.js +1 -1
- package/dist/modules/types/observerlist.js +1 -1
- package/dist/modules/types/proxyobserver.js +1 -1
- package/dist/modules/types/queue.js +1 -1
- package/dist/modules/types/randomid.js +1 -1
- package/dist/modules/types/stack.js +1 -1
- package/dist/modules/types/tokenlist.js +1 -1
- package/dist/modules/types/typeof.js +1 -1
- package/dist/modules/types/uniquequeue.js +1 -1
- package/dist/modules/types/validate.js +1 -1
- package/dist/modules/types/version.js +2 -2
- package/dist/modules/util/clone.js +1 -1
- package/dist/modules/util/comparator.js +1 -1
- package/dist/modules/util/freeze.js +1 -1
- package/dist/modules/util/namespace.js +2 -2
- package/dist/monster.dev.js +1293 -943
- package/dist/monster.dev.js.map +1 -1
- package/dist/monster.js +2 -2
- package/package.json +1 -1
- package/source/constraints/abstract.js +1 -1
- package/source/constraints/abstractoperator.js +1 -1
- package/source/constraints/andoperator.js +6 -6
- package/source/constraints/invalid.js +4 -4
- package/source/constraints/isarray.js +4 -4
- package/source/constraints/isobject.js +4 -4
- package/source/constraints/namespace.js +3 -2
- package/source/constraints/oroperator.js +6 -6
- package/source/constraints/valid.js +4 -4
- package/source/data/buildmap.js +245 -12
- package/source/data/diff.js +7 -6
- package/source/data/extend.js +3 -3
- package/source/data/namespace.js +3 -2
- package/source/data/pathfinder.js +15 -11
- package/source/data/pipe.js +4 -4
- package/source/data/transformer.js +4 -4
- package/source/dom/assembler.js +4 -4
- package/source/dom/attributes.js +36 -46
- package/source/dom/constants.js +16 -14
- package/source/dom/customcontrol.js +12 -8
- package/source/dom/customelement.js +24 -11
- package/source/dom/events.js +6 -6
- package/source/dom/locale.js +5 -4
- package/source/dom/namespace.js +3 -2
- package/source/dom/template.js +6 -6
- package/source/dom/theme.js +5 -4
- package/source/dom/updater.js +11 -5
- package/source/dom/util.js +9 -9
- package/source/i18n/locale.js +27 -15
- package/source/i18n/namespace.js +3 -2
- package/source/i18n/provider.js +3 -3
- package/source/i18n/providers/fetch.js +22 -6
- package/source/i18n/providers/namespace.js +3 -2
- package/source/i18n/translations.js +3 -3
- package/source/logging/handler/console.js +34 -10
- package/source/logging/handler/namespace.js +3 -2
- package/source/logging/handler.js +4 -4
- package/source/logging/logentry.js +5 -5
- package/source/logging/logger.js +13 -13
- package/source/logging/namespace.js +3 -2
- package/source/math/namespace.js +3 -2
- package/source/math/random.js +3 -3
- package/source/namespace.js +1 -1
- package/source/text/formatter.js +3 -3
- package/source/text/namespace.js +3 -2
- package/source/types/base.js +3 -3
- package/source/types/basewithoptions.js +3 -3
- package/source/types/global.js +7 -7
- package/source/types/id.js +3 -3
- package/source/types/is.js +30 -30
- package/source/types/namespace.js +3 -2
- package/source/types/observer.js +4 -4
- package/source/types/observerlist.js +3 -3
- package/source/types/proxyobserver.js +6 -6
- package/source/types/queue.js +4 -4
- package/source/types/randomid.js +3 -3
- package/source/types/stack.js +3 -3
- package/source/types/tokenlist.js +3 -3
- package/source/types/typeof.js +4 -4
- package/source/types/uniquequeue.js +3 -3
- package/source/types/validate.js +34 -34
- package/source/types/version.js +7 -7
- package/source/util/clone.js +3 -3
- package/source/util/comparator.js +37 -7
- package/source/util/freeze.js +4 -4
- package/source/util/namespace.js +3 -2
- package/test/cases/data/buildmap.js +242 -16
- package/test/cases/data/diff.js +36 -3
- package/test/cases/data/pathfinder.js +298 -196
- package/test/cases/logging/handler/console.js +20 -0
- package/test/cases/monster.js +1 -1
- package/test/web/import.js +1 -0
- package/test/web/monster-dev.html +3 -3
- package/test/web/monster.html +2 -2
- package/test/web/test.html +2 -2
- package/test/web/tests.js +3 -3
@@ -27,7 +27,7 @@ const internalSymbol = Symbol('internalSymbol');
|
|
27
27
|
*
|
28
28
|
* ```
|
29
29
|
* <script type="module">
|
30
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
30
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/customcontrol.js';
|
31
31
|
* console.log(new Monster.DOM.CustomControl())
|
32
32
|
* </script>
|
33
33
|
* ```
|
@@ -36,29 +36,36 @@ const internalSymbol = Symbol('internalSymbol');
|
|
36
36
|
*
|
37
37
|
* ```
|
38
38
|
* <script type="module">
|
39
|
-
* import {CustomControl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
39
|
+
* import {CustomControl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/customcontrol.js';
|
40
40
|
* console.log(new CustomControl())
|
41
41
|
* </script>
|
42
42
|
* ```
|
43
43
|
*
|
44
|
+
* @summary A base class for customcontrols
|
44
45
|
* @see https://www.npmjs.com/package/element-internals-polyfill
|
45
46
|
* @see https://github.com/WICG/webcomponents
|
46
47
|
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements
|
47
48
|
* @since 1.14.0
|
48
49
|
* @copyright schukai GmbH
|
49
|
-
* @memberOf Monster
|
50
|
+
* @memberOf Monster.DOM
|
50
51
|
*/
|
51
52
|
class CustomControl extends CustomElement {
|
52
53
|
|
53
54
|
/**
|
55
|
+
* IMPORTANT: CustomControls instances are not created via the constructor, but either via a tag in the HTML or via <code>document.createElement()</code>.
|
54
56
|
*
|
55
57
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
58
|
+
* @summary create new Instance
|
56
59
|
*/
|
57
60
|
constructor() {
|
58
61
|
super();
|
59
62
|
|
60
63
|
if (typeof this['attachInternals'] === 'function') {
|
61
|
-
|
64
|
+
/**
|
65
|
+
* currently only supported by chrome
|
66
|
+
* @property {Object}
|
67
|
+
* @private
|
68
|
+
*/
|
62
69
|
this[internalSymbol] = this.attachInternals();
|
63
70
|
}
|
64
71
|
|
@@ -75,10 +82,6 @@ class CustomControl extends CustomElement {
|
|
75
82
|
}
|
76
83
|
|
77
84
|
/**
|
78
|
-
* | option | description |
|
79
|
-
* |----------------|---------------------------------|
|
80
|
-
* | | |
|
81
|
-
*
|
82
85
|
* Derived classes can override and extend this method as follows.
|
83
86
|
*
|
84
87
|
* ```
|
@@ -284,6 +287,7 @@ class CustomControl extends CustomElement {
|
|
284
287
|
* @private
|
285
288
|
* @return {object}
|
286
289
|
* @throws {Error} the ElementInternals is not supported and a polyfill is necessary
|
290
|
+
* @this CustomControl
|
287
291
|
*/
|
288
292
|
function getInternal() {
|
289
293
|
const self = this;
|
@@ -31,15 +31,25 @@ const internalDataSymbol = Symbol.for(PROPERTY_KEY_INTERNALDATA);
|
|
31
31
|
const objectLinkSymbol = Symbol.for(OBJECTLINK_KEY_UPDATER);
|
32
32
|
|
33
33
|
/**
|
34
|
+
* @memberOf Monster.DOM
|
34
35
|
* @type {symbol}
|
35
36
|
*/
|
36
37
|
const initMethodSymbol = Symbol('initMethodSymbol');
|
37
38
|
|
38
39
|
/**
|
40
|
+
* @memberOf Monster.DOM
|
39
41
|
* @type {symbol}
|
40
42
|
*/
|
41
43
|
const assembleMethodSymbol = Symbol('assembleMethodSymbol');
|
42
44
|
|
45
|
+
|
46
|
+
/**
|
47
|
+
* HTMLElement
|
48
|
+
* @external HTMLElement
|
49
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement
|
50
|
+
*/
|
51
|
+
|
52
|
+
|
43
53
|
/**
|
44
54
|
* To define a new HTML element we need the power of CustomElement
|
45
55
|
*
|
@@ -50,7 +60,7 @@ const assembleMethodSymbol = Symbol('assembleMethodSymbol');
|
|
50
60
|
*
|
51
61
|
* ```
|
52
62
|
* <script type="module">
|
53
|
-
* import {CustomElement} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
63
|
+
* import {CustomElement} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/customelement.js';
|
54
64
|
* console.log(new Monster.DOM.CustomElement())
|
55
65
|
* </script>
|
56
66
|
* ```
|
@@ -59,7 +69,7 @@ const assembleMethodSymbol = Symbol('assembleMethodSymbol');
|
|
59
69
|
*
|
60
70
|
* ```
|
61
71
|
* <script type="module">
|
62
|
-
* import {CustomElement} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
72
|
+
* import {CustomElement} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/customelement.js';
|
63
73
|
* console.log(new CustomElement())
|
64
74
|
* </script>
|
65
75
|
* ```
|
@@ -144,7 +154,8 @@ const assembleMethodSymbol = Symbol('assembleMethodSymbol');
|
|
144
154
|
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements
|
145
155
|
* @since 1.7.0
|
146
156
|
* @copyright schukai GmbH
|
147
|
-
* @memberOf Monster
|
157
|
+
* @memberOf Monster.DOM
|
158
|
+
* @extends external:HTMLElement
|
148
159
|
*/
|
149
160
|
class CustomElement extends HTMLElement {
|
150
161
|
|
@@ -173,11 +184,6 @@ class CustomElement extends HTMLElement {
|
|
173
184
|
}
|
174
185
|
|
175
186
|
/**
|
176
|
-
* | option | description |
|
177
|
-
* |----------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
178
|
-
* | shadowMode | `open` Elements of the shadow root are accessible from JavaScript outside the root, for example using. `close` Denies access to the node(s) of a closed shadow root from JavaScript outside it |
|
179
|
-
* | delegatesFocus | A boolean that, when set to true, specifies behavior that mitigates custom element issues around focusability. When a non-focusable part of the shadow DOM is clicked, the first focusable part is given focus, and the shadow host is given any available :focus styling. |
|
180
|
-
* | templates.main | Main template |
|
181
187
|
*
|
182
188
|
* Derived classes can override and extend this method as follows.
|
183
189
|
*
|
@@ -189,6 +195,11 @@ class CustomElement extends HTMLElement {
|
|
189
195
|
* }
|
190
196
|
* ```
|
191
197
|
*
|
198
|
+
* @property {string} shadowMode=open `open` Elements of the shadow root are accessible from JavaScript outside the root, for example using. `close` Denies access to the node(s) of a closed shadow root from JavaScript outside it
|
199
|
+
* @property {Boolean} delegatesFocus=true A boolean that, when set to true, specifies behavior that mitigates custom element issues around focusability. When a non-focusable part of the shadow DOM is clicked, the first focusable part is given focus, and the shadow host is given any available :focus styling.
|
200
|
+
* @property {Object} templates Templates
|
201
|
+
* @property {string} templates.main=undefined Main template
|
202
|
+
*
|
192
203
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow
|
193
204
|
* @return {{shadowMode: string, delegatesFocus: boolean}}
|
194
205
|
* @since 1.8.0
|
@@ -439,6 +450,7 @@ class CustomElement extends HTMLElement {
|
|
439
450
|
/**
|
440
451
|
* @since 1.15.0
|
441
452
|
* @private
|
453
|
+
* @this CustomElement
|
442
454
|
*/
|
443
455
|
function initOptionObserver() {
|
444
456
|
const self = this;
|
@@ -520,7 +532,8 @@ function initHtmlContent() {
|
|
520
532
|
/**
|
521
533
|
* @private
|
522
534
|
* @return {CustomElement}
|
523
|
-
* @memberOf Monster
|
535
|
+
* @memberOf Monster.DOM
|
536
|
+
* @this CustomElement
|
524
537
|
* @since 1.16.0
|
525
538
|
*/
|
526
539
|
function initCSSStylesheet() {
|
@@ -550,7 +563,7 @@ function initCSSStylesheet() {
|
|
550
563
|
* @return {CustomElement}
|
551
564
|
* @throws {Error} html is not set.
|
552
565
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow
|
553
|
-
* @memberOf Monster
|
566
|
+
* @memberOf Monster.DOM
|
554
567
|
* @since 1.8.0
|
555
568
|
*/
|
556
569
|
function initShadowRoot() {
|
@@ -589,7 +602,7 @@ function initShadowRoot() {
|
|
589
602
|
* @return {void}
|
590
603
|
* @since 1.7.0
|
591
604
|
* @copyright schukai GmbH
|
592
|
-
* @memberOf Monster
|
605
|
+
* @memberOf Monster.DOM
|
593
606
|
* @throws {DOMException} Failed to execute 'define' on 'CustomElementRegistry': is not a valid custom element name
|
594
607
|
*/
|
595
608
|
function registerCustomElement(element) {
|
package/source/dom/events.js
CHANGED
@@ -13,7 +13,7 @@ import {getDocument} from "./util.js";
|
|
13
13
|
*
|
14
14
|
* ```
|
15
15
|
* <script type="module">
|
16
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
16
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/events.js';
|
17
17
|
* console.log(new Monster.DOM.fireEvent())
|
18
18
|
* </script>
|
19
19
|
* ```
|
@@ -22,7 +22,7 @@ import {getDocument} from "./util.js";
|
|
22
22
|
*
|
23
23
|
* ```
|
24
24
|
* <script type="module">
|
25
|
-
* import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
25
|
+
* import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/events.js';
|
26
26
|
* console.log(fireEvent())
|
27
27
|
* </script>
|
28
28
|
* ```
|
@@ -32,7 +32,7 @@ import {getDocument} from "./util.js";
|
|
32
32
|
* @return {void}
|
33
33
|
* @since 1.10.0
|
34
34
|
* @copyright schukai GmbH
|
35
|
-
* @memberOf Monster
|
35
|
+
* @memberOf Monster.DOM
|
36
36
|
* @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection
|
37
37
|
*/
|
38
38
|
function fireEvent(element, type) {
|
@@ -71,7 +71,7 @@ function fireEvent(element, type) {
|
|
71
71
|
*
|
72
72
|
* ```
|
73
73
|
* <script type="module">
|
74
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
74
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/events.js';
|
75
75
|
* console.log(new Monster.DOM.findTargetElementFromEvent())
|
76
76
|
* </script>
|
77
77
|
* ```
|
@@ -80,7 +80,7 @@ function fireEvent(element, type) {
|
|
80
80
|
*
|
81
81
|
* ```
|
82
82
|
* <script type="module">
|
83
|
-
* import {findTargetElementFromEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
83
|
+
* import {findTargetElementFromEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/events.js';
|
84
84
|
* console.log(findTargetElementFromEvent())
|
85
85
|
* </script>
|
86
86
|
* ```
|
@@ -90,7 +90,7 @@ function fireEvent(element, type) {
|
|
90
90
|
* @param {string} attributeName
|
91
91
|
* @param {string|null} attributeValue
|
92
92
|
* @throws {Error} unsupported event
|
93
|
-
* @memberOf Monster
|
93
|
+
* @memberOf Monster.DOM
|
94
94
|
* @throws {TypeError} value is not a string
|
95
95
|
* @throws {TypeError} value is not an instance of HTMLElement
|
96
96
|
*/
|
package/source/dom/locale.js
CHANGED
@@ -8,19 +8,20 @@ import {assignToNamespace, Monster} from '../namespace.js';
|
|
8
8
|
import {getDocument} from "./util.js";
|
9
9
|
|
10
10
|
/**
|
11
|
+
* @private
|
11
12
|
* @type {string}
|
12
13
|
*/
|
13
14
|
const DEFAULT_LANGUAGE = 'en';
|
14
15
|
|
15
16
|
/**
|
16
17
|
* With this function you can read the language version set by the document.
|
17
|
-
* For this the
|
18
|
+
* For this the attribute `lang` in the html tag is read. If no attribute is set, `en` is used as default.
|
18
19
|
*
|
19
20
|
* You can call the function via the monster namespace `new Monster.DOM.getLocaleOfDocument()`.
|
20
21
|
*
|
21
22
|
* ```
|
22
23
|
* <script type="module">
|
23
|
-
* import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
24
|
+
* import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/locale.js';
|
24
25
|
* console.log(new Monster.DOM.getLocaleOfDocument())
|
25
26
|
* </script>
|
26
27
|
* ```
|
@@ -29,14 +30,14 @@ const DEFAULT_LANGUAGE = 'en';
|
|
29
30
|
*
|
30
31
|
* ```
|
31
32
|
* <script type="module">
|
32
|
-
* import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
33
|
+
* import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/locale.js';
|
33
34
|
* console.log(new getLocaleOfDocument())
|
34
35
|
* </script>
|
35
36
|
* ```
|
36
37
|
*
|
37
38
|
* @since 1.13.0
|
38
39
|
* @copyright schukai GmbH
|
39
|
-
* @memberOf Monster
|
40
|
+
* @memberOf Monster.DOM
|
40
41
|
* @throws {TypeError} value is not a string
|
41
42
|
* @throws {Error} unsupported locale
|
42
43
|
*/
|
package/source/dom/namespace.js
CHANGED
@@ -3,7 +3,8 @@
|
|
3
3
|
/**
|
4
4
|
* In this namespace you will find classes and methods for handling the DOM.
|
5
5
|
*
|
6
|
-
* @namespace Monster
|
6
|
+
* @namespace Monster.DOM
|
7
|
+
* @memberOf Monster
|
7
8
|
* @author schukai GmbH
|
8
9
|
*/
|
9
10
|
|
@@ -11,4 +12,4 @@
|
|
11
12
|
* @private
|
12
13
|
* @type {string}
|
13
14
|
*/
|
14
|
-
const namespace = "Monster.DOM";
|
15
|
+
export const namespace = "Monster.DOM";
|
package/source/dom/template.js
CHANGED
@@ -14,7 +14,7 @@ import {getDocumentTheme} from "./theme.js";
|
|
14
14
|
*
|
15
15
|
* ```
|
16
16
|
* <script type="module">
|
17
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
17
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/template.js';
|
18
18
|
* console.log(new Monster.DOM.Template())
|
19
19
|
* </script>
|
20
20
|
* ```
|
@@ -23,14 +23,14 @@ import {getDocumentTheme} from "./theme.js";
|
|
23
23
|
*
|
24
24
|
* ```
|
25
25
|
* <script type="module">
|
26
|
-
* import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
26
|
+
* import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/template.js';
|
27
27
|
* console.log(new Template())
|
28
28
|
* </script>
|
29
29
|
* ```
|
30
30
|
*
|
31
31
|
* @since 1.6.0
|
32
32
|
* @copyright schukai GmbH
|
33
|
-
* @memberOf Monster
|
33
|
+
* @memberOf Monster.DOM
|
34
34
|
*/
|
35
35
|
class Template extends Base {
|
36
36
|
/**
|
@@ -73,7 +73,7 @@ class Template extends Base {
|
|
73
73
|
*
|
74
74
|
* ```
|
75
75
|
* <script type="module">
|
76
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
76
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/template.js';
|
77
77
|
* console.log(Monster.DOM.findDocumentTemplate())
|
78
78
|
* </script>
|
79
79
|
* ```
|
@@ -82,7 +82,7 @@ class Template extends Base {
|
|
82
82
|
*
|
83
83
|
* ```
|
84
84
|
* <script type="module">
|
85
|
-
* import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
85
|
+
* import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/template.js';
|
86
86
|
* console.log(findDocumentTemplate())
|
87
87
|
* </script>
|
88
88
|
* ```
|
@@ -92,7 +92,7 @@ class Template extends Base {
|
|
92
92
|
* @return {Template}
|
93
93
|
* @since 1.7.0
|
94
94
|
* @copyright schukai GmbH
|
95
|
-
* @memberOf Monster
|
95
|
+
* @memberOf Monster.DOM
|
96
96
|
* @throws {Error} template id not found.
|
97
97
|
* @throws {TypeError} value is not a string
|
98
98
|
*/
|
package/source/dom/theme.js
CHANGED
@@ -15,7 +15,7 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js";
|
|
15
15
|
*
|
16
16
|
* ```
|
17
17
|
* <script type="module">
|
18
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
18
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/theme.js';
|
19
19
|
* console.log(new Monster.DOM.Theme())
|
20
20
|
* </script>
|
21
21
|
* ```
|
@@ -24,14 +24,14 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js";
|
|
24
24
|
*
|
25
25
|
* ```
|
26
26
|
* <script type="module">
|
27
|
-
* import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
27
|
+
* import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/theme.js';
|
28
28
|
* console.log(new Theme())
|
29
29
|
* </script>
|
30
30
|
* ```
|
31
31
|
*
|
32
32
|
* @example
|
33
33
|
*
|
34
|
-
* import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
34
|
+
* import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/theme.js';
|
35
35
|
*
|
36
36
|
* const theme = getDocumentTheme();
|
37
37
|
* console.log(theme.getName());
|
@@ -39,7 +39,7 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js";
|
|
39
39
|
*
|
40
40
|
* @since 1.7.0
|
41
41
|
* @copyright schukai GmbH
|
42
|
-
* @memberOf Monster
|
42
|
+
* @memberOf Monster.DOM
|
43
43
|
*/
|
44
44
|
class Theme extends Base {
|
45
45
|
|
@@ -77,6 +77,7 @@ class Theme extends Base {
|
|
77
77
|
* the default theme name is `monster`.
|
78
78
|
*
|
79
79
|
* @return {Theme}
|
80
|
+
* @memberOf Monster.DOM
|
80
81
|
* @since 1.7.0
|
81
82
|
*/
|
82
83
|
function getDocumentTheme() {
|
package/source/dom/updater.js
CHANGED
@@ -34,7 +34,7 @@ import {getDocument} from "./util.js";
|
|
34
34
|
*
|
35
35
|
* ```
|
36
36
|
* <script type="module">
|
37
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
37
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/updater.js';
|
38
38
|
* console.log(new Monster.DOM.Updater())
|
39
39
|
* </script>
|
40
40
|
* ```
|
@@ -43,14 +43,14 @@ import {getDocument} from "./util.js";
|
|
43
43
|
*
|
44
44
|
* ```
|
45
45
|
* <script type="module">
|
46
|
-
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
46
|
+
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/updater.js';
|
47
47
|
* console.log(new Updater())
|
48
48
|
* </script>
|
49
49
|
* ```
|
50
50
|
*
|
51
51
|
* @example
|
52
52
|
*
|
53
|
-
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
53
|
+
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/updater.js';
|
54
54
|
*
|
55
55
|
* // First we prepare the html document.
|
56
56
|
* // This is done here via script, but can also be inserted into the document as pure html.
|
@@ -76,7 +76,7 @@ import {getDocument} from "./util.js";
|
|
76
76
|
*
|
77
77
|
* @since 1.8.0
|
78
78
|
* @copyright schukai GmbH
|
79
|
-
* @memberOf Monster
|
79
|
+
* @memberOf Monster.DOM
|
80
80
|
* @throws {Error} the value is not iterable
|
81
81
|
* @throws {Error} pipes are not allowed when cloning a node.
|
82
82
|
* @throws {Error} no template was found with the specified key.
|
@@ -244,7 +244,8 @@ class Updater extends Base {
|
|
244
244
|
/**
|
245
245
|
* @private
|
246
246
|
* @since 1.9.0
|
247
|
-
* @return {function
|
247
|
+
* @return {function
|
248
|
+
* @this Updater
|
248
249
|
*/
|
249
250
|
function getCheckStateCallback() {
|
250
251
|
const self = this;
|
@@ -275,6 +276,7 @@ const symbol = Symbol('EventHandler');
|
|
275
276
|
/**
|
276
277
|
* @private
|
277
278
|
* @return {function}
|
279
|
+
* @this Updater
|
278
280
|
*/
|
279
281
|
function getControlEventHandler() {
|
280
282
|
|
@@ -385,6 +387,7 @@ function removeElement(change) {
|
|
385
387
|
* @throws {Error} pipes are not allowed when cloning a node.
|
386
388
|
* @throws {Error} no template was found with the specified key.
|
387
389
|
* @throws {Error} the maximum depth for the recursion is reached.
|
390
|
+
* @this Updater
|
388
391
|
*/
|
389
392
|
function insertElement(change) {
|
390
393
|
const self = this;
|
@@ -539,6 +542,7 @@ function applyRecursive(node, key, path) {
|
|
539
542
|
* @since 1.8.0
|
540
543
|
* @param {object} change
|
541
544
|
* @return {void}
|
545
|
+
* @this Updater
|
542
546
|
*/
|
543
547
|
function updateContent(change) {
|
544
548
|
const self = this;
|
@@ -615,6 +619,7 @@ function updateAttributes(change) {
|
|
615
619
|
* @param {array} parts
|
616
620
|
* @param {object} subject
|
617
621
|
* @return {void}
|
622
|
+
* @this Updater
|
618
623
|
*/
|
619
624
|
function runUpdateAttributes(container, parts, subject) {
|
620
625
|
|
@@ -673,6 +678,7 @@ function runUpdateAttributes(container, parts, subject) {
|
|
673
678
|
* @param {string} name
|
674
679
|
* @param {string|number|undefined} value
|
675
680
|
* @return {void}
|
681
|
+
* @this Updater
|
676
682
|
*/
|
677
683
|
|
678
684
|
function handleInputControlAttributeUpdate(element, name, value) {
|
package/source/dom/util.js
CHANGED
@@ -13,7 +13,7 @@ import {validateString} from "../types/validate.js";
|
|
13
13
|
*
|
14
14
|
* ```
|
15
15
|
* <script type="module">
|
16
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
16
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/util.js';
|
17
17
|
* console.log(Monster.DOM.getDocument())
|
18
18
|
* </script>
|
19
19
|
* ```
|
@@ -22,7 +22,7 @@ import {validateString} from "../types/validate.js";
|
|
22
22
|
*
|
23
23
|
* ```
|
24
24
|
* <script type="module">
|
25
|
-
* import {getDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
25
|
+
* import {getDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/util.js';
|
26
26
|
* console.log(getDocument())
|
27
27
|
* </script>
|
28
28
|
* ```
|
@@ -57,7 +57,7 @@ import {validateString} from "../types/validate.js";
|
|
57
57
|
* @returns {object}
|
58
58
|
* @since 1.6.0
|
59
59
|
* @copyright schukai GmbH
|
60
|
-
* @memberOf Monster
|
60
|
+
* @memberOf Monster.DOM
|
61
61
|
* @throws {Error} not supported environment
|
62
62
|
*/
|
63
63
|
function getDocument() {
|
@@ -74,7 +74,7 @@ function getDocument() {
|
|
74
74
|
*
|
75
75
|
* ```
|
76
76
|
* <script type="module">
|
77
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
77
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/util.js';
|
78
78
|
* console.log(Monster.DOM.getWindow())
|
79
79
|
* </script>
|
80
80
|
* ```
|
@@ -83,7 +83,7 @@ function getDocument() {
|
|
83
83
|
*
|
84
84
|
* ```
|
85
85
|
* <script type="module">
|
86
|
-
* import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
86
|
+
* import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/util.js';
|
87
87
|
* console.log(getWindow(null))
|
88
88
|
* </script>
|
89
89
|
* ```
|
@@ -120,7 +120,7 @@ function getDocument() {
|
|
120
120
|
* @returns {object}
|
121
121
|
* @since 1.6.0
|
122
122
|
* @copyright schukai GmbH
|
123
|
-
* @memberOf Monster
|
123
|
+
* @memberOf Monster.DOM
|
124
124
|
* @throws {Error} not supported environment
|
125
125
|
*/
|
126
126
|
function getWindow() {
|
@@ -140,7 +140,7 @@ function getWindow() {
|
|
140
140
|
*
|
141
141
|
* ```
|
142
142
|
* <script type="module">
|
143
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
143
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/util.js';
|
144
144
|
* console.log(Monster.DOM.getDocumentFragmentFromString())
|
145
145
|
* </script>
|
146
146
|
* ```
|
@@ -149,7 +149,7 @@ function getWindow() {
|
|
149
149
|
*
|
150
150
|
* ```
|
151
151
|
* <script type="module">
|
152
|
-
* import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
152
|
+
* import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/dom/util.js';
|
153
153
|
* console.log(getDocumentFragmentFromString('<div></div>'))
|
154
154
|
* </script>
|
155
155
|
* ```
|
@@ -184,7 +184,7 @@ function getWindow() {
|
|
184
184
|
* @returns {DocumentFragment}
|
185
185
|
* @since 1.6.0
|
186
186
|
* @copyright schukai GmbH
|
187
|
-
* @memberOf Monster
|
187
|
+
* @memberOf Monster.DOM
|
188
188
|
* @throws {Error} not supported environment
|
189
189
|
* @throws {TypeError} value is not a string
|
190
190
|
*/
|
package/source/i18n/locale.js
CHANGED
@@ -9,30 +9,32 @@ import {validateString} from "../types/validate.js";
|
|
9
9
|
import {clone} from "../util/clone.js";
|
10
10
|
|
11
11
|
/**
|
12
|
+
* @memberOf Monster.I18n
|
12
13
|
* @type {symbol}
|
13
14
|
*/
|
14
15
|
const propertiesSymbol = Symbol('properties');
|
15
16
|
|
16
17
|
/**
|
17
18
|
* @type {symbol}
|
19
|
+
* @memberOf Monster.I18n
|
18
20
|
*/
|
19
21
|
const localeStringSymbol = Symbol('localeString');
|
20
22
|
|
21
23
|
/**
|
22
|
-
* You can
|
24
|
+
* You can create an instance via the monster namespace `new Monster.I18n.Locale()`.
|
23
25
|
*
|
24
26
|
* ```
|
25
27
|
* <script type="module">
|
26
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
28
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/i18n/locale.js';
|
27
29
|
* console.log(new Monster.I18n.Locale())
|
28
30
|
* </script>
|
29
31
|
* ```
|
30
32
|
*
|
31
|
-
* Alternatively, you can also integrate this
|
33
|
+
* Alternatively, you can also integrate this class individually.
|
32
34
|
*
|
33
35
|
* ```
|
34
36
|
* <script type="module">
|
35
|
-
* import {Locale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
37
|
+
* import {Locale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/i18n/locale.js';
|
36
38
|
* console.log(new Locale())
|
37
39
|
* </script>
|
38
40
|
* ```
|
@@ -70,18 +72,18 @@ const localeStringSymbol = Symbol('localeString');
|
|
70
72
|
*
|
71
73
|
* @since 1.13.0
|
72
74
|
* @copyright schukai GmbH
|
73
|
-
* @memberOf Monster
|
75
|
+
* @memberOf Monster.I18n
|
74
76
|
* @see https://datatracker.ietf.org/doc/html/rfc3066
|
75
77
|
*/
|
76
78
|
class Locale extends Base {
|
77
79
|
|
78
80
|
/**
|
79
|
-
* @param {string
|
80
|
-
* @param {string
|
81
|
-
* @param {string
|
82
|
-
* @param {string
|
83
|
-
* @param {string
|
84
|
-
* @param {string
|
81
|
+
* @param {string} language
|
82
|
+
* @param {string} [region]
|
83
|
+
* @param {string} [script]
|
84
|
+
* @param {string} [variants]
|
85
|
+
* @param {string} [extlang]
|
86
|
+
* @param {string} [privateUse]
|
85
87
|
* @throws {Error} unsupported locale
|
86
88
|
*/
|
87
89
|
constructor(language, region, script, variants, extlang, privateUse) {
|
@@ -170,7 +172,7 @@ class Locale extends Base {
|
|
170
172
|
}
|
171
173
|
|
172
174
|
/**
|
173
|
-
* @return {
|
175
|
+
* @return {Monster.I18n.LocaleMap}
|
174
176
|
*/
|
175
177
|
getMap() {
|
176
178
|
return clone(this[propertiesSymbol])
|
@@ -179,6 +181,16 @@ class Locale extends Base {
|
|
179
181
|
|
180
182
|
}
|
181
183
|
|
184
|
+
/**
|
185
|
+
* @typedef {Object} LocaleMap
|
186
|
+
* @property {string} language
|
187
|
+
* @property {string} script
|
188
|
+
* @property {string} region
|
189
|
+
* @property {string} variants
|
190
|
+
* @property {string} extlang
|
191
|
+
* @property {string} privateUse
|
192
|
+
* @memberOf Monster.I18n
|
193
|
+
*/
|
182
194
|
|
183
195
|
/**
|
184
196
|
* Parse local according to rfc4646 standard
|
@@ -189,7 +201,7 @@ class Locale extends Base {
|
|
189
201
|
*
|
190
202
|
* ```
|
191
203
|
* <script type="module">
|
192
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
204
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/i18n/locale.js';
|
193
205
|
* console.log(new Monster.I18n.createLocale())
|
194
206
|
* </script>
|
195
207
|
* ```
|
@@ -198,7 +210,7 @@ class Locale extends Base {
|
|
198
210
|
*
|
199
211
|
* ```
|
200
212
|
* <script type="module">
|
201
|
-
* import {createLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
213
|
+
* import {createLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.17.1/dist/modules/i18n/locale.js';
|
202
214
|
* console.log(createLocale())
|
203
215
|
* </script>
|
204
216
|
* ```
|
@@ -255,7 +267,7 @@ class Locale extends Base {
|
|
255
267
|
* @returns {Locale}
|
256
268
|
* @since 1.14.0
|
257
269
|
* @copyright schukai GmbH
|
258
|
-
* @memberOf Monster
|
270
|
+
* @memberOf Monster.I18n
|
259
271
|
* @throws {TypeError} value is not a string
|
260
272
|
* @throws {Error} unsupported locale
|
261
273
|
*/
|