@schukai/monster 1.24.0 → 1.27.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG +47 -0
- package/README.md +4 -4
- package/dist/modules/constants.js +2 -2
- 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 +1 -1
- 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/buildtree.js +2 -0
- package/dist/modules/data/datasource/namespace.js +1 -1
- package/dist/modules/data/datasource/restapi/writeerror.js +1 -1
- package/dist/modules/data/datasource/restapi.js +1 -1
- package/dist/modules/data/datasource/storage/localstorage.js +1 -1
- package/dist/modules/data/datasource/storage/namespace.js +1 -1
- package/dist/modules/data/datasource/storage/sessionstorage.js +1 -1
- package/dist/modules/data/datasource/storage.js +1 -1
- package/dist/modules/data/datasource.js +1 -1
- package/dist/modules/data/diff.js +1 -1
- package/dist/modules/data/extend.js +1 -1
- package/dist/modules/data/namespace.js +1 -1
- package/dist/modules/data/pathfinder.js +1 -1
- package/dist/modules/data/pipe.js +1 -1
- package/dist/modules/data/transformer.js +2 -2
- package/dist/modules/dom/assembler.js +1 -1
- package/dist/modules/dom/attributes.js +2 -2
- package/dist/modules/dom/constants.js +2 -2
- 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/focusmanager.js +2 -0
- package/dist/modules/dom/locale.js +1 -1
- package/dist/modules/dom/namespace.js +1 -1
- package/dist/modules/dom/resource/data.js +2 -0
- package/dist/modules/dom/resource/link/stylesheet.js +2 -0
- package/dist/modules/dom/resource/link.js +2 -0
- package/dist/modules/dom/resource/script.js +2 -0
- package/dist/modules/dom/resource.js +2 -0
- package/dist/modules/dom/resourcemanager.js +2 -0
- package/dist/modules/dom/template.js +2 -2
- package/dist/modules/dom/theme.js +1 -1
- package/dist/modules/dom/updater.js +2 -2
- package/dist/modules/dom/util.js +1 -1
- package/dist/modules/dom/worker/factory.js +2 -0
- package/dist/modules/i18n/formatter.js +2 -0
- package/dist/modules/i18n/locale.js +1 -1
- package/dist/modules/i18n/namespace.js +1 -1
- package/dist/modules/i18n/provider.js +1 -1
- package/dist/modules/i18n/providers/fetch.js +1 -1
- package/dist/modules/i18n/providers/namespace.js +1 -1
- package/dist/modules/i18n/translations.js +1 -1
- package/dist/modules/logging/handler/console.js +1 -1
- package/dist/modules/logging/handler/namespace.js +1 -1
- 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 +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 +1 -1
- package/dist/modules/types/basewithoptions.js +1 -1
- package/dist/modules/types/binary.js +1 -1
- package/dist/modules/types/dataurl.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 +2 -2
- package/dist/modules/types/mediatype.js +1 -1
- package/dist/modules/types/namespace.js +1 -1
- package/dist/modules/types/node.js +2 -0
- package/dist/modules/types/nodelist.js +2 -0
- package/dist/modules/types/noderecursiveiterator.js +2 -0
- 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/regex.js +2 -0
- 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/uuid.js +2 -0
- 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 +1 -1
- package/dist/modules/util/processing.js +1 -1
- package/dist/modules/util/trimspaces.js +1 -1
- package/dist/monster.dev.js +1528 -770
- package/dist/monster.dev.js.map +1 -1
- package/dist/monster.js +2 -2
- package/package.json +13 -2
- package/source/constants.js +11 -2
- package/source/constraints/abstract.js +5 -0
- package/source/constraints/abstractoperator.js +5 -0
- package/source/constraints/andoperator.js +10 -5
- package/source/constraints/invalid.js +8 -3
- package/source/constraints/isarray.js +9 -4
- package/source/constraints/isobject.js +8 -3
- package/source/constraints/oroperator.js +10 -5
- package/source/constraints/valid.js +8 -3
- package/source/data/buildmap.js +25 -9
- package/source/data/buildtree.js +95 -0
- package/source/data/datasource/restapi.js +3 -3
- package/source/data/datasource/storage/localstorage.js +2 -2
- package/source/data/datasource/storage/sessionstorage.js +2 -2
- package/source/data/datasource/storage.js +3 -3
- package/source/data/datasource.js +3 -3
- package/source/data/diff.js +3 -3
- package/source/data/extend.js +2 -2
- package/source/data/pathfinder.js +4 -4
- package/source/data/pipe.js +3 -3
- package/source/data/transformer.js +7 -5
- package/source/dom/assembler.js +2 -2
- package/source/dom/attributes.js +111 -28
- package/source/dom/constants.js +287 -10
- package/source/dom/customcontrol.js +1 -1
- package/source/dom/customelement.js +1 -1
- package/source/dom/events.js +6 -7
- package/source/dom/focusmanager.js +250 -0
- package/source/dom/locale.js +10 -5
- package/source/dom/resource/data.js +170 -0
- package/source/dom/resource/link/stylesheet.js +54 -0
- package/source/dom/resource/link.js +125 -0
- package/source/dom/resource/script.js +112 -0
- package/source/dom/resource.js +268 -0
- package/source/dom/resourcemanager.js +214 -0
- package/source/dom/template.js +86 -16
- package/source/dom/theme.js +3 -3
- package/source/dom/updater.js +138 -90
- package/source/dom/util.js +6 -6
- package/source/dom/worker/factory.js +134 -0
- package/source/i18n/formatter.js +140 -0
- package/source/i18n/locale.js +6 -4
- package/source/i18n/provider.js +2 -2
- package/source/i18n/providers/fetch.js +18 -3
- package/source/i18n/translations.js +18 -9
- package/source/logging/handler/console.js +2 -2
- package/source/logging/handler.js +2 -2
- package/source/logging/logentry.js +2 -2
- package/source/logging/logger.js +2 -2
- package/source/math/random.js +9 -5
- package/source/namespace.js +1 -1
- package/source/text/formatter.js +190 -48
- package/source/types/base.js +4 -4
- package/source/types/basewithoptions.js +2 -2
- package/source/types/binary.js +4 -4
- package/source/types/dataurl.js +4 -4
- package/source/types/global.js +4 -4
- package/source/types/id.js +6 -3
- package/source/types/is.js +103 -85
- package/source/types/mediatype.js +4 -4
- package/source/types/node.js +179 -0
- package/source/types/nodelist.js +125 -0
- package/source/types/noderecursiveiterator.js +126 -0
- package/source/types/observer.js +3 -3
- package/source/types/observerlist.js +2 -2
- package/source/types/proxyobserver.js +5 -5
- package/source/types/queue.js +4 -4
- package/source/types/randomid.js +2 -2
- package/source/types/regex.js +49 -0
- package/source/types/stack.js +2 -2
- package/source/types/tokenlist.js +2 -2
- package/source/types/typeof.js +3 -3
- package/source/types/uniquequeue.js +2 -2
- package/source/types/uuid.js +102 -0
- package/source/types/validate.js +20 -20
- package/source/types/version.js +6 -6
- package/source/util/clone.js +2 -2
- package/source/util/comparator.js +4 -4
- package/source/util/freeze.js +5 -5
- package/source/util/processing.js +3 -3
- package/source/util/trimspaces.js +3 -3
- package/test/cases/data/buildtree.js +149 -0
- package/test/cases/data/datasource/restapi.js +1 -1
- package/test/cases/data/transformer.js +2 -0
- package/test/cases/dom/attributes.js +46 -19
- package/test/cases/dom/customelement.js +0 -3
- package/test/cases/dom/focusmanager.js +111 -0
- package/test/cases/dom/locale.js +1 -4
- package/test/cases/dom/resource/data.js +129 -0
- package/test/cases/dom/resource/link/stylesheet.js +101 -0
- package/test/cases/dom/resource/link.js +101 -0
- package/test/cases/dom/resource/script.js +115 -0
- package/test/cases/dom/resourcemanager.js +118 -0
- package/test/cases/dom/template.js +72 -14
- package/test/cases/dom/updater.js +102 -75
- package/test/cases/dom/worker/factory.js +63 -0
- package/test/cases/i18n/formatter.js +66 -0
- package/test/cases/monster.js +1 -1
- package/test/cases/text/formatter.js +36 -5
- package/test/cases/types/node.js +196 -0
- package/test/cases/types/nodelist.js +64 -0
- package/test/cases/types/noderecursiveiterator.js +54 -0
- package/test/cases/types/regex.js +32 -0
- package/test/cases/types/uuid.js +42 -0
- package/test/cases/util/freeze.js +30 -4
- package/test/util/cleanupdom.js +48 -0
- package/test/util/jsdom.js +22 -9
- package/test/web/import.js +14 -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 +7 -7
package/dist/monster.dev.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/** Monster 1.
|
1
|
+
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
|
2
2
|
(function webpackUniversalModuleDefinition(root, factory) {
|
3
3
|
if(typeof exports === 'object' && typeof module === 'object')
|
4
4
|
module.exports = factory();
|
@@ -19,7 +19,8 @@ return /******/ (function() { // webpackBootstrap
|
|
19
19
|
__webpack_require__.r(__webpack_exports__);
|
20
20
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
21
21
|
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_0__.Monster; },
|
22
|
-
/* harmony export */ "internalSymbol": function() { return /* binding */ internalSymbol; }
|
22
|
+
/* harmony export */ "internalSymbol": function() { return /* binding */ internalSymbol; },
|
23
|
+
/* harmony export */ "internalStateSymbol": function() { return /* binding */ internalStateSymbol; }
|
23
24
|
/* harmony export */ });
|
24
25
|
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
25
26
|
|
@@ -37,7 +38,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
37
38
|
* @since 1.24.0
|
38
39
|
*/
|
39
40
|
|
40
|
-
var internalSymbol = Symbol('
|
41
|
+
var internalSymbol = Symbol('internalData');
|
42
|
+
/**
|
43
|
+
* @private
|
44
|
+
* @type {symbol}
|
45
|
+
* @memberOf Monster
|
46
|
+
* @since 1.25.0
|
47
|
+
*/
|
48
|
+
|
49
|
+
var internalStateSymbol = Symbol('state');
|
41
50
|
|
42
51
|
|
43
52
|
/***/ }),
|
@@ -131,7 +140,7 @@ var Monster = new Namespace("Monster");
|
|
131
140
|
*
|
132
141
|
* ```
|
133
142
|
* <script type="module">
|
134
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
143
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
135
144
|
* function hello() {
|
136
145
|
* console.log('Hello World!');
|
137
146
|
* }
|
@@ -279,6 +288,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
279
288
|
|
280
289
|
|
281
290
|
/**
|
291
|
+
* Constraints are used to define conditions that must be met by the value of a variable.
|
292
|
+
*
|
293
|
+
* The uniform API of the constraints allows chains to be formed.
|
294
|
+
*
|
282
295
|
* The abstract constraint defines the api for all constraints. mainly the method isValid() is defined.
|
283
296
|
*
|
284
297
|
* derived classes must implement the method isValid().
|
@@ -286,6 +299,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
286
299
|
* @since 1.3.0
|
287
300
|
* @copyright schukai GmbH
|
288
301
|
* @memberOf Monster.Constraints
|
302
|
+
* @summary The abstract constraint
|
289
303
|
*/
|
290
304
|
|
291
305
|
var AbstractConstraint = /*#__PURE__*/function (_Base) {
|
@@ -373,8 +387,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
373
387
|
*
|
374
388
|
* ```
|
375
389
|
* <script type="module">
|
376
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
377
|
-
*
|
390
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
391
|
+
* new Monster.Types.Base()
|
378
392
|
* </script>
|
379
393
|
* ```
|
380
394
|
*
|
@@ -382,8 +396,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
382
396
|
*
|
383
397
|
* ```
|
384
398
|
* <script type="module">
|
385
|
-
* import {Base} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
386
|
-
*
|
399
|
+
* import {Base} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/base.js';
|
400
|
+
* new Base()
|
387
401
|
* </script>
|
388
402
|
* ```
|
389
403
|
*
|
@@ -460,11 +474,16 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
460
474
|
|
461
475
|
|
462
476
|
/**
|
477
|
+
* Constraints are used to define conditions that must be met by the value of a variable.
|
478
|
+
*
|
479
|
+
* The uniform API of the constraints allows chains to be formed.
|
480
|
+
*
|
463
481
|
* Operators allow you to link constraints together. for example, you can check whether a value is an object or an array. each operator has two operands that are linked together.
|
464
482
|
*
|
465
483
|
* @since 1.3.0
|
466
484
|
* @copyright schukai GmbH
|
467
485
|
* @memberOf Monster.Constraints
|
486
|
+
* @summary The abstract operator constraint
|
468
487
|
*/
|
469
488
|
|
470
489
|
var AbstractOperator = /*#__PURE__*/function (_AbstractConstraint) {
|
@@ -541,11 +560,15 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
541
560
|
|
542
561
|
|
543
562
|
/**
|
563
|
+
* Constraints are used to define conditions that must be met by the value of a variable.
|
564
|
+
*
|
565
|
+
* The uniform API of the constraints allows chains to be formed.
|
566
|
+
*
|
544
567
|
* The AndOperator is used to link several contraints. The constraint is fulfilled if all constraints of the operators are fulfilled.
|
545
568
|
*
|
546
569
|
* ```
|
547
570
|
* <script type="module">
|
548
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
571
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
549
572
|
* new Monster.Constraint.AndOperator();
|
550
573
|
* </script>
|
551
574
|
* ```
|
@@ -554,16 +577,16 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
554
577
|
*
|
555
578
|
* ```
|
556
579
|
* <script type="module">
|
557
|
-
* import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
580
|
+
* import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/andoperator.js';
|
558
581
|
* new AndOperator();
|
559
582
|
* </script>
|
560
583
|
* ```
|
561
584
|
*
|
562
585
|
* @example
|
563
586
|
*
|
564
|
-
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
565
|
-
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
566
|
-
* import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
587
|
+
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/valid.js';
|
588
|
+
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/invalid.js';
|
589
|
+
* import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/andoperator.js';
|
567
590
|
*
|
568
591
|
* new AndOperator(
|
569
592
|
* new Valid(), new Valid()).isValid()
|
@@ -580,6 +603,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
580
603
|
* @since 1.3.0
|
581
604
|
* @copyright schukai GmbH
|
582
605
|
* @memberOf Monster.Constraints
|
606
|
+
* @summary A and operator constraint
|
583
607
|
*/
|
584
608
|
|
585
609
|
var AndOperator = /*#__PURE__*/function (_AbstractOperator) {
|
@@ -654,13 +678,17 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
654
678
|
|
655
679
|
|
656
680
|
/**
|
681
|
+
* Constraints are used to define conditions that must be met by the value of a variable.
|
682
|
+
*
|
683
|
+
* The uniform API of the constraints allows chains to be formed.
|
684
|
+
*
|
657
685
|
* The invalid constraint allows an always invalid query to be performed. this constraint is mainly intended for testing.
|
658
686
|
*
|
659
687
|
* You can call the method via the monster namespace `new Monster.Constraint.Invalid()`.
|
660
688
|
*
|
661
689
|
* ```
|
662
690
|
* <script type="module">
|
663
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
691
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
664
692
|
* new Monster.Constraint.Invalid();
|
665
693
|
* </script>
|
666
694
|
* ```
|
@@ -669,14 +697,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
669
697
|
*
|
670
698
|
* ```
|
671
699
|
* <script type="module">
|
672
|
-
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
700
|
+
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/invalid.js';
|
673
701
|
* new Invalid();
|
674
702
|
* </script>
|
675
703
|
* ```
|
676
704
|
*
|
677
705
|
* @example
|
678
706
|
*
|
679
|
-
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
707
|
+
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/invalid.js';
|
680
708
|
*
|
681
709
|
* new Invalid().isValid()
|
682
710
|
* .then(()=>console.log(true))
|
@@ -686,6 +714,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
686
714
|
* @since 1.3.0
|
687
715
|
* @copyright schukai GmbH
|
688
716
|
* @memberOf Monster.Constraints
|
717
|
+
* @summary A constraint that always invalid
|
689
718
|
*/
|
690
719
|
|
691
720
|
var Invalid = /*#__PURE__*/function (_AbstractConstraint) {
|
@@ -762,12 +791,16 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
762
791
|
|
763
792
|
|
764
793
|
/**
|
794
|
+
* Constraints are used to define conditions that must be met by the value of a variable.
|
795
|
+
*
|
796
|
+
* The uniform API of the constraints allows chains to be formed.
|
797
|
+
*
|
765
798
|
* You can call the method via the monster namespace `new Monster.Constraint.IsObject()`.
|
766
799
|
*
|
767
800
|
* ```
|
768
801
|
* <script type="module">
|
769
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
770
|
-
*
|
802
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
803
|
+
* new Monster.Constraint.IsArray()
|
771
804
|
* </script>
|
772
805
|
* ```
|
773
806
|
*
|
@@ -775,14 +808,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
775
808
|
*
|
776
809
|
* ```
|
777
810
|
* <script type="module">
|
778
|
-
* import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
811
|
+
* import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/isarray.js';
|
779
812
|
* console.log(new IsArray())
|
780
813
|
* </script>
|
781
814
|
* ```
|
782
815
|
*
|
783
816
|
* @example
|
784
817
|
*
|
785
|
-
* import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
818
|
+
* import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/isarray.js';
|
786
819
|
*
|
787
820
|
* new IsArray()
|
788
821
|
* .isValid([])
|
@@ -797,6 +830,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
797
830
|
* @since 1.3.0
|
798
831
|
* @copyright schukai GmbH
|
799
832
|
* @memberOf Monster.Constraints
|
833
|
+
* @summary A constraint to check if a value is an array
|
800
834
|
*/
|
801
835
|
|
802
836
|
var IsArray = /*#__PURE__*/function (_AbstractConstraint) {
|
@@ -862,16 +896,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
862
896
|
|
863
897
|
|
864
898
|
/**
|
865
|
-
* With this function you can check if a value is iterable
|
899
|
+
* With this function you can check if a value is iterable.
|
900
|
+
*
|
901
|
+
* This method is used in the library to have consistent names.
|
866
902
|
*
|
867
903
|
* You can call the method via the monster namespace `Monster.Types.isPrimitive()`.
|
868
904
|
*
|
869
905
|
* ```
|
870
906
|
* <script type="module">
|
871
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
872
|
-
*
|
873
|
-
*
|
874
|
-
*
|
907
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
908
|
+
* Monster.Types.isIterable(null) // ↦ false
|
909
|
+
* Monster.Types.isIterable('hello') // ↦ true
|
910
|
+
* Monster.Types.isIterable([]) // ↦ true
|
875
911
|
* </script>
|
876
912
|
* ```
|
877
913
|
*
|
@@ -879,10 +915,10 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
879
915
|
*
|
880
916
|
* ```
|
881
917
|
* <script type="module">
|
882
|
-
* import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
883
|
-
*
|
884
|
-
*
|
885
|
-
*
|
918
|
+
* import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/is.js';
|
919
|
+
* isIterable(null) // ↦ false
|
920
|
+
* isIterable('hello') // ↦ true
|
921
|
+
* isIterable([]) // ↦ true
|
886
922
|
* </script>
|
887
923
|
* ```
|
888
924
|
*
|
@@ -900,14 +936,16 @@ function isIterable(value) {
|
|
900
936
|
}
|
901
937
|
/**
|
902
938
|
* Checks whether the value passed is a primitive (string, number, boolean, NaN, undefined, null or symbol)
|
939
|
+
*
|
940
|
+
* This method is used in the library to have consistent names.
|
903
941
|
*
|
904
942
|
* You can call the method via the monster namespace `Monster.Types.isPrimitive()`.
|
905
943
|
*
|
906
944
|
* ```
|
907
945
|
* <script type="module">
|
908
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
909
|
-
*
|
910
|
-
*
|
946
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
947
|
+
* Monster.Types.isPrimitive('2') // ↦ false
|
948
|
+
* Monster.Types.isPrimitive([]) // ↦ true
|
911
949
|
* </script>
|
912
950
|
* ```
|
913
951
|
*
|
@@ -915,9 +953,9 @@ function isIterable(value) {
|
|
915
953
|
*
|
916
954
|
* ```
|
917
955
|
* <script type="module">
|
918
|
-
* import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
919
|
-
*
|
920
|
-
*
|
956
|
+
* import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/is.js';
|
957
|
+
* isPrimitive('2')) // ↦ true
|
958
|
+
* isPrimitive([])) // ↦ false
|
921
959
|
* </script>
|
922
960
|
* ```
|
923
961
|
*
|
@@ -946,14 +984,16 @@ function isPrimitive(value) {
|
|
946
984
|
}
|
947
985
|
/**
|
948
986
|
* Checks whether the value passed is a symbol
|
987
|
+
*
|
988
|
+
* This method is used in the library to have consistent names.
|
949
989
|
*
|
950
990
|
* You can call the method via the monster namespace `Monster.Types.isSymbol()`.
|
951
991
|
*
|
952
992
|
* ```
|
953
993
|
* <script type="module">
|
954
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
955
|
-
*
|
956
|
-
*
|
994
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
995
|
+
* Monster.Types.isSymbol('2') // ↦ false
|
996
|
+
* Monster.Types.isSymbol(Symbol('test') // ↦ true
|
957
997
|
* </script>
|
958
998
|
* ```
|
959
999
|
*
|
@@ -961,9 +1001,9 @@ function isPrimitive(value) {
|
|
961
1001
|
*
|
962
1002
|
* ```
|
963
1003
|
* <script type="module">
|
964
|
-
* import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
965
|
-
*
|
966
|
-
*
|
1004
|
+
* import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/is.js';
|
1005
|
+
* isSymbol(Symbol('a'))) // ↦ true
|
1006
|
+
* isSymbol([]) // ↦ false
|
967
1007
|
* </script>
|
968
1008
|
* ```
|
969
1009
|
*
|
@@ -979,16 +1019,18 @@ function isSymbol(value) {
|
|
979
1019
|
return 'symbol' === _typeof(value) ? true : false;
|
980
1020
|
}
|
981
1021
|
/**
|
982
|
-
* Checks whether the value passed is a boolean
|
1022
|
+
* Checks whether the value passed is a boolean.
|
1023
|
+
*
|
1024
|
+
* This method is used in the library to have consistent names.
|
983
1025
|
*
|
984
1026
|
* You can call the method via the monster namespace `Monster.Types.isBoolean()`.
|
985
1027
|
*
|
986
1028
|
* ```
|
987
1029
|
* <script type="module">
|
988
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
989
|
-
*
|
990
|
-
*
|
991
|
-
*
|
1030
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
1031
|
+
* Monster.Types.isBoolean('2') // ↦ false
|
1032
|
+
* Monster.Types.isBoolean([]) // ↦ false
|
1033
|
+
* Monster.Types.isBoolean(true) // ↦ true
|
992
1034
|
* </script>
|
993
1035
|
* ```
|
994
1036
|
*
|
@@ -996,10 +1038,10 @@ function isSymbol(value) {
|
|
996
1038
|
*
|
997
1039
|
* ```
|
998
1040
|
* <script type="module">
|
999
|
-
* import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1000
|
-
*
|
1001
|
-
*
|
1002
|
-
*
|
1041
|
+
* import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/is.js';
|
1042
|
+
* isBoolean('2')) // ↦ false
|
1043
|
+
* isBoolean([])) // ↦ false
|
1044
|
+
* isBoolean(2>4)) // ↦ true
|
1003
1045
|
* </script>
|
1004
1046
|
* ```
|
1005
1047
|
*
|
@@ -1019,15 +1061,17 @@ function isBoolean(value) {
|
|
1019
1061
|
return false;
|
1020
1062
|
}
|
1021
1063
|
/**
|
1022
|
-
*
|
1064
|
+
* Checks whether the value passed is a string
|
1065
|
+
*
|
1066
|
+
* This method is used in the library to have consistent names.
|
1023
1067
|
*
|
1024
|
-
*
|
1068
|
+
* You can call the method via the monster namespace `Monster.Types.isString()`.
|
1025
1069
|
*
|
1026
1070
|
* ```
|
1027
1071
|
* <script type="module">
|
1028
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1029
|
-
*
|
1030
|
-
*
|
1072
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
1073
|
+
* Monster.Types.isString('2') // ↦ true
|
1074
|
+
* Monster.Types.isString([]) // ↦ false
|
1031
1075
|
* </script>
|
1032
1076
|
* ```
|
1033
1077
|
*
|
@@ -1035,9 +1079,9 @@ function isBoolean(value) {
|
|
1035
1079
|
*
|
1036
1080
|
* ```
|
1037
1081
|
* <script type="module">
|
1038
|
-
* import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1039
|
-
*
|
1040
|
-
*
|
1082
|
+
* import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/is.js';
|
1083
|
+
* isString('2')) // ↦ true
|
1084
|
+
* isString([])) // ↦ false
|
1041
1085
|
* </script>
|
1042
1086
|
* ```
|
1043
1087
|
*
|
@@ -1057,16 +1101,18 @@ function isString(value) {
|
|
1057
1101
|
return true;
|
1058
1102
|
}
|
1059
1103
|
/**
|
1060
|
-
*
|
1104
|
+
* Checks whether the value passed is a object
|
1105
|
+
*
|
1106
|
+
* This method is used in the library to have consistent names.
|
1061
1107
|
*
|
1062
|
-
*
|
1108
|
+
* You can call the method via the monster namespace `Monster.Types.isObject()`.
|
1063
1109
|
*
|
1064
1110
|
* ```
|
1065
1111
|
* <script type="module">
|
1066
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1067
|
-
*
|
1068
|
-
*
|
1069
|
-
*
|
1112
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
1113
|
+
* Monster.Types.isObject('2') // ↦ false
|
1114
|
+
* Monster.Types.isObject([]) // ↦ false
|
1115
|
+
* Monster.Types.isObject({}) // ↦ true
|
1070
1116
|
* </script>
|
1071
1117
|
* ```
|
1072
1118
|
*
|
@@ -1074,9 +1120,9 @@ function isString(value) {
|
|
1074
1120
|
*
|
1075
1121
|
* ```
|
1076
1122
|
* <script type="module">
|
1077
|
-
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1078
|
-
*
|
1079
|
-
*
|
1123
|
+
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/is.js';
|
1124
|
+
* isObject('2')) // ↦ false
|
1125
|
+
* isObject([])) // ↦ false
|
1080
1126
|
* </script>
|
1081
1127
|
* ```
|
1082
1128
|
*
|
@@ -1099,16 +1145,18 @@ function isObject(value) {
|
|
1099
1145
|
return false;
|
1100
1146
|
}
|
1101
1147
|
/**
|
1102
|
-
*
|
1148
|
+
* Checks whether the value passed is a object and instance of instance.
|
1149
|
+
*
|
1150
|
+
* This method is used in the library to have consistent names.
|
1103
1151
|
*
|
1104
1152
|
* you can call the method via the monster namespace `Monster.Types.isInstance()`.
|
1105
1153
|
*
|
1106
1154
|
* ```
|
1107
1155
|
* <script type="module">
|
1108
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1109
|
-
*
|
1110
|
-
*
|
1111
|
-
*
|
1156
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
1157
|
+
* Monster.Types.isInstance('2') // ↦ false
|
1158
|
+
* Monster.Types.isInstance([]) // ↦ false
|
1159
|
+
* Monster.Types.isInstance({}) // ↦ true
|
1112
1160
|
* </script>
|
1113
1161
|
* ```
|
1114
1162
|
*
|
@@ -1116,9 +1164,9 @@ function isObject(value) {
|
|
1116
1164
|
*
|
1117
1165
|
* ```
|
1118
1166
|
* <script type="module">
|
1119
|
-
* import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1120
|
-
*
|
1121
|
-
*
|
1167
|
+
* import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/is.js';
|
1168
|
+
* isInstance('2')) // ↦ false
|
1169
|
+
* isInstance([])) // ↦ false
|
1122
1170
|
* </script>
|
1123
1171
|
* ```
|
1124
1172
|
*
|
@@ -1138,15 +1186,17 @@ function isInstance(value, instance) {
|
|
1138
1186
|
return value instanceof instance ? true : false;
|
1139
1187
|
}
|
1140
1188
|
/**
|
1141
|
-
*
|
1189
|
+
* Checks whether the value passed is a array
|
1190
|
+
*
|
1191
|
+
* This method is used in the library to have consistent names.
|
1142
1192
|
*
|
1143
1193
|
* you can call the method via the monster namespace `Monster.Types.isArray()`.
|
1144
1194
|
*
|
1145
1195
|
* ```
|
1146
1196
|
* <script type="module">
|
1147
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1148
|
-
*
|
1149
|
-
*
|
1197
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
1198
|
+
* Monster.Types.isArray('2') // ↦ false
|
1199
|
+
* Monster.Types.isArray([]) // ↦ true
|
1150
1200
|
* </script>
|
1151
1201
|
* ```
|
1152
1202
|
*
|
@@ -1154,9 +1204,9 @@ function isInstance(value, instance) {
|
|
1154
1204
|
*
|
1155
1205
|
* ```
|
1156
1206
|
* <script type="module">
|
1157
|
-
* import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1158
|
-
*
|
1159
|
-
*
|
1207
|
+
* import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/is.js';
|
1208
|
+
* isArray('2')) // ↦ false
|
1209
|
+
* isArray([])) // ↦ true
|
1160
1210
|
* </script>
|
1161
1211
|
* ```
|
1162
1212
|
*
|
@@ -1165,27 +1215,26 @@ function isInstance(value, instance) {
|
|
1165
1215
|
* @since 1.0.0
|
1166
1216
|
* @copyright schukai GmbH
|
1167
1217
|
* @memberOf Monster.Types
|
1218
|
+
* @see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
|
1168
1219
|
*/
|
1169
1220
|
|
1170
1221
|
|
1171
1222
|
function isArray(value) {
|
1172
|
-
|
1173
|
-
return true;
|
1174
|
-
}
|
1175
|
-
|
1176
|
-
return false;
|
1223
|
+
return Array.isArray(value);
|
1177
1224
|
}
|
1178
1225
|
/**
|
1179
|
-
*
|
1226
|
+
* Checks whether the value passed is a function
|
1227
|
+
*
|
1228
|
+
* This method is used in the library to have consistent names.
|
1180
1229
|
*
|
1181
1230
|
* you can call the method via the monster namespace `Monster.Types.isFunction()`.
|
1182
1231
|
*
|
1183
1232
|
* ```
|
1184
1233
|
* <script type="module">
|
1185
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1186
|
-
*
|
1187
|
-
*
|
1188
|
-
*
|
1234
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
1235
|
+
* Monster.Types.isFunction(()=>{}) // ↦ true
|
1236
|
+
* Monster.Types.isFunction('2') // ↦ false
|
1237
|
+
* Monster.Types.isFunction([]) // ↦ false
|
1189
1238
|
* </script>
|
1190
1239
|
* ```
|
1191
1240
|
*
|
@@ -1193,10 +1242,10 @@ function isArray(value) {
|
|
1193
1242
|
*
|
1194
1243
|
* ```
|
1195
1244
|
* <script type="module">
|
1196
|
-
* import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1197
|
-
*
|
1198
|
-
*
|
1199
|
-
*
|
1245
|
+
* import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/is.js';
|
1246
|
+
* isFunction(()=>{}) // ↦ true
|
1247
|
+
* isFunction('2')) // ↦ false
|
1248
|
+
* isFunction([])) // ↦ false
|
1200
1249
|
* </script>
|
1201
1250
|
* ```
|
1202
1251
|
*
|
@@ -1219,16 +1268,18 @@ function isFunction(value) {
|
|
1219
1268
|
return false;
|
1220
1269
|
}
|
1221
1270
|
/**
|
1222
|
-
*
|
1271
|
+
* Checks whether the value passed is an integer.
|
1272
|
+
*
|
1273
|
+
* This method is used in the library to have consistent names.
|
1223
1274
|
*
|
1224
|
-
*
|
1275
|
+
* You can call the method via the monster namespace `Monster.Types.isFunction()`.
|
1225
1276
|
*
|
1226
1277
|
* ```
|
1227
1278
|
* <script type="module">
|
1228
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1229
|
-
*
|
1230
|
-
*
|
1231
|
-
*
|
1279
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
1280
|
+
* Monster.Types.isInteger(()=>{}) // ↦ true
|
1281
|
+
* Monster.Types.isInteger('2') // ↦ false
|
1282
|
+
* Monster.Types.isInteger(2) // ↦ true
|
1232
1283
|
* </script>
|
1233
1284
|
* ```
|
1234
1285
|
*
|
@@ -1236,10 +1287,10 @@ function isFunction(value) {
|
|
1236
1287
|
*
|
1237
1288
|
* ```
|
1238
1289
|
* <script type="module">
|
1239
|
-
* import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1240
|
-
*
|
1241
|
-
*
|
1242
|
-
*
|
1290
|
+
* import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/is.js';
|
1291
|
+
* isInteger(()=>{}) // ↦ true
|
1292
|
+
* isInteger('2')) // ↦ false
|
1293
|
+
* isInteger(2)) // ↦ true
|
1243
1294
|
* </script>
|
1244
1295
|
* ```
|
1245
1296
|
*
|
@@ -1301,11 +1352,15 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1301
1352
|
|
1302
1353
|
|
1303
1354
|
/**
|
1355
|
+
* Constraints are used to define conditions that must be met by the value of a variable.
|
1356
|
+
*
|
1357
|
+
* The uniform API of the constraints allows chains to be formed.
|
1358
|
+
*
|
1304
1359
|
* You can call the method via the monster namespace `new Monster.Constraint.IsObject()`.
|
1305
1360
|
*
|
1306
1361
|
* ```
|
1307
1362
|
* <script type="module">
|
1308
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1363
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
1309
1364
|
* console.log(new Monster.Constraint.IsObject())
|
1310
1365
|
* </script>
|
1311
1366
|
* ```
|
@@ -1314,14 +1369,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1314
1369
|
*
|
1315
1370
|
* ```
|
1316
1371
|
* <script type="module">
|
1317
|
-
* import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1372
|
+
* import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/isobject.js';
|
1318
1373
|
* console.log(new IsObject())
|
1319
1374
|
* </script>
|
1320
1375
|
* ```
|
1321
1376
|
*
|
1322
1377
|
* @example
|
1323
1378
|
*
|
1324
|
-
* import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1379
|
+
* import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/isobject.js';
|
1325
1380
|
*
|
1326
1381
|
* new IsObject()
|
1327
1382
|
* .isValid({})
|
@@ -1337,6 +1392,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1337
1392
|
* @since 1.3.0
|
1338
1393
|
* @copyright schukai GmbH
|
1339
1394
|
* @memberOf Monster.Constraints
|
1395
|
+
* @summary A constraint to check if a value is an object
|
1340
1396
|
*/
|
1341
1397
|
|
1342
1398
|
var IsObject = /*#__PURE__*/function (_AbstractConstraint) {
|
@@ -1415,11 +1471,15 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1415
1471
|
|
1416
1472
|
|
1417
1473
|
/**
|
1474
|
+
* Constraints are used to define conditions that must be met by the value of a variable.
|
1475
|
+
*
|
1476
|
+
* The uniform API of the constraints allows chains to be formed.
|
1477
|
+
*
|
1418
1478
|
* The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled.
|
1419
1479
|
*
|
1420
1480
|
* ```
|
1421
1481
|
* <script type="module">
|
1422
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1482
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
1423
1483
|
* new Monster.Constraint.OrOperator();
|
1424
1484
|
* </script>
|
1425
1485
|
* ```
|
@@ -1428,16 +1488,16 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1428
1488
|
*
|
1429
1489
|
* ```
|
1430
1490
|
* <script type="module">
|
1431
|
-
* import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1491
|
+
* import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraint/oroperator.js';
|
1432
1492
|
* new OrOperator();
|
1433
1493
|
* </script>
|
1434
1494
|
* ```
|
1435
1495
|
*
|
1436
1496
|
* @example
|
1437
1497
|
*
|
1438
|
-
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1439
|
-
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1440
|
-
* import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1498
|
+
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/valid.js';
|
1499
|
+
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/invalid.js';
|
1500
|
+
* import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/oroperator.js';
|
1441
1501
|
*
|
1442
1502
|
* new OrOperator(
|
1443
1503
|
* new Valid(), new Invalid()).isValid()
|
@@ -1454,6 +1514,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1454
1514
|
* @since 1.3.0
|
1455
1515
|
* @copyright schukai GmbH
|
1456
1516
|
* @memberOf Monster.Constraints
|
1517
|
+
* @summary A or operator
|
1457
1518
|
*/
|
1458
1519
|
|
1459
1520
|
var OrOperator = /*#__PURE__*/function (_AbstractOperator) {
|
@@ -1551,13 +1612,17 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1551
1612
|
|
1552
1613
|
|
1553
1614
|
/**
|
1615
|
+
* Constraints are used to define conditions that must be met by the value of a variable.
|
1616
|
+
*
|
1617
|
+
* The uniform API of the constraints allows chains to be formed.
|
1618
|
+
*
|
1554
1619
|
* The valid constraint allows an always valid query to be performed. this constraint is mainly intended for testing.
|
1555
1620
|
*
|
1556
1621
|
* You can call the method via the monster namespace `new Monster.Constraint.Valid()`.
|
1557
1622
|
*
|
1558
1623
|
* ```
|
1559
1624
|
* <script type="module">
|
1560
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1625
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
1561
1626
|
* new Monster.Constraint.Valid();
|
1562
1627
|
* </script>
|
1563
1628
|
* ```
|
@@ -1566,14 +1631,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1566
1631
|
*
|
1567
1632
|
* ```
|
1568
1633
|
* <script type="module">
|
1569
|
-
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1634
|
+
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/valid.js';
|
1570
1635
|
* new Valid();
|
1571
1636
|
* </script>
|
1572
1637
|
* ```
|
1573
1638
|
*
|
1574
1639
|
* @example
|
1575
1640
|
*
|
1576
|
-
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1641
|
+
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/constraints/valid.js';
|
1577
1642
|
*
|
1578
1643
|
* new Valid().isValid()
|
1579
1644
|
* .then(()=>console.log(true))
|
@@ -1583,6 +1648,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1583
1648
|
* @since 1.3.0
|
1584
1649
|
* @copyright schukai GmbH
|
1585
1650
|
* @memberOf Monster.Constraints
|
1651
|
+
* @summary A constraint that always valid
|
1586
1652
|
*/
|
1587
1653
|
|
1588
1654
|
var Valid = /*#__PURE__*/function (_AbstractConstraint) {
|
@@ -1623,7 +1689,8 @@ var Valid = /*#__PURE__*/function (_AbstractConstraint) {
|
|
1623
1689
|
__webpack_require__.r(__webpack_exports__);
|
1624
1690
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
1625
1691
|
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_0__.Monster; },
|
1626
|
-
/* harmony export */ "buildMap": function() { return /* binding */ buildMap; }
|
1692
|
+
/* harmony export */ "buildMap": function() { return /* binding */ buildMap; },
|
1693
|
+
/* harmony export */ "assembleParts": function() { return /* binding */ assembleParts; }
|
1627
1694
|
/* harmony export */ });
|
1628
1695
|
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
1629
1696
|
/* harmony import */ var _types_is_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
@@ -1680,7 +1747,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
1680
1747
|
*
|
1681
1748
|
* ```
|
1682
1749
|
* <script type="module">
|
1683
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1750
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
1684
1751
|
* console.log(Monster.Data.buildMap())
|
1685
1752
|
* </script>
|
1686
1753
|
* ```
|
@@ -1689,7 +1756,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
1689
1756
|
*
|
1690
1757
|
* ```
|
1691
1758
|
* <script type="module">
|
1692
|
-
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1759
|
+
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/buildmap.js';
|
1693
1760
|
* console.log(buildMap())
|
1694
1761
|
* </script>
|
1695
1762
|
* ```
|
@@ -1700,7 +1767,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
1700
1767
|
*
|
1701
1768
|
* @example
|
1702
1769
|
*
|
1703
|
-
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1770
|
+
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/buildmap.js';
|
1704
1771
|
* // a typical data structure as reported by an api
|
1705
1772
|
*
|
1706
1773
|
* let map;
|
@@ -1780,6 +1847,23 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
1780
1847
|
*/
|
1781
1848
|
|
1782
1849
|
function buildMap(subject, selector, valueTemplate, keyTemplate, filter) {
|
1850
|
+
return assembleParts(subject, selector, filter, function (v, k, m) {
|
1851
|
+
k = build(v, keyTemplate, k);
|
1852
|
+
v = build(v, valueTemplate);
|
1853
|
+
this.set(k, v);
|
1854
|
+
});
|
1855
|
+
}
|
1856
|
+
/**
|
1857
|
+
* @private
|
1858
|
+
* @param {*} subject
|
1859
|
+
* @param {string|Monster.Data~exampleSelectorCallback} selector
|
1860
|
+
* @param {Monster.Data~exampleFilterCallback} [filter]
|
1861
|
+
* @param {function} callback
|
1862
|
+
* @return {*}
|
1863
|
+
*/
|
1864
|
+
|
1865
|
+
|
1866
|
+
function assembleParts(subject, selector, filter, callback) {
|
1783
1867
|
var result = new Map();
|
1784
1868
|
var map;
|
1785
1869
|
|
@@ -1805,9 +1889,7 @@ function buildMap(subject, selector, valueTemplate, keyTemplate, filter) {
|
|
1805
1889
|
if (filter.call(m, v, k) !== true) return;
|
1806
1890
|
}
|
1807
1891
|
|
1808
|
-
|
1809
|
-
v = build(v, valueTemplate);
|
1810
|
-
result.set(k, v);
|
1892
|
+
callback.call(result, v, k, m);
|
1811
1893
|
});
|
1812
1894
|
return result;
|
1813
1895
|
}
|
@@ -1915,7 +1997,7 @@ function buildFlatMap(subject, selector, key, parentMap) {
|
|
1915
1997
|
* Alternatively to a string selector a callback can be specified. this must return a map.
|
1916
1998
|
*
|
1917
1999
|
* @example
|
1918
|
-
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2000
|
+
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/buildmap.js';
|
1919
2001
|
*
|
1920
2002
|
* let obj = {
|
1921
2003
|
* "data": [
|
@@ -2118,7 +2200,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
2118
2200
|
*
|
2119
2201
|
* ```
|
2120
2202
|
* <script type="module">
|
2121
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2203
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2122
2204
|
* console.log(Monster.Types.validateIterable('2')) // ↦ TypeError
|
2123
2205
|
* console.log(Monster.Types.validateIterable([])) // ↦ value
|
2124
2206
|
* </script>
|
@@ -2128,7 +2210,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
2128
2210
|
*
|
2129
2211
|
* ```
|
2130
2212
|
* <script type="module">
|
2131
|
-
* import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2213
|
+
* import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/validate.js';
|
2132
2214
|
* console.log(validateIterable('2')) // ↦ TypeError
|
2133
2215
|
* console.log(validateIterable([])) // ↦ value
|
2134
2216
|
* </script>
|
@@ -2159,7 +2241,7 @@ function validateIterable(value) {
|
|
2159
2241
|
*
|
2160
2242
|
* ```
|
2161
2243
|
* <script type="module">
|
2162
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2244
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2163
2245
|
* console.log(Monster.Types.validatePrimitive('2')) // ↦ value
|
2164
2246
|
* console.log(Monster.Types.validatePrimitive([])) // ↦ TypeError
|
2165
2247
|
* </script>
|
@@ -2169,7 +2251,7 @@ function validateIterable(value) {
|
|
2169
2251
|
*
|
2170
2252
|
* ```
|
2171
2253
|
* <script type="module">
|
2172
|
-
* import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2254
|
+
* import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/validate.js';
|
2173
2255
|
* console.log(validatePrimitive('2')) // ↦ value
|
2174
2256
|
* console.log(validatePrimitive([])) // ↦ TypeError
|
2175
2257
|
* </script>
|
@@ -2201,7 +2283,7 @@ function validatePrimitive(value) {
|
|
2201
2283
|
*
|
2202
2284
|
* ```
|
2203
2285
|
* <script type="module">
|
2204
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2286
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2205
2287
|
* console.log(Monster.Types.validateBoolean(true)) // ↦ value
|
2206
2288
|
* console.log(Monster.Types.validateBoolean('2')) // ↦ TypeError
|
2207
2289
|
* console.log(Monster.Types.validateBoolean([])) // ↦ TypeError
|
@@ -2212,7 +2294,7 @@ function validatePrimitive(value) {
|
|
2212
2294
|
*
|
2213
2295
|
* ```
|
2214
2296
|
* <script type="module">
|
2215
|
-
* import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2297
|
+
* import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/validate.js';
|
2216
2298
|
* console.log(validateBoolean(false)) // ↦ value
|
2217
2299
|
* console.log(validateBoolean('2')) // ↦ TypeError
|
2218
2300
|
* console.log(validateBoolean([])) // ↦ TypeError
|
@@ -2243,7 +2325,7 @@ function validateBoolean(value) {
|
|
2243
2325
|
*
|
2244
2326
|
* ```
|
2245
2327
|
* <script type="module">
|
2246
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2328
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2247
2329
|
* console.log(Monster.Types.validateString('2')) // ↦ value
|
2248
2330
|
* console.log(Monster.Types.validateString([])) // ↦ TypeError
|
2249
2331
|
* </script>
|
@@ -2253,7 +2335,7 @@ function validateBoolean(value) {
|
|
2253
2335
|
*
|
2254
2336
|
* ```
|
2255
2337
|
* <script type="module">
|
2256
|
-
* import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2338
|
+
* import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/validate.js';
|
2257
2339
|
* console.log(validateString('2')) // ↦ value
|
2258
2340
|
* console.log(validateString([])) // ↦ TypeError
|
2259
2341
|
* </script>
|
@@ -2282,7 +2364,7 @@ function validateString(value) {
|
|
2282
2364
|
*
|
2283
2365
|
* ```
|
2284
2366
|
* <script type="module">
|
2285
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2367
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2286
2368
|
* console.log(Monster.Types.validateObject({})) // ↦ value
|
2287
2369
|
* console.log(Monster.Types.validateObject('2')) // ↦ TypeError
|
2288
2370
|
* console.log(Monster.Types.validateObject([])) // ↦ TypeError
|
@@ -2293,7 +2375,7 @@ function validateString(value) {
|
|
2293
2375
|
*
|
2294
2376
|
* ```
|
2295
2377
|
* <script type="module">
|
2296
|
-
* import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2378
|
+
* import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/validate.js';
|
2297
2379
|
* console.log(validateObject({})) // ↦ value
|
2298
2380
|
* console.log(validateObject('2')) // ↦ TypeError
|
2299
2381
|
* console.log(validateObject([])) // ↦ TypeError
|
@@ -2323,7 +2405,7 @@ function validateObject(value) {
|
|
2323
2405
|
*
|
2324
2406
|
* ```
|
2325
2407
|
* <script type="module">
|
2326
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2408
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2327
2409
|
* console.log(Monster.Types.validateInstance({}, Object)) // ↦ value
|
2328
2410
|
* console.log(Monster.Types.validateInstance('2', Object)) // ↦ TypeError
|
2329
2411
|
* console.log(Monster.Types.validateInstance([], Object)) // ↦ TypeError
|
@@ -2334,7 +2416,7 @@ function validateObject(value) {
|
|
2334
2416
|
*
|
2335
2417
|
* ```
|
2336
2418
|
* <script type="module">
|
2337
|
-
* import {validateInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2419
|
+
* import {validateInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/validate.js';
|
2338
2420
|
* console.log(validateInstance({}, Object)) // ↦ value
|
2339
2421
|
* console.log(validateInstance('2', Object)) // ↦ TypeError
|
2340
2422
|
* console.log(validateInstance([], Object)) // ↦ TypeError
|
@@ -2374,7 +2456,7 @@ function validateInstance(value, instance) {
|
|
2374
2456
|
*
|
2375
2457
|
* ```
|
2376
2458
|
* <script type="module">
|
2377
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2459
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2378
2460
|
* console.log(Monster.Types.validateArray('2')) // ↦ TypeError
|
2379
2461
|
* console.log(Monster.Types.validateArray([])) // ↦ value
|
2380
2462
|
* </script>
|
@@ -2384,7 +2466,7 @@ function validateInstance(value, instance) {
|
|
2384
2466
|
*
|
2385
2467
|
* ```
|
2386
2468
|
* <script type="module">
|
2387
|
-
* import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2469
|
+
* import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/validate.js';
|
2388
2470
|
* console.log(validateArray('2')) // ↦ TypeError
|
2389
2471
|
* console.log(validateArray([])) // ↦ value
|
2390
2472
|
* </script>
|
@@ -2413,7 +2495,7 @@ function validateArray(value) {
|
|
2413
2495
|
*
|
2414
2496
|
* ```
|
2415
2497
|
* <script type="module">
|
2416
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2498
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2417
2499
|
* console.log(Monster.Types.validateSymbol('2')) // ↦ TypeError
|
2418
2500
|
* console.log(Monster.Types.validateSymbol([])) // ↦ value
|
2419
2501
|
* </script>
|
@@ -2423,7 +2505,7 @@ function validateArray(value) {
|
|
2423
2505
|
*
|
2424
2506
|
* ```
|
2425
2507
|
* <script type="module">
|
2426
|
-
* import {validateSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2508
|
+
* import {validateSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/validate.js';
|
2427
2509
|
* console.log(validateSymbol('2')) // ↦ TypeError
|
2428
2510
|
* console.log(validateSymbol()) // ↦ value
|
2429
2511
|
* </script>
|
@@ -2452,7 +2534,7 @@ function validateSymbol(value) {
|
|
2452
2534
|
*
|
2453
2535
|
* ```
|
2454
2536
|
* <script type="module">
|
2455
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2537
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2456
2538
|
* console.log(Monster.Types.validateFunction(()=>{})) // ↦ value
|
2457
2539
|
* console.log(Monster.Types.validateFunction('2')) // ↦ TypeError
|
2458
2540
|
* console.log(Monster.Types.validateFunction([])) // ↦ TypeError
|
@@ -2463,7 +2545,7 @@ function validateSymbol(value) {
|
|
2463
2545
|
*
|
2464
2546
|
* ```
|
2465
2547
|
* <script type="module">
|
2466
|
-
* import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2548
|
+
* import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/validate.js';
|
2467
2549
|
* console.log(validateFunction(()=>{})) // ↦ value
|
2468
2550
|
* console.log(validateFunction('2')) // ↦ TypeError
|
2469
2551
|
* console.log(validateFunction([])) // ↦ TypeError
|
@@ -2493,7 +2575,7 @@ function validateFunction(value) {
|
|
2493
2575
|
*
|
2494
2576
|
* ```
|
2495
2577
|
* <script type="module">
|
2496
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2578
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2497
2579
|
* console.log(Monster.Types.validateInteger(true)) // ↦ TypeError
|
2498
2580
|
* console.log(Monster.Types.validateInteger('2')) // ↦ TypeError
|
2499
2581
|
* console.log(Monster.Types.validateInteger(2)) // ↦ value
|
@@ -2504,7 +2586,7 @@ function validateFunction(value) {
|
|
2504
2586
|
*
|
2505
2587
|
* ```
|
2506
2588
|
* <script type="module">
|
2507
|
-
* import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2589
|
+
* import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/validate.js';
|
2508
2590
|
* console.log(validateInteger(true)) // ↦ TypeError
|
2509
2591
|
* console.log(validateInteger('2')) // ↦ TypeError
|
2510
2592
|
* console.log(validateInteger(2)) // ↦ value
|
@@ -2570,7 +2652,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
2570
2652
|
*
|
2571
2653
|
* ```
|
2572
2654
|
* <script type="module">
|
2573
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2655
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2574
2656
|
* Monster.Util.clone({})
|
2575
2657
|
* </script>
|
2576
2658
|
* ```
|
@@ -2579,7 +2661,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
2579
2661
|
*
|
2580
2662
|
* ```
|
2581
2663
|
* <script type="module">
|
2582
|
-
* import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2664
|
+
* import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/util/clone.js';
|
2583
2665
|
* clone({})
|
2584
2666
|
* </script>
|
2585
2667
|
* ```
|
@@ -2791,7 +2873,7 @@ function getGlobal() {
|
|
2791
2873
|
*
|
2792
2874
|
* ```
|
2793
2875
|
* <script type="module">
|
2794
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2876
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2795
2877
|
* Monster.Types.getGlobalObject('document')
|
2796
2878
|
* // ↦ { }
|
2797
2879
|
* </script>
|
@@ -2801,7 +2883,7 @@ function getGlobal() {
|
|
2801
2883
|
*
|
2802
2884
|
* ```
|
2803
2885
|
* <script type="module">
|
2804
|
-
* import {getGlobalObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2886
|
+
* import {getGlobalObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/global.js';
|
2805
2887
|
* getGlobalObject('document')
|
2806
2888
|
* // ↦ { }
|
2807
2889
|
* </script>
|
@@ -2833,7 +2915,7 @@ function getGlobalObject(name) {
|
|
2833
2915
|
*
|
2834
2916
|
* ```
|
2835
2917
|
* <script type="module">
|
2836
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2918
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2837
2919
|
* console.log(Monster.Types.getGlobalFunction('parseInt')) // ↦ f parseInt() { }
|
2838
2920
|
* </script>
|
2839
2921
|
* ```
|
@@ -2842,7 +2924,7 @@ function getGlobalObject(name) {
|
|
2842
2924
|
*
|
2843
2925
|
* ```
|
2844
2926
|
* <script type="module">
|
2845
|
-
* import {getGlobalFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2927
|
+
* import {getGlobalFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/global.js';
|
2846
2928
|
* console.log(getGlobalFunction('parseInt')) // ↦ f parseInt() { }
|
2847
2929
|
* </script>
|
2848
2930
|
* ```
|
@@ -2893,7 +2975,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
2893
2975
|
*
|
2894
2976
|
* ```
|
2895
2977
|
* <script type="module">
|
2896
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2978
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
2897
2979
|
* console.log(Monster.Types.typeOf())
|
2898
2980
|
* </script>
|
2899
2981
|
* ```
|
@@ -2902,14 +2984,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
2902
2984
|
*
|
2903
2985
|
* ```
|
2904
2986
|
* <script type="module">
|
2905
|
-
* import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2987
|
+
* import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/typeof.js';
|
2906
2988
|
* console.log(typeOf())
|
2907
2989
|
* </script>
|
2908
2990
|
* ```
|
2909
2991
|
*
|
2910
2992
|
* @example
|
2911
2993
|
*
|
2912
|
-
* import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2994
|
+
* import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/typeof.js';
|
2913
2995
|
*
|
2914
2996
|
* console.log(typeOf(undefined)); // ↦ undefined
|
2915
2997
|
* console.log(typeOf("")); // ↦ string
|
@@ -3028,7 +3110,7 @@ var WILDCARD = '*';
|
|
3028
3110
|
*
|
3029
3111
|
* ```
|
3030
3112
|
* <script type="module">
|
3031
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3113
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
3032
3114
|
* console.log(new Monster.Data.Pathfinder())
|
3033
3115
|
* </script>
|
3034
3116
|
* ```
|
@@ -3037,7 +3119,7 @@ var WILDCARD = '*';
|
|
3037
3119
|
*
|
3038
3120
|
* ```
|
3039
3121
|
* <script type="module">
|
3040
|
-
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3122
|
+
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/pathfinder.js';
|
3041
3123
|
* console.log(new Pathfinder())
|
3042
3124
|
* </script>
|
3043
3125
|
* ```
|
@@ -3079,7 +3161,7 @@ var WILDCARD = '*';
|
|
3079
3161
|
*
|
3080
3162
|
* @example
|
3081
3163
|
*
|
3082
|
-
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3164
|
+
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/pathfinder.js';
|
3083
3165
|
*
|
3084
3166
|
* let value = new Pathfinder({
|
3085
3167
|
* a: {
|
@@ -3105,7 +3187,7 @@ var WILDCARD = '*';
|
|
3105
3187
|
*
|
3106
3188
|
* @example
|
3107
3189
|
*
|
3108
|
-
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3190
|
+
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/pathfinder.js';
|
3109
3191
|
*
|
3110
3192
|
* let p = new Pathfinder({
|
3111
3193
|
* a: {
|
@@ -3520,7 +3602,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
3520
3602
|
*
|
3521
3603
|
* ```
|
3522
3604
|
* <script type="module">
|
3523
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3605
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
3524
3606
|
* console.log(new Monster.Types.Stack())
|
3525
3607
|
* </script>
|
3526
3608
|
* ```
|
@@ -3529,7 +3611,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
3529
3611
|
*
|
3530
3612
|
* ```
|
3531
3613
|
* <script type="module">
|
3532
|
-
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3614
|
+
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/stack.js';
|
3533
3615
|
* console.log(new Stack())
|
3534
3616
|
* </script>
|
3535
3617
|
* ```
|
@@ -3664,7 +3746,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
3664
3746
|
*
|
3665
3747
|
* ```
|
3666
3748
|
* <script type="module">
|
3667
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3749
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
3668
3750
|
* Monster.Data.Diff(a, b)
|
3669
3751
|
* </script>
|
3670
3752
|
* ```
|
@@ -3673,14 +3755,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
3673
3755
|
*
|
3674
3756
|
* ```
|
3675
3757
|
* <script type="module">
|
3676
|
-
* import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3758
|
+
* import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/diff.js';
|
3677
3759
|
* Diff(a, b)
|
3678
3760
|
* </script>
|
3679
3761
|
* ```
|
3680
3762
|
*
|
3681
3763
|
* @example
|
3682
3764
|
*
|
3683
|
-
* import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3765
|
+
* import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/diff.js';
|
3684
3766
|
*
|
3685
3767
|
* // given are two objects x and y.
|
3686
3768
|
*
|
@@ -3926,7 +4008,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
3926
4008
|
*
|
3927
4009
|
* ```
|
3928
4010
|
* <script type="module">
|
3929
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4011
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
3930
4012
|
* Monster.Data.extend(a, b)
|
3931
4013
|
* </script>
|
3932
4014
|
* ```
|
@@ -3935,7 +4017,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
3935
4017
|
*
|
3936
4018
|
* ```
|
3937
4019
|
* <script type="module">
|
3938
|
-
* import {extend} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4020
|
+
* import {extend} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/extend.js';
|
3939
4021
|
* extend(a, b)
|
3940
4022
|
* </script>
|
3941
4023
|
* ```
|
@@ -4064,7 +4146,7 @@ var DELIMITER = '|';
|
|
4064
4146
|
*
|
4065
4147
|
* ```
|
4066
4148
|
* <script type="module">
|
4067
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4149
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
4068
4150
|
* new Monster.Data.Pipe()
|
4069
4151
|
* </script>
|
4070
4152
|
* ```
|
@@ -4073,7 +4155,7 @@ var DELIMITER = '|';
|
|
4073
4155
|
*
|
4074
4156
|
* ```
|
4075
4157
|
* <script type="module">
|
4076
|
-
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4158
|
+
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/pipe.js';
|
4077
4159
|
* new Pipe()
|
4078
4160
|
* </script>
|
4079
4161
|
* ```
|
@@ -4084,7 +4166,7 @@ var DELIMITER = '|';
|
|
4084
4166
|
* the word is then converted to uppercase letters and a prefix Hello is added. the two backslash safe the space char.
|
4085
4167
|
*
|
4086
4168
|
* @example
|
4087
|
-
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4169
|
+
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/pipe.js';
|
4088
4170
|
*
|
4089
4171
|
* let obj = {
|
4090
4172
|
* a: {
|
@@ -4246,7 +4328,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
4246
4328
|
*
|
4247
4329
|
* ```
|
4248
4330
|
* <script type="module">
|
4249
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4331
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
4250
4332
|
* new Monster.Data.Transformer()
|
4251
4333
|
* </script>
|
4252
4334
|
* ```
|
@@ -4255,7 +4337,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
4255
4337
|
*
|
4256
4338
|
* ```
|
4257
4339
|
* <script type="module">
|
4258
|
-
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4340
|
+
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/transformer.js';
|
4259
4341
|
* new Transformer()
|
4260
4342
|
* </script>
|
4261
4343
|
* ```
|
@@ -4272,8 +4354,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
4272
4354
|
*
|
4273
4355
|
* | command | parameter | alias | description |
|
4274
4356
|
* |:-------------|:---------------------------|:------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
4275
|
-
* | to-base64 | | base64
|
4276
|
-
* | from-base64 | |
|
4357
|
+
* | to-base64 | | base64, btob | Converts the value to base64 |
|
4358
|
+
* | from-base64 | | atob | Converts the value from base64 |
|
4277
4359
|
* | call | function:param1:param2:... | | Calling a callback function. The function can be defined in three places: either globally, in the context `addCallback` or in the passed object |
|
4278
4360
|
* | default | value:type | ?? | If the value is undefined the first argument is returned, otherwise the value. The third optional parameter specifies the desired type. If no type is specified, string is used. Valid types are bool, string, int, float, undefined and object. An object default value must be specified as a base64 encoded json string. (since 1.12.0) |
|
4279
4361
|
* | debug | | | the passed value is output (console) and returned |
|
@@ -4341,7 +4423,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
4341
4423
|
*
|
4342
4424
|
* @example
|
4343
4425
|
*
|
4344
|
-
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4426
|
+
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/data/transformer.js';
|
4345
4427
|
*
|
4346
4428
|
* const transformer = new Transformer("tolower")
|
4347
4429
|
*
|
@@ -4643,9 +4725,11 @@ function transform(value) {
|
|
4643
4725
|
throw new TypeError("unsupported type " + _typeof(value));
|
4644
4726
|
|
4645
4727
|
case 'to-base64':
|
4728
|
+
case 'btoa':
|
4646
4729
|
case 'base64':
|
4647
4730
|
return btoa(convertToString(value));
|
4648
4731
|
|
4732
|
+
case 'atob':
|
4649
4733
|
case 'from-base64':
|
4650
4734
|
return atob(convertToString(value));
|
4651
4735
|
|
@@ -4872,7 +4956,7 @@ var internalCounter = new Map();
|
|
4872
4956
|
*
|
4873
4957
|
* ```
|
4874
4958
|
* <script type="module">
|
4875
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4959
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
4876
4960
|
* console.log(new Monster.Types.ID())
|
4877
4961
|
* </script>
|
4878
4962
|
* ```
|
@@ -4881,7 +4965,7 @@ var internalCounter = new Map();
|
|
4881
4965
|
*
|
4882
4966
|
* ```
|
4883
4967
|
* <script type="module">
|
4884
|
-
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4968
|
+
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/id.js';
|
4885
4969
|
* console.log(new ID())
|
4886
4970
|
* </script>
|
4887
4971
|
* ```
|
@@ -4891,6 +4975,7 @@ var internalCounter = new Map();
|
|
4891
4975
|
* @since 1.0.0
|
4892
4976
|
* @copyright schukai GmbH
|
4893
4977
|
* @memberOf Monster.Types
|
4978
|
+
* @summary Automatic generation of ids
|
4894
4979
|
*/
|
4895
4980
|
|
4896
4981
|
var ID = /*#__PURE__*/function (_Base) {
|
@@ -4899,7 +4984,9 @@ var ID = /*#__PURE__*/function (_Base) {
|
|
4899
4984
|
var _super = _createSuper(ID);
|
4900
4985
|
|
4901
4986
|
/**
|
4902
|
-
* create new
|
4987
|
+
* create new id with prefix
|
4988
|
+
*
|
4989
|
+
* @param {string} prefix
|
4903
4990
|
*/
|
4904
4991
|
function ID(prefix) {
|
4905
4992
|
var _this;
|
@@ -5001,7 +5088,7 @@ var ATTRIBUTEPREFIX = "data-monster-";
|
|
5001
5088
|
*
|
5002
5089
|
* ```
|
5003
5090
|
* <script type="module">
|
5004
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5091
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
5005
5092
|
* console.log(new Monster.DOM.Assembler())
|
5006
5093
|
* </script>
|
5007
5094
|
* ```
|
@@ -5010,7 +5097,7 @@ var ATTRIBUTEPREFIX = "data-monster-";
|
|
5010
5097
|
*
|
5011
5098
|
* ```
|
5012
5099
|
* <script type="module">
|
5013
|
-
* import {Assembler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5100
|
+
* import {Assembler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/assembler.js';
|
5014
5101
|
* console.log(new Assembler())
|
5015
5102
|
* </script>
|
5016
5103
|
* ```
|
@@ -5151,7 +5238,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5151
5238
|
*
|
5152
5239
|
* ```
|
5153
5240
|
* <script type="module">
|
5154
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5241
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
5155
5242
|
* new Monster.Types.ProxyObserver()
|
5156
5243
|
* </script>
|
5157
5244
|
* ```
|
@@ -5160,7 +5247,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5160
5247
|
*
|
5161
5248
|
* ```
|
5162
5249
|
* <script type="module">
|
5163
|
-
* import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5250
|
+
* import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/proxyobserver.js';
|
5164
5251
|
* new ProxyObserver()
|
5165
5252
|
* </script>
|
5166
5253
|
* ```
|
@@ -5171,9 +5258,9 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5171
5258
|
*
|
5172
5259
|
* @example
|
5173
5260
|
*
|
5174
|
-
* import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5175
|
-
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5176
|
-
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5261
|
+
* import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/proxyobserver.js';
|
5262
|
+
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/observer.js';
|
5263
|
+
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/is.js';
|
5177
5264
|
*
|
5178
5265
|
* const o = new Observer(function () {
|
5179
5266
|
* if (isObject(this) && this instanceof ProxyObserver) {
|
@@ -5499,7 +5586,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5499
5586
|
*
|
5500
5587
|
* ```
|
5501
5588
|
* <script type="module">
|
5502
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5589
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
5503
5590
|
* console.log(new Monster.Types.Observer())
|
5504
5591
|
* </script>
|
5505
5592
|
* ```
|
@@ -5508,7 +5595,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5508
5595
|
*
|
5509
5596
|
* ```
|
5510
5597
|
* <script type="module">
|
5511
|
-
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5598
|
+
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/observer.js';
|
5512
5599
|
* console.log(new Observer())
|
5513
5600
|
* </script>
|
5514
5601
|
* ```
|
@@ -5542,7 +5629,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5542
5629
|
*
|
5543
5630
|
* @example
|
5544
5631
|
*
|
5545
|
-
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5632
|
+
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/observer.js';
|
5546
5633
|
*
|
5547
5634
|
* const observer = new Observer(function(a, b, c) {
|
5548
5635
|
* console.log(this, a, b, c); // ↦ "a", 2, true
|
@@ -5742,7 +5829,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5742
5829
|
*
|
5743
5830
|
* ```
|
5744
5831
|
* <script type="module">
|
5745
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5832
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
5746
5833
|
* new Monster.Types.TokenList("myclass row")
|
5747
5834
|
* </script>
|
5748
5835
|
* ```
|
@@ -5751,7 +5838,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5751
5838
|
*
|
5752
5839
|
* ```
|
5753
5840
|
* <script type="module">
|
5754
|
-
* import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5841
|
+
* import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/tokenlist.js';
|
5755
5842
|
* new TokenList("myclass row")
|
5756
5843
|
* </script>
|
5757
5844
|
* ```
|
@@ -6174,7 +6261,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6174
6261
|
*
|
6175
6262
|
* ```
|
6176
6263
|
* <script type="module">
|
6177
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6264
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
6178
6265
|
* new Monster.Types.UniqueQueue()
|
6179
6266
|
* </script>
|
6180
6267
|
* ```
|
@@ -6183,7 +6270,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6183
6270
|
*
|
6184
6271
|
* ```
|
6185
6272
|
* <script type="module">
|
6186
|
-
* import {UniqueQueue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6273
|
+
* import {UniqueQueue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/uniquequeue.js';
|
6187
6274
|
* new UniqueQueue()
|
6188
6275
|
* </script>
|
6189
6276
|
* ```
|
@@ -6314,11 +6401,11 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6314
6401
|
|
6315
6402
|
|
6316
6403
|
/**
|
6317
|
-
* You can
|
6404
|
+
* You can create the instance via the monster namespace `new Monster.Types.Queue()`.
|
6318
6405
|
*
|
6319
6406
|
* ```
|
6320
6407
|
* <script type="module">
|
6321
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6408
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
6322
6409
|
* new Monster.Types.Queue()
|
6323
6410
|
* </script>
|
6324
6411
|
* ```
|
@@ -6327,14 +6414,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6327
6414
|
*
|
6328
6415
|
* ```
|
6329
6416
|
* <script type="module">
|
6330
|
-
* import {
|
6417
|
+
* import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/queue.js';
|
6331
6418
|
* new Queue()
|
6332
6419
|
* </script>
|
6333
6420
|
* ```
|
6334
6421
|
*
|
6335
6422
|
* @example
|
6336
6423
|
*
|
6337
|
-
* import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6424
|
+
* import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/queue.js';
|
6338
6425
|
*
|
6339
6426
|
* const queue = new Queue;
|
6340
6427
|
*
|
@@ -6503,7 +6590,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6503
6590
|
*
|
6504
6591
|
* ```
|
6505
6592
|
* <script type="module">
|
6506
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6593
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
6507
6594
|
* console.log(new Monster.Types.ObserverList())
|
6508
6595
|
* console.log(new Monster.Types.ObserverList())
|
6509
6596
|
* </script>
|
@@ -6513,7 +6600,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6513
6600
|
*
|
6514
6601
|
* ```
|
6515
6602
|
* <script type="module">
|
6516
|
-
* import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6603
|
+
* import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/observerlist.js';
|
6517
6604
|
* console.log(ObserverList())
|
6518
6605
|
* console.log(ObserverList())
|
6519
6606
|
* </script>
|
@@ -6645,7 +6732,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
6645
6732
|
/* harmony export */ "addAttributeToken": function() { return /* binding */ addAttributeToken; },
|
6646
6733
|
/* harmony export */ "toggleAttributeToken": function() { return /* binding */ toggleAttributeToken; },
|
6647
6734
|
/* harmony export */ "getLinkedObjects": function() { return /* binding */ getLinkedObjects; },
|
6648
|
-
/* harmony export */ "findClosestObjectLink": function() { return /* binding */ findClosestObjectLink; }
|
6735
|
+
/* harmony export */ "findClosestObjectLink": function() { return /* binding */ findClosestObjectLink; },
|
6736
|
+
/* harmony export */ "findClosestByClass": function() { return /* binding */ findClosestByClass; }
|
6649
6737
|
/* harmony export */ });
|
6650
6738
|
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
6651
6739
|
/* harmony import */ var _types_global_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);
|
@@ -6672,7 +6760,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
6672
6760
|
*
|
6673
6761
|
* ```
|
6674
6762
|
* <script type="module">
|
6675
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6763
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
6676
6764
|
* console.log(Monster.DOM.findClosestObjectLink())
|
6677
6765
|
* </script>
|
6678
6766
|
* ```
|
@@ -6681,7 +6769,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
6681
6769
|
*
|
6682
6770
|
* ```
|
6683
6771
|
* <script type="module">
|
6684
|
-
* import {getUpdaterFromNode} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6772
|
+
* import {getUpdaterFromNode} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/updater.js';
|
6685
6773
|
* console.log(findClosestObjectLink())
|
6686
6774
|
* </script>
|
6687
6775
|
* ```
|
@@ -6702,7 +6790,7 @@ function findClosestObjectLink(element) {
|
|
6702
6790
|
*
|
6703
6791
|
* ```
|
6704
6792
|
* <script type="module">
|
6705
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6793
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
6706
6794
|
* Monster.DOM.addToObjectLink();
|
6707
6795
|
* </script>
|
6708
6796
|
* ```
|
@@ -6711,7 +6799,7 @@ function findClosestObjectLink(element) {
|
|
6711
6799
|
*
|
6712
6800
|
* ```
|
6713
6801
|
* <script type="module">
|
6714
|
-
* import {addToObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6802
|
+
* import {addToObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
6715
6803
|
* addToObjectLink();
|
6716
6804
|
* </script>
|
6717
6805
|
* ```
|
@@ -6743,7 +6831,7 @@ function addToObjectLink(element, symbol, object) {
|
|
6743
6831
|
*
|
6744
6832
|
* ```
|
6745
6833
|
* <script type="module">
|
6746
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6834
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
6747
6835
|
* Monster.DOM.removeObjectLink();
|
6748
6836
|
* </script>
|
6749
6837
|
* ```
|
@@ -6752,7 +6840,7 @@ function addToObjectLink(element, symbol, object) {
|
|
6752
6840
|
*
|
6753
6841
|
* ```
|
6754
6842
|
* <script type="module">
|
6755
|
-
* import {removeObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6843
|
+
* import {removeObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
6756
6844
|
* removeObjectLink();
|
6757
6845
|
* </script>
|
6758
6846
|
* ```
|
@@ -6783,7 +6871,7 @@ function removeObjectLink(element, symbol) {
|
|
6783
6871
|
*
|
6784
6872
|
* ```
|
6785
6873
|
* <script type="module">
|
6786
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6874
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
6787
6875
|
* Monster.DOM.hasObjectLink();
|
6788
6876
|
* </script>
|
6789
6877
|
* ```
|
@@ -6792,7 +6880,7 @@ function removeObjectLink(element, symbol) {
|
|
6792
6880
|
*
|
6793
6881
|
* ```
|
6794
6882
|
* <script type="module">
|
6795
|
-
* import {hasObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6883
|
+
* import {hasObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
6796
6884
|
* hasObjectLink();
|
6797
6885
|
* </script>
|
6798
6886
|
* ```
|
@@ -6828,7 +6916,7 @@ function hasObjectLink(element, symbol) {
|
|
6828
6916
|
*
|
6829
6917
|
* ```
|
6830
6918
|
* <script type="module">
|
6831
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6919
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
6832
6920
|
* Monster.DOM.getLinkedObjects();
|
6833
6921
|
* </script>
|
6834
6922
|
* ```
|
@@ -6837,7 +6925,7 @@ function hasObjectLink(element, symbol) {
|
|
6837
6925
|
*
|
6838
6926
|
* ```
|
6839
6927
|
* <script type="module">
|
6840
|
-
* import {getLinkedObjects} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6928
|
+
* import {getLinkedObjects} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
6841
6929
|
* getLinkedObjects();
|
6842
6930
|
* </script>
|
6843
6931
|
* ```
|
@@ -6871,7 +6959,7 @@ function getLinkedObjects(element, symbol) {
|
|
6871
6959
|
*
|
6872
6960
|
* ```
|
6873
6961
|
* <script type="module">
|
6874
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6962
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
6875
6963
|
* Monster.DOM.toggleAttributeToken();
|
6876
6964
|
* </script>
|
6877
6965
|
* ```
|
@@ -6880,7 +6968,7 @@ function getLinkedObjects(element, symbol) {
|
|
6880
6968
|
*
|
6881
6969
|
* ```
|
6882
6970
|
* <script type="module">
|
6883
|
-
* import {toggleAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6971
|
+
* import {toggleAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
6884
6972
|
* toggleAttributeToken();
|
6885
6973
|
* </script>
|
6886
6974
|
* ```
|
@@ -6915,7 +7003,7 @@ function toggleAttributeToken(element, key, token) {
|
|
6915
7003
|
*
|
6916
7004
|
* ```
|
6917
7005
|
* <script type="module">
|
6918
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7006
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
6919
7007
|
* Monster.DOM.addAttributeToken();
|
6920
7008
|
* </script>
|
6921
7009
|
* ```
|
@@ -6924,7 +7012,7 @@ function toggleAttributeToken(element, key, token) {
|
|
6924
7012
|
*
|
6925
7013
|
* ```
|
6926
7014
|
* <script type="module">
|
6927
|
-
* import {addAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7015
|
+
* import {addAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
6928
7016
|
* addAttributeToken();
|
6929
7017
|
* </script>
|
6930
7018
|
* ```
|
@@ -6961,7 +7049,7 @@ function addAttributeToken(element, key, token) {
|
|
6961
7049
|
*
|
6962
7050
|
* ```
|
6963
7051
|
* <script type="module">
|
6964
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7052
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
6965
7053
|
* Monster.DOM.removeAttributeToken();
|
6966
7054
|
* </script>
|
6967
7055
|
* ```
|
@@ -6970,7 +7058,7 @@ function addAttributeToken(element, key, token) {
|
|
6970
7058
|
*
|
6971
7059
|
* ```
|
6972
7060
|
* <script type="module">
|
6973
|
-
* import {removeAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7061
|
+
* import {removeAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
6974
7062
|
* removeAttributeToken();
|
6975
7063
|
* </script>
|
6976
7064
|
* ```
|
@@ -7006,7 +7094,7 @@ function removeAttributeToken(element, key, token) {
|
|
7006
7094
|
*
|
7007
7095
|
* ```
|
7008
7096
|
* <script type="module">
|
7009
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7097
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
7010
7098
|
* Monster.DOM.containsAttributeToken();
|
7011
7099
|
* </script>
|
7012
7100
|
* ```
|
@@ -7015,7 +7103,7 @@ function removeAttributeToken(element, key, token) {
|
|
7015
7103
|
*
|
7016
7104
|
* ```
|
7017
7105
|
* <script type="module">
|
7018
|
-
* import {containsAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7106
|
+
* import {containsAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
7019
7107
|
* containsAttributeToken();
|
7020
7108
|
* </script>
|
7021
7109
|
* ```
|
@@ -7048,7 +7136,7 @@ function containsAttributeToken(element, key, token) {
|
|
7048
7136
|
*
|
7049
7137
|
* ```
|
7050
7138
|
* <script type="module">
|
7051
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7139
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
7052
7140
|
* Monster.DOM.replaceAttributeToken();
|
7053
7141
|
* </script>
|
7054
7142
|
* ```
|
@@ -7057,7 +7145,7 @@ function containsAttributeToken(element, key, token) {
|
|
7057
7145
|
*
|
7058
7146
|
* ```
|
7059
7147
|
* <script type="module">
|
7060
|
-
* import {replaceAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7148
|
+
* import {replaceAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
7061
7149
|
* replaceAttributeToken();
|
7062
7150
|
* </script>
|
7063
7151
|
* ```
|
@@ -7093,7 +7181,7 @@ function replaceAttributeToken(element, key, from, to) {
|
|
7093
7181
|
*
|
7094
7182
|
* ```
|
7095
7183
|
* <script type="module">
|
7096
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7184
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
7097
7185
|
* Monster.DOM.clearAttributeTokens();
|
7098
7186
|
* </script>
|
7099
7187
|
* ```
|
@@ -7102,7 +7190,7 @@ function replaceAttributeToken(element, key, from, to) {
|
|
7102
7190
|
*
|
7103
7191
|
* ```
|
7104
7192
|
* <script type="module">
|
7105
|
-
* import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7193
|
+
* import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
7106
7194
|
* clearAttributeTokens();
|
7107
7195
|
* </script>
|
7108
7196
|
* ```
|
@@ -7128,11 +7216,29 @@ function clearAttributeTokens(element, key) {
|
|
7128
7216
|
return element;
|
7129
7217
|
}
|
7130
7218
|
/**
|
7219
|
+
* This function searches, starting from an `HTMLElemement`, for the next element that has a certain attribute.
|
7220
|
+
*
|
7221
|
+
* ```html
|
7222
|
+
* <div data-my-attribute="2" id="2">
|
7223
|
+
* <div id="1"></div>
|
7224
|
+
* </div>
|
7225
|
+
* ```
|
7226
|
+
*
|
7227
|
+
* ```javascript
|
7228
|
+
* // if no value is specified (undefined), then only the attribute is checked.
|
7229
|
+
* findClosestByAttribute(document.getElementById('1'),'data-my-attribute'); // ↦ node with id 2
|
7230
|
+
* findClosestByAttribute(document.getElementById('2'),'data-my-attribute'); // ↦ node with id 2
|
7231
|
+
*
|
7232
|
+
* // if a value is specified, for example an empty string, then the name and the value are checked.
|
7233
|
+
* findClosestByAttribute(document.getElementById('1'),'data-my-attribute', ''); // ↦ undefined
|
7234
|
+
* findClosestByAttribute(document.getElementById('1'),'data-my-attribute', '2'); // ↦ node with id 2
|
7235
|
+
* ```
|
7236
|
+
*
|
7131
7237
|
* You can call the method via the monster namespace `new Monster.DOM.findClosestByAttribute()`.
|
7132
7238
|
*
|
7133
7239
|
* ```
|
7134
7240
|
* <script type="module">
|
7135
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7241
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
7136
7242
|
* Monster.DOM.findClosestByAttribute();
|
7137
7243
|
* </script>
|
7138
7244
|
* ```
|
@@ -7141,7 +7247,7 @@ function clearAttributeTokens(element, key) {
|
|
7141
7247
|
*
|
7142
7248
|
* ```
|
7143
7249
|
* <script type="module">
|
7144
|
-
* import {findClosestByAttribute} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7250
|
+
* import {findClosestByAttribute} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
7145
7251
|
* findClosestByAttribute();
|
7146
7252
|
* </script>
|
7147
7253
|
* ```
|
@@ -7153,14 +7259,21 @@ function clearAttributeTokens(element, key) {
|
|
7153
7259
|
* @param {string} key
|
7154
7260
|
* @param {string|undefined} value
|
7155
7261
|
* @return {HTMLElement|undefined}
|
7262
|
+
* @summary find closest node
|
7156
7263
|
*/
|
7157
7264
|
|
7158
7265
|
|
7159
7266
|
function findClosestByAttribute(element, key, value) {
|
7160
7267
|
(0,_types_validate_js__WEBPACK_IMPORTED_MODULE_3__.validateInstance)(element, (0,_types_global_js__WEBPACK_IMPORTED_MODULE_1__.getGlobalFunction)('HTMLElement'));
|
7161
7268
|
|
7162
|
-
if (element.hasAttribute(key)
|
7163
|
-
|
7269
|
+
if (element.hasAttribute(key)) {
|
7270
|
+
if (value === undefined) {
|
7271
|
+
return element;
|
7272
|
+
}
|
7273
|
+
|
7274
|
+
if (element.getAttribute(key) === value) {
|
7275
|
+
return element;
|
7276
|
+
}
|
7164
7277
|
}
|
7165
7278
|
|
7166
7279
|
var selector = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_3__.validateString)(key);
|
@@ -7171,11 +7284,71 @@ function findClosestByAttribute(element, key, value) {
|
|
7171
7284
|
return result;
|
7172
7285
|
}
|
7173
7286
|
|
7287
|
+
return undefined;
|
7288
|
+
}
|
7289
|
+
/**
|
7290
|
+
* This function searches, starting from an `HTMLElemement`, for the next element that has a certain attribute.
|
7291
|
+
*
|
7292
|
+
* ```html
|
7293
|
+
* <div class="myclass" id="2">
|
7294
|
+
* <div id="1"></div>
|
7295
|
+
* </div>
|
7296
|
+
* ```
|
7297
|
+
*
|
7298
|
+
* ```javascript
|
7299
|
+
* // if no value is specified (undefined), then only the attribute is checked.
|
7300
|
+
* findClosestByClass(document.getElementById('1'),'myclass'); // ↦ node with id 2
|
7301
|
+
* findClosestByClass(document.getElementById('2'),'myclass'); // ↦ node with id 2
|
7302
|
+
* ```
|
7303
|
+
*
|
7304
|
+
* You can call the method via the monster namespace `new Monster.DOM.findClosestByClass()`.
|
7305
|
+
*
|
7306
|
+
* ```
|
7307
|
+
* <script type="module">
|
7308
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
7309
|
+
* Monster.DOM.findClosestByClass();
|
7310
|
+
* </script>
|
7311
|
+
* ```
|
7312
|
+
*
|
7313
|
+
* Alternatively, you can also integrate this function individually.
|
7314
|
+
*
|
7315
|
+
* ```
|
7316
|
+
* <script type="module">
|
7317
|
+
* import {findClosestByClass} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/attributes.js';
|
7318
|
+
* findClosestByClass();
|
7319
|
+
* </script>
|
7320
|
+
* ```
|
7321
|
+
*
|
7322
|
+
* @since 1.27.0
|
7323
|
+
* @copyright schukai GmbH
|
7324
|
+
* @memberOf Monster.DOM
|
7325
|
+
* @param {HTMLElement} element
|
7326
|
+
* @param {string} className
|
7327
|
+
* @return {HTMLElement|undefined}
|
7328
|
+
* @summary find closest node
|
7329
|
+
*/
|
7330
|
+
|
7331
|
+
|
7332
|
+
function findClosestByClass(element, className) {
|
7333
|
+
var _element$classList;
|
7334
|
+
|
7335
|
+
(0,_types_validate_js__WEBPACK_IMPORTED_MODULE_3__.validateInstance)(element, (0,_types_global_js__WEBPACK_IMPORTED_MODULE_1__.getGlobalFunction)('HTMLElement'));
|
7336
|
+
|
7337
|
+
if (element !== null && element !== void 0 && (_element$classList = element.classList) !== null && _element$classList !== void 0 && _element$classList.contains((0,_types_validate_js__WEBPACK_IMPORTED_MODULE_3__.validateString)(className))) {
|
7338
|
+
return element;
|
7339
|
+
}
|
7340
|
+
|
7341
|
+
var result = element.closest('.' + className);
|
7342
|
+
|
7343
|
+
if (result instanceof HTMLElement) {
|
7344
|
+
return result;
|
7345
|
+
}
|
7346
|
+
|
7174
7347
|
return undefined;
|
7175
7348
|
} // exports
|
7176
7349
|
|
7177
7350
|
|
7178
|
-
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_0__.assignToNamespace)('Monster.DOM', getLinkedObjects, addToObjectLink, removeObjectLink, findClosestByAttribute, hasObjectLink, clearAttributeTokens, replaceAttributeToken, containsAttributeToken, removeAttributeToken, addAttributeToken, toggleAttributeToken);
|
7351
|
+
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_0__.assignToNamespace)('Monster.DOM', findClosestByClass, getLinkedObjects, addToObjectLink, removeObjectLink, findClosestByAttribute, hasObjectLink, clearAttributeTokens, replaceAttributeToken, containsAttributeToken, removeAttributeToken, addAttributeToken, toggleAttributeToken);
|
7179
7352
|
|
7180
7353
|
|
7181
7354
|
/***/ }),
|
@@ -7185,6 +7358,38 @@ function findClosestByAttribute(element, key, value) {
|
|
7185
7358
|
__webpack_require__.r(__webpack_exports__);
|
7186
7359
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
7187
7360
|
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_0__.Monster; },
|
7361
|
+
/* harmony export */ "ATTRIBUTE_HIDDEN": function() { return /* binding */ ATTRIBUTE_HIDDEN; },
|
7362
|
+
/* harmony export */ "ATTRIBUTE_EXPORTPARTS": function() { return /* binding */ ATTRIBUTE_EXPORTPARTS; },
|
7363
|
+
/* harmony export */ "ATTRIBUTE_ENTERKEYHINT": function() { return /* binding */ ATTRIBUTE_ENTERKEYHINT; },
|
7364
|
+
/* harmony export */ "ATTRIBUTE_DRAGGABLE": function() { return /* binding */ ATTRIBUTE_DRAGGABLE; },
|
7365
|
+
/* harmony export */ "ATTRIBUTE_DIR": function() { return /* binding */ ATTRIBUTE_DIR; },
|
7366
|
+
/* harmony export */ "ATTRIBUTE_CONTENTEDITABLE": function() { return /* binding */ ATTRIBUTE_CONTENTEDITABLE; },
|
7367
|
+
/* harmony export */ "ATTRIBUTE_AUTOFOCUS": function() { return /* binding */ ATTRIBUTE_AUTOFOCUS; },
|
7368
|
+
/* harmony export */ "ATTRIBUTE_AUTOCAPITALIZE": function() { return /* binding */ ATTRIBUTE_AUTOCAPITALIZE; },
|
7369
|
+
/* harmony export */ "ATTRIBUTE_ACCESSKEY": function() { return /* binding */ ATTRIBUTE_ACCESSKEY; },
|
7370
|
+
/* harmony export */ "TAG_SCRIPT": function() { return /* binding */ TAG_SCRIPT; },
|
7371
|
+
/* harmony export */ "TAG_LINK": function() { return /* binding */ TAG_LINK; },
|
7372
|
+
/* harmony export */ "ATTRIBUTE_INPUTMODE": function() { return /* binding */ ATTRIBUTE_INPUTMODE; },
|
7373
|
+
/* harmony export */ "ATTRIBUTE_IS": function() { return /* binding */ ATTRIBUTE_IS; },
|
7374
|
+
/* harmony export */ "ATTRIBUTE_ITEMPROP": function() { return /* binding */ ATTRIBUTE_ITEMPROP; },
|
7375
|
+
/* harmony export */ "ATTRIBUTE_ITEMID": function() { return /* binding */ ATTRIBUTE_ITEMID; },
|
7376
|
+
/* harmony export */ "ATTRIBUTE_ITEMREF": function() { return /* binding */ ATTRIBUTE_ITEMREF; },
|
7377
|
+
/* harmony export */ "ATTRIBUTE_ITEMSCOPE": function() { return /* binding */ ATTRIBUTE_ITEMSCOPE; },
|
7378
|
+
/* harmony export */ "TAG_STYLE": function() { return /* binding */ TAG_STYLE; },
|
7379
|
+
/* harmony export */ "ATTRIBUTE_ITEMTYPE": function() { return /* binding */ ATTRIBUTE_ITEMTYPE; },
|
7380
|
+
/* harmony export */ "ATTRIBUTE_HREF": function() { return /* binding */ ATTRIBUTE_HREF; },
|
7381
|
+
/* harmony export */ "ATTRIBUTE_LANG": function() { return /* binding */ ATTRIBUTE_LANG; },
|
7382
|
+
/* harmony export */ "ATTRIBUTE_PART": function() { return /* binding */ ATTRIBUTE_PART; },
|
7383
|
+
/* harmony export */ "ATTRIBUTE_SLOT": function() { return /* binding */ ATTRIBUTE_SLOT; },
|
7384
|
+
/* harmony export */ "ATTRIBUTE_SPELLCHECK": function() { return /* binding */ ATTRIBUTE_SPELLCHECK; },
|
7385
|
+
/* harmony export */ "ATTRIBUTE_SRC": function() { return /* binding */ ATTRIBUTE_SRC; },
|
7386
|
+
/* harmony export */ "ATTRIBUTE_TABINDEX": function() { return /* binding */ ATTRIBUTE_TABINDEX; },
|
7387
|
+
/* harmony export */ "ATTRIBUTE_TRANSLATE": function() { return /* binding */ ATTRIBUTE_TRANSLATE; },
|
7388
|
+
/* harmony export */ "ATTRIBUTE_NONCE": function() { return /* binding */ ATTRIBUTE_NONCE; },
|
7389
|
+
/* harmony export */ "ATTRIBUTE_TYPE": function() { return /* binding */ ATTRIBUTE_TYPE; },
|
7390
|
+
/* harmony export */ "ATTRIBUTE_TITLE": function() { return /* binding */ ATTRIBUTE_TITLE; },
|
7391
|
+
/* harmony export */ "ATTRIBUTE_CLASS": function() { return /* binding */ ATTRIBUTE_CLASS; },
|
7392
|
+
/* harmony export */ "ATTRIBUTE_ID": function() { return /* binding */ ATTRIBUTE_ID; },
|
7188
7393
|
/* harmony export */ "ATTRIBUTE_PREFIX": function() { return /* binding */ ATTRIBUTE_PREFIX; },
|
7189
7394
|
/* harmony export */ "ATTRIBUTE_OPTIONS": function() { return /* binding */ ATTRIBUTE_OPTIONS; },
|
7190
7395
|
/* harmony export */ "DEFAULT_THEME": function() { return /* binding */ DEFAULT_THEME; },
|
@@ -7201,7 +7406,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
7201
7406
|
/* harmony export */ "ATTRIBUTE_DISABLED": function() { return /* binding */ ATTRIBUTE_DISABLED; },
|
7202
7407
|
/* harmony export */ "ATTRIBUTE_ERRORMESSAGE": function() { return /* binding */ ATTRIBUTE_ERRORMESSAGE; },
|
7203
7408
|
/* harmony export */ "ATTRIBUTE_VALUE": function() { return /* binding */ ATTRIBUTE_VALUE; },
|
7204
|
-
/* harmony export */ "objectUpdaterLinkSymbol": function() { return /* binding */ objectUpdaterLinkSymbol; }
|
7409
|
+
/* harmony export */ "objectUpdaterLinkSymbol": function() { return /* binding */ objectUpdaterLinkSymbol; },
|
7410
|
+
/* harmony export */ "ATTRIBUTE_TEMPLATE_PREFIX": function() { return /* binding */ ATTRIBUTE_TEMPLATE_PREFIX; }
|
7205
7411
|
/* harmony export */ });
|
7206
7412
|
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
7207
7413
|
|
@@ -7212,28 +7418,28 @@ __webpack_require__.r(__webpack_exports__);
|
|
7212
7418
|
*/
|
7213
7419
|
|
7214
7420
|
/**
|
7421
|
+
* default theme
|
7215
7422
|
* @memberOf Monster.DOM
|
7216
|
-
* @since 1.8.0
|
7217
7423
|
* @type {string}
|
7218
7424
|
*/
|
7219
7425
|
|
7220
|
-
var
|
7426
|
+
var DEFAULT_THEME = 'monster';
|
7221
7427
|
/**
|
7222
|
-
* This is the name of the attribute to pass options to a control
|
7223
|
-
*
|
7224
7428
|
* @memberOf Monster.DOM
|
7225
7429
|
* @since 1.8.0
|
7226
7430
|
* @type {string}
|
7227
7431
|
*/
|
7228
7432
|
|
7229
|
-
var
|
7433
|
+
var ATTRIBUTE_PREFIX = 'data-monster-';
|
7230
7434
|
/**
|
7231
|
-
*
|
7435
|
+
* This is the name of the attribute to pass options to a control
|
7436
|
+
*
|
7232
7437
|
* @memberOf Monster.DOM
|
7438
|
+
* @since 1.8.0
|
7233
7439
|
* @type {string}
|
7234
7440
|
*/
|
7235
7441
|
|
7236
|
-
var
|
7442
|
+
var ATTRIBUTE_OPTIONS = ATTRIBUTE_PREFIX + 'options';
|
7237
7443
|
/**
|
7238
7444
|
* @memberOf Monster.DOM
|
7239
7445
|
* @type {string}
|
@@ -7289,6 +7495,13 @@ var ATTRIBUTE_UPDATER_REMOVE = ATTRIBUTE_PREFIX + 'remove';
|
|
7289
7495
|
*/
|
7290
7496
|
|
7291
7497
|
var ATTRIBUTE_UPDATER_BIND = ATTRIBUTE_PREFIX + 'bind';
|
7498
|
+
/**
|
7499
|
+
* @memberOf Monster.DOM
|
7500
|
+
* @type {string}
|
7501
|
+
* @since 1.27.0
|
7502
|
+
*/
|
7503
|
+
|
7504
|
+
var ATTRIBUTE_TEMPLATE_PREFIX = ATTRIBUTE_PREFIX + 'template-prefix';
|
7292
7505
|
/**
|
7293
7506
|
* @memberOf Monster.DOM
|
7294
7507
|
* @type {string}
|
@@ -7331,79 +7544,303 @@ var ATTRIBUTE_ERRORMESSAGE = ATTRIBUTE_PREFIX + 'error';
|
|
7331
7544
|
*/
|
7332
7545
|
|
7333
7546
|
var objectUpdaterLinkSymbol = Symbol('monsterUpdater');
|
7547
|
+
/**
|
7548
|
+
* @memberOf Monster.DOM
|
7549
|
+
* @type {string}
|
7550
|
+
* @since 1.25.0
|
7551
|
+
*/
|
7334
7552
|
|
7553
|
+
var TAG_SCRIPT = 'script';
|
7554
|
+
/**
|
7555
|
+
* @memberOf Monster.DOM
|
7556
|
+
* @type {string}
|
7557
|
+
* @since 1.25.0
|
7558
|
+
*/
|
7335
7559
|
|
7336
|
-
|
7337
|
-
|
7338
|
-
|
7560
|
+
var TAG_STYLE = 'style';
|
7561
|
+
/**
|
7562
|
+
* @memberOf Monster.DOM
|
7563
|
+
* @type {string}
|
7564
|
+
* @since 1.25.0
|
7565
|
+
*/
|
7339
7566
|
|
7340
|
-
|
7341
|
-
|
7342
|
-
|
7343
|
-
|
7344
|
-
|
7345
|
-
|
7346
|
-
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
7347
|
-
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33);
|
7348
|
-
/* harmony import */ var _customelement_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(35);
|
7567
|
+
var TAG_LINK = 'link';
|
7568
|
+
/**
|
7569
|
+
* @memberOf Monster.DOM
|
7570
|
+
* @type {string}
|
7571
|
+
* @since 1.25.0
|
7572
|
+
*/
|
7349
7573
|
|
7574
|
+
var ATTRIBUTE_ID = 'id';
|
7575
|
+
/**
|
7576
|
+
* @memberOf Monster.DOM
|
7577
|
+
* @type {string}
|
7578
|
+
* @since 1.25.0
|
7579
|
+
*/
|
7350
7580
|
|
7351
|
-
|
7581
|
+
var ATTRIBUTE_CLASS = 'class';
|
7582
|
+
/**
|
7583
|
+
* @memberOf Monster.DOM
|
7584
|
+
* @type {string}
|
7585
|
+
* @since 1.25.0
|
7586
|
+
*/
|
7352
7587
|
|
7353
|
-
|
7588
|
+
var ATTRIBUTE_TITLE = 'title';
|
7589
|
+
/**
|
7590
|
+
* @memberOf Monster.DOM
|
7591
|
+
* @type {string}
|
7592
|
+
* @since 1.25.0
|
7593
|
+
*/
|
7354
7594
|
|
7355
|
-
|
7595
|
+
var ATTRIBUTE_SRC = 'src';
|
7596
|
+
/**
|
7597
|
+
* @memberOf Monster.DOM
|
7598
|
+
* @type {string}
|
7599
|
+
* @since 1.25.0
|
7600
|
+
*/
|
7356
7601
|
|
7357
|
-
|
7602
|
+
var ATTRIBUTE_HREF = 'href';
|
7603
|
+
/**
|
7604
|
+
* @memberOf Monster.DOM
|
7605
|
+
* @type {string}
|
7606
|
+
* @since 1.25.0
|
7607
|
+
*/
|
7358
7608
|
|
7359
|
-
|
7609
|
+
var ATTRIBUTE_TYPE = 'type';
|
7610
|
+
/**
|
7611
|
+
* @memberOf Monster.DOM
|
7612
|
+
* @type {string}
|
7613
|
+
* @since 1.25.0
|
7614
|
+
*/
|
7360
7615
|
|
7361
|
-
|
7616
|
+
var ATTRIBUTE_NONCE = 'nonce';
|
7617
|
+
/**
|
7618
|
+
* @memberOf Monster.DOM
|
7619
|
+
* @type {string}
|
7620
|
+
* @since 1.25.0
|
7621
|
+
*/
|
7362
7622
|
|
7363
|
-
|
7623
|
+
var ATTRIBUTE_TRANSLATE = 'translate';
|
7624
|
+
/**
|
7625
|
+
* @memberOf Monster.DOM
|
7626
|
+
* @type {string}
|
7627
|
+
* @since 1.25.0
|
7628
|
+
*/
|
7364
7629
|
|
7365
|
-
|
7630
|
+
var ATTRIBUTE_TABINDEX = 'tabindex';
|
7631
|
+
/**
|
7632
|
+
* @memberOf Monster.DOM
|
7633
|
+
* @type {string}
|
7634
|
+
* @since 1.25.0
|
7635
|
+
*/
|
7366
7636
|
|
7367
|
-
|
7637
|
+
var ATTRIBUTE_SPELLCHECK = 'spellcheck';
|
7638
|
+
/**
|
7639
|
+
* @memberOf Monster.DOM
|
7640
|
+
* @type {string}
|
7641
|
+
* @since 1.25.0
|
7642
|
+
*/
|
7368
7643
|
|
7369
|
-
|
7644
|
+
var ATTRIBUTE_SLOT = 'slot';
|
7645
|
+
/**
|
7646
|
+
* @memberOf Monster.DOM
|
7647
|
+
* @type {string}
|
7648
|
+
* @since 1.25.0
|
7649
|
+
*/
|
7370
7650
|
|
7371
|
-
|
7651
|
+
var ATTRIBUTE_PART = 'part';
|
7652
|
+
/**
|
7653
|
+
* @memberOf Monster.DOM
|
7654
|
+
* @type {string}
|
7655
|
+
* @since 1.25.0
|
7656
|
+
*/
|
7372
7657
|
|
7373
|
-
|
7658
|
+
var ATTRIBUTE_LANG = 'lang';
|
7659
|
+
/**
|
7660
|
+
* @memberOf Monster.DOM
|
7661
|
+
* @type {string}
|
7662
|
+
* @since 1.25.0
|
7663
|
+
*/
|
7374
7664
|
|
7375
|
-
|
7665
|
+
var ATTRIBUTE_ITEMTYPE = 'itemtype';
|
7666
|
+
/**
|
7667
|
+
* @memberOf Monster.DOM
|
7668
|
+
* @type {string}
|
7669
|
+
* @since 1.25.0
|
7670
|
+
*/
|
7376
7671
|
|
7672
|
+
var ATTRIBUTE_ITEMSCOPE = 'itemscope';
|
7673
|
+
/**
|
7674
|
+
* @memberOf Monster.DOM
|
7675
|
+
* @type {string}
|
7676
|
+
* @since 1.25.0
|
7677
|
+
*/
|
7377
7678
|
|
7679
|
+
var ATTRIBUTE_ITEMREF = 'itemref';
|
7378
7680
|
/**
|
7379
|
-
* @
|
7681
|
+
* @memberOf Monster.DOM
|
7682
|
+
* @type {string}
|
7683
|
+
* @since 1.25.0
|
7380
7684
|
*/
|
7381
7685
|
|
7686
|
+
var ATTRIBUTE_ITEMID = 'itemid';
|
7687
|
+
/**
|
7688
|
+
* @memberOf Monster.DOM
|
7689
|
+
* @type {string}
|
7690
|
+
* @since 1.25.0
|
7691
|
+
*/
|
7382
7692
|
|
7693
|
+
var ATTRIBUTE_ITEMPROP = 'itemprop';
|
7694
|
+
/**
|
7695
|
+
* @memberOf Monster.DOM
|
7696
|
+
* @type {string}
|
7697
|
+
* @since 1.25.0
|
7698
|
+
*/
|
7383
7699
|
|
7700
|
+
var ATTRIBUTE_IS = 'is';
|
7701
|
+
/**
|
7702
|
+
* @memberOf Monster.DOM
|
7703
|
+
* @type {string}
|
7704
|
+
* @since 1.25.0
|
7705
|
+
*/
|
7384
7706
|
|
7707
|
+
var ATTRIBUTE_INPUTMODE = 'inputmode';
|
7385
7708
|
/**
|
7386
|
-
* @
|
7387
|
-
* @type {
|
7709
|
+
* @memberOf Monster.DOM
|
7710
|
+
* @type {string}
|
7711
|
+
* @since 1.25.0
|
7388
7712
|
*/
|
7389
7713
|
|
7390
|
-
var
|
7714
|
+
var ATTRIBUTE_ACCESSKEY = 'accesskey';
|
7391
7715
|
/**
|
7392
|
-
*
|
7393
|
-
*
|
7394
|
-
*
|
7395
|
-
|
7396
|
-
|
7397
|
-
|
7398
|
-
|
7399
|
-
*
|
7400
|
-
*
|
7401
|
-
*
|
7402
|
-
|
7716
|
+
* @memberOf Monster.DOM
|
7717
|
+
* @type {string}
|
7718
|
+
* @since 1.25.0
|
7719
|
+
*/
|
7720
|
+
|
7721
|
+
var ATTRIBUTE_AUTOCAPITALIZE = 'autocapitalize';
|
7722
|
+
/**
|
7723
|
+
* @memberOf Monster.DOM
|
7724
|
+
* @type {string}
|
7725
|
+
* @since 1.25.0
|
7726
|
+
*/
|
7727
|
+
|
7728
|
+
var ATTRIBUTE_AUTOFOCUS = 'autofocus';
|
7729
|
+
/**
|
7730
|
+
* @memberOf Monster.DOM
|
7731
|
+
* @type {string}
|
7732
|
+
* @since 1.25.0
|
7733
|
+
*/
|
7734
|
+
|
7735
|
+
var ATTRIBUTE_CONTENTEDITABLE = 'contenteditable';
|
7736
|
+
/**
|
7737
|
+
* @memberOf Monster.DOM
|
7738
|
+
* @type {string}
|
7739
|
+
* @since 1.25.0
|
7740
|
+
*/
|
7741
|
+
|
7742
|
+
var ATTRIBUTE_DIR = 'dir';
|
7743
|
+
/**
|
7744
|
+
* @memberOf Monster.DOM
|
7745
|
+
* @type {string}
|
7746
|
+
* @since 1.25.0
|
7747
|
+
*/
|
7748
|
+
|
7749
|
+
var ATTRIBUTE_DRAGGABLE = 'draggable';
|
7750
|
+
/**
|
7751
|
+
* @memberOf Monster.DOM
|
7752
|
+
* @type {string}
|
7753
|
+
* @since 1.25.0
|
7754
|
+
*/
|
7755
|
+
|
7756
|
+
var ATTRIBUTE_ENTERKEYHINT = 'enterkeyhint';
|
7757
|
+
/**
|
7758
|
+
* @memberOf Monster.DOM
|
7759
|
+
* @type {string}
|
7760
|
+
* @since 1.25.0
|
7761
|
+
*/
|
7762
|
+
|
7763
|
+
var ATTRIBUTE_EXPORTPARTS = 'exportparts';
|
7764
|
+
/**
|
7765
|
+
* @memberOf Monster.DOM
|
7766
|
+
* @type {string}
|
7767
|
+
* @since 1.25.0
|
7768
|
+
*/
|
7769
|
+
|
7770
|
+
var ATTRIBUTE_HIDDEN = 'hidden';
|
7771
|
+
|
7772
|
+
|
7773
|
+
/***/ }),
|
7774
|
+
/* 34 */
|
7775
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
7776
|
+
|
7777
|
+
__webpack_require__.r(__webpack_exports__);
|
7778
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
7779
|
+
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_1__.Monster; },
|
7780
|
+
/* harmony export */ "CustomControl": function() { return /* binding */ CustomControl; }
|
7781
|
+
/* harmony export */ });
|
7782
|
+
/* harmony import */ var _data_extend_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(21);
|
7783
|
+
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
7784
|
+
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(33);
|
7785
|
+
/* harmony import */ var _customelement_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(35);
|
7786
|
+
|
7787
|
+
|
7788
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
7789
|
+
|
7790
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
7791
|
+
|
7792
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
7793
|
+
|
7794
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
7795
|
+
|
7796
|
+
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
|
7797
|
+
|
7798
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
7799
|
+
|
7800
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
7801
|
+
|
7802
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
7803
|
+
|
7804
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
7805
|
+
|
7806
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
7807
|
+
|
7808
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
7809
|
+
|
7810
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
7811
|
+
|
7812
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
7813
|
+
|
7814
|
+
|
7815
|
+
/**
|
7816
|
+
* @author schukai GmbH
|
7817
|
+
*/
|
7818
|
+
|
7819
|
+
|
7820
|
+
|
7821
|
+
|
7822
|
+
/**
|
7823
|
+
* @private
|
7824
|
+
* @type {symbol}
|
7825
|
+
*/
|
7826
|
+
|
7827
|
+
var attachedInternalSymbol = Symbol('attachedInternal');
|
7828
|
+
/**
|
7829
|
+
* To define a new HTML control we need the power of CustomElement
|
7830
|
+
*
|
7831
|
+
* IMPORTANT: after defining a `CustomElement`, the `registerCustomElement` method must be called
|
7832
|
+
* with the new class name. only then will the tag defined via the `getTag` method be made known to the DOM.
|
7833
|
+
*
|
7834
|
+
* <img src="./images/customcontrol-class.png">
|
7835
|
+
*
|
7836
|
+
* This control uses `attachInternals()` to integrate the control into a form.
|
7837
|
+
* If the target environment does not support this method, the [polyfill](https://www.npmjs.com/package/element-internals-polyfill ) can be used.
|
7838
|
+
*
|
7839
|
+
* You can create the object via the function `document.createElement()`.
|
7403
7840
|
*
|
7404
7841
|
* ```
|
7405
7842
|
* <script type="module">
|
7406
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7843
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
7407
7844
|
* document.createElement('monster-')
|
7408
7845
|
* </script>
|
7409
7846
|
* ```
|
@@ -7938,7 +8375,7 @@ var attributeObserverSymbol = Symbol('attributeObserver');
|
|
7938
8375
|
*
|
7939
8376
|
* ```
|
7940
8377
|
* <script type="module">
|
7941
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
8378
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
7942
8379
|
* document.createElement('monster-')
|
7943
8380
|
* </script>
|
7944
8381
|
* ```
|
@@ -8804,7 +9241,7 @@ var internal = Symbol('internal');
|
|
8804
9241
|
*
|
8805
9242
|
* ```
|
8806
9243
|
* <script type="module">
|
8807
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9244
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
8808
9245
|
* new Monster.Types.DataUrl()
|
8809
9246
|
* </script>
|
8810
9247
|
* ```
|
@@ -8813,7 +9250,7 @@ var internal = Symbol('internal');
|
|
8813
9250
|
*
|
8814
9251
|
* ```
|
8815
9252
|
* <script type="module">
|
8816
|
-
* import {DataUrl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9253
|
+
* import {DataUrl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/dataurl.js';
|
8817
9254
|
* new DataUrl()
|
8818
9255
|
* </script>
|
8819
9256
|
* ```
|
@@ -8893,7 +9330,7 @@ var DataUrl = /*#__PURE__*/function (_Base) {
|
|
8893
9330
|
*
|
8894
9331
|
* ```
|
8895
9332
|
* <script type="module">
|
8896
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9333
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
8897
9334
|
* console.log(Monster.Types.parseDataURL())
|
8898
9335
|
* </script>
|
8899
9336
|
* ```
|
@@ -8902,7 +9339,7 @@ var DataUrl = /*#__PURE__*/function (_Base) {
|
|
8902
9339
|
*
|
8903
9340
|
* ```
|
8904
9341
|
* <script type="module">
|
8905
|
-
* import {parseDataURL} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9342
|
+
* import {parseDataURL} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/dataurl.js';
|
8906
9343
|
* console.log(parseDataURL())
|
8907
9344
|
* </script>
|
8908
9345
|
* ```
|
@@ -9040,7 +9477,7 @@ var internal = Symbol('internal');
|
|
9040
9477
|
*
|
9041
9478
|
* ```
|
9042
9479
|
* <script type="module">
|
9043
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9480
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
9044
9481
|
* console.log(new Monster.Types.MediaType())
|
9045
9482
|
* </script>
|
9046
9483
|
* ```
|
@@ -9049,7 +9486,7 @@ var internal = Symbol('internal');
|
|
9049
9486
|
*
|
9050
9487
|
* ```
|
9051
9488
|
* <script type="module">
|
9052
|
-
* import {MediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9489
|
+
* import {MediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/mediatype.js';
|
9053
9490
|
* console.log(new MediaType())
|
9054
9491
|
* </script>
|
9055
9492
|
* ```
|
@@ -9167,7 +9604,7 @@ var MediaType = /*#__PURE__*/function (_Base) {
|
|
9167
9604
|
*
|
9168
9605
|
* ```
|
9169
9606
|
* <script type="module">
|
9170
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9607
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
9171
9608
|
* console.log(Monster.Types.parseMediaType())
|
9172
9609
|
* </script>
|
9173
9610
|
* ```
|
@@ -9176,7 +9613,7 @@ var MediaType = /*#__PURE__*/function (_Base) {
|
|
9176
9613
|
*
|
9177
9614
|
* ```
|
9178
9615
|
* <script type="module">
|
9179
|
-
* import {parseMediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9616
|
+
* import {parseMediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/dataurl.js';
|
9180
9617
|
* console.log(parseMediaType())
|
9181
9618
|
* </script>
|
9182
9619
|
* ```
|
@@ -9275,7 +9712,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
9275
9712
|
/* harmony import */ var _types_base_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
9276
9713
|
/* harmony import */ var _types_global_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16);
|
9277
9714
|
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14);
|
9278
|
-
/* harmony import */ var
|
9715
|
+
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(33);
|
9716
|
+
/* harmony import */ var _theme_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(39);
|
9279
9717
|
|
9280
9718
|
/**
|
9281
9719
|
* @author schukai GmbH
|
@@ -9308,13 +9746,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
9308
9746
|
|
9309
9747
|
|
9310
9748
|
|
9749
|
+
|
9311
9750
|
/**
|
9312
9751
|
* you can call the method via the monster namespace `new Monster.DOM.Template()`.
|
9313
9752
|
*
|
9314
9753
|
* ```
|
9315
9754
|
* <script type="module">
|
9316
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9317
|
-
*
|
9755
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
9756
|
+
* new Monster.DOM.Template()
|
9318
9757
|
* </script>
|
9319
9758
|
* ```
|
9320
9759
|
*
|
@@ -9322,8 +9761,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
9322
9761
|
*
|
9323
9762
|
* ```
|
9324
9763
|
* <script type="module">
|
9325
|
-
* import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9326
|
-
*
|
9764
|
+
* import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/template.js';
|
9765
|
+
* new Template()
|
9327
9766
|
* </script>
|
9328
9767
|
* ```
|
9329
9768
|
*
|
@@ -9385,7 +9824,7 @@ var Template = /*#__PURE__*/function (_Base) {
|
|
9385
9824
|
/**
|
9386
9825
|
* This method loads a template with the given ID and returns it.
|
9387
9826
|
*
|
9388
|
-
* To do this, it first
|
9827
|
+
* To do this, it first reads the theme of the document and looks for the `data-monster-theme-name` attribute in the HTML tag.
|
9389
9828
|
*
|
9390
9829
|
* ```
|
9391
9830
|
* <html data-monster-theme-name="my-theme">
|
@@ -9393,15 +9832,15 @@ var Template = /*#__PURE__*/function (_Base) {
|
|
9393
9832
|
*
|
9394
9833
|
* If no theme was specified, the default theme is `monster`.
|
9395
9834
|
*
|
9396
|
-
* Now it is looked if there is a template with the given ID and theme `id-theme` and if yes it is returned.
|
9835
|
+
* Now it is looked if there is a template with the given ID and theme `id-theme` and if yes it is returned.
|
9397
9836
|
* If there is no template a search for a template with the given ID `id` is done. If this is also not found, an error is thrown.
|
9398
9837
|
*
|
9399
9838
|
* You can call the method via the monster namespace `Monster.DOM.findDocumentTemplate()`.
|
9400
9839
|
*
|
9401
9840
|
* ```
|
9402
9841
|
* <script type="module">
|
9403
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9404
|
-
*
|
9842
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
9843
|
+
* Monster.DOM.findDocumentTemplate()
|
9405
9844
|
* </script>
|
9406
9845
|
* ```
|
9407
9846
|
*
|
@@ -9409,11 +9848,41 @@ var Template = /*#__PURE__*/function (_Base) {
|
|
9409
9848
|
*
|
9410
9849
|
* ```
|
9411
9850
|
* <script type="module">
|
9412
|
-
* import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9413
|
-
*
|
9851
|
+
* import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/template.js';
|
9852
|
+
* findDocumentTemplate()
|
9414
9853
|
* </script>
|
9415
9854
|
* ```
|
9416
9855
|
*
|
9856
|
+
* @example
|
9857
|
+
*
|
9858
|
+
* import { findDocumentTemplate } from "https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/template.js";
|
9859
|
+
*
|
9860
|
+
* const template = document.createElement("template");
|
9861
|
+
* template.id = "myTemplate";
|
9862
|
+
* template.innerHTML = "<p>my default template</p>";
|
9863
|
+
* document.body.appendChild(template);
|
9864
|
+
*
|
9865
|
+
* const themedTemplate = document.createElement("template");
|
9866
|
+
* themedTemplate.id = "myTemplate-myTheme";
|
9867
|
+
* themedTemplate.innerHTML = "<p>my themed template</p>";
|
9868
|
+
* document.body.appendChild(themedTemplate);
|
9869
|
+
*
|
9870
|
+
* // loads the temple and since no theme is set the default template
|
9871
|
+
* const template1 = findDocumentTemplate("myTemplate");
|
9872
|
+
* console.log(template1.createDocumentFragment());
|
9873
|
+
* // ↦ '<p>my default template</p>'
|
9874
|
+
*
|
9875
|
+
* // now we set our own theme
|
9876
|
+
* document
|
9877
|
+
* .querySelector("html")
|
9878
|
+
* .setAttribute("data-monster-theme-name", "myTheme");
|
9879
|
+
*
|
9880
|
+
* // now we don't get the default template,
|
9881
|
+
* // but the template with the theme in the id
|
9882
|
+
* const template2 = findDocumentTemplate("myTemplate");
|
9883
|
+
* console.log(template2.createDocumentFragment());
|
9884
|
+
* // ↦ '<p>my themed template</p>'
|
9885
|
+
*
|
9417
9886
|
* @param {string} id
|
9418
9887
|
* @param {Node} currentNode
|
9419
9888
|
* @return {Monster.DOM.Template}
|
@@ -9427,9 +9896,18 @@ var Template = /*#__PURE__*/function (_Base) {
|
|
9427
9896
|
|
9428
9897
|
function findDocumentTemplate(id, currentNode) {
|
9429
9898
|
(0,_types_validate_js__WEBPACK_IMPORTED_MODULE_3__.validateString)(id);
|
9899
|
+
var document = (0,_types_global_js__WEBPACK_IMPORTED_MODULE_2__.getGlobalObject)('document');
|
9900
|
+
var HTMLTemplateElement = (0,_types_global_js__WEBPACK_IMPORTED_MODULE_2__.getGlobalFunction)('HTMLTemplateElement');
|
9901
|
+
var DocumentFragment = (0,_types_global_js__WEBPACK_IMPORTED_MODULE_2__.getGlobalFunction)('DocumentFragment');
|
9902
|
+
var Document = (0,_types_global_js__WEBPACK_IMPORTED_MODULE_2__.getGlobalFunction)('Document');
|
9903
|
+
var prefixID;
|
9430
9904
|
|
9431
9905
|
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
|
9432
9906
|
if (currentNode instanceof Node) {
|
9907
|
+
if (currentNode.hasAttribute(_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_TEMPLATE_PREFIX)) {
|
9908
|
+
prefixID = currentNode.getAttribute(_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_TEMPLATE_PREFIX);
|
9909
|
+
}
|
9910
|
+
|
9433
9911
|
currentNode = currentNode.getRootNode();
|
9434
9912
|
|
9435
9913
|
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
|
@@ -9438,27 +9916,57 @@ function findDocumentTemplate(id, currentNode) {
|
|
9438
9916
|
}
|
9439
9917
|
|
9440
9918
|
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
|
9441
|
-
currentNode =
|
9919
|
+
currentNode = document;
|
9442
9920
|
}
|
9443
9921
|
}
|
9444
9922
|
|
9445
|
-
var
|
9446
|
-
var theme = (0,
|
9447
|
-
|
9448
|
-
|
9923
|
+
var template;
|
9924
|
+
var theme = (0,_theme_js__WEBPACK_IMPORTED_MODULE_5__.getDocumentTheme)();
|
9925
|
+
|
9926
|
+
if (prefixID) {
|
9927
|
+
var themedPrefixID = prefixID + '-' + id + '-' + theme.getName(); // current + themedPrefixID
|
9928
|
+
|
9929
|
+
template = currentNode.getElementById(themedPrefixID);
|
9930
|
+
|
9931
|
+
if (template instanceof HTMLTemplateElement) {
|
9932
|
+
return new Template(template);
|
9933
|
+
} // document + themedPrefixID
|
9934
|
+
|
9935
|
+
|
9936
|
+
template = document.getElementById(themedPrefixID);
|
9937
|
+
|
9938
|
+
if (template instanceof HTMLTemplateElement) {
|
9939
|
+
return new Template(template);
|
9940
|
+
}
|
9941
|
+
}
|
9942
|
+
|
9943
|
+
var themedID = id + '-' + theme.getName(); // current + themedID
|
9944
|
+
|
9945
|
+
template = currentNode.getElementById(themedID);
|
9449
9946
|
|
9450
9947
|
if (template instanceof HTMLTemplateElement) {
|
9451
9948
|
return new Template(template);
|
9452
|
-
}
|
9949
|
+
} // document + themedID
|
9950
|
+
|
9951
|
+
|
9952
|
+
template = document.getElementById(themedID);
|
9953
|
+
|
9954
|
+
if (template instanceof HTMLTemplateElement) {
|
9955
|
+
return new Template(template);
|
9956
|
+
} // current + ID
|
9957
|
+
|
9453
9958
|
|
9454
9959
|
template = currentNode.getElementById(id);
|
9455
9960
|
|
9456
9961
|
if (template instanceof HTMLTemplateElement) {
|
9457
9962
|
return new Template(template);
|
9458
|
-
}
|
9963
|
+
} // document + ID
|
9964
|
+
|
9459
9965
|
|
9460
|
-
|
9461
|
-
|
9966
|
+
template = document.getElementById(id);
|
9967
|
+
|
9968
|
+
if (template instanceof HTMLTemplateElement) {
|
9969
|
+
return new Template(template);
|
9462
9970
|
}
|
9463
9971
|
|
9464
9972
|
throw new Error("template " + id + " not found.");
|
@@ -9519,7 +10027,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
9519
10027
|
*
|
9520
10028
|
* ```
|
9521
10029
|
* <script type="module">
|
9522
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10030
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
9523
10031
|
* console.log(new Monster.DOM.Theme())
|
9524
10032
|
* </script>
|
9525
10033
|
* ```
|
@@ -9528,14 +10036,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
9528
10036
|
*
|
9529
10037
|
* ```
|
9530
10038
|
* <script type="module">
|
9531
|
-
* import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10039
|
+
* import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/theme.js';
|
9532
10040
|
* console.log(new Theme())
|
9533
10041
|
* </script>
|
9534
10042
|
* ```
|
9535
10043
|
*
|
9536
10044
|
* @example
|
9537
10045
|
*
|
9538
|
-
* import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10046
|
+
* import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/theme.js';
|
9539
10047
|
*
|
9540
10048
|
* const theme = getDocumentTheme();
|
9541
10049
|
* console.log(theme.getName());
|
@@ -9625,23 +10133,25 @@ function getDocumentTheme() {
|
|
9625
10133
|
|
9626
10134
|
__webpack_require__.r(__webpack_exports__);
|
9627
10135
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
9628
|
-
/* harmony export */ "Monster": function() { return /* reexport safe */
|
10136
|
+
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_5__.Monster; },
|
9629
10137
|
/* harmony export */ "Updater": function() { return /* binding */ Updater; }
|
9630
10138
|
/* harmony export */ });
|
9631
|
-
/* harmony import */ var
|
9632
|
-
/* harmony import */ var
|
9633
|
-
/* harmony import */ var
|
9634
|
-
/* harmony import */ var
|
9635
|
-
/* harmony import */ var
|
9636
|
-
/* harmony import */ var
|
9637
|
-
/* harmony import */ var
|
9638
|
-
/* harmony import */ var
|
9639
|
-
/* harmony import */ var
|
9640
|
-
/* harmony import */ var
|
9641
|
-
/* harmony import */ var
|
9642
|
-
/* harmony import */ var
|
9643
|
-
/* harmony import */ var
|
9644
|
-
/* harmony import */ var
|
10139
|
+
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
10140
|
+
/* harmony import */ var _data_diff_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20);
|
10141
|
+
/* harmony import */ var _data_pathfinder_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18);
|
10142
|
+
/* harmony import */ var _data_pipe_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(22);
|
10143
|
+
/* harmony import */ var _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(33);
|
10144
|
+
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2);
|
10145
|
+
/* harmony import */ var _types_base_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4);
|
10146
|
+
/* harmony import */ var _types_is_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9);
|
10147
|
+
/* harmony import */ var _types_observer_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(27);
|
10148
|
+
/* harmony import */ var _types_proxyobserver_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(26);
|
10149
|
+
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(14);
|
10150
|
+
/* harmony import */ var _util_clone_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(15);
|
10151
|
+
/* harmony import */ var _util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(41);
|
10152
|
+
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(42);
|
10153
|
+
/* harmony import */ var _template_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(38);
|
10154
|
+
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(43);
|
9645
10155
|
|
9646
10156
|
/**
|
9647
10157
|
* @author schukai GmbH
|
@@ -9705,6 +10215,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
9705
10215
|
|
9706
10216
|
|
9707
10217
|
|
10218
|
+
|
10219
|
+
|
9708
10220
|
/**
|
9709
10221
|
* The updater class connects an object with the dom. In this way, structures and contents in the DOM can be programmatically adapted via attributes.
|
9710
10222
|
*
|
@@ -9715,7 +10227,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
9715
10227
|
*
|
9716
10228
|
* ```
|
9717
10229
|
* <script type="module">
|
9718
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10230
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
9719
10231
|
* new Monster.DOM.Updater()
|
9720
10232
|
* </script>
|
9721
10233
|
* ```
|
@@ -9724,14 +10236,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
9724
10236
|
*
|
9725
10237
|
* ```
|
9726
10238
|
* <script type="module">
|
9727
|
-
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10239
|
+
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/updater.js';
|
9728
10240
|
* new Updater()
|
9729
10241
|
* </script>
|
9730
10242
|
* ```
|
9731
10243
|
*
|
9732
10244
|
* @example
|
9733
10245
|
*
|
9734
|
-
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10246
|
+
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/updater.js';
|
9735
10247
|
*
|
9736
10248
|
* // First we prepare the html document.
|
9737
10249
|
* // This is done here via script, but can also be inserted into the document as pure html.
|
@@ -9790,28 +10302,27 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
9790
10302
|
* @type {HTMLElement}
|
9791
10303
|
*/
|
9792
10304
|
|
9793
|
-
_this.element = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_9__.validateInstance)(element, HTMLElement);
|
9794
10305
|
if (subject === undefined) subject = {};
|
9795
|
-
var a = subject;
|
9796
10306
|
|
9797
|
-
if (!(0,
|
9798
|
-
subject = new
|
10307
|
+
if (!(0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isInstance)(subject, _types_proxyobserver_js__WEBPACK_IMPORTED_MODULE_9__.ProxyObserver)) {
|
10308
|
+
subject = new _types_proxyobserver_js__WEBPACK_IMPORTED_MODULE_9__.ProxyObserver(subject);
|
9799
10309
|
}
|
9800
10310
|
|
9801
|
-
_this.
|
9802
|
-
|
9803
|
-
|
9804
|
-
|
9805
|
-
|
9806
|
-
|
9807
|
-
|
10311
|
+
_this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol] = {
|
10312
|
+
element: (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_10__.validateInstance)(element, HTMLElement),
|
10313
|
+
last: {},
|
10314
|
+
callbacks: new Map(),
|
10315
|
+
eventTypes: ['keyup', 'click', 'change', 'drop', 'touchend', 'input'],
|
10316
|
+
subject: subject
|
10317
|
+
};
|
9808
10318
|
|
10319
|
+
_this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].callbacks.set('checkstate', getCheckStateCallback.call(_assertThisInitialized(_this)));
|
9809
10320
|
|
9810
|
-
_this.subject
|
9811
|
-
var s = _this.subject.getRealSubject();
|
10321
|
+
_this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.attachObserver(new _types_observer_js__WEBPACK_IMPORTED_MODULE_8__.Observer(function () {
|
10322
|
+
var s = _this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject();
|
9812
10323
|
|
9813
|
-
var diffResult = (0,
|
9814
|
-
_this.last = (0,
|
10324
|
+
var diffResult = (0,_data_diff_js__WEBPACK_IMPORTED_MODULE_1__.diff)(_this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].last, s);
|
10325
|
+
_this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].last = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(s);
|
9815
10326
|
|
9816
10327
|
for (var _i = 0, _Object$entries = Object.entries(diffResult); _i < _Object$entries.length; _i++) {
|
9817
10328
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
@@ -9823,7 +10334,7 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
9823
10334
|
updateAttributes.call(_assertThisInitialized(_this), change);
|
9824
10335
|
}
|
9825
10336
|
}));
|
9826
|
-
|
10337
|
+
|
9827
10338
|
return _this;
|
9828
10339
|
}
|
9829
10340
|
/**
|
@@ -9839,7 +10350,7 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
9839
10350
|
_createClass(Updater, [{
|
9840
10351
|
key: "setEventTypes",
|
9841
10352
|
value: function setEventTypes(types) {
|
9842
|
-
this.eventTypes = (0,
|
10353
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].eventTypes = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_10__.validateArray)(types);
|
9843
10354
|
return this;
|
9844
10355
|
}
|
9845
10356
|
/**
|
@@ -9853,6 +10364,7 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
9853
10364
|
*
|
9854
10365
|
* @since 1.9.0
|
9855
10366
|
* @return {Updater}
|
10367
|
+
* @throws {Error} the bind argument must start as a value with a path
|
9856
10368
|
*/
|
9857
10369
|
|
9858
10370
|
}, {
|
@@ -9860,13 +10372,17 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
9860
10372
|
value: function enableEventProcessing() {
|
9861
10373
|
this.disableEventProcessing();
|
9862
10374
|
|
9863
|
-
var _iterator = _createForOfIteratorHelper(this.eventTypes),
|
10375
|
+
var _iterator = _createForOfIteratorHelper(this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].eventTypes),
|
9864
10376
|
_step;
|
9865
10377
|
|
9866
10378
|
try {
|
9867
10379
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
9868
10380
|
var type = _step.value;
|
9869
|
-
|
10381
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
|
10382
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.addEventListener(type, getControlEventHandler.call(this), {
|
10383
|
+
capture: true,
|
10384
|
+
passive: true
|
10385
|
+
});
|
9870
10386
|
}
|
9871
10387
|
} catch (err) {
|
9872
10388
|
_iterator.e(err);
|
@@ -9886,13 +10402,13 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
9886
10402
|
}, {
|
9887
10403
|
key: "disableEventProcessing",
|
9888
10404
|
value: function disableEventProcessing() {
|
9889
|
-
var _iterator2 = _createForOfIteratorHelper(this.eventTypes),
|
10405
|
+
var _iterator2 = _createForOfIteratorHelper(this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].eventTypes),
|
9890
10406
|
_step2;
|
9891
10407
|
|
9892
10408
|
try {
|
9893
10409
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
9894
10410
|
var type = _step2.value;
|
9895
|
-
this.element.removeEventListener(type, getControlEventHandler.call(this));
|
10411
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.removeEventListener(type, getControlEventHandler.call(this));
|
9896
10412
|
}
|
9897
10413
|
} catch (err) {
|
9898
10414
|
_iterator2.e(err);
|
@@ -9921,25 +10437,38 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
9921
10437
|
value: function run() {
|
9922
10438
|
// the key __init__has no further meaning and is only
|
9923
10439
|
// used to create the diff for empty objects.
|
9924
|
-
this.last = {
|
10440
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].last = {
|
9925
10441
|
'__init__': true
|
9926
10442
|
};
|
9927
|
-
return this.subject.notifyObservers();
|
10443
|
+
return this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.notifyObservers();
|
10444
|
+
}
|
10445
|
+
/**
|
10446
|
+
* Gets the values of bound elements and changes them in subject
|
10447
|
+
*
|
10448
|
+
* @since 1.27.0
|
10449
|
+
* @return {Monster.DOM.Updater}
|
10450
|
+
*/
|
10451
|
+
|
10452
|
+
}, {
|
10453
|
+
key: "retrieve",
|
10454
|
+
value: function retrieve() {
|
10455
|
+
retrieveFromBindings.call(this);
|
10456
|
+
return this;
|
9928
10457
|
}
|
9929
10458
|
/**
|
9930
|
-
* If you have passed a ProxyObserver in the constructor, you will get the
|
9931
|
-
* However, if you
|
10459
|
+
* If you have passed a ProxyObserver in the constructor, you will get the object that the ProxyObserver manages here.
|
10460
|
+
* However, if you passed a simple object, here you will get a proxy for that object.
|
9932
10461
|
*
|
9933
10462
|
* For changes the ProxyObserver must be used.
|
9934
10463
|
*
|
9935
10464
|
* @since 1.8.0
|
9936
|
-
* @return {
|
10465
|
+
* @return {Proxy}
|
9937
10466
|
*/
|
9938
10467
|
|
9939
10468
|
}, {
|
9940
10469
|
key: "getSubject",
|
9941
10470
|
value: function getSubject() {
|
9942
|
-
return this.subject.getSubject();
|
10471
|
+
return this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getSubject();
|
9943
10472
|
}
|
9944
10473
|
/**
|
9945
10474
|
* This method can be used to register commands that can be called via call: instruction.
|
@@ -9955,13 +10484,13 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
9955
10484
|
}, {
|
9956
10485
|
key: "setCallback",
|
9957
10486
|
value: function setCallback(name, callback) {
|
9958
|
-
this.callbacks.set(name, callback);
|
10487
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].callbacks.set(name, callback);
|
9959
10488
|
return this;
|
9960
10489
|
}
|
9961
10490
|
}]);
|
9962
10491
|
|
9963
10492
|
return Updater;
|
9964
|
-
}(
|
10493
|
+
}(_types_base_js__WEBPACK_IMPORTED_MODULE_6__.Base);
|
9965
10494
|
/**
|
9966
10495
|
* @private
|
9967
10496
|
* @since 1.9.0
|
@@ -9973,12 +10502,13 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
9973
10502
|
function getCheckStateCallback() {
|
9974
10503
|
var self = this;
|
9975
10504
|
return function (current) {
|
10505
|
+
// this is a reference to the current object (therefore no array function here)
|
9976
10506
|
if (this instanceof HTMLInputElement) {
|
9977
10507
|
if (['radio', 'checkbox'].indexOf(this.type) !== -1) {
|
9978
10508
|
return this.value + "" === current + "" ? 'true' : undefined;
|
9979
10509
|
}
|
9980
10510
|
} else if (this instanceof HTMLOptionElement) {
|
9981
|
-
if ((0,
|
10511
|
+
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isArray)(current) && current.indexOf(this.value) !== -1) {
|
9982
10512
|
return 'true';
|
9983
10513
|
}
|
9984
10514
|
|
@@ -9996,6 +10526,7 @@ var symbol = Symbol('EventHandler');
|
|
9996
10526
|
* @private
|
9997
10527
|
* @return {function}
|
9998
10528
|
* @this Updater
|
10529
|
+
* @throws {Error} the bind argument must start as a value with a path
|
9999
10530
|
*/
|
10000
10531
|
|
10001
10532
|
function getControlEventHandler() {
|
@@ -10004,97 +10535,112 @@ function getControlEventHandler() {
|
|
10004
10535
|
if (self[symbol]) {
|
10005
10536
|
return self[symbol];
|
10006
10537
|
}
|
10007
|
-
|
10008
|
-
var pathfinder = new _data_pathfinder_js__WEBPACK_IMPORTED_MODULE_1__.Pathfinder(this.subject.getSubject());
|
10009
10538
|
/**
|
10010
10539
|
* @throws {Error} the bind argument must start as a value with a path.
|
10011
10540
|
* @throws {Error} unsupported object
|
10012
10541
|
* @param {Event} event
|
10013
10542
|
*/
|
10014
10543
|
|
10015
|
-
self[symbol] = function (event) {
|
10016
|
-
var _element$constructor, _Object$getOwnPropert;
|
10017
10544
|
|
10018
|
-
|
10545
|
+
self[symbol] = function (event) {
|
10546
|
+
var element = (0,_events_js__WEBPACK_IMPORTED_MODULE_13__.findTargetElementFromEvent)(event, _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_BIND);
|
10019
10547
|
|
10020
|
-
if (
|
10548
|
+
if (element === undefined) {
|
10021
10549
|
return;
|
10022
10550
|
}
|
10023
10551
|
|
10024
|
-
|
10552
|
+
retrieveAndSetValue.call(self, element);
|
10553
|
+
};
|
10025
10554
|
|
10026
|
-
|
10027
|
-
|
10028
|
-
|
10555
|
+
return self[symbol];
|
10556
|
+
}
|
10557
|
+
/**
|
10558
|
+
* @throws {Error} the bind argument must start as a value with a path
|
10559
|
+
* @param {HTMLElement} element
|
10560
|
+
* @return void
|
10561
|
+
*/
|
10029
10562
|
|
10030
|
-
path = path.substr(5);
|
10031
|
-
var value;
|
10032
10563
|
|
10033
|
-
|
10034
|
-
|
10035
|
-
case 'checkbox':
|
10036
|
-
value = element.checked ? element.value : undefined;
|
10037
|
-
break;
|
10564
|
+
function retrieveAndSetValue(element) {
|
10565
|
+
var _element$constructor, _Object$getOwnPropert;
|
10038
10566
|
|
10039
|
-
|
10040
|
-
|
10041
|
-
|
10042
|
-
}
|
10043
|
-
} else if (element instanceof HTMLTextAreaElement) {
|
10044
|
-
value = element.value;
|
10045
|
-
} else if (element instanceof HTMLSelectElement) {
|
10046
|
-
switch (element.type) {
|
10047
|
-
case 'select-one':
|
10048
|
-
value = element.value;
|
10049
|
-
break;
|
10050
|
-
|
10051
|
-
case 'select-multiple':
|
10052
|
-
value = element.value;
|
10053
|
-
var options = element === null || element === void 0 ? void 0 : element.selectedOptions;
|
10054
|
-
if (options === undefined) options = element.querySelectorAll(":scope option:checked");
|
10055
|
-
value = Array.from(options).map(function (_ref) {
|
10056
|
-
var value = _ref.value;
|
10057
|
-
return value;
|
10058
|
-
});
|
10059
|
-
break;
|
10060
|
-
} // values from customelements
|
10567
|
+
var self = this;
|
10568
|
+
var pathfinder = new _data_pathfinder_js__WEBPACK_IMPORTED_MODULE_2__.Pathfinder(self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getSubject());
|
10569
|
+
var path = element.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_BIND);
|
10061
10570
|
|
10062
|
-
|
10063
|
-
|
10064
|
-
|
10065
|
-
|
10066
|
-
|
10571
|
+
if (path.indexOf('path:') !== 0) {
|
10572
|
+
throw new Error('the bind argument must start as a value with a path');
|
10573
|
+
}
|
10574
|
+
|
10575
|
+
path = path.substr(5);
|
10576
|
+
var value;
|
10067
10577
|
|
10068
|
-
|
10069
|
-
|
10070
|
-
|
10071
|
-
|
10578
|
+
if (element instanceof HTMLInputElement) {
|
10579
|
+
switch (element.type) {
|
10580
|
+
case 'checkbox':
|
10581
|
+
value = element.checked ? element.value : undefined;
|
10582
|
+
break;
|
10072
10583
|
|
10073
|
-
|
10074
|
-
|
10584
|
+
default:
|
10585
|
+
value = element.value;
|
10586
|
+
break;
|
10075
10587
|
}
|
10076
|
-
}
|
10588
|
+
} else if (element instanceof HTMLTextAreaElement) {
|
10589
|
+
value = element.value;
|
10590
|
+
} else if (element instanceof HTMLSelectElement) {
|
10591
|
+
switch (element.type) {
|
10592
|
+
case 'select-one':
|
10593
|
+
value = element.value;
|
10594
|
+
break;
|
10077
10595
|
|
10078
|
-
|
10596
|
+
case 'select-multiple':
|
10597
|
+
value = element.value;
|
10598
|
+
var options = element === null || element === void 0 ? void 0 : element.selectedOptions;
|
10599
|
+
if (options === undefined) options = element.querySelectorAll(":scope option:checked");
|
10600
|
+
value = Array.from(options).map(function (_ref) {
|
10601
|
+
var value = _ref.value;
|
10602
|
+
return value;
|
10603
|
+
});
|
10604
|
+
break;
|
10605
|
+
} // values from customelements
|
10606
|
+
|
10607
|
+
} else if (element !== null && element !== void 0 && (_element$constructor = element.constructor) !== null && _element$constructor !== void 0 && _element$constructor.prototype && !!((_Object$getOwnPropert = Object.getOwnPropertyDescriptor(element.constructor.prototype, 'value')) !== null && _Object$getOwnPropert !== void 0 && _Object$getOwnPropert['get']) || element.hasOwnProperty('value')) {
|
10608
|
+
value = element === null || element === void 0 ? void 0 : element['value'];
|
10609
|
+
} else {
|
10610
|
+
throw new Error("unsupported object");
|
10611
|
+
}
|
10612
|
+
|
10613
|
+
var copy = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject());
|
10614
|
+
var pf = new _data_pathfinder_js__WEBPACK_IMPORTED_MODULE_2__.Pathfinder(copy);
|
10615
|
+
pf.setVia(path, value);
|
10616
|
+
var diffResult = (0,_data_diff_js__WEBPACK_IMPORTED_MODULE_1__.diff)(copy, self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject());
|
10617
|
+
|
10618
|
+
if (diffResult.length > 0) {
|
10619
|
+
pathfinder.setVia(path, value);
|
10620
|
+
}
|
10079
10621
|
}
|
10080
10622
|
/**
|
10081
|
-
* @
|
10082
|
-
* @
|
10083
|
-
* @param {object} change
|
10084
|
-
* @return {void}
|
10623
|
+
* @since 1.27.0
|
10624
|
+
* @return void
|
10085
10625
|
*/
|
10086
10626
|
|
10087
10627
|
|
10088
|
-
function
|
10089
|
-
var
|
10628
|
+
function retrieveFromBindings() {
|
10629
|
+
var self = this;
|
10630
|
+
|
10631
|
+
if (self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.matches('[' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_BIND + ']')) {
|
10632
|
+
retrieveAndSetValue.call(self, element);
|
10633
|
+
}
|
10634
|
+
|
10635
|
+
var _iterator3 = _createForOfIteratorHelper(self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.querySelectorAll('[' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_BIND + ']').entries()),
|
10090
10636
|
_step3;
|
10091
10637
|
|
10092
10638
|
try {
|
10093
10639
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
10094
10640
|
var _step3$value = _slicedToArray(_step3.value, 2),
|
10095
|
-
|
10641
|
+
_element = _step3$value[1];
|
10096
10642
|
|
10097
|
-
|
10643
|
+
retrieveAndSetValue.call(self, _element);
|
10098
10644
|
}
|
10099
10645
|
} catch (err) {
|
10100
10646
|
_iterator3.e(err);
|
@@ -10102,6 +10648,33 @@ function removeElement(change) {
|
|
10102
10648
|
_iterator3.f();
|
10103
10649
|
}
|
10104
10650
|
}
|
10651
|
+
/**
|
10652
|
+
* @private
|
10653
|
+
* @since 1.8.0
|
10654
|
+
* @param {object} change
|
10655
|
+
* @return {void}
|
10656
|
+
*/
|
10657
|
+
|
10658
|
+
|
10659
|
+
function removeElement(change) {
|
10660
|
+
var self = this;
|
10661
|
+
|
10662
|
+
var _iterator4 = _createForOfIteratorHelper(self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.querySelectorAll(':scope [' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_REMOVE + ']').entries()),
|
10663
|
+
_step4;
|
10664
|
+
|
10665
|
+
try {
|
10666
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
10667
|
+
var _step4$value = _slicedToArray(_step4.value, 2),
|
10668
|
+
_element2 = _step4$value[1];
|
10669
|
+
|
10670
|
+
_element2.parentNode.removeChild(_element2);
|
10671
|
+
}
|
10672
|
+
} catch (err) {
|
10673
|
+
_iterator4.e(err);
|
10674
|
+
} finally {
|
10675
|
+
_iterator4.f();
|
10676
|
+
}
|
10677
|
+
}
|
10105
10678
|
/**
|
10106
10679
|
* @private
|
10107
10680
|
* @since 1.8.0
|
@@ -10119,56 +10692,56 @@ function insertElement(change) {
|
|
10119
10692
|
var _this2 = this;
|
10120
10693
|
|
10121
10694
|
var self = this;
|
10122
|
-
var subject = self.subject.getRealSubject();
|
10123
|
-
var document = (0,
|
10695
|
+
var subject = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject();
|
10696
|
+
var document = (0,_util_js__WEBPACK_IMPORTED_MODULE_15__.getDocument)();
|
10124
10697
|
var mem = new WeakSet();
|
10125
10698
|
var wd = 0;
|
10126
10699
|
|
10127
10700
|
while (true) {
|
10128
10701
|
var found = false;
|
10129
10702
|
wd++;
|
10130
|
-
var p = (0,
|
10131
|
-
if (!(0,
|
10703
|
+
var p = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(change === null || change === void 0 ? void 0 : change['path']);
|
10704
|
+
if (!(0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isArray)(p)) return this;
|
10132
10705
|
|
10133
10706
|
while (p.length > 0) {
|
10134
10707
|
var current = p.join('.');
|
10135
|
-
var list = this.element.querySelectorAll(':scope [' +
|
10708
|
+
var list = this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.querySelectorAll(':scope [' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_INSERT + '*="path:' + current + '"]').entries();
|
10136
10709
|
|
10137
|
-
var
|
10138
|
-
|
10710
|
+
var _iterator5 = _createForOfIteratorHelper(list),
|
10711
|
+
_step5;
|
10139
10712
|
|
10140
10713
|
try {
|
10141
10714
|
var _loop = function _loop() {
|
10142
|
-
var
|
10143
|
-
containerElement =
|
10715
|
+
var _step5$value = _slicedToArray(_step5.value, 2),
|
10716
|
+
containerElement = _step5$value[1];
|
10144
10717
|
|
10145
10718
|
if (mem.has(containerElement)) return "continue";
|
10146
10719
|
mem.add(containerElement);
|
10147
10720
|
found = true;
|
10148
|
-
var attributes = containerElement.getAttribute(
|
10149
|
-
var def = (0,
|
10721
|
+
var attributes = containerElement.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_INSERT);
|
10722
|
+
var def = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(attributes);
|
10150
10723
|
var i = def.indexOf(' ');
|
10151
|
-
var key = (0,
|
10724
|
+
var key = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(def.substr(0, i));
|
10152
10725
|
var refPrefix = key + '-';
|
10153
|
-
var cmd = (0,
|
10726
|
+
var cmd = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(def.substr(i)); // this case is actually excluded by the query but is nevertheless checked again here
|
10154
10727
|
|
10155
10728
|
if (cmd.indexOf('|') > 0) {
|
10156
10729
|
throw new Error("pipes are not allowed when cloning a node.");
|
10157
10730
|
}
|
10158
10731
|
|
10159
|
-
var pipe = new
|
10732
|
+
var pipe = new _data_pipe_js__WEBPACK_IMPORTED_MODULE_3__.Pipe(cmd);
|
10160
10733
|
|
10161
|
-
_this2.callbacks.forEach(function (f, n) {
|
10734
|
+
_this2[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].callbacks.forEach(function (f, n) {
|
10162
10735
|
pipe.setCallback(n, f);
|
10163
10736
|
});
|
10164
10737
|
|
10165
10738
|
var value = void 0;
|
10166
10739
|
|
10167
10740
|
try {
|
10168
|
-
containerElement.removeAttribute(
|
10741
|
+
containerElement.removeAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE);
|
10169
10742
|
value = pipe.run(subject);
|
10170
10743
|
} catch (e) {
|
10171
|
-
containerElement.setAttribute(
|
10744
|
+
containerElement.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE, e.message);
|
10172
10745
|
}
|
10173
10746
|
|
10174
10747
|
var dataPath = cmd.split(':').pop();
|
@@ -10178,7 +10751,7 @@ function insertElement(change) {
|
|
10178
10751
|
insertPoint = containerElement.lastChild;
|
10179
10752
|
}
|
10180
10753
|
|
10181
|
-
if (!(0,
|
10754
|
+
if (!(0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isIterable)(value)) {
|
10182
10755
|
throw new Error('the value is not iterable');
|
10183
10756
|
}
|
10184
10757
|
|
@@ -10192,7 +10765,7 @@ function insertElement(change) {
|
|
10192
10765
|
var ref = refPrefix + _i3;
|
10193
10766
|
var currentPath = dataPath + "." + _i3;
|
10194
10767
|
available.add(ref);
|
10195
|
-
var refElement = containerElement.querySelector('[' +
|
10768
|
+
var refElement = containerElement.querySelector('[' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_INSERT_REFERENCE + '="' + ref + '"]');
|
10196
10769
|
|
10197
10770
|
if (refElement instanceof HTMLElement) {
|
10198
10771
|
insertPoint = refElement;
|
@@ -10202,27 +10775,27 @@ function insertElement(change) {
|
|
10202
10775
|
appendNewDocumentFragment(containerElement, key, ref, currentPath);
|
10203
10776
|
}
|
10204
10777
|
|
10205
|
-
var nodes = containerElement.querySelectorAll('[' +
|
10778
|
+
var nodes = containerElement.querySelectorAll('[' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_INSERT_REFERENCE + '*="' + refPrefix + '"]');
|
10206
10779
|
|
10207
10780
|
for (var _i4 = 0, _Object$entries3 = Object.entries(nodes); _i4 < _Object$entries3.length; _i4++) {
|
10208
10781
|
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i4], 2),
|
10209
10782
|
node = _Object$entries3$_i[1];
|
10210
10783
|
|
10211
|
-
if (!available.has(node.getAttribute(
|
10784
|
+
if (!available.has(node.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_INSERT_REFERENCE))) {
|
10212
10785
|
containerElement.removeChild(node);
|
10213
10786
|
}
|
10214
10787
|
}
|
10215
10788
|
};
|
10216
10789
|
|
10217
|
-
for (
|
10790
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
10218
10791
|
var _ret = _loop();
|
10219
10792
|
|
10220
10793
|
if (_ret === "continue") continue;
|
10221
10794
|
}
|
10222
10795
|
} catch (err) {
|
10223
|
-
|
10796
|
+
_iterator5.e(err);
|
10224
10797
|
} finally {
|
10225
|
-
|
10798
|
+
_iterator5.f();
|
10226
10799
|
}
|
10227
10800
|
|
10228
10801
|
p.pop();
|
@@ -10248,7 +10821,7 @@ function insertElement(change) {
|
|
10248
10821
|
|
10249
10822
|
|
10250
10823
|
function appendNewDocumentFragment(container, key, ref, path) {
|
10251
|
-
var template = (0,
|
10824
|
+
var template = (0,_template_js__WEBPACK_IMPORTED_MODULE_14__.findDocumentTemplate)(key, container);
|
10252
10825
|
var nodes = template.createDocumentFragment();
|
10253
10826
|
|
10254
10827
|
for (var _i5 = 0, _Object$entries4 = Object.entries(nodes.childNodes); _i5 < _Object$entries4.length; _i5++) {
|
@@ -10257,7 +10830,7 @@ function appendNewDocumentFragment(container, key, ref, path) {
|
|
10257
10830
|
|
10258
10831
|
if (node instanceof HTMLElement) {
|
10259
10832
|
applyRecursive(node, key, path);
|
10260
|
-
node.setAttribute(
|
10833
|
+
node.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_INSERT_REFERENCE, ref);
|
10261
10834
|
}
|
10262
10835
|
|
10263
10836
|
container.appendChild(node);
|
@@ -10275,15 +10848,15 @@ function appendNewDocumentFragment(container, key, ref, path) {
|
|
10275
10848
|
|
10276
10849
|
function applyRecursive(node, key, path) {
|
10277
10850
|
if (node instanceof HTMLElement) {
|
10278
|
-
if (node.hasAttribute(
|
10279
|
-
var value = node.getAttribute(
|
10280
|
-
node.setAttribute(
|
10851
|
+
if (node.hasAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_REPLACE)) {
|
10852
|
+
var value = node.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_REPLACE);
|
10853
|
+
node.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_REPLACE, value.replaceAll("path:" + key, "path:" + path));
|
10281
10854
|
}
|
10282
10855
|
|
10283
|
-
if (node.hasAttribute(
|
10284
|
-
var _value = node.getAttribute(
|
10856
|
+
if (node.hasAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES)) {
|
10857
|
+
var _value = node.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES);
|
10285
10858
|
|
10286
|
-
node.setAttribute(
|
10859
|
+
node.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES, _value.replaceAll("path:" + key, "path:" + path));
|
10287
10860
|
}
|
10288
10861
|
|
10289
10862
|
for (var _i6 = 0, _Object$entries5 = Object.entries(node.childNodes); _i6 < _Object$entries5.length; _i6++) {
|
@@ -10305,10 +10878,10 @@ function applyRecursive(node, key, path) {
|
|
10305
10878
|
|
10306
10879
|
function updateContent(change) {
|
10307
10880
|
var self = this;
|
10308
|
-
var subject = self.subject.getRealSubject();
|
10309
|
-
var p = (0,
|
10310
|
-
runUpdateContent.call(this, this.element, p, subject);
|
10311
|
-
var slots = this.element.querySelectorAll('slot');
|
10881
|
+
var subject = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject();
|
10882
|
+
var p = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(change === null || change === void 0 ? void 0 : change['path']);
|
10883
|
+
runUpdateContent.call(this, this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element, p, subject);
|
10884
|
+
var slots = this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.querySelectorAll('slot');
|
10312
10885
|
|
10313
10886
|
if (slots.length > 0) {
|
10314
10887
|
for (var _i7 = 0, _Object$entries6 = Object.entries(slots); _i7 < _Object$entries6.length; _i7++) {
|
@@ -10317,9 +10890,9 @@ function updateContent(change) {
|
|
10317
10890
|
|
10318
10891
|
for (var _i8 = 0, _Object$entries7 = Object.entries(slot.assignedNodes()); _i8 < _Object$entries7.length; _i8++) {
|
10319
10892
|
var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i8], 2),
|
10320
|
-
|
10893
|
+
_element3 = _Object$entries7$_i[1];
|
10321
10894
|
|
10322
|
-
runUpdateContent.call(this,
|
10895
|
+
runUpdateContent.call(this, _element3, p, subject);
|
10323
10896
|
}
|
10324
10897
|
}
|
10325
10898
|
}
|
@@ -10337,16 +10910,16 @@ function updateContent(change) {
|
|
10337
10910
|
function runUpdateContent(container, parts, subject) {
|
10338
10911
|
var _this3 = this;
|
10339
10912
|
|
10340
|
-
if (!(0,
|
10913
|
+
if (!(0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isArray)(parts)) return;
|
10341
10914
|
if (!(container instanceof HTMLElement)) return;
|
10342
|
-
parts = (0,
|
10915
|
+
parts = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(parts);
|
10343
10916
|
var mem = new WeakSet();
|
10344
10917
|
|
10345
10918
|
while (parts.length > 0) {
|
10346
10919
|
var current = parts.join('.');
|
10347
10920
|
parts.pop(); // Unfortunately, static data is always changed as well, since it is not possible to react to changes here.
|
10348
10921
|
|
10349
|
-
var query = '[' +
|
10922
|
+
var query = '[' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_REPLACE + '^="path:' + current + '"], [' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_REPLACE + '^="static:"]';
|
10350
10923
|
var e = container.querySelectorAll('' + query);
|
10351
10924
|
var iterator = new Set(_toConsumableArray(e));
|
10352
10925
|
|
@@ -10357,21 +10930,21 @@ function runUpdateContent(container, parts, subject) {
|
|
10357
10930
|
iterator.forEach(function (key, element) {
|
10358
10931
|
if (mem.has(element)) return;
|
10359
10932
|
mem.add(element);
|
10360
|
-
var attributes = element.getAttribute(
|
10361
|
-
var cmd = (0,
|
10362
|
-
var pipe = new
|
10933
|
+
var attributes = element.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_REPLACE);
|
10934
|
+
var cmd = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(attributes);
|
10935
|
+
var pipe = new _data_pipe_js__WEBPACK_IMPORTED_MODULE_3__.Pipe(cmd);
|
10363
10936
|
|
10364
|
-
_this3.callbacks.forEach(function (f, n) {
|
10937
|
+
_this3[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].callbacks.forEach(function (f, n) {
|
10365
10938
|
pipe.setCallback(n, f);
|
10366
10939
|
});
|
10367
10940
|
|
10368
10941
|
var value;
|
10369
10942
|
|
10370
10943
|
try {
|
10371
|
-
element.removeAttribute(
|
10944
|
+
element.removeAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE);
|
10372
10945
|
value = pipe.run(subject);
|
10373
10946
|
} catch (e) {
|
10374
|
-
element.setAttribute(
|
10947
|
+
element.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE, e.message);
|
10375
10948
|
}
|
10376
10949
|
|
10377
10950
|
if (value instanceof HTMLElement) {
|
@@ -10396,9 +10969,9 @@ function runUpdateContent(container, parts, subject) {
|
|
10396
10969
|
|
10397
10970
|
|
10398
10971
|
function updateAttributes(change) {
|
10399
|
-
var subject = this.subject.getRealSubject();
|
10400
|
-
var p = (0,
|
10401
|
-
runUpdateAttributes.call(this, this.element, p, subject);
|
10972
|
+
var subject = this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject();
|
10973
|
+
var p = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(change === null || change === void 0 ? void 0 : change['path']);
|
10974
|
+
runUpdateAttributes.call(this, this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element, p, subject);
|
10402
10975
|
}
|
10403
10976
|
/**
|
10404
10977
|
* @private
|
@@ -10414,15 +10987,15 @@ function runUpdateAttributes(container, parts, subject) {
|
|
10414
10987
|
var _this4 = this;
|
10415
10988
|
|
10416
10989
|
var self = this;
|
10417
|
-
if (!(0,
|
10418
|
-
parts = (0,
|
10990
|
+
if (!(0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isArray)(parts)) return;
|
10991
|
+
parts = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(parts);
|
10419
10992
|
var mem = new WeakSet();
|
10420
10993
|
|
10421
10994
|
while (parts.length > 0) {
|
10422
10995
|
var current = parts.join('.');
|
10423
10996
|
parts.pop();
|
10424
10997
|
var iterator = new Set();
|
10425
|
-
var query = '[' +
|
10998
|
+
var query = '[' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES + '*="path:' + current + '"], [' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES + '^="static:"]';
|
10426
10999
|
var e = container.querySelectorAll(query);
|
10427
11000
|
|
10428
11001
|
if (e.length > 0) {
|
@@ -10436,27 +11009,27 @@ function runUpdateAttributes(container, parts, subject) {
|
|
10436
11009
|
iterator.forEach(function (key, element) {
|
10437
11010
|
if (mem.has(element)) return;
|
10438
11011
|
mem.add(element);
|
10439
|
-
var attributes = element.getAttribute(
|
11012
|
+
var attributes = element.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES);
|
10440
11013
|
|
10441
11014
|
var _loop2 = function _loop2() {
|
10442
11015
|
var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i9], 2),
|
10443
11016
|
def = _Object$entries8$_i[1];
|
10444
11017
|
|
10445
|
-
def = (0,
|
11018
|
+
def = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(def);
|
10446
11019
|
var i = def.indexOf(' ');
|
10447
|
-
var name = (0,
|
10448
|
-
var cmd = (0,
|
10449
|
-
var pipe = new
|
10450
|
-
self.callbacks.forEach(function (f, n) {
|
11020
|
+
var name = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(def.substr(0, i));
|
11021
|
+
var cmd = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(def.substr(i));
|
11022
|
+
var pipe = new _data_pipe_js__WEBPACK_IMPORTED_MODULE_3__.Pipe(cmd);
|
11023
|
+
self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].callbacks.forEach(function (f, n) {
|
10451
11024
|
pipe.setCallback(n, f, element);
|
10452
11025
|
});
|
10453
11026
|
var value = void 0;
|
10454
11027
|
|
10455
11028
|
try {
|
10456
|
-
element.removeAttribute(
|
11029
|
+
element.removeAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE);
|
10457
11030
|
value = pipe.run(subject);
|
10458
11031
|
} catch (e) {
|
10459
|
-
element.setAttribute(
|
11032
|
+
element.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE, e.message);
|
10460
11033
|
}
|
10461
11034
|
|
10462
11035
|
if (value === undefined) {
|
@@ -10554,7 +11127,7 @@ function handleInputControlAttributeUpdate(element, name, value) {
|
|
10554
11127
|
}
|
10555
11128
|
}
|
10556
11129
|
|
10557
|
-
(0,
|
11130
|
+
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_5__.assignToNamespace)('Monster.DOM', Updater);
|
10558
11131
|
|
10559
11132
|
|
10560
11133
|
/***/ }),
|
@@ -10600,7 +11173,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
10600
11173
|
*
|
10601
11174
|
* ```
|
10602
11175
|
* <script type="module">
|
10603
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11176
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
10604
11177
|
* Monster.Util.trimSpaces(" hello ")
|
10605
11178
|
* </script>
|
10606
11179
|
* ```
|
@@ -10609,14 +11182,14 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
10609
11182
|
*
|
10610
11183
|
* ```
|
10611
11184
|
* <script type="module">
|
10612
|
-
* import {
|
11185
|
+
* import {trimSpaces} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/util/trimspaces.js';
|
10613
11186
|
* trimSpaces(' hello \\ ')
|
10614
11187
|
* </script>
|
10615
11188
|
* ```
|
10616
11189
|
*
|
10617
11190
|
* Hint: One stroke is escaped by the javascript interpreter, the second stroke escapes the stroke.
|
10618
11191
|
*
|
10619
|
-
* ```
|
11192
|
+
* ```text
|
10620
11193
|
* a\ b ↦ a b
|
10621
11194
|
* a\\ b ↦ a\ b
|
10622
11195
|
* ```
|
@@ -10686,30 +11259,35 @@ function trimSpaces(value) {
|
|
10686
11259
|
__webpack_require__.r(__webpack_exports__);
|
10687
11260
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10688
11261
|
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_0__.Monster; },
|
10689
|
-
/* harmony export */ "
|
10690
|
-
/* harmony export */ "
|
10691
|
-
/* harmony export */ "getDocumentFragmentFromString": function() { return /* binding */ getDocumentFragmentFromString; }
|
11262
|
+
/* harmony export */ "findTargetElementFromEvent": function() { return /* binding */ findTargetElementFromEvent; },
|
11263
|
+
/* harmony export */ "fireEvent": function() { return /* binding */ fireEvent; }
|
10692
11264
|
/* harmony export */ });
|
10693
11265
|
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
10694
|
-
/* harmony import */ var
|
11266
|
+
/* harmony import */ var _types_is_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
10695
11267
|
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14);
|
11268
|
+
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43);
|
10696
11269
|
|
10697
11270
|
/**
|
10698
11271
|
* @author schukai GmbH
|
10699
11272
|
*/
|
10700
11273
|
|
10701
|
-
function
|
11274
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
11275
|
+
|
11276
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
11277
|
+
|
11278
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
11279
|
+
|
10702
11280
|
|
10703
11281
|
|
10704
11282
|
|
10705
11283
|
|
10706
11284
|
/**
|
10707
|
-
*
|
11285
|
+
* You can call the function via the monster namespace `new Monster.DOM.fireEvent()`.
|
10708
11286
|
*
|
10709
11287
|
* ```
|
10710
11288
|
* <script type="module">
|
10711
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10712
|
-
* console.log(Monster.DOM.
|
11289
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
11290
|
+
* console.log(new Monster.DOM.fireEvent())
|
10713
11291
|
* </script>
|
10714
11292
|
* ```
|
10715
11293
|
*
|
@@ -10717,12 +11295,157 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
10717
11295
|
*
|
10718
11296
|
* ```
|
10719
11297
|
* <script type="module">
|
10720
|
-
* import {
|
10721
|
-
* console.log(
|
11298
|
+
* import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/events.js';
|
11299
|
+
* console.log(fireEvent())
|
10722
11300
|
* </script>
|
10723
11301
|
* ```
|
10724
11302
|
*
|
10725
|
-
*
|
11303
|
+
* @param {HTMLElement|HTMLCollection|NodeList} element
|
11304
|
+
* @param {string} type
|
11305
|
+
* @return {void}
|
11306
|
+
* @since 1.10.0
|
11307
|
+
* @copyright schukai GmbH
|
11308
|
+
* @memberOf Monster.DOM
|
11309
|
+
* @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection
|
11310
|
+
* @summary Construct and send and event
|
11311
|
+
*/
|
11312
|
+
|
11313
|
+
function fireEvent(element, type) {
|
11314
|
+
var document = (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.getDocument)();
|
11315
|
+
|
11316
|
+
if (element instanceof HTMLElement) {
|
11317
|
+
if (type === 'click') {
|
11318
|
+
element.click();
|
11319
|
+
return;
|
11320
|
+
}
|
11321
|
+
|
11322
|
+
var event = new Event((0,_types_validate_js__WEBPACK_IMPORTED_MODULE_2__.validateString)(type), {
|
11323
|
+
bubbles: true,
|
11324
|
+
cancelable: true
|
11325
|
+
});
|
11326
|
+
element.dispatchEvent(event);
|
11327
|
+
} else if (element instanceof HTMLCollection || element instanceof NodeList) {
|
11328
|
+
var _iterator = _createForOfIteratorHelper(element),
|
11329
|
+
_step;
|
11330
|
+
|
11331
|
+
try {
|
11332
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
11333
|
+
var e = _step.value;
|
11334
|
+
fireEvent(e, type);
|
11335
|
+
}
|
11336
|
+
} catch (err) {
|
11337
|
+
_iterator.e(err);
|
11338
|
+
} finally {
|
11339
|
+
_iterator.f();
|
11340
|
+
}
|
11341
|
+
} else {
|
11342
|
+
throw new TypeError('value is not an instance of HTMLElement or HTMLCollection');
|
11343
|
+
}
|
11344
|
+
}
|
11345
|
+
/**
|
11346
|
+
* This function gets the path `Event.composedPath()` from an event and tries to find the next element
|
11347
|
+
* up the tree `element.closest()` with the attribute and value. If no value, or a value that is undefined or null,
|
11348
|
+
* is specified, only the attribute is searched.
|
11349
|
+
*
|
11350
|
+
* You can call the function via the monster namespace `new Monster.DOM.findTargetElementFromEvent()`.
|
11351
|
+
*
|
11352
|
+
* ```
|
11353
|
+
* <script type="module">
|
11354
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
11355
|
+
* new Monster.DOM.findTargetElementFromEvent()
|
11356
|
+
* </script>
|
11357
|
+
* ```
|
11358
|
+
*
|
11359
|
+
* Alternatively, you can also integrate this function individually.
|
11360
|
+
*
|
11361
|
+
* ```
|
11362
|
+
* <script type="module">
|
11363
|
+
* import {findTargetElementFromEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/events.js';
|
11364
|
+
* findTargetElementFromEvent()
|
11365
|
+
* </script>
|
11366
|
+
* ```
|
11367
|
+
*
|
11368
|
+
* @since 1.14.0
|
11369
|
+
* @param {Event} event
|
11370
|
+
* @param {string} attributeName
|
11371
|
+
* @param {string|null|undefined} attributeValue
|
11372
|
+
* @throws {Error} unsupported event
|
11373
|
+
* @memberOf Monster.DOM
|
11374
|
+
* @throws {TypeError} value is not a string
|
11375
|
+
* @throws {TypeError} value is not an instance of HTMLElement
|
11376
|
+
* @summary Help function to find the appropriate control
|
11377
|
+
*/
|
11378
|
+
|
11379
|
+
|
11380
|
+
function findTargetElementFromEvent(event, attributeName, attributeValue) {
|
11381
|
+
(0,_types_validate_js__WEBPACK_IMPORTED_MODULE_2__.validateInstance)(event, Event);
|
11382
|
+
|
11383
|
+
if (typeof event.composedPath !== 'function') {
|
11384
|
+
throw new Error('unsupported event');
|
11385
|
+
}
|
11386
|
+
|
11387
|
+
var path = event.composedPath(); // closest cannot be used here, because closest is not correct for slotted elements
|
11388
|
+
|
11389
|
+
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_1__.isArray)(path)) {
|
11390
|
+
for (var i = 0; i < path.length; i++) {
|
11391
|
+
var o = path[i];
|
11392
|
+
|
11393
|
+
if (o instanceof HTMLElement && o.hasAttribute(attributeName) && (attributeValue === undefined || o.getAttribute(attributeName) === attributeValue)) {
|
11394
|
+
return o;
|
11395
|
+
}
|
11396
|
+
}
|
11397
|
+
}
|
11398
|
+
|
11399
|
+
return undefined;
|
11400
|
+
}
|
11401
|
+
|
11402
|
+
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_0__.assignToNamespace)('Monster.DOM', findTargetElementFromEvent, fireEvent);
|
11403
|
+
|
11404
|
+
|
11405
|
+
/***/ }),
|
11406
|
+
/* 43 */
|
11407
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
11408
|
+
|
11409
|
+
__webpack_require__.r(__webpack_exports__);
|
11410
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11411
|
+
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_0__.Monster; },
|
11412
|
+
/* harmony export */ "getWindow": function() { return /* binding */ getWindow; },
|
11413
|
+
/* harmony export */ "getDocument": function() { return /* binding */ getDocument; },
|
11414
|
+
/* harmony export */ "getDocumentFragmentFromString": function() { return /* binding */ getDocumentFragmentFromString; }
|
11415
|
+
/* harmony export */ });
|
11416
|
+
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
11417
|
+
/* harmony import */ var _types_global_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);
|
11418
|
+
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14);
|
11419
|
+
|
11420
|
+
/**
|
11421
|
+
* @author schukai GmbH
|
11422
|
+
*/
|
11423
|
+
|
11424
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
11425
|
+
|
11426
|
+
|
11427
|
+
|
11428
|
+
|
11429
|
+
/**
|
11430
|
+
* this method fetches the document object
|
11431
|
+
*
|
11432
|
+
* ```
|
11433
|
+
* <script type="module">
|
11434
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
11435
|
+
* console.log(Monster.DOM.getDocument())
|
11436
|
+
* </script>
|
11437
|
+
* ```
|
11438
|
+
*
|
11439
|
+
* Alternatively, you can also integrate this function individually.
|
11440
|
+
*
|
11441
|
+
* ```
|
11442
|
+
* <script type="module">
|
11443
|
+
* import {getDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/util.js';
|
11444
|
+
* console.log(getDocument())
|
11445
|
+
* </script>
|
11446
|
+
* ```
|
11447
|
+
*
|
11448
|
+
* in nodejs this functionality can be performed with [jsdom](https://www.npmjs.com/package/jsdom).
|
10726
11449
|
*
|
10727
11450
|
* ```
|
10728
11451
|
* import {JSDOM} from "jsdom"
|
@@ -10772,7 +11495,7 @@ function getDocument() {
|
|
10772
11495
|
*
|
10773
11496
|
* ```
|
10774
11497
|
* <script type="module">
|
10775
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11498
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
10776
11499
|
* console.log(Monster.DOM.getWindow())
|
10777
11500
|
* </script>
|
10778
11501
|
* ```
|
@@ -10781,7 +11504,7 @@ function getDocument() {
|
|
10781
11504
|
*
|
10782
11505
|
* ```
|
10783
11506
|
* <script type="module">
|
10784
|
-
* import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11507
|
+
* import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/util.js';
|
10785
11508
|
* console.log(getWindow(null))
|
10786
11509
|
* </script>
|
10787
11510
|
* ```
|
@@ -10841,7 +11564,7 @@ function getWindow() {
|
|
10841
11564
|
*
|
10842
11565
|
* ```
|
10843
11566
|
* <script type="module">
|
10844
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11567
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
10845
11568
|
* console.log(Monster.DOM.getDocumentFragmentFromString())
|
10846
11569
|
* </script>
|
10847
11570
|
* ```
|
@@ -10850,7 +11573,7 @@ function getWindow() {
|
|
10850
11573
|
*
|
10851
11574
|
* ```
|
10852
11575
|
* <script type="module">
|
10853
|
-
* import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11576
|
+
* import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/util.js';
|
10854
11577
|
* console.log(getDocumentFragmentFromString('<div></div>'))
|
10855
11578
|
* </script>
|
10856
11579
|
* ```
|
@@ -10902,157 +11625,6 @@ function getDocumentFragmentFromString(html) {
|
|
10902
11625
|
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_0__.assignToNamespace)('Monster.DOM', getWindow, getDocument, getDocumentFragmentFromString);
|
10903
11626
|
|
10904
11627
|
|
10905
|
-
/***/ }),
|
10906
|
-
/* 43 */
|
10907
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
10908
|
-
|
10909
|
-
__webpack_require__.r(__webpack_exports__);
|
10910
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10911
|
-
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_0__.Monster; },
|
10912
|
-
/* harmony export */ "findTargetElementFromEvent": function() { return /* binding */ findTargetElementFromEvent; },
|
10913
|
-
/* harmony export */ "fireEvent": function() { return /* binding */ fireEvent; }
|
10914
|
-
/* harmony export */ });
|
10915
|
-
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
10916
|
-
/* harmony import */ var _types_is_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
10917
|
-
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14);
|
10918
|
-
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42);
|
10919
|
-
|
10920
|
-
/**
|
10921
|
-
* @author schukai GmbH
|
10922
|
-
*/
|
10923
|
-
|
10924
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
10925
|
-
|
10926
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
10927
|
-
|
10928
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
10929
|
-
|
10930
|
-
|
10931
|
-
|
10932
|
-
|
10933
|
-
|
10934
|
-
/**
|
10935
|
-
* You can call the function via the monster namespace `new Monster.DOM.fireEvent()`.
|
10936
|
-
*
|
10937
|
-
* ```
|
10938
|
-
* <script type="module">
|
10939
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.24.0/dist/modules/dom/events.js';
|
10940
|
-
* console.log(new Monster.DOM.fireEvent())
|
10941
|
-
* </script>
|
10942
|
-
* ```
|
10943
|
-
*
|
10944
|
-
* Alternatively, you can also integrate this function individually.
|
10945
|
-
*
|
10946
|
-
* ```
|
10947
|
-
* <script type="module">
|
10948
|
-
* import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.24.0/dist/modules/dom/events.js';
|
10949
|
-
* console.log(fireEvent())
|
10950
|
-
* </script>
|
10951
|
-
* ```
|
10952
|
-
*
|
10953
|
-
* @param {HTMLElement|HTMLCollection|NodeList} element
|
10954
|
-
* @param {string} type
|
10955
|
-
* @return {void}
|
10956
|
-
* @since 1.10.0
|
10957
|
-
* @copyright schukai GmbH
|
10958
|
-
* @memberOf Monster.DOM
|
10959
|
-
* @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection
|
10960
|
-
* @summary Construct and send and event
|
10961
|
-
*/
|
10962
|
-
|
10963
|
-
function fireEvent(element, type) {
|
10964
|
-
var document = (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.getDocument)();
|
10965
|
-
|
10966
|
-
if (element instanceof HTMLElement) {
|
10967
|
-
if (type === 'click') {
|
10968
|
-
element.click();
|
10969
|
-
return;
|
10970
|
-
}
|
10971
|
-
|
10972
|
-
var event = new Event((0,_types_validate_js__WEBPACK_IMPORTED_MODULE_2__.validateString)(type), {
|
10973
|
-
bubbles: true,
|
10974
|
-
cancelable: true
|
10975
|
-
});
|
10976
|
-
element.dispatchEvent(event);
|
10977
|
-
} else if (element instanceof HTMLCollection || element instanceof NodeList) {
|
10978
|
-
var _iterator = _createForOfIteratorHelper(element),
|
10979
|
-
_step;
|
10980
|
-
|
10981
|
-
try {
|
10982
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
10983
|
-
var e = _step.value;
|
10984
|
-
fireEvent(e, type);
|
10985
|
-
}
|
10986
|
-
} catch (err) {
|
10987
|
-
_iterator.e(err);
|
10988
|
-
} finally {
|
10989
|
-
_iterator.f();
|
10990
|
-
}
|
10991
|
-
} else {
|
10992
|
-
throw new TypeError('value is not an instance of HTMLElement or HTMLCollection');
|
10993
|
-
}
|
10994
|
-
}
|
10995
|
-
/**
|
10996
|
-
* This function gets the path `Event.composedPath()` from an event and tries to find the next element
|
10997
|
-
* up the tree `element.closest()` with the attribute and value. If no value, or a value that is undefined or null,
|
10998
|
-
* is specified, only the attribute is searched.
|
10999
|
-
*
|
11000
|
-
* You can call the function via the monster namespace `new Monster.DOM.findTargetElementFromEvent()`.
|
11001
|
-
*
|
11002
|
-
* ```
|
11003
|
-
* <script type="module">
|
11004
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.24.0/dist/modules/dom/events.js';
|
11005
|
-
* console.log(new Monster.DOM.findTargetElementFromEvent())
|
11006
|
-
* </script>
|
11007
|
-
* ```
|
11008
|
-
*
|
11009
|
-
* Alternatively, you can also integrate this function individually.
|
11010
|
-
*
|
11011
|
-
* ```
|
11012
|
-
* <script type="module">
|
11013
|
-
* import {findTargetElementFromEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.24.0/dist/modules/dom/events.js';
|
11014
|
-
* console.log(findTargetElementFromEvent())
|
11015
|
-
* </script>
|
11016
|
-
* ```
|
11017
|
-
*
|
11018
|
-
* @since 1.14.0
|
11019
|
-
* @param {Event} event
|
11020
|
-
* @param {string} attributeName
|
11021
|
-
* @param {string|null|undefined} attributeValue
|
11022
|
-
* @throws {Error} unsupported event
|
11023
|
-
* @memberOf Monster.DOM
|
11024
|
-
* @throws {TypeError} value is not a string
|
11025
|
-
* @throws {TypeError} value is not an instance of HTMLElement
|
11026
|
-
* @summary Help function to find the appropriate control
|
11027
|
-
*/
|
11028
|
-
|
11029
|
-
|
11030
|
-
function findTargetElementFromEvent(event, attributeName, attributeValue) {
|
11031
|
-
(0,_types_validate_js__WEBPACK_IMPORTED_MODULE_2__.validateInstance)(event, Event);
|
11032
|
-
|
11033
|
-
if (typeof event.composedPath !== 'function') {
|
11034
|
-
throw new Error('unsupported event');
|
11035
|
-
}
|
11036
|
-
|
11037
|
-
var path = event.composedPath();
|
11038
|
-
var element = path === null || path === void 0 ? void 0 : path[0]; // closest cannot be used here, because closest is not correct for slotted elements
|
11039
|
-
|
11040
|
-
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_1__.isArray)(path)) {
|
11041
|
-
for (var i = 0; i < path.length; i++) {
|
11042
|
-
var o = path[i];
|
11043
|
-
|
11044
|
-
if (o instanceof HTMLElement && o.hasAttribute(attributeName) && (attributeValue === undefined || o.getAttribute(attributeName) === attributeValue)) {
|
11045
|
-
return o;
|
11046
|
-
}
|
11047
|
-
}
|
11048
|
-
}
|
11049
|
-
|
11050
|
-
return undefined;
|
11051
|
-
}
|
11052
|
-
|
11053
|
-
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_0__.assignToNamespace)('Monster.DOM', findTargetElementFromEvent, fireEvent);
|
11054
|
-
|
11055
|
-
|
11056
11628
|
/***/ }),
|
11057
11629
|
/* 44 */
|
11058
11630
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
@@ -11064,9 +11636,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
11064
11636
|
/* harmony export */ });
|
11065
11637
|
/* harmony import */ var _i18n_locale_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(45);
|
11066
11638
|
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
11067
|
-
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
11068
|
-
|
11069
|
-
|
11639
|
+
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43);
|
11070
11640
|
|
11071
11641
|
/**
|
11072
11642
|
* @author schukai GmbH
|
@@ -11074,6 +11644,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
11074
11644
|
|
11075
11645
|
|
11076
11646
|
|
11647
|
+
|
11077
11648
|
/**
|
11078
11649
|
* @private
|
11079
11650
|
* @type {string}
|
@@ -11083,13 +11654,17 @@ var DEFAULT_LANGUAGE = 'en';
|
|
11083
11654
|
/**
|
11084
11655
|
* With this function you can read the language version set by the document.
|
11085
11656
|
* For this the attribute `lang` in the html tag is read. If no attribute is set, `en` is used as default.
|
11657
|
+
*
|
11658
|
+
* ```html
|
11659
|
+
* <html lang="en">
|
11660
|
+
* ```
|
11086
11661
|
*
|
11087
11662
|
* You can call the function via the monster namespace `new Monster.DOM.getLocaleOfDocument()`.
|
11088
11663
|
*
|
11089
11664
|
* ```
|
11090
11665
|
* <script type="module">
|
11091
|
-
* import {
|
11092
|
-
*
|
11666
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
11667
|
+
* new Monster.DOM.getLocaleOfDocument()
|
11093
11668
|
* </script>
|
11094
11669
|
* ```
|
11095
11670
|
*
|
@@ -11097,8 +11672,8 @@ var DEFAULT_LANGUAGE = 'en';
|
|
11097
11672
|
*
|
11098
11673
|
* ```
|
11099
11674
|
* <script type="module">
|
11100
|
-
* import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11101
|
-
*
|
11675
|
+
* import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/dom/locale.js';
|
11676
|
+
* new getLocaleOfDocument()
|
11102
11677
|
* </script>
|
11103
11678
|
* ```
|
11104
11679
|
*
|
@@ -11190,7 +11765,7 @@ var localeStringSymbol = Symbol('localeString');
|
|
11190
11765
|
*
|
11191
11766
|
* ```
|
11192
11767
|
* <script type="module">
|
11193
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11768
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
11194
11769
|
* new Monster.I18n.Locale()
|
11195
11770
|
* </script>
|
11196
11771
|
* ```
|
@@ -11199,7 +11774,7 @@ var localeStringSymbol = Symbol('localeString');
|
|
11199
11774
|
*
|
11200
11775
|
* ```
|
11201
11776
|
* <script type="module">
|
11202
|
-
* import {Locale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11777
|
+
* import {Locale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/i18n/locale.js';
|
11203
11778
|
* new Locale()
|
11204
11779
|
* </script>
|
11205
11780
|
* ```
|
@@ -11358,6 +11933,8 @@ var Locale = /*#__PURE__*/function (_Base) {
|
|
11358
11933
|
return "" + this.localeString;
|
11359
11934
|
}
|
11360
11935
|
/**
|
11936
|
+
* The structure has the following: language, script, region, variants, extlang, privateUse
|
11937
|
+
*
|
11361
11938
|
* @return {Monster.I18n.LocaleMap}
|
11362
11939
|
*/
|
11363
11940
|
|
@@ -11390,7 +11967,7 @@ var Locale = /*#__PURE__*/function (_Base) {
|
|
11390
11967
|
*
|
11391
11968
|
* ```
|
11392
11969
|
* <script type="module">
|
11393
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11970
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
11394
11971
|
* new Monster.I18n.createLocale()
|
11395
11972
|
* </script>
|
11396
11973
|
* ```
|
@@ -11399,7 +11976,7 @@ var Locale = /*#__PURE__*/function (_Base) {
|
|
11399
11976
|
*
|
11400
11977
|
* ```
|
11401
11978
|
* <script type="module">
|
11402
|
-
* import {createLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11979
|
+
* import {createLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/i18n/locale.js';
|
11403
11980
|
* createLocale()
|
11404
11981
|
* </script>
|
11405
11982
|
* ```
|
@@ -11575,7 +12152,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
11575
12152
|
*
|
11576
12153
|
* ```
|
11577
12154
|
* <script type="module">
|
11578
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12155
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
11579
12156
|
* new Monster.I18n.Provider()
|
11580
12157
|
* </script>
|
11581
12158
|
* ```
|
@@ -11584,7 +12161,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
11584
12161
|
*
|
11585
12162
|
* ```
|
11586
12163
|
* <script type="module">
|
11587
|
-
* import {Provider} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12164
|
+
* import {Provider} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/i18n/provider.js';
|
11588
12165
|
* new Provider()
|
11589
12166
|
* </script>
|
11590
12167
|
* ```
|
@@ -11685,7 +12262,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
11685
12262
|
*
|
11686
12263
|
* ```
|
11687
12264
|
* <script type="module">
|
11688
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12265
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
11689
12266
|
* new Monster.Types.BaseWithOptions()
|
11690
12267
|
* </script>
|
11691
12268
|
* ```
|
@@ -11694,7 +12271,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
11694
12271
|
*
|
11695
12272
|
* ```
|
11696
12273
|
* <script type="module">
|
11697
|
-
* import {BaseWithOptions} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12274
|
+
* import {BaseWithOptions} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/basewithoptions.js';
|
11698
12275
|
* new BaseWithOptions()
|
11699
12276
|
* </script>
|
11700
12277
|
* ```
|
@@ -11835,7 +12412,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
11835
12412
|
*
|
11836
12413
|
* ```
|
11837
12414
|
* <script type="module">
|
11838
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12415
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
11839
12416
|
* new Monster.I18n.Translations()
|
11840
12417
|
* </script>
|
11841
12418
|
* ```
|
@@ -11844,23 +12421,33 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
11844
12421
|
*
|
11845
12422
|
* ```
|
11846
12423
|
* <script type="module">
|
11847
|
-
* import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12424
|
+
* import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/i18n/translations.js';
|
11848
12425
|
* new Translations()
|
11849
12426
|
* </script>
|
11850
12427
|
* ```
|
11851
12428
|
*
|
11852
12429
|
* @example
|
11853
12430
|
*
|
11854
|
-
* import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12431
|
+
* import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/i18n/translations.js';
|
12432
|
+
* import {parseLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/i18n/locale.js';
|
12433
|
+
*
|
11855
12434
|
* const translation = new Translations(parseLocale('en-GB'));
|
11856
12435
|
*
|
11857
12436
|
* translation.assignTranslations({
|
11858
|
-
*
|
11859
|
-
*
|
11860
|
-
*
|
12437
|
+
* text1: "click",
|
12438
|
+
* text2: {
|
12439
|
+
* 'one': 'click once',
|
12440
|
+
* 'other': 'click n times'
|
12441
|
+
* }
|
12442
|
+
* });
|
12443
|
+
*
|
12444
|
+
* console.log(translation.getText('text1'));
|
12445
|
+
* // ↦ click
|
11861
12446
|
*
|
11862
|
-
* translation.
|
11863
|
-
*
|
12447
|
+
* console.log(translation.getPluralRuleText('text2',1));
|
12448
|
+
* // -> click once
|
12449
|
+
* console.log(translation.getPluralRuleText('text2',2));
|
12450
|
+
* // -> click n times
|
11864
12451
|
*
|
11865
12452
|
* @since 1.13.0
|
11866
12453
|
* @copyright schukai GmbH
|
@@ -12114,7 +12701,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12114
12701
|
*
|
12115
12702
|
* ```
|
12116
12703
|
* <script type="module">
|
12117
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12704
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
12118
12705
|
* new Monster.I18n.Providers.Fetch()
|
12119
12706
|
* </script>
|
12120
12707
|
* ```
|
@@ -12123,15 +12710,24 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12123
12710
|
*
|
12124
12711
|
* ```
|
12125
12712
|
* <script type="module">
|
12126
|
-
* import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12713
|
+
* import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/i18n/providers/fetch.js';
|
12127
12714
|
* new Fetch()
|
12128
12715
|
* </script>
|
12129
12716
|
* ```
|
12717
|
+
*
|
12718
|
+
* @example <caption>das ist ein test</caption>
|
12719
|
+
*
|
12720
|
+
* import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/i18n/providers/fetch.js';
|
12721
|
+
*
|
12722
|
+
* // fetch from API
|
12723
|
+
* const translation = new Fetch('https://example.com/${language}.json').getTranslation('en-GB');
|
12724
|
+
* // ↦ https://example.com/en.json
|
12130
12725
|
*
|
12131
12726
|
* @since 1.13.0
|
12132
12727
|
* @copyright schukai GmbH
|
12133
12728
|
* @memberOf Monster.I18n.Providers
|
12134
12729
|
* @see {@link https://datatracker.ietf.org/doc/html/rfc3066}
|
12730
|
+
* @tutorial i18n-locale-and-formatter
|
12135
12731
|
*/
|
12136
12732
|
|
12137
12733
|
var Fetch = /*#__PURE__*/function (_Provider) {
|
@@ -12141,7 +12737,13 @@ var Fetch = /*#__PURE__*/function (_Provider) {
|
|
12141
12737
|
|
12142
12738
|
/**
|
12143
12739
|
* As options the key `fetch` can be passed. This config object is passed to the fetch method as init.
|
12144
|
-
*
|
12740
|
+
*
|
12741
|
+
* The url may contain placeholders (language, script, region, variants, extlang, privateUse), so you can specify one url for all translations.
|
12742
|
+
*
|
12743
|
+
* ```
|
12744
|
+
* new Fetch('https://www.example.com/assets/${language}.json')
|
12745
|
+
* ```
|
12746
|
+
*
|
12145
12747
|
* @param {string|URL} url
|
12146
12748
|
* @param {Object} options see {@link Monster.I18n.Providers.Fetch#defaults}
|
12147
12749
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch}
|
@@ -12244,14 +12846,20 @@ var Fetch = /*#__PURE__*/function (_Provider) {
|
|
12244
12846
|
|
12245
12847
|
__webpack_require__.r(__webpack_exports__);
|
12246
12848
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
12247
|
-
/* harmony export */ "Monster": function() { return /* reexport safe */
|
12849
|
+
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_3__.Monster; },
|
12248
12850
|
/* harmony export */ "Formatter": function() { return /* binding */ Formatter; }
|
12249
12851
|
/* harmony export */ });
|
12250
|
-
/* harmony import */ var
|
12251
|
-
/* harmony import */ var
|
12252
|
-
/* harmony import */ var
|
12253
|
-
/* harmony import */ var
|
12852
|
+
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
12853
|
+
/* harmony import */ var _data_extend_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21);
|
12854
|
+
/* harmony import */ var _data_pipe_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22);
|
12855
|
+
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
|
12856
|
+
/* harmony import */ var _types_basewithoptions_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(47);
|
12857
|
+
/* harmony import */ var _types_is_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9);
|
12858
|
+
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(14);
|
12254
12859
|
|
12860
|
+
/**
|
12861
|
+
* @author schukai GmbH
|
12862
|
+
*/
|
12255
12863
|
|
12256
12864
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
12257
12865
|
|
@@ -12275,6 +12883,10 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
12275
12883
|
|
12276
12884
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
12277
12885
|
|
12886
|
+
function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
|
12887
|
+
|
12888
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
12889
|
+
|
12278
12890
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
12279
12891
|
|
12280
12892
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
@@ -12290,23 +12902,52 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
12290
12902
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
12291
12903
|
|
12292
12904
|
|
12905
|
+
|
12906
|
+
|
12907
|
+
|
12908
|
+
|
12909
|
+
|
12910
|
+
|
12293
12911
|
/**
|
12294
|
-
* @
|
12912
|
+
* @private
|
12913
|
+
* @type {symbol}
|
12295
12914
|
*/
|
12296
12915
|
|
12916
|
+
var internalObjectSymbol = Symbol('internalObject');
|
12917
|
+
/**
|
12918
|
+
* @private
|
12919
|
+
* @type {symbol}
|
12920
|
+
*/
|
12297
12921
|
|
12922
|
+
var watchdogSymbol = Symbol('watchdog');
|
12923
|
+
/**
|
12924
|
+
* @private
|
12925
|
+
* @type {symbol}
|
12926
|
+
*/
|
12298
12927
|
|
12928
|
+
var markerOpenIndexSymbol = Symbol('markerOpenIndex');
|
12929
|
+
/**
|
12930
|
+
* @private
|
12931
|
+
* @type {symbol}
|
12932
|
+
*/
|
12299
12933
|
|
12934
|
+
var markerCloseIndexSymbol = Symbol('markercloseIndex');
|
12935
|
+
/**
|
12936
|
+
* @private
|
12937
|
+
* @type {symbol}
|
12938
|
+
*/
|
12939
|
+
|
12940
|
+
var workingDataSymbol = Symbol('workingData');
|
12300
12941
|
/**
|
12301
12942
|
* Messages can be formatted with the formatter. To do this, an object with the values must be passed to the formatter. The message can then contain placeholders.
|
12302
12943
|
*
|
12303
12944
|
* Look at the example below. The placeholders use the logic of Pipe.
|
12304
12945
|
*
|
12305
|
-
* You can
|
12946
|
+
* You can create an instance via the monster namespace `new Monster.Text.Formatter()`.
|
12306
12947
|
*
|
12307
12948
|
* ```
|
12308
12949
|
* <script type="module">
|
12309
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12950
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
12310
12951
|
* new Monster.Text.Formatter()
|
12311
12952
|
* </script>
|
12312
12953
|
* ```
|
@@ -12315,19 +12956,42 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12315
12956
|
*
|
12316
12957
|
* ```
|
12317
12958
|
* <script type="module">
|
12318
|
-
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12959
|
+
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/text/formatter.js';
|
12319
12960
|
* new Formatter()
|
12320
12961
|
* </script>
|
12321
12962
|
* ```
|
12322
12963
|
*
|
12323
12964
|
* ## Marker in marker
|
12324
12965
|
*
|
12325
|
-
* Markers can be nested. Here, the inner marker is resolved first and then the outer marker
|
12966
|
+
* Markers can be nested. Here, the inner marker is resolved first `${subkey} ↦ 1 = ${mykey2}` and then the outer marker `${mykey2}`.
|
12326
12967
|
*
|
12327
12968
|
* ```
|
12969
|
+
* const text = '${mykey${subkey}}';
|
12970
|
+
* let obj = {
|
12971
|
+
* mykey2: "1",
|
12972
|
+
* subkey: "2"
|
12973
|
+
* };
|
12328
12974
|
*
|
12975
|
+
* new Formatter(obj).format(text);
|
12976
|
+
* // ↦ 1
|
12329
12977
|
* ```
|
12330
12978
|
*
|
12979
|
+
* ## Callbacks
|
12980
|
+
*
|
12981
|
+
* The values in a formatter can be adjusted via the commands of the `Transformer` or the`Pipe`.
|
12982
|
+
* There is also the possibility to use callbacks.
|
12983
|
+
*
|
12984
|
+
* const formatter = new Formatter({x: '1'}, {
|
12985
|
+
* callbacks: {
|
12986
|
+
* quote: (value) => {
|
12987
|
+
* return '"' + value + '"'
|
12988
|
+
* }
|
12989
|
+
* }
|
12990
|
+
* });
|
12991
|
+
*
|
12992
|
+
* formatter.format('${x | call:quote}'))
|
12993
|
+
* // ↦ "1"
|
12994
|
+
*
|
12331
12995
|
* ## Marker with parameter
|
12332
12996
|
*
|
12333
12997
|
* A string can also bring its own values. These must then be separated from the key by a separator `::`.
|
@@ -12337,7 +13001,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12337
13001
|
*
|
12338
13002
|
* @example
|
12339
13003
|
*
|
12340
|
-
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13004
|
+
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/text/formatter.js';
|
12341
13005
|
*
|
12342
13006
|
* new Formatter({
|
12343
13007
|
* a: {
|
@@ -12346,7 +13010,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12346
13010
|
* },
|
12347
13011
|
* d: "world",
|
12348
13012
|
* }
|
12349
|
-
* }).format("${a.b.c} ${a.d | ucfirst}!");
|
13013
|
+
* }).format("${a.b.c} ${a.d | ucfirst}!"); // with pipe
|
12350
13014
|
*
|
12351
13015
|
* // ↦ Hello World!
|
12352
13016
|
*
|
@@ -12355,8 +13019,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12355
13019
|
* @memberOf Monster.Text
|
12356
13020
|
*/
|
12357
13021
|
|
12358
|
-
var Formatter = /*#__PURE__*/function (
|
12359
|
-
_inherits(Formatter,
|
13022
|
+
var Formatter = /*#__PURE__*/function (_BaseWithOptions) {
|
13023
|
+
_inherits(Formatter, _BaseWithOptions);
|
12360
13024
|
|
12361
13025
|
var _super = _createSuper(Formatter);
|
12362
13026
|
|
@@ -12366,52 +13030,70 @@ var Formatter = /*#__PURE__*/function (_Base) {
|
|
12366
13030
|
* @param {object} object
|
12367
13031
|
* @throws {TypeError} value is not a object
|
12368
13032
|
*/
|
12369
|
-
function Formatter(object) {
|
13033
|
+
function Formatter(object, options) {
|
12370
13034
|
var _this;
|
12371
13035
|
|
12372
13036
|
_classCallCheck(this, Formatter);
|
12373
13037
|
|
12374
|
-
_this = _super.call(this);
|
12375
|
-
|
12376
|
-
|
12377
|
-
|
12378
|
-
}
|
12379
|
-
|
12380
|
-
_this.object = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_3__.validateObject)(object);
|
12381
|
-
_this.openMarker = '${';
|
12382
|
-
_this.closeMarker = '}';
|
12383
|
-
_this.parameterDelimiter = '::';
|
12384
|
-
_this.parameterAssignment = '=';
|
13038
|
+
_this = _super.call(this, options);
|
13039
|
+
_this[internalObjectSymbol] = object || {};
|
13040
|
+
_this[markerOpenIndexSymbol] = 0;
|
13041
|
+
_this[markerCloseIndexSymbol] = 0;
|
12385
13042
|
return _this;
|
12386
13043
|
}
|
12387
13044
|
/**
|
12388
|
-
*
|
12389
|
-
*
|
12390
|
-
*
|
12391
|
-
*
|
12392
|
-
*
|
12393
|
-
*
|
12394
|
-
*
|
12395
|
-
* formatter.setParameterChars('i18n{','}');
|
12396
|
-
* ```
|
12397
|
-
*
|
12398
|
-
* @param {string} delimiter
|
12399
|
-
* @param {string} assignment
|
12400
|
-
* @return {Formatter}
|
12401
|
-
* @since 1.24.0
|
12402
|
-
* @throws {TypeError} value is not a string
|
13045
|
+
* @property {object} marker
|
13046
|
+
* @property {array} marker.open=["${"]
|
13047
|
+
* @property {array} marker.close=["${"]
|
13048
|
+
* @property {object} parameter
|
13049
|
+
* @property {string} parameter.delimiter="::"
|
13050
|
+
* @property {string} parameter.assignment="="
|
13051
|
+
* @property {object} callbacks={}
|
12403
13052
|
*/
|
12404
13053
|
|
12405
13054
|
|
12406
13055
|
_createClass(Formatter, [{
|
13056
|
+
key: "defaults",
|
13057
|
+
get: function get() {
|
13058
|
+
return (0,_data_extend_js__WEBPACK_IMPORTED_MODULE_1__.extend)({}, _get(_getPrototypeOf(Formatter.prototype), "defaults", this), {
|
13059
|
+
marker: {
|
13060
|
+
open: ['${'],
|
13061
|
+
close: ['}']
|
13062
|
+
},
|
13063
|
+
parameter: {
|
13064
|
+
delimiter: '::',
|
13065
|
+
assignment: '='
|
13066
|
+
},
|
13067
|
+
callbacks: {}
|
13068
|
+
});
|
13069
|
+
}
|
13070
|
+
/**
|
13071
|
+
* Set new Parameter Character
|
13072
|
+
*
|
13073
|
+
* Default values for the chars are `::` and `=`
|
13074
|
+
*
|
13075
|
+
* ```
|
13076
|
+
* formatter.setParameterChars('#');
|
13077
|
+
* formatter.setParameterChars('[',']');
|
13078
|
+
* formatter.setParameterChars('i18n{','}');
|
13079
|
+
* ```
|
13080
|
+
*
|
13081
|
+
* @param {string} delimiter
|
13082
|
+
* @param {string} assignment
|
13083
|
+
* @return {Formatter}
|
13084
|
+
* @since 1.24.0
|
13085
|
+
* @throws {TypeError} value is not a string
|
13086
|
+
*/
|
13087
|
+
|
13088
|
+
}, {
|
12407
13089
|
key: "setParameterChars",
|
12408
13090
|
value: function setParameterChars(delimiter, assignment) {
|
12409
13091
|
if (delimiter !== undefined) {
|
12410
|
-
this.
|
13092
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['parameter']['delimiter'] = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateString)(delimiter);
|
12411
13093
|
}
|
12412
13094
|
|
12413
13095
|
if (assignment !== undefined) {
|
12414
|
-
this.
|
13096
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['parameter']['assignment'] = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateString)(assignment);
|
12415
13097
|
}
|
12416
13098
|
|
12417
13099
|
return this;
|
@@ -12427,8 +13109,8 @@ var Formatter = /*#__PURE__*/function (_Base) {
|
|
12427
13109
|
* formatter.setMarker('i18n{','}');
|
12428
13110
|
* ```
|
12429
13111
|
*
|
12430
|
-
* @param {string} open
|
12431
|
-
* @param {string} close
|
13112
|
+
* @param {array|string} open
|
13113
|
+
* @param {array|string|undefined} close
|
12432
13114
|
* @return {Formatter}
|
12433
13115
|
* @since 1.12.0
|
12434
13116
|
* @throws {TypeError} value is not a string
|
@@ -12441,8 +13123,10 @@ var Formatter = /*#__PURE__*/function (_Base) {
|
|
12441
13123
|
close = open;
|
12442
13124
|
}
|
12443
13125
|
|
12444
|
-
|
12445
|
-
|
13126
|
+
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_5__.isString)(open)) open = [open];
|
13127
|
+
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_5__.isString)(close)) close = [close];
|
13128
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['marker']['open'] = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateArray)(open);
|
13129
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['marker']['close'] = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateArray)(close);
|
12446
13130
|
return this;
|
12447
13131
|
}
|
12448
13132
|
/**
|
@@ -12450,17 +13134,58 @@ var Formatter = /*#__PURE__*/function (_Base) {
|
|
12450
13134
|
* @param {string} text
|
12451
13135
|
* @return {string}
|
12452
13136
|
* @throws {TypeError} value is not a string
|
13137
|
+
* @throws {Error} too deep nesting
|
12453
13138
|
*/
|
12454
13139
|
|
12455
13140
|
}, {
|
12456
13141
|
key: "format",
|
12457
13142
|
value: function format(text) {
|
12458
|
-
|
13143
|
+
this[watchdogSymbol] = 0;
|
13144
|
+
this[markerOpenIndexSymbol] = 0;
|
13145
|
+
this[markerCloseIndexSymbol] = 0;
|
13146
|
+
this[workingDataSymbol] = {};
|
13147
|
+
return _format.call(this, text);
|
12459
13148
|
}
|
12460
13149
|
}]);
|
12461
13150
|
|
12462
13151
|
return Formatter;
|
12463
|
-
}(
|
13152
|
+
}(_types_basewithoptions_js__WEBPACK_IMPORTED_MODULE_4__.BaseWithOptions);
|
13153
|
+
/**
|
13154
|
+
* @private
|
13155
|
+
* @return {string}
|
13156
|
+
*/
|
13157
|
+
|
13158
|
+
|
13159
|
+
function _format(text) {
|
13160
|
+
var _self$internalSymbol$, _self$internalSymbol$2, _self$internalSymbol$3, _self$internalSymbol$4;
|
13161
|
+
|
13162
|
+
var self = this;
|
13163
|
+
self[watchdogSymbol]++;
|
13164
|
+
|
13165
|
+
if (this[watchdogSymbol] > 20) {
|
13166
|
+
throw new Error('too deep nesting');
|
13167
|
+
}
|
13168
|
+
|
13169
|
+
var openMarker = (_self$internalSymbol$ = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['marker']['open']) === null || _self$internalSymbol$ === void 0 ? void 0 : _self$internalSymbol$[this[markerOpenIndexSymbol]];
|
13170
|
+
var closeMarker = (_self$internalSymbol$2 = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['marker']['close']) === null || _self$internalSymbol$2 === void 0 ? void 0 : _self$internalSymbol$2[this[markerCloseIndexSymbol]]; // contains no placeholders
|
13171
|
+
|
13172
|
+
if (text.indexOf(openMarker) === -1 || text.indexOf(closeMarker) === -1) {
|
13173
|
+
return text;
|
13174
|
+
}
|
13175
|
+
|
13176
|
+
var result = tokenize.call(this, (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateString)(text), openMarker, closeMarker);
|
13177
|
+
|
13178
|
+
if ((_self$internalSymbol$3 = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['marker']['open']) !== null && _self$internalSymbol$3 !== void 0 && _self$internalSymbol$3[this[markerOpenIndexSymbol] + 1]) {
|
13179
|
+
this[markerOpenIndexSymbol]++;
|
13180
|
+
}
|
13181
|
+
|
13182
|
+
if ((_self$internalSymbol$4 = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['marker']['close']) !== null && _self$internalSymbol$4 !== void 0 && _self$internalSymbol$4[this[markerCloseIndexSymbol] + 1]) {
|
13183
|
+
this[markerCloseIndexSymbol]++;
|
13184
|
+
}
|
13185
|
+
|
13186
|
+
result = _format.call(self, result);
|
13187
|
+
return result;
|
13188
|
+
}
|
12464
13189
|
/**
|
12465
13190
|
* @private
|
12466
13191
|
* @since 1.12.0
|
@@ -12469,12 +13194,17 @@ var Formatter = /*#__PURE__*/function (_Base) {
|
|
12469
13194
|
*/
|
12470
13195
|
|
12471
13196
|
|
12472
|
-
function
|
13197
|
+
function tokenize(text, openMarker, closeMarker) {
|
12473
13198
|
var self = this;
|
12474
13199
|
var formatted = [];
|
13200
|
+
var parameterAssignment = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['parameter']['assignment'];
|
13201
|
+
var parameterDelimiter = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['parameter']['delimiter'];
|
13202
|
+
var callbacks = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['callbacks'];
|
12475
13203
|
|
12476
13204
|
while (true) {
|
12477
|
-
var
|
13205
|
+
var _self$workingDataSymb;
|
13206
|
+
|
13207
|
+
var startIndex = text.indexOf(openMarker); // no marker
|
12478
13208
|
|
12479
13209
|
if (startIndex === -1) {
|
12480
13210
|
formatted.push(text);
|
@@ -12484,19 +13214,18 @@ function tokenizer(text) {
|
|
12484
13214
|
text = text.substring(startIndex);
|
12485
13215
|
}
|
12486
13216
|
|
12487
|
-
var endIndex = text.substring(
|
12488
|
-
if (endIndex !== -1) endIndex +=
|
12489
|
-
var insideStartIndex = text.substring(
|
13217
|
+
var endIndex = text.substring(openMarker.length).indexOf(closeMarker);
|
13218
|
+
if (endIndex !== -1) endIndex += openMarker.length;
|
13219
|
+
var insideStartIndex = text.substring(openMarker.length).indexOf(openMarker);
|
12490
13220
|
|
12491
13221
|
if (insideStartIndex !== -1) {
|
12492
|
-
insideStartIndex +=
|
13222
|
+
insideStartIndex += openMarker.length;
|
12493
13223
|
|
12494
13224
|
if (insideStartIndex < endIndex) {
|
12495
|
-
var
|
12496
|
-
var result = tokenizer.call(self, text.substring(insideStartIndex));
|
13225
|
+
var result = tokenize.call(self, text.substring(insideStartIndex), openMarker, closeMarker);
|
12497
13226
|
text = text.substring(0, insideStartIndex) + result;
|
12498
|
-
endIndex = text.substring(
|
12499
|
-
if (endIndex !== -1) endIndex +=
|
13227
|
+
endIndex = text.substring(openMarker.length).indexOf(closeMarker);
|
13228
|
+
if (endIndex !== -1) endIndex += openMarker.length;
|
12500
13229
|
}
|
12501
13230
|
}
|
12502
13231
|
|
@@ -12505,11 +13234,10 @@ function tokenizer(text) {
|
|
12505
13234
|
return;
|
12506
13235
|
}
|
12507
13236
|
|
12508
|
-
var
|
12509
|
-
var
|
12510
|
-
var
|
12511
|
-
|
12512
|
-
var temp = self.object;
|
13237
|
+
var key = text.substring(openMarker.length, endIndex);
|
13238
|
+
var parts = key.split(parameterDelimiter);
|
13239
|
+
var currentPipe = parts.shift();
|
13240
|
+
self[workingDataSymbol] = (0,_data_extend_js__WEBPACK_IMPORTED_MODULE_1__.extend)({}, self[internalObjectSymbol], self[workingDataSymbol]);
|
12513
13241
|
|
12514
13242
|
var _iterator = _createForOfIteratorHelper(parts),
|
12515
13243
|
_step;
|
@@ -12518,12 +13246,12 @@ function tokenizer(text) {
|
|
12518
13246
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
12519
13247
|
var kv = _step.value;
|
12520
13248
|
|
12521
|
-
var _kv$split = kv.split(
|
13249
|
+
var _kv$split = kv.split(parameterAssignment),
|
12522
13250
|
_kv$split2 = _slicedToArray(_kv$split, 2),
|
12523
13251
|
k = _kv$split2[0],
|
12524
13252
|
v = _kv$split2[1];
|
12525
13253
|
|
12526
|
-
|
13254
|
+
self[workingDataSymbol][k] = v;
|
12527
13255
|
}
|
12528
13256
|
} catch (err) {
|
12529
13257
|
_iterator.e(err);
|
@@ -12531,14 +13259,40 @@ function tokenizer(text) {
|
|
12531
13259
|
_iterator.f();
|
12532
13260
|
}
|
12533
13261
|
|
12534
|
-
|
12535
|
-
|
13262
|
+
var t1 = key.split('|').shift().trim(); // pipe symbol
|
13263
|
+
|
13264
|
+
var t2 = t1.split('::').shift().trim(); // key value delimiter
|
13265
|
+
|
13266
|
+
var t3 = t2.split('.').shift().trim(); // path delimiter
|
13267
|
+
|
13268
|
+
var prefix = (_self$workingDataSymb = self[workingDataSymbol]) !== null && _self$workingDataSymb !== void 0 && _self$workingDataSymb[t3] ? 'path:' : 'static:';
|
13269
|
+
var command = "";
|
13270
|
+
|
13271
|
+
if (prefix && key.indexOf(prefix) !== 0 && key.indexOf('path:') !== 0 && key.indexOf('static:') !== 0) {
|
13272
|
+
command = prefix;
|
13273
|
+
}
|
13274
|
+
|
13275
|
+
command += currentPipe;
|
13276
|
+
var pipe = new _data_pipe_js__WEBPACK_IMPORTED_MODULE_2__.Pipe(command);
|
13277
|
+
|
13278
|
+
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_5__.isObject)(callbacks)) {
|
13279
|
+
for (var _i = 0, _Object$entries = Object.entries(callbacks); _i < _Object$entries.length; _i++) {
|
13280
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
13281
|
+
name = _Object$entries$_i[0],
|
13282
|
+
callback = _Object$entries$_i[1];
|
13283
|
+
|
13284
|
+
pipe.setCallback(name, callback);
|
13285
|
+
}
|
13286
|
+
}
|
13287
|
+
|
13288
|
+
formatted.push((0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateString)(pipe.run(self[workingDataSymbol])));
|
13289
|
+
text = text.substring(endIndex + closeMarker.length);
|
12536
13290
|
}
|
12537
13291
|
|
12538
13292
|
return formatted.join('');
|
12539
13293
|
}
|
12540
13294
|
|
12541
|
-
(0,
|
13295
|
+
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_3__.assignToNamespace)('Monster.Text', Formatter);
|
12542
13296
|
|
12543
13297
|
|
12544
13298
|
/***/ }),
|
@@ -12592,7 +13346,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12592
13346
|
*
|
12593
13347
|
* ```
|
12594
13348
|
* <script type="module">
|
12595
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13349
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
12596
13350
|
* console.log(new Monster.Logging.Handler())
|
12597
13351
|
* </script>
|
12598
13352
|
* ```
|
@@ -12601,7 +13355,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12601
13355
|
*
|
12602
13356
|
* ```
|
12603
13357
|
* <script type="module">
|
12604
|
-
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13358
|
+
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/logging/handler.js';
|
12605
13359
|
* console.log(new Handler())
|
12606
13360
|
* </script>
|
12607
13361
|
* ```
|
@@ -12839,7 +13593,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12839
13593
|
*
|
12840
13594
|
* ```
|
12841
13595
|
* <script type="module">
|
12842
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13596
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
12843
13597
|
* console.log(new Monster.Logging.LogEntry())
|
12844
13598
|
* </script>
|
12845
13599
|
* ```
|
@@ -12848,7 +13602,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12848
13602
|
*
|
12849
13603
|
* ```
|
12850
13604
|
* <script type="module">
|
12851
|
-
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13605
|
+
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/logging/logentry.js';
|
12852
13606
|
* console.log(new LogEntry())
|
12853
13607
|
* </script>
|
12854
13608
|
* ```
|
@@ -13034,7 +13788,7 @@ var OFF = 0;
|
|
13034
13788
|
*
|
13035
13789
|
* ```
|
13036
13790
|
* <script type="module">
|
13037
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13791
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
13038
13792
|
* new Monster.Logging.Logger()
|
13039
13793
|
* </script>
|
13040
13794
|
* ```
|
@@ -13043,7 +13797,7 @@ var OFF = 0;
|
|
13043
13797
|
*
|
13044
13798
|
* ```
|
13045
13799
|
* <script type="module">
|
13046
|
-
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13800
|
+
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/logging/logger.js';
|
13047
13801
|
* new Logger()
|
13048
13802
|
* </script>
|
13049
13803
|
* ```
|
@@ -13343,7 +14097,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13343
14097
|
*
|
13344
14098
|
* ```
|
13345
14099
|
* <script type="module">
|
13346
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14100
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
13347
14101
|
* console.log(new Monster.Logging.Handler.ConsoleHandler())
|
13348
14102
|
* </script>
|
13349
14103
|
* ```
|
@@ -13352,7 +14106,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13352
14106
|
*
|
13353
14107
|
* ```
|
13354
14108
|
* <script type="module">
|
13355
|
-
* import {ConsoleHandler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14109
|
+
* import {ConsoleHandler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/logging/handler/console.js';
|
13356
14110
|
* console.log(new ConsoleHandler())
|
13357
14111
|
* </script>
|
13358
14112
|
* ```
|
@@ -13428,8 +14182,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
13428
14182
|
*
|
13429
14183
|
* ```
|
13430
14184
|
* <script type="module">
|
13431
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13432
|
-
|
14185
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
14186
|
+
* Monster.Math.random(1,10)
|
13433
14187
|
* // ↦ 5
|
13434
14188
|
* </script>
|
13435
14189
|
* ```
|
@@ -13438,8 +14192,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
13438
14192
|
*
|
13439
14193
|
* ```
|
13440
14194
|
* <script type="module">
|
13441
|
-
* import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13442
|
-
* random(1,10)
|
14195
|
+
* import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/math/random.js';
|
14196
|
+
* random(1,10)
|
13443
14197
|
* // ↦ 5
|
13444
14198
|
* </script>
|
13445
14199
|
* ```
|
@@ -13533,7 +14287,11 @@ function create(min, max) {
|
|
13533
14287
|
return create(min, max);
|
13534
14288
|
}
|
13535
14289
|
|
13536
|
-
|
14290
|
+
if (rval < min) {
|
14291
|
+
rval += min;
|
14292
|
+
}
|
14293
|
+
|
14294
|
+
return rval;
|
13537
14295
|
}
|
13538
14296
|
|
13539
14297
|
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_0__.assignToNamespace)('Monster.Math', random);
|
@@ -13591,7 +14349,7 @@ var internalCounter = 0;
|
|
13591
14349
|
*
|
13592
14350
|
* ```
|
13593
14351
|
* <script type="module">
|
13594
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14352
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
13595
14353
|
* console.log(new Monster.Types.RandomID())
|
13596
14354
|
* </script>
|
13597
14355
|
* ```
|
@@ -13600,7 +14358,7 @@ var internalCounter = 0;
|
|
13600
14358
|
*
|
13601
14359
|
* ```
|
13602
14360
|
* <script type="module">
|
13603
|
-
* import {RandomID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14361
|
+
* import {RandomID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/randomid.js';
|
13604
14362
|
* console.log(new RandomID())
|
13605
14363
|
* </script>
|
13606
14364
|
* ```
|
@@ -13683,7 +14441,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13683
14441
|
*
|
13684
14442
|
* ```
|
13685
14443
|
* <script type="module">
|
13686
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14444
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
13687
14445
|
* console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3
|
13688
14446
|
* console.log(new Monster.Types.Version('1')) // ↦ 1.0.0
|
13689
14447
|
* </script>
|
@@ -13693,7 +14451,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13693
14451
|
*
|
13694
14452
|
* ```
|
13695
14453
|
* <script type="module">
|
13696
|
-
* import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14454
|
+
* import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/version.js';
|
13697
14455
|
* console.log(new Version('1.2.3')) // ↦ 1.2.3
|
13698
14456
|
* console.log(new Version('1')) // ↦ 1.0.0
|
13699
14457
|
* </script>
|
@@ -13701,7 +14459,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13701
14459
|
*
|
13702
14460
|
* @example
|
13703
14461
|
*
|
13704
|
-
* import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14462
|
+
* import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/version.js';
|
13705
14463
|
*
|
13706
14464
|
* new Version('1.0.0') // ↦ 1.0.0
|
13707
14465
|
* new Version(1) // ↦ 1.0.0
|
@@ -13835,7 +14593,7 @@ var monsterVersion;
|
|
13835
14593
|
*
|
13836
14594
|
* ```
|
13837
14595
|
* <script type="module">
|
13838
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14596
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
13839
14597
|
* console.log(Monster.getVersion())
|
13840
14598
|
* </script>
|
13841
14599
|
* ```
|
@@ -13844,7 +14602,7 @@ var monsterVersion;
|
|
13844
14602
|
*
|
13845
14603
|
* ```
|
13846
14604
|
* <script type="module">
|
13847
|
-
* import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14605
|
+
* import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/types/version.js';
|
13848
14606
|
* console.log(getVersion())
|
13849
14607
|
* </script>
|
13850
14608
|
* ```
|
@@ -13863,7 +14621,7 @@ function getVersion() {
|
|
13863
14621
|
/**#@+ dont touch, replaced by make with package.json version */
|
13864
14622
|
|
13865
14623
|
|
13866
|
-
monsterVersion = new Version('1.
|
14624
|
+
monsterVersion = new Version('1.27.0');
|
13867
14625
|
/**#@-*/
|
13868
14626
|
|
13869
14627
|
return monsterVersion;
|
@@ -13919,8 +14677,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13919
14677
|
*
|
13920
14678
|
* ```
|
13921
14679
|
* <script type="module">
|
13922
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13923
|
-
*
|
14680
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
14681
|
+
* new Monster.Util.Comparator()
|
13924
14682
|
* </script>
|
13925
14683
|
* ```
|
13926
14684
|
*
|
@@ -13928,7 +14686,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13928
14686
|
*
|
13929
14687
|
* ```
|
13930
14688
|
* <script type="module">
|
13931
|
-
* import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14689
|
+
* import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/util/comparator.js';
|
13932
14690
|
* console.log(new Comparator())
|
13933
14691
|
* </script>
|
13934
14692
|
* ```
|
@@ -13953,7 +14711,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13953
14711
|
*
|
13954
14712
|
* @example
|
13955
14713
|
*
|
13956
|
-
* import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14714
|
+
* import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/util/comparator.js';
|
13957
14715
|
*
|
13958
14716
|
* console.log(new Comparator().lessThanOrEqual(2, 5))
|
13959
14717
|
* // ↦ true
|
@@ -14166,8 +14924,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
14166
14924
|
*
|
14167
14925
|
* ```
|
14168
14926
|
* <script type="module">
|
14169
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14170
|
-
*
|
14927
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/monster.js';
|
14928
|
+
* Monster.Util.deepFreeze({})
|
14171
14929
|
* </script>
|
14172
14930
|
* ```
|
14173
14931
|
*
|
@@ -14175,8 +14933,8 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
14175
14933
|
*
|
14176
14934
|
* ```
|
14177
14935
|
* <script type="module">
|
14178
|
-
* import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14179
|
-
*
|
14936
|
+
* import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.27.0/dist/modules/util/freeze.js';
|
14937
|
+
* deepFreeze({})
|
14180
14938
|
* </script>
|
14181
14939
|
* ```
|
14182
14940
|
*
|
@@ -14298,12 +15056,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
14298
15056
|
/* harmony import */ var _dom_constants_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(33);
|
14299
15057
|
/* harmony import */ var _dom_customcontrol_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(34);
|
14300
15058
|
/* harmony import */ var _dom_customelement_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(35);
|
14301
|
-
/* harmony import */ var _dom_events_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(
|
15059
|
+
/* harmony import */ var _dom_events_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(42);
|
14302
15060
|
/* harmony import */ var _dom_locale_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(44);
|
14303
15061
|
/* harmony import */ var _dom_template_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(38);
|
14304
15062
|
/* harmony import */ var _dom_theme_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(39);
|
14305
15063
|
/* harmony import */ var _dom_updater_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(40);
|
14306
|
-
/* harmony import */ var _dom_util_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(
|
15064
|
+
/* harmony import */ var _dom_util_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(43);
|
14307
15065
|
/* harmony import */ var _i18n_locale_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(45);
|
14308
15066
|
/* harmony import */ var _i18n_provider_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(46);
|
14309
15067
|
/* harmony import */ var _i18n_providers_fetch_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(49);
|