@schukai/monster 1.25.0 → 1.28.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG +43 -0
- package/README.md +4 -4
- package/dist/modules/constants.js +1 -1
- package/dist/modules/constraints/abstract.js +1 -1
- package/dist/modules/constraints/abstractoperator.js +1 -1
- package/dist/modules/constraints/andoperator.js +1 -1
- package/dist/modules/constraints/invalid.js +1 -1
- package/dist/modules/constraints/isarray.js +1 -1
- package/dist/modules/constraints/isobject.js +1 -1
- package/dist/modules/constraints/namespace.js +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 +1 -1
- 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 +1 -1
- package/dist/modules/dom/locale.js +1 -1
- package/dist/modules/dom/namespace.js +1 -1
- package/dist/modules/dom/resource/data.js +1 -1
- package/dist/modules/dom/resource/link/stylesheet.js +1 -1
- package/dist/modules/dom/resource/link.js +1 -1
- package/dist/modules/dom/resource/script.js +1 -1
- package/dist/modules/dom/resource.js +1 -1
- package/dist/modules/dom/resourcemanager.js +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- package/dist/modules/types/validate.js +1 -1
- package/dist/modules/types/version.js +2 -2
- package/dist/modules/util/clone.js +1 -1
- package/dist/modules/util/comparator.js +1 -1
- package/dist/modules/util/freeze.js +1 -1
- package/dist/modules/util/namespace.js +1 -1
- package/dist/modules/util/processing.js +1 -1
- package/dist/modules/util/trimspaces.js +1 -1
- package/dist/monster.dev.js +1181 -708
- package/dist/monster.dev.js.map +1 -1
- package/dist/monster.js +2 -2
- package/package.json +13 -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 +27 -13
- package/source/data/buildtree.js +129 -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 +3 -3
- package/source/dom/assembler.js +2 -2
- package/source/dom/attributes.js +111 -28
- package/source/dom/constants.js +17 -1
- 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 +6 -7
- package/source/dom/locale.js +8 -4
- package/source/dom/resource/data.js +2 -2
- package/source/dom/resource/link/stylesheet.js +2 -2
- package/source/dom/resource/link.js +2 -2
- package/source/dom/resource/script.js +2 -2
- package/source/dom/resource.js +2 -2
- package/source/dom/resourcemanager.js +2 -2
- package/source/dom/template.js +55 -15
- package/source/dom/theme.js +3 -3
- package/source/dom/updater.js +158 -98
- package/source/dom/util.js +6 -6
- package/source/dom/worker/factory.js +2 -2
- 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 +2 -2
- package/source/namespace.js +1 -1
- package/source/text/formatter.js +190 -48
- package/source/types/base.js +2 -2
- 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 +100 -82
- package/source/types/mediatype.js +4 -4
- package/source/types/node.js +210 -0
- package/source/types/nodelist.js +129 -0
- package/source/types/noderecursiveiterator.js +148 -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 +2 -2
- 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 +3 -3
- package/source/util/freeze.js +2 -2
- package/source/util/processing.js +3 -3
- package/source/util/trimspaces.js +2 -2
- package/test/cases/data/buildtree.js +212 -0
- package/test/cases/dom/attributes.js +46 -19
- package/test/cases/dom/resource/link/stylesheet.js +1 -1
- package/test/cases/dom/template.js +72 -14
- package/test/cases/dom/updater.js +102 -75
- 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 +252 -0
- package/test/cases/types/nodelist.js +71 -0
- package/test/cases/types/noderecursiveiterator.js +75 -0
- package/test/cases/types/regex.js +32 -0
- package/test/util/jsdom.js +0 -1
- package/test/web/import.js +6 -0
- package/test/web/monster-dev.html +3 -3
- package/test/web/monster.html +2 -2
- package/test/web/test.html +3 -3
- package/test/web/tests.js +3 -3
package/dist/monster.dev.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/** Monster 1.
|
1
|
+
/** Monster 1.28.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();
|
@@ -140,7 +140,7 @@ var Monster = new Namespace("Monster");
|
|
140
140
|
*
|
141
141
|
* ```
|
142
142
|
* <script type="module">
|
143
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
143
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
144
144
|
* function hello() {
|
145
145
|
* console.log('Hello World!');
|
146
146
|
* }
|
@@ -288,6 +288,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
288
288
|
|
289
289
|
|
290
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
|
+
*
|
291
295
|
* The abstract constraint defines the api for all constraints. mainly the method isValid() is defined.
|
292
296
|
*
|
293
297
|
* derived classes must implement the method isValid().
|
@@ -295,6 +299,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
295
299
|
* @since 1.3.0
|
296
300
|
* @copyright schukai GmbH
|
297
301
|
* @memberOf Monster.Constraints
|
302
|
+
* @summary The abstract constraint
|
298
303
|
*/
|
299
304
|
|
300
305
|
var AbstractConstraint = /*#__PURE__*/function (_Base) {
|
@@ -382,7 +387,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
382
387
|
*
|
383
388
|
* ```
|
384
389
|
* <script type="module">
|
385
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
390
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
386
391
|
* new Monster.Types.Base()
|
387
392
|
* </script>
|
388
393
|
* ```
|
@@ -391,7 +396,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
391
396
|
*
|
392
397
|
* ```
|
393
398
|
* <script type="module">
|
394
|
-
* import {Base} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
399
|
+
* import {Base} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/base.js';
|
395
400
|
* new Base()
|
396
401
|
* </script>
|
397
402
|
* ```
|
@@ -469,11 +474,16 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
469
474
|
|
470
475
|
|
471
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
|
+
*
|
472
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.
|
473
482
|
*
|
474
483
|
* @since 1.3.0
|
475
484
|
* @copyright schukai GmbH
|
476
485
|
* @memberOf Monster.Constraints
|
486
|
+
* @summary The abstract operator constraint
|
477
487
|
*/
|
478
488
|
|
479
489
|
var AbstractOperator = /*#__PURE__*/function (_AbstractConstraint) {
|
@@ -550,11 +560,15 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
550
560
|
|
551
561
|
|
552
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
|
+
*
|
553
567
|
* The AndOperator is used to link several contraints. The constraint is fulfilled if all constraints of the operators are fulfilled.
|
554
568
|
*
|
555
569
|
* ```
|
556
570
|
* <script type="module">
|
557
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
571
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
558
572
|
* new Monster.Constraint.AndOperator();
|
559
573
|
* </script>
|
560
574
|
* ```
|
@@ -563,16 +577,16 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
563
577
|
*
|
564
578
|
* ```
|
565
579
|
* <script type="module">
|
566
|
-
* import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
580
|
+
* import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/andoperator.js';
|
567
581
|
* new AndOperator();
|
568
582
|
* </script>
|
569
583
|
* ```
|
570
584
|
*
|
571
585
|
* @example
|
572
586
|
*
|
573
|
-
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
574
|
-
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
575
|
-
* import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
587
|
+
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/valid.js';
|
588
|
+
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/invalid.js';
|
589
|
+
* import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/andoperator.js';
|
576
590
|
*
|
577
591
|
* new AndOperator(
|
578
592
|
* new Valid(), new Valid()).isValid()
|
@@ -589,6 +603,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
589
603
|
* @since 1.3.0
|
590
604
|
* @copyright schukai GmbH
|
591
605
|
* @memberOf Monster.Constraints
|
606
|
+
* @summary A and operator constraint
|
592
607
|
*/
|
593
608
|
|
594
609
|
var AndOperator = /*#__PURE__*/function (_AbstractOperator) {
|
@@ -663,13 +678,17 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
663
678
|
|
664
679
|
|
665
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
|
+
*
|
666
685
|
* The invalid constraint allows an always invalid query to be performed. this constraint is mainly intended for testing.
|
667
686
|
*
|
668
687
|
* You can call the method via the monster namespace `new Monster.Constraint.Invalid()`.
|
669
688
|
*
|
670
689
|
* ```
|
671
690
|
* <script type="module">
|
672
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
691
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
673
692
|
* new Monster.Constraint.Invalid();
|
674
693
|
* </script>
|
675
694
|
* ```
|
@@ -678,14 +697,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
678
697
|
*
|
679
698
|
* ```
|
680
699
|
* <script type="module">
|
681
|
-
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
700
|
+
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/invalid.js';
|
682
701
|
* new Invalid();
|
683
702
|
* </script>
|
684
703
|
* ```
|
685
704
|
*
|
686
705
|
* @example
|
687
706
|
*
|
688
|
-
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
707
|
+
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/invalid.js';
|
689
708
|
*
|
690
709
|
* new Invalid().isValid()
|
691
710
|
* .then(()=>console.log(true))
|
@@ -695,6 +714,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
695
714
|
* @since 1.3.0
|
696
715
|
* @copyright schukai GmbH
|
697
716
|
* @memberOf Monster.Constraints
|
717
|
+
* @summary A constraint that always invalid
|
698
718
|
*/
|
699
719
|
|
700
720
|
var Invalid = /*#__PURE__*/function (_AbstractConstraint) {
|
@@ -771,12 +791,16 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
771
791
|
|
772
792
|
|
773
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
|
+
*
|
774
798
|
* You can call the method via the monster namespace `new Monster.Constraint.IsObject()`.
|
775
799
|
*
|
776
800
|
* ```
|
777
801
|
* <script type="module">
|
778
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
779
|
-
*
|
802
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
803
|
+
* new Monster.Constraint.IsArray()
|
780
804
|
* </script>
|
781
805
|
* ```
|
782
806
|
*
|
@@ -784,14 +808,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
784
808
|
*
|
785
809
|
* ```
|
786
810
|
* <script type="module">
|
787
|
-
* import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
811
|
+
* import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/isarray.js';
|
788
812
|
* console.log(new IsArray())
|
789
813
|
* </script>
|
790
814
|
* ```
|
791
815
|
*
|
792
816
|
* @example
|
793
817
|
*
|
794
|
-
* import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
818
|
+
* import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/isarray.js';
|
795
819
|
*
|
796
820
|
* new IsArray()
|
797
821
|
* .isValid([])
|
@@ -806,6 +830,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
806
830
|
* @since 1.3.0
|
807
831
|
* @copyright schukai GmbH
|
808
832
|
* @memberOf Monster.Constraints
|
833
|
+
* @summary A constraint to check if a value is an array
|
809
834
|
*/
|
810
835
|
|
811
836
|
var IsArray = /*#__PURE__*/function (_AbstractConstraint) {
|
@@ -871,16 +896,18 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
871
896
|
|
872
897
|
|
873
898
|
/**
|
874
|
-
* 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.
|
875
902
|
*
|
876
903
|
* You can call the method via the monster namespace `Monster.Types.isPrimitive()`.
|
877
904
|
*
|
878
905
|
* ```
|
879
906
|
* <script type="module">
|
880
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
881
|
-
*
|
882
|
-
*
|
883
|
-
*
|
907
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
908
|
+
* Monster.Types.isIterable(null) // ↦ false
|
909
|
+
* Monster.Types.isIterable('hello') // ↦ true
|
910
|
+
* Monster.Types.isIterable([]) // ↦ true
|
884
911
|
* </script>
|
885
912
|
* ```
|
886
913
|
*
|
@@ -888,7 +915,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
888
915
|
*
|
889
916
|
* ```
|
890
917
|
* <script type="module">
|
891
|
-
* import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
918
|
+
* import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/is.js';
|
892
919
|
* isIterable(null) // ↦ false
|
893
920
|
* isIterable('hello') // ↦ true
|
894
921
|
* isIterable([]) // ↦ true
|
@@ -909,14 +936,16 @@ function isIterable(value) {
|
|
909
936
|
}
|
910
937
|
/**
|
911
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.
|
912
941
|
*
|
913
942
|
* You can call the method via the monster namespace `Monster.Types.isPrimitive()`.
|
914
943
|
*
|
915
944
|
* ```
|
916
945
|
* <script type="module">
|
917
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
918
|
-
*
|
919
|
-
*
|
946
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
947
|
+
* Monster.Types.isPrimitive('2') // ↦ false
|
948
|
+
* Monster.Types.isPrimitive([]) // ↦ true
|
920
949
|
* </script>
|
921
950
|
* ```
|
922
951
|
*
|
@@ -924,9 +953,9 @@ function isIterable(value) {
|
|
924
953
|
*
|
925
954
|
* ```
|
926
955
|
* <script type="module">
|
927
|
-
* import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
928
|
-
*
|
929
|
-
*
|
956
|
+
* import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/is.js';
|
957
|
+
* isPrimitive('2')) // ↦ true
|
958
|
+
* isPrimitive([])) // ↦ false
|
930
959
|
* </script>
|
931
960
|
* ```
|
932
961
|
*
|
@@ -955,14 +984,16 @@ function isPrimitive(value) {
|
|
955
984
|
}
|
956
985
|
/**
|
957
986
|
* Checks whether the value passed is a symbol
|
987
|
+
*
|
988
|
+
* This method is used in the library to have consistent names.
|
958
989
|
*
|
959
990
|
* You can call the method via the monster namespace `Monster.Types.isSymbol()`.
|
960
991
|
*
|
961
992
|
* ```
|
962
993
|
* <script type="module">
|
963
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
964
|
-
*
|
965
|
-
*
|
994
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
995
|
+
* Monster.Types.isSymbol('2') // ↦ false
|
996
|
+
* Monster.Types.isSymbol(Symbol('test') // ↦ true
|
966
997
|
* </script>
|
967
998
|
* ```
|
968
999
|
*
|
@@ -970,9 +1001,9 @@ function isPrimitive(value) {
|
|
970
1001
|
*
|
971
1002
|
* ```
|
972
1003
|
* <script type="module">
|
973
|
-
* import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
974
|
-
*
|
975
|
-
*
|
1004
|
+
* import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/is.js';
|
1005
|
+
* isSymbol(Symbol('a'))) // ↦ true
|
1006
|
+
* isSymbol([]) // ↦ false
|
976
1007
|
* </script>
|
977
1008
|
* ```
|
978
1009
|
*
|
@@ -988,16 +1019,18 @@ function isSymbol(value) {
|
|
988
1019
|
return 'symbol' === _typeof(value) ? true : false;
|
989
1020
|
}
|
990
1021
|
/**
|
991
|
-
* 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.
|
992
1025
|
*
|
993
1026
|
* You can call the method via the monster namespace `Monster.Types.isBoolean()`.
|
994
1027
|
*
|
995
1028
|
* ```
|
996
1029
|
* <script type="module">
|
997
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
998
|
-
*
|
999
|
-
*
|
1000
|
-
*
|
1030
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
1031
|
+
* Monster.Types.isBoolean('2') // ↦ false
|
1032
|
+
* Monster.Types.isBoolean([]) // ↦ false
|
1033
|
+
* Monster.Types.isBoolean(true) // ↦ true
|
1001
1034
|
* </script>
|
1002
1035
|
* ```
|
1003
1036
|
*
|
@@ -1005,10 +1038,10 @@ function isSymbol(value) {
|
|
1005
1038
|
*
|
1006
1039
|
* ```
|
1007
1040
|
* <script type="module">
|
1008
|
-
* import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1009
|
-
*
|
1010
|
-
*
|
1011
|
-
*
|
1041
|
+
* import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/is.js';
|
1042
|
+
* isBoolean('2')) // ↦ false
|
1043
|
+
* isBoolean([])) // ↦ false
|
1044
|
+
* isBoolean(2>4)) // ↦ true
|
1012
1045
|
* </script>
|
1013
1046
|
* ```
|
1014
1047
|
*
|
@@ -1028,15 +1061,17 @@ function isBoolean(value) {
|
|
1028
1061
|
return false;
|
1029
1062
|
}
|
1030
1063
|
/**
|
1031
|
-
*
|
1064
|
+
* Checks whether the value passed is a string
|
1065
|
+
*
|
1066
|
+
* This method is used in the library to have consistent names.
|
1032
1067
|
*
|
1033
|
-
*
|
1068
|
+
* You can call the method via the monster namespace `Monster.Types.isString()`.
|
1034
1069
|
*
|
1035
1070
|
* ```
|
1036
1071
|
* <script type="module">
|
1037
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1038
|
-
*
|
1039
|
-
*
|
1072
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
1073
|
+
* Monster.Types.isString('2') // ↦ true
|
1074
|
+
* Monster.Types.isString([]) // ↦ false
|
1040
1075
|
* </script>
|
1041
1076
|
* ```
|
1042
1077
|
*
|
@@ -1044,9 +1079,9 @@ function isBoolean(value) {
|
|
1044
1079
|
*
|
1045
1080
|
* ```
|
1046
1081
|
* <script type="module">
|
1047
|
-
* import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1048
|
-
*
|
1049
|
-
*
|
1082
|
+
* import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/is.js';
|
1083
|
+
* isString('2')) // ↦ true
|
1084
|
+
* isString([])) // ↦ false
|
1050
1085
|
* </script>
|
1051
1086
|
* ```
|
1052
1087
|
*
|
@@ -1066,16 +1101,18 @@ function isString(value) {
|
|
1066
1101
|
return true;
|
1067
1102
|
}
|
1068
1103
|
/**
|
1069
|
-
*
|
1104
|
+
* Checks whether the value passed is a object
|
1105
|
+
*
|
1106
|
+
* This method is used in the library to have consistent names.
|
1070
1107
|
*
|
1071
|
-
*
|
1108
|
+
* You can call the method via the monster namespace `Monster.Types.isObject()`.
|
1072
1109
|
*
|
1073
1110
|
* ```
|
1074
1111
|
* <script type="module">
|
1075
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1076
|
-
*
|
1077
|
-
*
|
1078
|
-
*
|
1112
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
1113
|
+
* Monster.Types.isObject('2') // ↦ false
|
1114
|
+
* Monster.Types.isObject([]) // ↦ false
|
1115
|
+
* Monster.Types.isObject({}) // ↦ true
|
1079
1116
|
* </script>
|
1080
1117
|
* ```
|
1081
1118
|
*
|
@@ -1083,9 +1120,9 @@ function isString(value) {
|
|
1083
1120
|
*
|
1084
1121
|
* ```
|
1085
1122
|
* <script type="module">
|
1086
|
-
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1087
|
-
*
|
1088
|
-
*
|
1123
|
+
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/is.js';
|
1124
|
+
* isObject('2')) // ↦ false
|
1125
|
+
* isObject([])) // ↦ false
|
1089
1126
|
* </script>
|
1090
1127
|
* ```
|
1091
1128
|
*
|
@@ -1108,16 +1145,18 @@ function isObject(value) {
|
|
1108
1145
|
return false;
|
1109
1146
|
}
|
1110
1147
|
/**
|
1111
|
-
*
|
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.
|
1112
1151
|
*
|
1113
1152
|
* you can call the method via the monster namespace `Monster.Types.isInstance()`.
|
1114
1153
|
*
|
1115
1154
|
* ```
|
1116
1155
|
* <script type="module">
|
1117
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1118
|
-
*
|
1119
|
-
*
|
1120
|
-
*
|
1156
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
1157
|
+
* Monster.Types.isInstance('2') // ↦ false
|
1158
|
+
* Monster.Types.isInstance([]) // ↦ false
|
1159
|
+
* Monster.Types.isInstance({}) // ↦ true
|
1121
1160
|
* </script>
|
1122
1161
|
* ```
|
1123
1162
|
*
|
@@ -1125,9 +1164,9 @@ function isObject(value) {
|
|
1125
1164
|
*
|
1126
1165
|
* ```
|
1127
1166
|
* <script type="module">
|
1128
|
-
* import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1129
|
-
*
|
1130
|
-
*
|
1167
|
+
* import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/is.js';
|
1168
|
+
* isInstance('2')) // ↦ false
|
1169
|
+
* isInstance([])) // ↦ false
|
1131
1170
|
* </script>
|
1132
1171
|
* ```
|
1133
1172
|
*
|
@@ -1147,15 +1186,17 @@ function isInstance(value, instance) {
|
|
1147
1186
|
return value instanceof instance ? true : false;
|
1148
1187
|
}
|
1149
1188
|
/**
|
1150
|
-
*
|
1189
|
+
* Checks whether the value passed is a array
|
1190
|
+
*
|
1191
|
+
* This method is used in the library to have consistent names.
|
1151
1192
|
*
|
1152
1193
|
* you can call the method via the monster namespace `Monster.Types.isArray()`.
|
1153
1194
|
*
|
1154
1195
|
* ```
|
1155
1196
|
* <script type="module">
|
1156
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1157
|
-
*
|
1158
|
-
*
|
1197
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
1198
|
+
* Monster.Types.isArray('2') // ↦ false
|
1199
|
+
* Monster.Types.isArray([]) // ↦ true
|
1159
1200
|
* </script>
|
1160
1201
|
* ```
|
1161
1202
|
*
|
@@ -1163,9 +1204,9 @@ function isInstance(value, instance) {
|
|
1163
1204
|
*
|
1164
1205
|
* ```
|
1165
1206
|
* <script type="module">
|
1166
|
-
* import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1167
|
-
*
|
1168
|
-
*
|
1207
|
+
* import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/is.js';
|
1208
|
+
* isArray('2')) // ↦ false
|
1209
|
+
* isArray([])) // ↦ true
|
1169
1210
|
* </script>
|
1170
1211
|
* ```
|
1171
1212
|
*
|
@@ -1174,27 +1215,26 @@ function isInstance(value, instance) {
|
|
1174
1215
|
* @since 1.0.0
|
1175
1216
|
* @copyright schukai GmbH
|
1176
1217
|
* @memberOf Monster.Types
|
1218
|
+
* @see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
|
1177
1219
|
*/
|
1178
1220
|
|
1179
1221
|
|
1180
1222
|
function isArray(value) {
|
1181
|
-
|
1182
|
-
return true;
|
1183
|
-
}
|
1184
|
-
|
1185
|
-
return false;
|
1223
|
+
return Array.isArray(value);
|
1186
1224
|
}
|
1187
1225
|
/**
|
1188
|
-
*
|
1226
|
+
* Checks whether the value passed is a function
|
1227
|
+
*
|
1228
|
+
* This method is used in the library to have consistent names.
|
1189
1229
|
*
|
1190
1230
|
* you can call the method via the monster namespace `Monster.Types.isFunction()`.
|
1191
1231
|
*
|
1192
1232
|
* ```
|
1193
1233
|
* <script type="module">
|
1194
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1195
|
-
*
|
1196
|
-
*
|
1197
|
-
*
|
1234
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
1235
|
+
* Monster.Types.isFunction(()=>{}) // ↦ true
|
1236
|
+
* Monster.Types.isFunction('2') // ↦ false
|
1237
|
+
* Monster.Types.isFunction([]) // ↦ false
|
1198
1238
|
* </script>
|
1199
1239
|
* ```
|
1200
1240
|
*
|
@@ -1202,10 +1242,10 @@ function isArray(value) {
|
|
1202
1242
|
*
|
1203
1243
|
* ```
|
1204
1244
|
* <script type="module">
|
1205
|
-
* import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1206
|
-
*
|
1207
|
-
*
|
1208
|
-
*
|
1245
|
+
* import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/is.js';
|
1246
|
+
* isFunction(()=>{}) // ↦ true
|
1247
|
+
* isFunction('2')) // ↦ false
|
1248
|
+
* isFunction([])) // ↦ false
|
1209
1249
|
* </script>
|
1210
1250
|
* ```
|
1211
1251
|
*
|
@@ -1228,16 +1268,18 @@ function isFunction(value) {
|
|
1228
1268
|
return false;
|
1229
1269
|
}
|
1230
1270
|
/**
|
1231
|
-
*
|
1271
|
+
* Checks whether the value passed is an integer.
|
1272
|
+
*
|
1273
|
+
* This method is used in the library to have consistent names.
|
1232
1274
|
*
|
1233
|
-
*
|
1275
|
+
* You can call the method via the monster namespace `Monster.Types.isFunction()`.
|
1234
1276
|
*
|
1235
1277
|
* ```
|
1236
1278
|
* <script type="module">
|
1237
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1238
|
-
*
|
1239
|
-
*
|
1240
|
-
*
|
1279
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
1280
|
+
* Monster.Types.isInteger(()=>{}) // ↦ true
|
1281
|
+
* Monster.Types.isInteger('2') // ↦ false
|
1282
|
+
* Monster.Types.isInteger(2) // ↦ true
|
1241
1283
|
* </script>
|
1242
1284
|
* ```
|
1243
1285
|
*
|
@@ -1245,10 +1287,10 @@ function isFunction(value) {
|
|
1245
1287
|
*
|
1246
1288
|
* ```
|
1247
1289
|
* <script type="module">
|
1248
|
-
* import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1249
|
-
*
|
1250
|
-
*
|
1251
|
-
*
|
1290
|
+
* import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/is.js';
|
1291
|
+
* isInteger(()=>{}) // ↦ true
|
1292
|
+
* isInteger('2')) // ↦ false
|
1293
|
+
* isInteger(2)) // ↦ true
|
1252
1294
|
* </script>
|
1253
1295
|
* ```
|
1254
1296
|
*
|
@@ -1310,11 +1352,15 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1310
1352
|
|
1311
1353
|
|
1312
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
|
+
*
|
1313
1359
|
* You can call the method via the monster namespace `new Monster.Constraint.IsObject()`.
|
1314
1360
|
*
|
1315
1361
|
* ```
|
1316
1362
|
* <script type="module">
|
1317
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1363
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
1318
1364
|
* console.log(new Monster.Constraint.IsObject())
|
1319
1365
|
* </script>
|
1320
1366
|
* ```
|
@@ -1323,14 +1369,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1323
1369
|
*
|
1324
1370
|
* ```
|
1325
1371
|
* <script type="module">
|
1326
|
-
* import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1372
|
+
* import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/isobject.js';
|
1327
1373
|
* console.log(new IsObject())
|
1328
1374
|
* </script>
|
1329
1375
|
* ```
|
1330
1376
|
*
|
1331
1377
|
* @example
|
1332
1378
|
*
|
1333
|
-
* import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1379
|
+
* import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/isobject.js';
|
1334
1380
|
*
|
1335
1381
|
* new IsObject()
|
1336
1382
|
* .isValid({})
|
@@ -1346,6 +1392,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1346
1392
|
* @since 1.3.0
|
1347
1393
|
* @copyright schukai GmbH
|
1348
1394
|
* @memberOf Monster.Constraints
|
1395
|
+
* @summary A constraint to check if a value is an object
|
1349
1396
|
*/
|
1350
1397
|
|
1351
1398
|
var IsObject = /*#__PURE__*/function (_AbstractConstraint) {
|
@@ -1424,11 +1471,15 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1424
1471
|
|
1425
1472
|
|
1426
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
|
+
*
|
1427
1478
|
* The OrOperator is used to link several constraints. The constraint is fulfilled if one of the constraints is fulfilled.
|
1428
1479
|
*
|
1429
1480
|
* ```
|
1430
1481
|
* <script type="module">
|
1431
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1482
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
1432
1483
|
* new Monster.Constraint.OrOperator();
|
1433
1484
|
* </script>
|
1434
1485
|
* ```
|
@@ -1437,16 +1488,16 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1437
1488
|
*
|
1438
1489
|
* ```
|
1439
1490
|
* <script type="module">
|
1440
|
-
* import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1491
|
+
* import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraint/oroperator.js';
|
1441
1492
|
* new OrOperator();
|
1442
1493
|
* </script>
|
1443
1494
|
* ```
|
1444
1495
|
*
|
1445
1496
|
* @example
|
1446
1497
|
*
|
1447
|
-
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1448
|
-
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1449
|
-
* import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1498
|
+
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/valid.js';
|
1499
|
+
* import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/invalid.js';
|
1500
|
+
* import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/oroperator.js';
|
1450
1501
|
*
|
1451
1502
|
* new OrOperator(
|
1452
1503
|
* new Valid(), new Invalid()).isValid()
|
@@ -1463,6 +1514,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1463
1514
|
* @since 1.3.0
|
1464
1515
|
* @copyright schukai GmbH
|
1465
1516
|
* @memberOf Monster.Constraints
|
1517
|
+
* @summary A or operator
|
1466
1518
|
*/
|
1467
1519
|
|
1468
1520
|
var OrOperator = /*#__PURE__*/function (_AbstractOperator) {
|
@@ -1560,13 +1612,17 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1560
1612
|
|
1561
1613
|
|
1562
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
|
+
*
|
1563
1619
|
* The valid constraint allows an always valid query to be performed. this constraint is mainly intended for testing.
|
1564
1620
|
*
|
1565
1621
|
* You can call the method via the monster namespace `new Monster.Constraint.Valid()`.
|
1566
1622
|
*
|
1567
1623
|
* ```
|
1568
1624
|
* <script type="module">
|
1569
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1625
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
1570
1626
|
* new Monster.Constraint.Valid();
|
1571
1627
|
* </script>
|
1572
1628
|
* ```
|
@@ -1575,14 +1631,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1575
1631
|
*
|
1576
1632
|
* ```
|
1577
1633
|
* <script type="module">
|
1578
|
-
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1634
|
+
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/valid.js';
|
1579
1635
|
* new Valid();
|
1580
1636
|
* </script>
|
1581
1637
|
* ```
|
1582
1638
|
*
|
1583
1639
|
* @example
|
1584
1640
|
*
|
1585
|
-
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1641
|
+
* import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/constraints/valid.js';
|
1586
1642
|
*
|
1587
1643
|
* new Valid().isValid()
|
1588
1644
|
* .then(()=>console.log(true))
|
@@ -1592,6 +1648,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
1592
1648
|
* @since 1.3.0
|
1593
1649
|
* @copyright schukai GmbH
|
1594
1650
|
* @memberOf Monster.Constraints
|
1651
|
+
* @summary A constraint that always valid
|
1595
1652
|
*/
|
1596
1653
|
|
1597
1654
|
var Valid = /*#__PURE__*/function (_AbstractConstraint) {
|
@@ -1632,7 +1689,8 @@ var Valid = /*#__PURE__*/function (_AbstractConstraint) {
|
|
1632
1689
|
__webpack_require__.r(__webpack_exports__);
|
1633
1690
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
1634
1691
|
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_0__.Monster; },
|
1635
|
-
/* harmony export */ "buildMap": function() { return /* binding */ buildMap; }
|
1692
|
+
/* harmony export */ "buildMap": function() { return /* binding */ buildMap; },
|
1693
|
+
/* harmony export */ "assembleParts": function() { return /* binding */ assembleParts; }
|
1636
1694
|
/* harmony export */ });
|
1637
1695
|
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
1638
1696
|
/* harmony import */ var _types_is_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
@@ -1689,7 +1747,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
1689
1747
|
*
|
1690
1748
|
* ```
|
1691
1749
|
* <script type="module">
|
1692
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1750
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
1693
1751
|
* console.log(Monster.Data.buildMap())
|
1694
1752
|
* </script>
|
1695
1753
|
* ```
|
@@ -1698,7 +1756,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
1698
1756
|
*
|
1699
1757
|
* ```
|
1700
1758
|
* <script type="module">
|
1701
|
-
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1759
|
+
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/buildmap.js';
|
1702
1760
|
* console.log(buildMap())
|
1703
1761
|
* </script>
|
1704
1762
|
* ```
|
@@ -1709,7 +1767,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
1709
1767
|
*
|
1710
1768
|
* @example
|
1711
1769
|
*
|
1712
|
-
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
1770
|
+
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/buildmap.js';
|
1713
1771
|
* // a typical data structure as reported by an api
|
1714
1772
|
*
|
1715
1773
|
* let map;
|
@@ -1789,6 +1847,23 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
1789
1847
|
*/
|
1790
1848
|
|
1791
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 {Map}
|
1863
|
+
*/
|
1864
|
+
|
1865
|
+
|
1866
|
+
function assembleParts(subject, selector, filter, callback) {
|
1792
1867
|
var result = new Map();
|
1793
1868
|
var map;
|
1794
1869
|
|
@@ -1814,9 +1889,7 @@ function buildMap(subject, selector, valueTemplate, keyTemplate, filter) {
|
|
1814
1889
|
if (filter.call(m, v, k) !== true) return;
|
1815
1890
|
}
|
1816
1891
|
|
1817
|
-
|
1818
|
-
v = build(v, valueTemplate);
|
1819
|
-
result.set(k, v);
|
1892
|
+
callback.call(result, v, k, m);
|
1820
1893
|
});
|
1821
1894
|
return result;
|
1822
1895
|
}
|
@@ -1870,7 +1943,7 @@ function buildFlatMap(subject, selector, key, parentMap) {
|
|
1870
1943
|
var kk = copyKey.join(_pathfinder_js__WEBPACK_IMPORTED_MODULE_4__.DELIMITER);
|
1871
1944
|
var sub = buildFlatMap.call(result, o, parts.join(_pathfinder_js__WEBPACK_IMPORTED_MODULE_4__.DELIMITER), copyKey, o);
|
1872
1945
|
|
1873
|
-
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_1__.isObject)(sub)) {
|
1946
|
+
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_1__.isObject)(sub) && parentMap !== undefined) {
|
1874
1947
|
sub['^'] = parentMap;
|
1875
1948
|
}
|
1876
1949
|
|
@@ -1924,7 +1997,7 @@ function buildFlatMap(subject, selector, key, parentMap) {
|
|
1924
1997
|
* Alternatively to a string selector a callback can be specified. this must return a map.
|
1925
1998
|
*
|
1926
1999
|
* @example
|
1927
|
-
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2000
|
+
* import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/buildmap.js';
|
1928
2001
|
*
|
1929
2002
|
* let obj = {
|
1930
2003
|
* "data": [
|
@@ -2127,7 +2200,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
2127
2200
|
*
|
2128
2201
|
* ```
|
2129
2202
|
* <script type="module">
|
2130
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2203
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2131
2204
|
* console.log(Monster.Types.validateIterable('2')) // ↦ TypeError
|
2132
2205
|
* console.log(Monster.Types.validateIterable([])) // ↦ value
|
2133
2206
|
* </script>
|
@@ -2137,7 +2210,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
2137
2210
|
*
|
2138
2211
|
* ```
|
2139
2212
|
* <script type="module">
|
2140
|
-
* import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2213
|
+
* import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/validate.js';
|
2141
2214
|
* console.log(validateIterable('2')) // ↦ TypeError
|
2142
2215
|
* console.log(validateIterable([])) // ↦ value
|
2143
2216
|
* </script>
|
@@ -2168,7 +2241,7 @@ function validateIterable(value) {
|
|
2168
2241
|
*
|
2169
2242
|
* ```
|
2170
2243
|
* <script type="module">
|
2171
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2244
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2172
2245
|
* console.log(Monster.Types.validatePrimitive('2')) // ↦ value
|
2173
2246
|
* console.log(Monster.Types.validatePrimitive([])) // ↦ TypeError
|
2174
2247
|
* </script>
|
@@ -2178,7 +2251,7 @@ function validateIterable(value) {
|
|
2178
2251
|
*
|
2179
2252
|
* ```
|
2180
2253
|
* <script type="module">
|
2181
|
-
* import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2254
|
+
* import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/validate.js';
|
2182
2255
|
* console.log(validatePrimitive('2')) // ↦ value
|
2183
2256
|
* console.log(validatePrimitive([])) // ↦ TypeError
|
2184
2257
|
* </script>
|
@@ -2210,7 +2283,7 @@ function validatePrimitive(value) {
|
|
2210
2283
|
*
|
2211
2284
|
* ```
|
2212
2285
|
* <script type="module">
|
2213
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2286
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2214
2287
|
* console.log(Monster.Types.validateBoolean(true)) // ↦ value
|
2215
2288
|
* console.log(Monster.Types.validateBoolean('2')) // ↦ TypeError
|
2216
2289
|
* console.log(Monster.Types.validateBoolean([])) // ↦ TypeError
|
@@ -2221,7 +2294,7 @@ function validatePrimitive(value) {
|
|
2221
2294
|
*
|
2222
2295
|
* ```
|
2223
2296
|
* <script type="module">
|
2224
|
-
* import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2297
|
+
* import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/validate.js';
|
2225
2298
|
* console.log(validateBoolean(false)) // ↦ value
|
2226
2299
|
* console.log(validateBoolean('2')) // ↦ TypeError
|
2227
2300
|
* console.log(validateBoolean([])) // ↦ TypeError
|
@@ -2252,7 +2325,7 @@ function validateBoolean(value) {
|
|
2252
2325
|
*
|
2253
2326
|
* ```
|
2254
2327
|
* <script type="module">
|
2255
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2328
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2256
2329
|
* console.log(Monster.Types.validateString('2')) // ↦ value
|
2257
2330
|
* console.log(Monster.Types.validateString([])) // ↦ TypeError
|
2258
2331
|
* </script>
|
@@ -2262,7 +2335,7 @@ function validateBoolean(value) {
|
|
2262
2335
|
*
|
2263
2336
|
* ```
|
2264
2337
|
* <script type="module">
|
2265
|
-
* import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2338
|
+
* import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/validate.js';
|
2266
2339
|
* console.log(validateString('2')) // ↦ value
|
2267
2340
|
* console.log(validateString([])) // ↦ TypeError
|
2268
2341
|
* </script>
|
@@ -2291,7 +2364,7 @@ function validateString(value) {
|
|
2291
2364
|
*
|
2292
2365
|
* ```
|
2293
2366
|
* <script type="module">
|
2294
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2367
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2295
2368
|
* console.log(Monster.Types.validateObject({})) // ↦ value
|
2296
2369
|
* console.log(Monster.Types.validateObject('2')) // ↦ TypeError
|
2297
2370
|
* console.log(Monster.Types.validateObject([])) // ↦ TypeError
|
@@ -2302,7 +2375,7 @@ function validateString(value) {
|
|
2302
2375
|
*
|
2303
2376
|
* ```
|
2304
2377
|
* <script type="module">
|
2305
|
-
* import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2378
|
+
* import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/validate.js';
|
2306
2379
|
* console.log(validateObject({})) // ↦ value
|
2307
2380
|
* console.log(validateObject('2')) // ↦ TypeError
|
2308
2381
|
* console.log(validateObject([])) // ↦ TypeError
|
@@ -2332,7 +2405,7 @@ function validateObject(value) {
|
|
2332
2405
|
*
|
2333
2406
|
* ```
|
2334
2407
|
* <script type="module">
|
2335
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2408
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2336
2409
|
* console.log(Monster.Types.validateInstance({}, Object)) // ↦ value
|
2337
2410
|
* console.log(Monster.Types.validateInstance('2', Object)) // ↦ TypeError
|
2338
2411
|
* console.log(Monster.Types.validateInstance([], Object)) // ↦ TypeError
|
@@ -2343,7 +2416,7 @@ function validateObject(value) {
|
|
2343
2416
|
*
|
2344
2417
|
* ```
|
2345
2418
|
* <script type="module">
|
2346
|
-
* import {validateInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2419
|
+
* import {validateInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/validate.js';
|
2347
2420
|
* console.log(validateInstance({}, Object)) // ↦ value
|
2348
2421
|
* console.log(validateInstance('2', Object)) // ↦ TypeError
|
2349
2422
|
* console.log(validateInstance([], Object)) // ↦ TypeError
|
@@ -2383,7 +2456,7 @@ function validateInstance(value, instance) {
|
|
2383
2456
|
*
|
2384
2457
|
* ```
|
2385
2458
|
* <script type="module">
|
2386
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2459
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2387
2460
|
* console.log(Monster.Types.validateArray('2')) // ↦ TypeError
|
2388
2461
|
* console.log(Monster.Types.validateArray([])) // ↦ value
|
2389
2462
|
* </script>
|
@@ -2393,7 +2466,7 @@ function validateInstance(value, instance) {
|
|
2393
2466
|
*
|
2394
2467
|
* ```
|
2395
2468
|
* <script type="module">
|
2396
|
-
* import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2469
|
+
* import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/validate.js';
|
2397
2470
|
* console.log(validateArray('2')) // ↦ TypeError
|
2398
2471
|
* console.log(validateArray([])) // ↦ value
|
2399
2472
|
* </script>
|
@@ -2422,7 +2495,7 @@ function validateArray(value) {
|
|
2422
2495
|
*
|
2423
2496
|
* ```
|
2424
2497
|
* <script type="module">
|
2425
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2498
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2426
2499
|
* console.log(Monster.Types.validateSymbol('2')) // ↦ TypeError
|
2427
2500
|
* console.log(Monster.Types.validateSymbol([])) // ↦ value
|
2428
2501
|
* </script>
|
@@ -2432,7 +2505,7 @@ function validateArray(value) {
|
|
2432
2505
|
*
|
2433
2506
|
* ```
|
2434
2507
|
* <script type="module">
|
2435
|
-
* import {validateSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2508
|
+
* import {validateSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/validate.js';
|
2436
2509
|
* console.log(validateSymbol('2')) // ↦ TypeError
|
2437
2510
|
* console.log(validateSymbol()) // ↦ value
|
2438
2511
|
* </script>
|
@@ -2461,7 +2534,7 @@ function validateSymbol(value) {
|
|
2461
2534
|
*
|
2462
2535
|
* ```
|
2463
2536
|
* <script type="module">
|
2464
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2537
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2465
2538
|
* console.log(Monster.Types.validateFunction(()=>{})) // ↦ value
|
2466
2539
|
* console.log(Monster.Types.validateFunction('2')) // ↦ TypeError
|
2467
2540
|
* console.log(Monster.Types.validateFunction([])) // ↦ TypeError
|
@@ -2472,7 +2545,7 @@ function validateSymbol(value) {
|
|
2472
2545
|
*
|
2473
2546
|
* ```
|
2474
2547
|
* <script type="module">
|
2475
|
-
* import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2548
|
+
* import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/validate.js';
|
2476
2549
|
* console.log(validateFunction(()=>{})) // ↦ value
|
2477
2550
|
* console.log(validateFunction('2')) // ↦ TypeError
|
2478
2551
|
* console.log(validateFunction([])) // ↦ TypeError
|
@@ -2502,7 +2575,7 @@ function validateFunction(value) {
|
|
2502
2575
|
*
|
2503
2576
|
* ```
|
2504
2577
|
* <script type="module">
|
2505
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2578
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2506
2579
|
* console.log(Monster.Types.validateInteger(true)) // ↦ TypeError
|
2507
2580
|
* console.log(Monster.Types.validateInteger('2')) // ↦ TypeError
|
2508
2581
|
* console.log(Monster.Types.validateInteger(2)) // ↦ value
|
@@ -2513,7 +2586,7 @@ function validateFunction(value) {
|
|
2513
2586
|
*
|
2514
2587
|
* ```
|
2515
2588
|
* <script type="module">
|
2516
|
-
* import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2589
|
+
* import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/validate.js';
|
2517
2590
|
* console.log(validateInteger(true)) // ↦ TypeError
|
2518
2591
|
* console.log(validateInteger('2')) // ↦ TypeError
|
2519
2592
|
* console.log(validateInteger(2)) // ↦ value
|
@@ -2579,7 +2652,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
2579
2652
|
*
|
2580
2653
|
* ```
|
2581
2654
|
* <script type="module">
|
2582
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2655
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2583
2656
|
* Monster.Util.clone({})
|
2584
2657
|
* </script>
|
2585
2658
|
* ```
|
@@ -2588,7 +2661,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
2588
2661
|
*
|
2589
2662
|
* ```
|
2590
2663
|
* <script type="module">
|
2591
|
-
* import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2664
|
+
* import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/util/clone.js';
|
2592
2665
|
* clone({})
|
2593
2666
|
* </script>
|
2594
2667
|
* ```
|
@@ -2800,7 +2873,7 @@ function getGlobal() {
|
|
2800
2873
|
*
|
2801
2874
|
* ```
|
2802
2875
|
* <script type="module">
|
2803
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2876
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2804
2877
|
* Monster.Types.getGlobalObject('document')
|
2805
2878
|
* // ↦ { }
|
2806
2879
|
* </script>
|
@@ -2810,7 +2883,7 @@ function getGlobal() {
|
|
2810
2883
|
*
|
2811
2884
|
* ```
|
2812
2885
|
* <script type="module">
|
2813
|
-
* import {getGlobalObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2886
|
+
* import {getGlobalObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/global.js';
|
2814
2887
|
* getGlobalObject('document')
|
2815
2888
|
* // ↦ { }
|
2816
2889
|
* </script>
|
@@ -2842,7 +2915,7 @@ function getGlobalObject(name) {
|
|
2842
2915
|
*
|
2843
2916
|
* ```
|
2844
2917
|
* <script type="module">
|
2845
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2918
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2846
2919
|
* console.log(Monster.Types.getGlobalFunction('parseInt')) // ↦ f parseInt() { }
|
2847
2920
|
* </script>
|
2848
2921
|
* ```
|
@@ -2851,7 +2924,7 @@ function getGlobalObject(name) {
|
|
2851
2924
|
*
|
2852
2925
|
* ```
|
2853
2926
|
* <script type="module">
|
2854
|
-
* import {getGlobalFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2927
|
+
* import {getGlobalFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/global.js';
|
2855
2928
|
* console.log(getGlobalFunction('parseInt')) // ↦ f parseInt() { }
|
2856
2929
|
* </script>
|
2857
2930
|
* ```
|
@@ -2902,7 +2975,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
2902
2975
|
*
|
2903
2976
|
* ```
|
2904
2977
|
* <script type="module">
|
2905
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2978
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
2906
2979
|
* console.log(Monster.Types.typeOf())
|
2907
2980
|
* </script>
|
2908
2981
|
* ```
|
@@ -2911,14 +2984,14 @@ __webpack_require__.r(__webpack_exports__);
|
|
2911
2984
|
*
|
2912
2985
|
* ```
|
2913
2986
|
* <script type="module">
|
2914
|
-
* import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2987
|
+
* import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/typeof.js';
|
2915
2988
|
* console.log(typeOf())
|
2916
2989
|
* </script>
|
2917
2990
|
* ```
|
2918
2991
|
*
|
2919
2992
|
* @example
|
2920
2993
|
*
|
2921
|
-
* import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
2994
|
+
* import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/typeof.js';
|
2922
2995
|
*
|
2923
2996
|
* console.log(typeOf(undefined)); // ↦ undefined
|
2924
2997
|
* console.log(typeOf("")); // ↦ string
|
@@ -3037,7 +3110,7 @@ var WILDCARD = '*';
|
|
3037
3110
|
*
|
3038
3111
|
* ```
|
3039
3112
|
* <script type="module">
|
3040
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3113
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
3041
3114
|
* console.log(new Monster.Data.Pathfinder())
|
3042
3115
|
* </script>
|
3043
3116
|
* ```
|
@@ -3046,7 +3119,7 @@ var WILDCARD = '*';
|
|
3046
3119
|
*
|
3047
3120
|
* ```
|
3048
3121
|
* <script type="module">
|
3049
|
-
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3122
|
+
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/pathfinder.js';
|
3050
3123
|
* console.log(new Pathfinder())
|
3051
3124
|
* </script>
|
3052
3125
|
* ```
|
@@ -3088,7 +3161,7 @@ var WILDCARD = '*';
|
|
3088
3161
|
*
|
3089
3162
|
* @example
|
3090
3163
|
*
|
3091
|
-
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3164
|
+
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/pathfinder.js';
|
3092
3165
|
*
|
3093
3166
|
* let value = new Pathfinder({
|
3094
3167
|
* a: {
|
@@ -3114,7 +3187,7 @@ var WILDCARD = '*';
|
|
3114
3187
|
*
|
3115
3188
|
* @example
|
3116
3189
|
*
|
3117
|
-
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3190
|
+
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/pathfinder.js';
|
3118
3191
|
*
|
3119
3192
|
* let p = new Pathfinder({
|
3120
3193
|
* a: {
|
@@ -3529,7 +3602,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
3529
3602
|
*
|
3530
3603
|
* ```
|
3531
3604
|
* <script type="module">
|
3532
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3605
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
3533
3606
|
* console.log(new Monster.Types.Stack())
|
3534
3607
|
* </script>
|
3535
3608
|
* ```
|
@@ -3538,7 +3611,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
3538
3611
|
*
|
3539
3612
|
* ```
|
3540
3613
|
* <script type="module">
|
3541
|
-
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3614
|
+
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/stack.js';
|
3542
3615
|
* console.log(new Stack())
|
3543
3616
|
* </script>
|
3544
3617
|
* ```
|
@@ -3673,7 +3746,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
3673
3746
|
*
|
3674
3747
|
* ```
|
3675
3748
|
* <script type="module">
|
3676
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3749
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
3677
3750
|
* Monster.Data.Diff(a, b)
|
3678
3751
|
* </script>
|
3679
3752
|
* ```
|
@@ -3682,14 +3755,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
3682
3755
|
*
|
3683
3756
|
* ```
|
3684
3757
|
* <script type="module">
|
3685
|
-
* import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3758
|
+
* import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/diff.js';
|
3686
3759
|
* Diff(a, b)
|
3687
3760
|
* </script>
|
3688
3761
|
* ```
|
3689
3762
|
*
|
3690
3763
|
* @example
|
3691
3764
|
*
|
3692
|
-
* import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
3765
|
+
* import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/diff.js';
|
3693
3766
|
*
|
3694
3767
|
* // given are two objects x and y.
|
3695
3768
|
*
|
@@ -3935,7 +4008,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
3935
4008
|
*
|
3936
4009
|
* ```
|
3937
4010
|
* <script type="module">
|
3938
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4011
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
3939
4012
|
* Monster.Data.extend(a, b)
|
3940
4013
|
* </script>
|
3941
4014
|
* ```
|
@@ -3944,7 +4017,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
3944
4017
|
*
|
3945
4018
|
* ```
|
3946
4019
|
* <script type="module">
|
3947
|
-
* import {extend} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4020
|
+
* import {extend} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/extend.js';
|
3948
4021
|
* extend(a, b)
|
3949
4022
|
* </script>
|
3950
4023
|
* ```
|
@@ -4073,7 +4146,7 @@ var DELIMITER = '|';
|
|
4073
4146
|
*
|
4074
4147
|
* ```
|
4075
4148
|
* <script type="module">
|
4076
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4149
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
4077
4150
|
* new Monster.Data.Pipe()
|
4078
4151
|
* </script>
|
4079
4152
|
* ```
|
@@ -4082,7 +4155,7 @@ var DELIMITER = '|';
|
|
4082
4155
|
*
|
4083
4156
|
* ```
|
4084
4157
|
* <script type="module">
|
4085
|
-
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4158
|
+
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/pipe.js';
|
4086
4159
|
* new Pipe()
|
4087
4160
|
* </script>
|
4088
4161
|
* ```
|
@@ -4093,7 +4166,7 @@ var DELIMITER = '|';
|
|
4093
4166
|
* the word is then converted to uppercase letters and a prefix Hello is added. the two backslash safe the space char.
|
4094
4167
|
*
|
4095
4168
|
* @example
|
4096
|
-
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4169
|
+
* import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/pipe.js';
|
4097
4170
|
*
|
4098
4171
|
* let obj = {
|
4099
4172
|
* a: {
|
@@ -4255,7 +4328,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
4255
4328
|
*
|
4256
4329
|
* ```
|
4257
4330
|
* <script type="module">
|
4258
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4331
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
4259
4332
|
* new Monster.Data.Transformer()
|
4260
4333
|
* </script>
|
4261
4334
|
* ```
|
@@ -4264,7 +4337,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
4264
4337
|
*
|
4265
4338
|
* ```
|
4266
4339
|
* <script type="module">
|
4267
|
-
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4340
|
+
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/transformer.js';
|
4268
4341
|
* new Transformer()
|
4269
4342
|
* </script>
|
4270
4343
|
* ```
|
@@ -4350,7 +4423,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
4350
4423
|
*
|
4351
4424
|
* @example
|
4352
4425
|
*
|
4353
|
-
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4426
|
+
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/data/transformer.js';
|
4354
4427
|
*
|
4355
4428
|
* const transformer = new Transformer("tolower")
|
4356
4429
|
*
|
@@ -4883,7 +4956,7 @@ var internalCounter = new Map();
|
|
4883
4956
|
*
|
4884
4957
|
* ```
|
4885
4958
|
* <script type="module">
|
4886
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4959
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
4887
4960
|
* console.log(new Monster.Types.ID())
|
4888
4961
|
* </script>
|
4889
4962
|
* ```
|
@@ -4892,7 +4965,7 @@ var internalCounter = new Map();
|
|
4892
4965
|
*
|
4893
4966
|
* ```
|
4894
4967
|
* <script type="module">
|
4895
|
-
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
4968
|
+
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/id.js';
|
4896
4969
|
* console.log(new ID())
|
4897
4970
|
* </script>
|
4898
4971
|
* ```
|
@@ -4902,6 +4975,7 @@ var internalCounter = new Map();
|
|
4902
4975
|
* @since 1.0.0
|
4903
4976
|
* @copyright schukai GmbH
|
4904
4977
|
* @memberOf Monster.Types
|
4978
|
+
* @summary Automatic generation of ids
|
4905
4979
|
*/
|
4906
4980
|
|
4907
4981
|
var ID = /*#__PURE__*/function (_Base) {
|
@@ -4910,7 +4984,9 @@ var ID = /*#__PURE__*/function (_Base) {
|
|
4910
4984
|
var _super = _createSuper(ID);
|
4911
4985
|
|
4912
4986
|
/**
|
4913
|
-
* create new
|
4987
|
+
* create new id with prefix
|
4988
|
+
*
|
4989
|
+
* @param {string} prefix
|
4914
4990
|
*/
|
4915
4991
|
function ID(prefix) {
|
4916
4992
|
var _this;
|
@@ -5012,7 +5088,7 @@ var ATTRIBUTEPREFIX = "data-monster-";
|
|
5012
5088
|
*
|
5013
5089
|
* ```
|
5014
5090
|
* <script type="module">
|
5015
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5091
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
5016
5092
|
* console.log(new Monster.DOM.Assembler())
|
5017
5093
|
* </script>
|
5018
5094
|
* ```
|
@@ -5021,7 +5097,7 @@ var ATTRIBUTEPREFIX = "data-monster-";
|
|
5021
5097
|
*
|
5022
5098
|
* ```
|
5023
5099
|
* <script type="module">
|
5024
|
-
* import {Assembler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5100
|
+
* import {Assembler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/assembler.js';
|
5025
5101
|
* console.log(new Assembler())
|
5026
5102
|
* </script>
|
5027
5103
|
* ```
|
@@ -5162,7 +5238,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5162
5238
|
*
|
5163
5239
|
* ```
|
5164
5240
|
* <script type="module">
|
5165
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5241
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
5166
5242
|
* new Monster.Types.ProxyObserver()
|
5167
5243
|
* </script>
|
5168
5244
|
* ```
|
@@ -5171,7 +5247,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5171
5247
|
*
|
5172
5248
|
* ```
|
5173
5249
|
* <script type="module">
|
5174
|
-
* import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5250
|
+
* import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/proxyobserver.js';
|
5175
5251
|
* new ProxyObserver()
|
5176
5252
|
* </script>
|
5177
5253
|
* ```
|
@@ -5182,9 +5258,9 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5182
5258
|
*
|
5183
5259
|
* @example
|
5184
5260
|
*
|
5185
|
-
* import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5186
|
-
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5187
|
-
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5261
|
+
* import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/proxyobserver.js';
|
5262
|
+
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/observer.js';
|
5263
|
+
* import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/is.js';
|
5188
5264
|
*
|
5189
5265
|
* const o = new Observer(function () {
|
5190
5266
|
* if (isObject(this) && this instanceof ProxyObserver) {
|
@@ -5510,7 +5586,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5510
5586
|
*
|
5511
5587
|
* ```
|
5512
5588
|
* <script type="module">
|
5513
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5589
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
5514
5590
|
* console.log(new Monster.Types.Observer())
|
5515
5591
|
* </script>
|
5516
5592
|
* ```
|
@@ -5519,7 +5595,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5519
5595
|
*
|
5520
5596
|
* ```
|
5521
5597
|
* <script type="module">
|
5522
|
-
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5598
|
+
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/observer.js';
|
5523
5599
|
* console.log(new Observer())
|
5524
5600
|
* </script>
|
5525
5601
|
* ```
|
@@ -5553,7 +5629,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5553
5629
|
*
|
5554
5630
|
* @example
|
5555
5631
|
*
|
5556
|
-
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5632
|
+
* import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/observer.js';
|
5557
5633
|
*
|
5558
5634
|
* const observer = new Observer(function(a, b, c) {
|
5559
5635
|
* console.log(this, a, b, c); // ↦ "a", 2, true
|
@@ -5753,7 +5829,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5753
5829
|
*
|
5754
5830
|
* ```
|
5755
5831
|
* <script type="module">
|
5756
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5832
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
5757
5833
|
* new Monster.Types.TokenList("myclass row")
|
5758
5834
|
* </script>
|
5759
5835
|
* ```
|
@@ -5762,7 +5838,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
5762
5838
|
*
|
5763
5839
|
* ```
|
5764
5840
|
* <script type="module">
|
5765
|
-
* import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
5841
|
+
* import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/tokenlist.js';
|
5766
5842
|
* new TokenList("myclass row")
|
5767
5843
|
* </script>
|
5768
5844
|
* ```
|
@@ -6185,7 +6261,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6185
6261
|
*
|
6186
6262
|
* ```
|
6187
6263
|
* <script type="module">
|
6188
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6264
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
6189
6265
|
* new Monster.Types.UniqueQueue()
|
6190
6266
|
* </script>
|
6191
6267
|
* ```
|
@@ -6194,7 +6270,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6194
6270
|
*
|
6195
6271
|
* ```
|
6196
6272
|
* <script type="module">
|
6197
|
-
* import {UniqueQueue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6273
|
+
* import {UniqueQueue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/uniquequeue.js';
|
6198
6274
|
* new UniqueQueue()
|
6199
6275
|
* </script>
|
6200
6276
|
* ```
|
@@ -6325,11 +6401,11 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6325
6401
|
|
6326
6402
|
|
6327
6403
|
/**
|
6328
|
-
* You can
|
6404
|
+
* You can create the instance via the monster namespace `new Monster.Types.Queue()`.
|
6329
6405
|
*
|
6330
6406
|
* ```
|
6331
6407
|
* <script type="module">
|
6332
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6408
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
6333
6409
|
* new Monster.Types.Queue()
|
6334
6410
|
* </script>
|
6335
6411
|
* ```
|
@@ -6338,14 +6414,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6338
6414
|
*
|
6339
6415
|
* ```
|
6340
6416
|
* <script type="module">
|
6341
|
-
* import {
|
6417
|
+
* import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/queue.js';
|
6342
6418
|
* new Queue()
|
6343
6419
|
* </script>
|
6344
6420
|
* ```
|
6345
6421
|
*
|
6346
6422
|
* @example
|
6347
6423
|
*
|
6348
|
-
* import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6424
|
+
* import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/queue.js';
|
6349
6425
|
*
|
6350
6426
|
* const queue = new Queue;
|
6351
6427
|
*
|
@@ -6514,7 +6590,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6514
6590
|
*
|
6515
6591
|
* ```
|
6516
6592
|
* <script type="module">
|
6517
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6593
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
6518
6594
|
* console.log(new Monster.Types.ObserverList())
|
6519
6595
|
* console.log(new Monster.Types.ObserverList())
|
6520
6596
|
* </script>
|
@@ -6524,7 +6600,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
6524
6600
|
*
|
6525
6601
|
* ```
|
6526
6602
|
* <script type="module">
|
6527
|
-
* import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6603
|
+
* import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/observerlist.js';
|
6528
6604
|
* console.log(ObserverList())
|
6529
6605
|
* console.log(ObserverList())
|
6530
6606
|
* </script>
|
@@ -6656,7 +6732,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
6656
6732
|
/* harmony export */ "addAttributeToken": function() { return /* binding */ addAttributeToken; },
|
6657
6733
|
/* harmony export */ "toggleAttributeToken": function() { return /* binding */ toggleAttributeToken; },
|
6658
6734
|
/* harmony export */ "getLinkedObjects": function() { return /* binding */ getLinkedObjects; },
|
6659
|
-
/* harmony export */ "findClosestObjectLink": function() { return /* binding */ findClosestObjectLink; }
|
6735
|
+
/* harmony export */ "findClosestObjectLink": function() { return /* binding */ findClosestObjectLink; },
|
6736
|
+
/* harmony export */ "findClosestByClass": function() { return /* binding */ findClosestByClass; }
|
6660
6737
|
/* harmony export */ });
|
6661
6738
|
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
6662
6739
|
/* harmony import */ var _types_global_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);
|
@@ -6683,7 +6760,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
6683
6760
|
*
|
6684
6761
|
* ```
|
6685
6762
|
* <script type="module">
|
6686
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6763
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
6687
6764
|
* console.log(Monster.DOM.findClosestObjectLink())
|
6688
6765
|
* </script>
|
6689
6766
|
* ```
|
@@ -6692,7 +6769,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
6692
6769
|
*
|
6693
6770
|
* ```
|
6694
6771
|
* <script type="module">
|
6695
|
-
* import {getUpdaterFromNode} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6772
|
+
* import {getUpdaterFromNode} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/updater.js';
|
6696
6773
|
* console.log(findClosestObjectLink())
|
6697
6774
|
* </script>
|
6698
6775
|
* ```
|
@@ -6713,7 +6790,7 @@ function findClosestObjectLink(element) {
|
|
6713
6790
|
*
|
6714
6791
|
* ```
|
6715
6792
|
* <script type="module">
|
6716
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6793
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
6717
6794
|
* Monster.DOM.addToObjectLink();
|
6718
6795
|
* </script>
|
6719
6796
|
* ```
|
@@ -6722,7 +6799,7 @@ function findClosestObjectLink(element) {
|
|
6722
6799
|
*
|
6723
6800
|
* ```
|
6724
6801
|
* <script type="module">
|
6725
|
-
* import {addToObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6802
|
+
* import {addToObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/attributes.js';
|
6726
6803
|
* addToObjectLink();
|
6727
6804
|
* </script>
|
6728
6805
|
* ```
|
@@ -6754,7 +6831,7 @@ function addToObjectLink(element, symbol, object) {
|
|
6754
6831
|
*
|
6755
6832
|
* ```
|
6756
6833
|
* <script type="module">
|
6757
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6834
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
6758
6835
|
* Monster.DOM.removeObjectLink();
|
6759
6836
|
* </script>
|
6760
6837
|
* ```
|
@@ -6763,7 +6840,7 @@ function addToObjectLink(element, symbol, object) {
|
|
6763
6840
|
*
|
6764
6841
|
* ```
|
6765
6842
|
* <script type="module">
|
6766
|
-
* import {removeObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6843
|
+
* import {removeObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/attributes.js';
|
6767
6844
|
* removeObjectLink();
|
6768
6845
|
* </script>
|
6769
6846
|
* ```
|
@@ -6794,7 +6871,7 @@ function removeObjectLink(element, symbol) {
|
|
6794
6871
|
*
|
6795
6872
|
* ```
|
6796
6873
|
* <script type="module">
|
6797
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6874
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
6798
6875
|
* Monster.DOM.hasObjectLink();
|
6799
6876
|
* </script>
|
6800
6877
|
* ```
|
@@ -6803,7 +6880,7 @@ function removeObjectLink(element, symbol) {
|
|
6803
6880
|
*
|
6804
6881
|
* ```
|
6805
6882
|
* <script type="module">
|
6806
|
-
* import {hasObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6883
|
+
* import {hasObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/attributes.js';
|
6807
6884
|
* hasObjectLink();
|
6808
6885
|
* </script>
|
6809
6886
|
* ```
|
@@ -6839,7 +6916,7 @@ function hasObjectLink(element, symbol) {
|
|
6839
6916
|
*
|
6840
6917
|
* ```
|
6841
6918
|
* <script type="module">
|
6842
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6919
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
6843
6920
|
* Monster.DOM.getLinkedObjects();
|
6844
6921
|
* </script>
|
6845
6922
|
* ```
|
@@ -6848,7 +6925,7 @@ function hasObjectLink(element, symbol) {
|
|
6848
6925
|
*
|
6849
6926
|
* ```
|
6850
6927
|
* <script type="module">
|
6851
|
-
* import {getLinkedObjects} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6928
|
+
* import {getLinkedObjects} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/attributes.js';
|
6852
6929
|
* getLinkedObjects();
|
6853
6930
|
* </script>
|
6854
6931
|
* ```
|
@@ -6882,7 +6959,7 @@ function getLinkedObjects(element, symbol) {
|
|
6882
6959
|
*
|
6883
6960
|
* ```
|
6884
6961
|
* <script type="module">
|
6885
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6962
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
6886
6963
|
* Monster.DOM.toggleAttributeToken();
|
6887
6964
|
* </script>
|
6888
6965
|
* ```
|
@@ -6891,7 +6968,7 @@ function getLinkedObjects(element, symbol) {
|
|
6891
6968
|
*
|
6892
6969
|
* ```
|
6893
6970
|
* <script type="module">
|
6894
|
-
* import {toggleAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
6971
|
+
* import {toggleAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/attributes.js';
|
6895
6972
|
* toggleAttributeToken();
|
6896
6973
|
* </script>
|
6897
6974
|
* ```
|
@@ -6926,7 +7003,7 @@ function toggleAttributeToken(element, key, token) {
|
|
6926
7003
|
*
|
6927
7004
|
* ```
|
6928
7005
|
* <script type="module">
|
6929
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7006
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
6930
7007
|
* Monster.DOM.addAttributeToken();
|
6931
7008
|
* </script>
|
6932
7009
|
* ```
|
@@ -6935,7 +7012,7 @@ function toggleAttributeToken(element, key, token) {
|
|
6935
7012
|
*
|
6936
7013
|
* ```
|
6937
7014
|
* <script type="module">
|
6938
|
-
* import {addAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7015
|
+
* import {addAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/attributes.js';
|
6939
7016
|
* addAttributeToken();
|
6940
7017
|
* </script>
|
6941
7018
|
* ```
|
@@ -6972,7 +7049,7 @@ function addAttributeToken(element, key, token) {
|
|
6972
7049
|
*
|
6973
7050
|
* ```
|
6974
7051
|
* <script type="module">
|
6975
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7052
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
6976
7053
|
* Monster.DOM.removeAttributeToken();
|
6977
7054
|
* </script>
|
6978
7055
|
* ```
|
@@ -6981,7 +7058,7 @@ function addAttributeToken(element, key, token) {
|
|
6981
7058
|
*
|
6982
7059
|
* ```
|
6983
7060
|
* <script type="module">
|
6984
|
-
* import {removeAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7061
|
+
* import {removeAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/attributes.js';
|
6985
7062
|
* removeAttributeToken();
|
6986
7063
|
* </script>
|
6987
7064
|
* ```
|
@@ -7017,7 +7094,7 @@ function removeAttributeToken(element, key, token) {
|
|
7017
7094
|
*
|
7018
7095
|
* ```
|
7019
7096
|
* <script type="module">
|
7020
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7097
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
7021
7098
|
* Monster.DOM.containsAttributeToken();
|
7022
7099
|
* </script>
|
7023
7100
|
* ```
|
@@ -7026,7 +7103,7 @@ function removeAttributeToken(element, key, token) {
|
|
7026
7103
|
*
|
7027
7104
|
* ```
|
7028
7105
|
* <script type="module">
|
7029
|
-
* import {containsAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7106
|
+
* import {containsAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/attributes.js';
|
7030
7107
|
* containsAttributeToken();
|
7031
7108
|
* </script>
|
7032
7109
|
* ```
|
@@ -7059,7 +7136,7 @@ function containsAttributeToken(element, key, token) {
|
|
7059
7136
|
*
|
7060
7137
|
* ```
|
7061
7138
|
* <script type="module">
|
7062
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7139
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
7063
7140
|
* Monster.DOM.replaceAttributeToken();
|
7064
7141
|
* </script>
|
7065
7142
|
* ```
|
@@ -7068,7 +7145,7 @@ function containsAttributeToken(element, key, token) {
|
|
7068
7145
|
*
|
7069
7146
|
* ```
|
7070
7147
|
* <script type="module">
|
7071
|
-
* import {replaceAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7148
|
+
* import {replaceAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/attributes.js';
|
7072
7149
|
* replaceAttributeToken();
|
7073
7150
|
* </script>
|
7074
7151
|
* ```
|
@@ -7104,7 +7181,7 @@ function replaceAttributeToken(element, key, from, to) {
|
|
7104
7181
|
*
|
7105
7182
|
* ```
|
7106
7183
|
* <script type="module">
|
7107
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7184
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
7108
7185
|
* Monster.DOM.clearAttributeTokens();
|
7109
7186
|
* </script>
|
7110
7187
|
* ```
|
@@ -7113,7 +7190,7 @@ function replaceAttributeToken(element, key, from, to) {
|
|
7113
7190
|
*
|
7114
7191
|
* ```
|
7115
7192
|
* <script type="module">
|
7116
|
-
* import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7193
|
+
* import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/attributes.js';
|
7117
7194
|
* clearAttributeTokens();
|
7118
7195
|
* </script>
|
7119
7196
|
* ```
|
@@ -7139,11 +7216,29 @@ function clearAttributeTokens(element, key) {
|
|
7139
7216
|
return element;
|
7140
7217
|
}
|
7141
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
|
+
*
|
7142
7237
|
* You can call the method via the monster namespace `new Monster.DOM.findClosestByAttribute()`.
|
7143
7238
|
*
|
7144
7239
|
* ```
|
7145
7240
|
* <script type="module">
|
7146
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7241
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
7147
7242
|
* Monster.DOM.findClosestByAttribute();
|
7148
7243
|
* </script>
|
7149
7244
|
* ```
|
@@ -7152,7 +7247,7 @@ function clearAttributeTokens(element, key) {
|
|
7152
7247
|
*
|
7153
7248
|
* ```
|
7154
7249
|
* <script type="module">
|
7155
|
-
* import {findClosestByAttribute} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7250
|
+
* import {findClosestByAttribute} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/attributes.js';
|
7156
7251
|
* findClosestByAttribute();
|
7157
7252
|
* </script>
|
7158
7253
|
* ```
|
@@ -7164,14 +7259,21 @@ function clearAttributeTokens(element, key) {
|
|
7164
7259
|
* @param {string} key
|
7165
7260
|
* @param {string|undefined} value
|
7166
7261
|
* @return {HTMLElement|undefined}
|
7262
|
+
* @summary find closest node
|
7167
7263
|
*/
|
7168
7264
|
|
7169
7265
|
|
7170
7266
|
function findClosestByAttribute(element, key, value) {
|
7171
7267
|
(0,_types_validate_js__WEBPACK_IMPORTED_MODULE_3__.validateInstance)(element, (0,_types_global_js__WEBPACK_IMPORTED_MODULE_1__.getGlobalFunction)('HTMLElement'));
|
7172
7268
|
|
7173
|
-
if (element.hasAttribute(key)
|
7174
|
-
|
7269
|
+
if (element.hasAttribute(key)) {
|
7270
|
+
if (value === undefined) {
|
7271
|
+
return element;
|
7272
|
+
}
|
7273
|
+
|
7274
|
+
if (element.getAttribute(key) === value) {
|
7275
|
+
return element;
|
7276
|
+
}
|
7175
7277
|
}
|
7176
7278
|
|
7177
7279
|
var selector = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_3__.validateString)(key);
|
@@ -7182,11 +7284,71 @@ function findClosestByAttribute(element, key, value) {
|
|
7182
7284
|
return result;
|
7183
7285
|
}
|
7184
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.28.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.28.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
|
+
|
7185
7347
|
return undefined;
|
7186
7348
|
} // exports
|
7187
7349
|
|
7188
7350
|
|
7189
|
-
(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);
|
7190
7352
|
|
7191
7353
|
|
7192
7354
|
/***/ }),
|
@@ -7244,7 +7406,9 @@ __webpack_require__.r(__webpack_exports__);
|
|
7244
7406
|
/* harmony export */ "ATTRIBUTE_DISABLED": function() { return /* binding */ ATTRIBUTE_DISABLED; },
|
7245
7407
|
/* harmony export */ "ATTRIBUTE_ERRORMESSAGE": function() { return /* binding */ ATTRIBUTE_ERRORMESSAGE; },
|
7246
7408
|
/* harmony export */ "ATTRIBUTE_VALUE": function() { return /* binding */ ATTRIBUTE_VALUE; },
|
7247
|
-
/* 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; },
|
7411
|
+
/* harmony export */ "ATTRIBUTE_UPDATER_SELECT_THIS": function() { return /* binding */ ATTRIBUTE_UPDATER_SELECT_THIS; }
|
7248
7412
|
/* harmony export */ });
|
7249
7413
|
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
7250
7414
|
|
@@ -7297,6 +7461,13 @@ var ATTRIBUTE_THEME_NAME = ATTRIBUTE_THEME_PREFIX + 'name';
|
|
7297
7461
|
*/
|
7298
7462
|
|
7299
7463
|
var ATTRIBUTE_UPDATER_ATTRIBUTES = ATTRIBUTE_PREFIX + 'attributes';
|
7464
|
+
/**
|
7465
|
+
* @memberOf Monster.DOM
|
7466
|
+
* @type {string}
|
7467
|
+
* @since 1.27.1
|
7468
|
+
*/
|
7469
|
+
|
7470
|
+
var ATTRIBUTE_UPDATER_SELECT_THIS = ATTRIBUTE_PREFIX + 'select-this';
|
7300
7471
|
/**
|
7301
7472
|
* @memberOf Monster.DOM
|
7302
7473
|
* @type {string}
|
@@ -7332,6 +7503,13 @@ var ATTRIBUTE_UPDATER_REMOVE = ATTRIBUTE_PREFIX + 'remove';
|
|
7332
7503
|
*/
|
7333
7504
|
|
7334
7505
|
var ATTRIBUTE_UPDATER_BIND = ATTRIBUTE_PREFIX + 'bind';
|
7506
|
+
/**
|
7507
|
+
* @memberOf Monster.DOM
|
7508
|
+
* @type {string}
|
7509
|
+
* @since 1.27.0
|
7510
|
+
*/
|
7511
|
+
|
7512
|
+
var ATTRIBUTE_TEMPLATE_PREFIX = ATTRIBUTE_PREFIX + 'template-prefix';
|
7335
7513
|
/**
|
7336
7514
|
* @memberOf Monster.DOM
|
7337
7515
|
* @type {string}
|
@@ -7670,7 +7848,7 @@ var attachedInternalSymbol = Symbol('attachedInternal');
|
|
7670
7848
|
*
|
7671
7849
|
* ```
|
7672
7850
|
* <script type="module">
|
7673
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
7851
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
7674
7852
|
* document.createElement('monster-')
|
7675
7853
|
* </script>
|
7676
7854
|
* ```
|
@@ -8205,7 +8383,7 @@ var attributeObserverSymbol = Symbol('attributeObserver');
|
|
8205
8383
|
*
|
8206
8384
|
* ```
|
8207
8385
|
* <script type="module">
|
8208
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
8386
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
8209
8387
|
* document.createElement('monster-')
|
8210
8388
|
* </script>
|
8211
8389
|
* ```
|
@@ -9071,7 +9249,7 @@ var internal = Symbol('internal');
|
|
9071
9249
|
*
|
9072
9250
|
* ```
|
9073
9251
|
* <script type="module">
|
9074
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9252
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
9075
9253
|
* new Monster.Types.DataUrl()
|
9076
9254
|
* </script>
|
9077
9255
|
* ```
|
@@ -9080,7 +9258,7 @@ var internal = Symbol('internal');
|
|
9080
9258
|
*
|
9081
9259
|
* ```
|
9082
9260
|
* <script type="module">
|
9083
|
-
* import {DataUrl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9261
|
+
* import {DataUrl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/dataurl.js';
|
9084
9262
|
* new DataUrl()
|
9085
9263
|
* </script>
|
9086
9264
|
* ```
|
@@ -9160,7 +9338,7 @@ var DataUrl = /*#__PURE__*/function (_Base) {
|
|
9160
9338
|
*
|
9161
9339
|
* ```
|
9162
9340
|
* <script type="module">
|
9163
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9341
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
9164
9342
|
* console.log(Monster.Types.parseDataURL())
|
9165
9343
|
* </script>
|
9166
9344
|
* ```
|
@@ -9169,7 +9347,7 @@ var DataUrl = /*#__PURE__*/function (_Base) {
|
|
9169
9347
|
*
|
9170
9348
|
* ```
|
9171
9349
|
* <script type="module">
|
9172
|
-
* import {parseDataURL} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9350
|
+
* import {parseDataURL} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/dataurl.js';
|
9173
9351
|
* console.log(parseDataURL())
|
9174
9352
|
* </script>
|
9175
9353
|
* ```
|
@@ -9307,7 +9485,7 @@ var internal = Symbol('internal');
|
|
9307
9485
|
*
|
9308
9486
|
* ```
|
9309
9487
|
* <script type="module">
|
9310
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9488
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
9311
9489
|
* console.log(new Monster.Types.MediaType())
|
9312
9490
|
* </script>
|
9313
9491
|
* ```
|
@@ -9316,7 +9494,7 @@ var internal = Symbol('internal');
|
|
9316
9494
|
*
|
9317
9495
|
* ```
|
9318
9496
|
* <script type="module">
|
9319
|
-
* import {MediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9497
|
+
* import {MediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/mediatype.js';
|
9320
9498
|
* console.log(new MediaType())
|
9321
9499
|
* </script>
|
9322
9500
|
* ```
|
@@ -9434,7 +9612,7 @@ var MediaType = /*#__PURE__*/function (_Base) {
|
|
9434
9612
|
*
|
9435
9613
|
* ```
|
9436
9614
|
* <script type="module">
|
9437
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9615
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
9438
9616
|
* console.log(Monster.Types.parseMediaType())
|
9439
9617
|
* </script>
|
9440
9618
|
* ```
|
@@ -9443,7 +9621,7 @@ var MediaType = /*#__PURE__*/function (_Base) {
|
|
9443
9621
|
*
|
9444
9622
|
* ```
|
9445
9623
|
* <script type="module">
|
9446
|
-
* import {parseMediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9624
|
+
* import {parseMediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/dataurl.js';
|
9447
9625
|
* console.log(parseMediaType())
|
9448
9626
|
* </script>
|
9449
9627
|
* ```
|
@@ -9542,7 +9720,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
9542
9720
|
/* harmony import */ var _types_base_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(4);
|
9543
9721
|
/* harmony import */ var _types_global_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(16);
|
9544
9722
|
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(14);
|
9545
|
-
/* harmony import */ var
|
9723
|
+
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(33);
|
9724
|
+
/* harmony import */ var _theme_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(39);
|
9546
9725
|
|
9547
9726
|
/**
|
9548
9727
|
* @author schukai GmbH
|
@@ -9575,12 +9754,13 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
9575
9754
|
|
9576
9755
|
|
9577
9756
|
|
9757
|
+
|
9578
9758
|
/**
|
9579
9759
|
* you can call the method via the monster namespace `new Monster.DOM.Template()`.
|
9580
9760
|
*
|
9581
9761
|
* ```
|
9582
9762
|
* <script type="module">
|
9583
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9763
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
9584
9764
|
* new Monster.DOM.Template()
|
9585
9765
|
* </script>
|
9586
9766
|
* ```
|
@@ -9589,7 +9769,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
9589
9769
|
*
|
9590
9770
|
* ```
|
9591
9771
|
* <script type="module">
|
9592
|
-
* import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9772
|
+
* import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/template.js';
|
9593
9773
|
* new Template()
|
9594
9774
|
* </script>
|
9595
9775
|
* ```
|
@@ -9660,14 +9840,14 @@ var Template = /*#__PURE__*/function (_Base) {
|
|
9660
9840
|
*
|
9661
9841
|
* If no theme was specified, the default theme is `monster`.
|
9662
9842
|
*
|
9663
|
-
* Now it is looked if there is a template with the given ID and theme `id-theme` and if yes it is returned.
|
9843
|
+
* Now it is looked if there is a template with the given ID and theme `id-theme` and if yes it is returned.
|
9664
9844
|
* 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.
|
9665
|
-
*
|
9845
|
+
*
|
9666
9846
|
* You can call the method via the monster namespace `Monster.DOM.findDocumentTemplate()`.
|
9667
9847
|
*
|
9668
9848
|
* ```
|
9669
9849
|
* <script type="module">
|
9670
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9850
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
9671
9851
|
* Monster.DOM.findDocumentTemplate()
|
9672
9852
|
* </script>
|
9673
9853
|
* ```
|
@@ -9676,14 +9856,14 @@ var Template = /*#__PURE__*/function (_Base) {
|
|
9676
9856
|
*
|
9677
9857
|
* ```
|
9678
9858
|
* <script type="module">
|
9679
|
-
* import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9859
|
+
* import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/template.js';
|
9680
9860
|
* findDocumentTemplate()
|
9681
9861
|
* </script>
|
9682
9862
|
* ```
|
9683
9863
|
*
|
9684
9864
|
* @example
|
9685
9865
|
*
|
9686
|
-
* import { findDocumentTemplate } from "https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
9866
|
+
* import { findDocumentTemplate } from "https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/template.js";
|
9687
9867
|
*
|
9688
9868
|
* const template = document.createElement("template");
|
9689
9869
|
* template.id = "myTemplate";
|
@@ -9704,8 +9884,8 @@ var Template = /*#__PURE__*/function (_Base) {
|
|
9704
9884
|
* document
|
9705
9885
|
* .querySelector("html")
|
9706
9886
|
* .setAttribute("data-monster-theme-name", "myTheme");
|
9707
|
-
*
|
9708
|
-
* // now we don't get the default template,
|
9887
|
+
*
|
9888
|
+
* // now we don't get the default template,
|
9709
9889
|
* // but the template with the theme in the id
|
9710
9890
|
* const template2 = findDocumentTemplate("myTemplate");
|
9711
9891
|
* console.log(template2.createDocumentFragment());
|
@@ -9724,9 +9904,18 @@ var Template = /*#__PURE__*/function (_Base) {
|
|
9724
9904
|
|
9725
9905
|
function findDocumentTemplate(id, currentNode) {
|
9726
9906
|
(0,_types_validate_js__WEBPACK_IMPORTED_MODULE_3__.validateString)(id);
|
9907
|
+
var document = (0,_types_global_js__WEBPACK_IMPORTED_MODULE_2__.getGlobalObject)('document');
|
9908
|
+
var HTMLTemplateElement = (0,_types_global_js__WEBPACK_IMPORTED_MODULE_2__.getGlobalFunction)('HTMLTemplateElement');
|
9909
|
+
var DocumentFragment = (0,_types_global_js__WEBPACK_IMPORTED_MODULE_2__.getGlobalFunction)('DocumentFragment');
|
9910
|
+
var Document = (0,_types_global_js__WEBPACK_IMPORTED_MODULE_2__.getGlobalFunction)('Document');
|
9911
|
+
var prefixID;
|
9727
9912
|
|
9728
9913
|
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
|
9729
9914
|
if (currentNode instanceof Node) {
|
9915
|
+
if (currentNode.hasAttribute(_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_TEMPLATE_PREFIX)) {
|
9916
|
+
prefixID = currentNode.getAttribute(_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_TEMPLATE_PREFIX);
|
9917
|
+
}
|
9918
|
+
|
9730
9919
|
currentNode = currentNode.getRootNode();
|
9731
9920
|
|
9732
9921
|
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
|
@@ -9735,27 +9924,57 @@ function findDocumentTemplate(id, currentNode) {
|
|
9735
9924
|
}
|
9736
9925
|
|
9737
9926
|
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
|
9738
|
-
currentNode =
|
9927
|
+
currentNode = document;
|
9739
9928
|
}
|
9740
9929
|
}
|
9741
9930
|
|
9742
|
-
var
|
9743
|
-
var theme = (0,
|
9744
|
-
|
9745
|
-
|
9931
|
+
var template;
|
9932
|
+
var theme = (0,_theme_js__WEBPACK_IMPORTED_MODULE_5__.getDocumentTheme)();
|
9933
|
+
|
9934
|
+
if (prefixID) {
|
9935
|
+
var themedPrefixID = prefixID + '-' + id + '-' + theme.getName(); // current + themedPrefixID
|
9936
|
+
|
9937
|
+
template = currentNode.getElementById(themedPrefixID);
|
9938
|
+
|
9939
|
+
if (template instanceof HTMLTemplateElement) {
|
9940
|
+
return new Template(template);
|
9941
|
+
} // document + themedPrefixID
|
9942
|
+
|
9943
|
+
|
9944
|
+
template = document.getElementById(themedPrefixID);
|
9945
|
+
|
9946
|
+
if (template instanceof HTMLTemplateElement) {
|
9947
|
+
return new Template(template);
|
9948
|
+
}
|
9949
|
+
}
|
9950
|
+
|
9951
|
+
var themedID = id + '-' + theme.getName(); // current + themedID
|
9952
|
+
|
9953
|
+
template = currentNode.getElementById(themedID);
|
9746
9954
|
|
9747
9955
|
if (template instanceof HTMLTemplateElement) {
|
9748
9956
|
return new Template(template);
|
9749
|
-
}
|
9957
|
+
} // document + themedID
|
9958
|
+
|
9959
|
+
|
9960
|
+
template = document.getElementById(themedID);
|
9961
|
+
|
9962
|
+
if (template instanceof HTMLTemplateElement) {
|
9963
|
+
return new Template(template);
|
9964
|
+
} // current + ID
|
9965
|
+
|
9750
9966
|
|
9751
9967
|
template = currentNode.getElementById(id);
|
9752
9968
|
|
9753
9969
|
if (template instanceof HTMLTemplateElement) {
|
9754
9970
|
return new Template(template);
|
9755
|
-
}
|
9971
|
+
} // document + ID
|
9972
|
+
|
9973
|
+
|
9974
|
+
template = document.getElementById(id);
|
9756
9975
|
|
9757
|
-
if (
|
9758
|
-
return
|
9976
|
+
if (template instanceof HTMLTemplateElement) {
|
9977
|
+
return new Template(template);
|
9759
9978
|
}
|
9760
9979
|
|
9761
9980
|
throw new Error("template " + id + " not found.");
|
@@ -9816,7 +10035,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
9816
10035
|
*
|
9817
10036
|
* ```
|
9818
10037
|
* <script type="module">
|
9819
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10038
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
9820
10039
|
* console.log(new Monster.DOM.Theme())
|
9821
10040
|
* </script>
|
9822
10041
|
* ```
|
@@ -9825,14 +10044,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
9825
10044
|
*
|
9826
10045
|
* ```
|
9827
10046
|
* <script type="module">
|
9828
|
-
* import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10047
|
+
* import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/theme.js';
|
9829
10048
|
* console.log(new Theme())
|
9830
10049
|
* </script>
|
9831
10050
|
* ```
|
9832
10051
|
*
|
9833
10052
|
* @example
|
9834
10053
|
*
|
9835
|
-
* import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10054
|
+
* import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/theme.js';
|
9836
10055
|
*
|
9837
10056
|
* const theme = getDocumentTheme();
|
9838
10057
|
* console.log(theme.getName());
|
@@ -9922,23 +10141,25 @@ function getDocumentTheme() {
|
|
9922
10141
|
|
9923
10142
|
__webpack_require__.r(__webpack_exports__);
|
9924
10143
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
9925
|
-
/* harmony export */ "Monster": function() { return /* reexport safe */
|
10144
|
+
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_5__.Monster; },
|
9926
10145
|
/* harmony export */ "Updater": function() { return /* binding */ Updater; }
|
9927
10146
|
/* harmony export */ });
|
9928
|
-
/* harmony import */ var
|
9929
|
-
/* harmony import */ var
|
9930
|
-
/* harmony import */ var
|
9931
|
-
/* harmony import */ var
|
9932
|
-
/* harmony import */ var
|
9933
|
-
/* harmony import */ var
|
9934
|
-
/* harmony import */ var
|
9935
|
-
/* harmony import */ var
|
9936
|
-
/* harmony import */ var
|
9937
|
-
/* harmony import */ var
|
9938
|
-
/* harmony import */ var
|
9939
|
-
/* harmony import */ var
|
9940
|
-
/* harmony import */ var
|
9941
|
-
/* harmony import */ var
|
10147
|
+
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
10148
|
+
/* harmony import */ var _data_diff_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(20);
|
10149
|
+
/* harmony import */ var _data_pathfinder_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(18);
|
10150
|
+
/* harmony import */ var _data_pipe_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(22);
|
10151
|
+
/* harmony import */ var _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(33);
|
10152
|
+
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(2);
|
10153
|
+
/* harmony import */ var _types_base_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(4);
|
10154
|
+
/* harmony import */ var _types_is_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(9);
|
10155
|
+
/* harmony import */ var _types_observer_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(27);
|
10156
|
+
/* harmony import */ var _types_proxyobserver_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(26);
|
10157
|
+
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(14);
|
10158
|
+
/* harmony import */ var _util_clone_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(15);
|
10159
|
+
/* harmony import */ var _util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(41);
|
10160
|
+
/* harmony import */ var _events_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(42);
|
10161
|
+
/* harmony import */ var _template_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(38);
|
10162
|
+
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(43);
|
9942
10163
|
|
9943
10164
|
/**
|
9944
10165
|
* @author schukai GmbH
|
@@ -10002,17 +10223,22 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
10002
10223
|
|
10003
10224
|
|
10004
10225
|
|
10226
|
+
|
10227
|
+
|
10005
10228
|
/**
|
10006
10229
|
* The updater class connects an object with the dom. In this way, structures and contents in the DOM can be programmatically adapted via attributes.
|
10007
10230
|
*
|
10008
10231
|
* For example, to include a string from an object, the attribute `data-monster-replace` can be used.
|
10009
10232
|
* a further explanation can be found under {@tutorial dom-based-templating-implementation}.
|
10010
10233
|
*
|
10234
|
+
* Changes to attributes are made only when the direct values are changed. If you want to assign changes to other values
|
10235
|
+
* as well, you have to insert the attribute `data-monster-select-this`. This should be done with care, as it can reduce performance.
|
10236
|
+
*
|
10011
10237
|
* You can create an object of this class using the monster namespace `new Monster.DOM.Updater()`.
|
10012
10238
|
*
|
10013
10239
|
* ```
|
10014
10240
|
* <script type="module">
|
10015
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10241
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
10016
10242
|
* new Monster.DOM.Updater()
|
10017
10243
|
* </script>
|
10018
10244
|
* ```
|
@@ -10021,14 +10247,14 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
10021
10247
|
*
|
10022
10248
|
* ```
|
10023
10249
|
* <script type="module">
|
10024
|
-
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10250
|
+
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/updater.js';
|
10025
10251
|
* new Updater()
|
10026
10252
|
* </script>
|
10027
10253
|
* ```
|
10028
10254
|
*
|
10029
10255
|
* @example
|
10030
10256
|
*
|
10031
|
-
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
10257
|
+
* import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/updater.js';
|
10032
10258
|
*
|
10033
10259
|
* // First we prepare the html document.
|
10034
10260
|
* // This is done here via script, but can also be inserted into the document as pure html.
|
@@ -10042,7 +10268,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
10042
10268
|
* let obj = {
|
10043
10269
|
* headline: "Hello World",
|
10044
10270
|
* };
|
10045
|
-
*
|
10271
|
+
*
|
10046
10272
|
* // Now comes the real magic. we pass the updater the parent HTMLElement
|
10047
10273
|
* // and the desired data structure.
|
10048
10274
|
* const updater = new Updater(body, obj);
|
@@ -10087,28 +10313,27 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
10087
10313
|
* @type {HTMLElement}
|
10088
10314
|
*/
|
10089
10315
|
|
10090
|
-
_this.element = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_9__.validateInstance)(element, HTMLElement);
|
10091
10316
|
if (subject === undefined) subject = {};
|
10092
|
-
var a = subject;
|
10093
10317
|
|
10094
|
-
if (!(0,
|
10095
|
-
subject = new
|
10318
|
+
if (!(0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isInstance)(subject, _types_proxyobserver_js__WEBPACK_IMPORTED_MODULE_9__.ProxyObserver)) {
|
10319
|
+
subject = new _types_proxyobserver_js__WEBPACK_IMPORTED_MODULE_9__.ProxyObserver(subject);
|
10096
10320
|
}
|
10097
10321
|
|
10098
|
-
_this.
|
10099
|
-
|
10100
|
-
|
10101
|
-
|
10102
|
-
|
10103
|
-
|
10104
|
-
|
10322
|
+
_this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol] = {
|
10323
|
+
element: (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_10__.validateInstance)(element, HTMLElement),
|
10324
|
+
last: {},
|
10325
|
+
callbacks: new Map(),
|
10326
|
+
eventTypes: ['keyup', 'click', 'change', 'drop', 'touchend', 'input'],
|
10327
|
+
subject: subject
|
10328
|
+
};
|
10105
10329
|
|
10330
|
+
_this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].callbacks.set('checkstate', getCheckStateCallback.call(_assertThisInitialized(_this)));
|
10106
10331
|
|
10107
|
-
_this.subject
|
10108
|
-
var s = _this.subject.getRealSubject();
|
10332
|
+
_this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.attachObserver(new _types_observer_js__WEBPACK_IMPORTED_MODULE_8__.Observer(function () {
|
10333
|
+
var s = _this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject();
|
10109
10334
|
|
10110
|
-
var diffResult = (0,
|
10111
|
-
_this.last = (0,
|
10335
|
+
var diffResult = (0,_data_diff_js__WEBPACK_IMPORTED_MODULE_1__.diff)(_this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].last, s);
|
10336
|
+
_this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].last = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(s);
|
10112
10337
|
|
10113
10338
|
for (var _i = 0, _Object$entries = Object.entries(diffResult); _i < _Object$entries.length; _i++) {
|
10114
10339
|
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
@@ -10120,7 +10345,7 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
10120
10345
|
updateAttributes.call(_assertThisInitialized(_this), change);
|
10121
10346
|
}
|
10122
10347
|
}));
|
10123
|
-
|
10348
|
+
|
10124
10349
|
return _this;
|
10125
10350
|
}
|
10126
10351
|
/**
|
@@ -10136,7 +10361,7 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
10136
10361
|
_createClass(Updater, [{
|
10137
10362
|
key: "setEventTypes",
|
10138
10363
|
value: function setEventTypes(types) {
|
10139
|
-
this.eventTypes = (0,
|
10364
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].eventTypes = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_10__.validateArray)(types);
|
10140
10365
|
return this;
|
10141
10366
|
}
|
10142
10367
|
/**
|
@@ -10150,6 +10375,7 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
10150
10375
|
*
|
10151
10376
|
* @since 1.9.0
|
10152
10377
|
* @return {Updater}
|
10378
|
+
* @throws {Error} the bind argument must start as a value with a path
|
10153
10379
|
*/
|
10154
10380
|
|
10155
10381
|
}, {
|
@@ -10157,13 +10383,17 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
10157
10383
|
value: function enableEventProcessing() {
|
10158
10384
|
this.disableEventProcessing();
|
10159
10385
|
|
10160
|
-
var _iterator = _createForOfIteratorHelper(this.eventTypes),
|
10386
|
+
var _iterator = _createForOfIteratorHelper(this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].eventTypes),
|
10161
10387
|
_step;
|
10162
10388
|
|
10163
10389
|
try {
|
10164
10390
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
10165
10391
|
var type = _step.value;
|
10166
|
-
|
10392
|
+
// @see https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
|
10393
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.addEventListener(type, getControlEventHandler.call(this), {
|
10394
|
+
capture: true,
|
10395
|
+
passive: true
|
10396
|
+
});
|
10167
10397
|
}
|
10168
10398
|
} catch (err) {
|
10169
10399
|
_iterator.e(err);
|
@@ -10183,13 +10413,13 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
10183
10413
|
}, {
|
10184
10414
|
key: "disableEventProcessing",
|
10185
10415
|
value: function disableEventProcessing() {
|
10186
|
-
var _iterator2 = _createForOfIteratorHelper(this.eventTypes),
|
10416
|
+
var _iterator2 = _createForOfIteratorHelper(this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].eventTypes),
|
10187
10417
|
_step2;
|
10188
10418
|
|
10189
10419
|
try {
|
10190
10420
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
10191
10421
|
var type = _step2.value;
|
10192
|
-
this.element.removeEventListener(type, getControlEventHandler.call(this));
|
10422
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.removeEventListener(type, getControlEventHandler.call(this));
|
10193
10423
|
}
|
10194
10424
|
} catch (err) {
|
10195
10425
|
_iterator2.e(err);
|
@@ -10218,10 +10448,23 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
10218
10448
|
value: function run() {
|
10219
10449
|
// the key __init__has no further meaning and is only
|
10220
10450
|
// used to create the diff for empty objects.
|
10221
|
-
this.last = {
|
10451
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].last = {
|
10222
10452
|
'__init__': true
|
10223
10453
|
};
|
10224
|
-
return this.subject.notifyObservers();
|
10454
|
+
return this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.notifyObservers();
|
10455
|
+
}
|
10456
|
+
/**
|
10457
|
+
* Gets the values of bound elements and changes them in subject
|
10458
|
+
*
|
10459
|
+
* @since 1.27.0
|
10460
|
+
* @return {Monster.DOM.Updater}
|
10461
|
+
*/
|
10462
|
+
|
10463
|
+
}, {
|
10464
|
+
key: "retrieve",
|
10465
|
+
value: function retrieve() {
|
10466
|
+
retrieveFromBindings.call(this);
|
10467
|
+
return this;
|
10225
10468
|
}
|
10226
10469
|
/**
|
10227
10470
|
* If you have passed a ProxyObserver in the constructor, you will get the object that the ProxyObserver manages here.
|
@@ -10236,7 +10479,7 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
10236
10479
|
}, {
|
10237
10480
|
key: "getSubject",
|
10238
10481
|
value: function getSubject() {
|
10239
|
-
return this.subject.getSubject();
|
10482
|
+
return this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getSubject();
|
10240
10483
|
}
|
10241
10484
|
/**
|
10242
10485
|
* This method can be used to register commands that can be called via call: instruction.
|
@@ -10252,13 +10495,13 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
10252
10495
|
}, {
|
10253
10496
|
key: "setCallback",
|
10254
10497
|
value: function setCallback(name, callback) {
|
10255
|
-
this.callbacks.set(name, callback);
|
10498
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].callbacks.set(name, callback);
|
10256
10499
|
return this;
|
10257
10500
|
}
|
10258
10501
|
}]);
|
10259
10502
|
|
10260
10503
|
return Updater;
|
10261
|
-
}(
|
10504
|
+
}(_types_base_js__WEBPACK_IMPORTED_MODULE_6__.Base);
|
10262
10505
|
/**
|
10263
10506
|
* @private
|
10264
10507
|
* @since 1.9.0
|
@@ -10270,12 +10513,13 @@ var Updater = /*#__PURE__*/function (_Base) {
|
|
10270
10513
|
function getCheckStateCallback() {
|
10271
10514
|
var self = this;
|
10272
10515
|
return function (current) {
|
10516
|
+
// this is a reference to the current object (therefore no array function here)
|
10273
10517
|
if (this instanceof HTMLInputElement) {
|
10274
10518
|
if (['radio', 'checkbox'].indexOf(this.type) !== -1) {
|
10275
10519
|
return this.value + "" === current + "" ? 'true' : undefined;
|
10276
10520
|
}
|
10277
10521
|
} else if (this instanceof HTMLOptionElement) {
|
10278
|
-
if ((0,
|
10522
|
+
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isArray)(current) && current.indexOf(this.value) !== -1) {
|
10279
10523
|
return 'true';
|
10280
10524
|
}
|
10281
10525
|
|
@@ -10293,6 +10537,7 @@ var symbol = Symbol('EventHandler');
|
|
10293
10537
|
* @private
|
10294
10538
|
* @return {function}
|
10295
10539
|
* @this Updater
|
10540
|
+
* @throws {Error} the bind argument must start as a value with a path
|
10296
10541
|
*/
|
10297
10542
|
|
10298
10543
|
function getControlEventHandler() {
|
@@ -10301,97 +10546,112 @@ function getControlEventHandler() {
|
|
10301
10546
|
if (self[symbol]) {
|
10302
10547
|
return self[symbol];
|
10303
10548
|
}
|
10304
|
-
|
10305
|
-
var pathfinder = new _data_pathfinder_js__WEBPACK_IMPORTED_MODULE_1__.Pathfinder(this.subject.getSubject());
|
10306
10549
|
/**
|
10307
10550
|
* @throws {Error} the bind argument must start as a value with a path.
|
10308
10551
|
* @throws {Error} unsupported object
|
10309
10552
|
* @param {Event} event
|
10310
10553
|
*/
|
10311
10554
|
|
10312
|
-
self[symbol] = function (event) {
|
10313
|
-
var _element$constructor, _Object$getOwnPropert;
|
10314
10555
|
|
10315
|
-
|
10556
|
+
self[symbol] = function (event) {
|
10557
|
+
var element = (0,_events_js__WEBPACK_IMPORTED_MODULE_13__.findTargetElementFromEvent)(event, _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_BIND);
|
10316
10558
|
|
10317
|
-
if (
|
10559
|
+
if (element === undefined) {
|
10318
10560
|
return;
|
10319
10561
|
}
|
10320
10562
|
|
10321
|
-
|
10563
|
+
retrieveAndSetValue.call(self, element);
|
10564
|
+
};
|
10322
10565
|
|
10323
|
-
|
10324
|
-
|
10325
|
-
|
10566
|
+
return self[symbol];
|
10567
|
+
}
|
10568
|
+
/**
|
10569
|
+
* @throws {Error} the bind argument must start as a value with a path
|
10570
|
+
* @param {HTMLElement} element
|
10571
|
+
* @return void
|
10572
|
+
*/
|
10326
10573
|
|
10327
|
-
path = path.substr(5);
|
10328
|
-
var value;
|
10329
10574
|
|
10330
|
-
|
10331
|
-
|
10332
|
-
case 'checkbox':
|
10333
|
-
value = element.checked ? element.value : undefined;
|
10334
|
-
break;
|
10575
|
+
function retrieveAndSetValue(element) {
|
10576
|
+
var _element$constructor, _Object$getOwnPropert;
|
10335
10577
|
|
10336
|
-
|
10337
|
-
|
10338
|
-
|
10339
|
-
}
|
10340
|
-
} else if (element instanceof HTMLTextAreaElement) {
|
10341
|
-
value = element.value;
|
10342
|
-
} else if (element instanceof HTMLSelectElement) {
|
10343
|
-
switch (element.type) {
|
10344
|
-
case 'select-one':
|
10345
|
-
value = element.value;
|
10346
|
-
break;
|
10347
|
-
|
10348
|
-
case 'select-multiple':
|
10349
|
-
value = element.value;
|
10350
|
-
var options = element === null || element === void 0 ? void 0 : element.selectedOptions;
|
10351
|
-
if (options === undefined) options = element.querySelectorAll(":scope option:checked");
|
10352
|
-
value = Array.from(options).map(function (_ref) {
|
10353
|
-
var value = _ref.value;
|
10354
|
-
return value;
|
10355
|
-
});
|
10356
|
-
break;
|
10357
|
-
} // values from customelements
|
10578
|
+
var self = this;
|
10579
|
+
var pathfinder = new _data_pathfinder_js__WEBPACK_IMPORTED_MODULE_2__.Pathfinder(self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getSubject());
|
10580
|
+
var path = element.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_BIND);
|
10358
10581
|
|
10359
|
-
|
10360
|
-
|
10361
|
-
|
10362
|
-
|
10363
|
-
|
10582
|
+
if (path.indexOf('path:') !== 0) {
|
10583
|
+
throw new Error('the bind argument must start as a value with a path');
|
10584
|
+
}
|
10585
|
+
|
10586
|
+
path = path.substr(5);
|
10587
|
+
var value;
|
10364
10588
|
|
10365
|
-
|
10366
|
-
|
10367
|
-
|
10368
|
-
|
10589
|
+
if (element instanceof HTMLInputElement) {
|
10590
|
+
switch (element.type) {
|
10591
|
+
case 'checkbox':
|
10592
|
+
value = element.checked ? element.value : undefined;
|
10593
|
+
break;
|
10369
10594
|
|
10370
|
-
|
10371
|
-
|
10595
|
+
default:
|
10596
|
+
value = element.value;
|
10597
|
+
break;
|
10372
10598
|
}
|
10373
|
-
}
|
10599
|
+
} else if (element instanceof HTMLTextAreaElement) {
|
10600
|
+
value = element.value;
|
10601
|
+
} else if (element instanceof HTMLSelectElement) {
|
10602
|
+
switch (element.type) {
|
10603
|
+
case 'select-one':
|
10604
|
+
value = element.value;
|
10605
|
+
break;
|
10374
10606
|
|
10375
|
-
|
10607
|
+
case 'select-multiple':
|
10608
|
+
value = element.value;
|
10609
|
+
var options = element === null || element === void 0 ? void 0 : element.selectedOptions;
|
10610
|
+
if (options === undefined) options = element.querySelectorAll(":scope option:checked");
|
10611
|
+
value = Array.from(options).map(function (_ref) {
|
10612
|
+
var value = _ref.value;
|
10613
|
+
return value;
|
10614
|
+
});
|
10615
|
+
break;
|
10616
|
+
} // values from customelements
|
10617
|
+
|
10618
|
+
} 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')) {
|
10619
|
+
value = element === null || element === void 0 ? void 0 : element['value'];
|
10620
|
+
} else {
|
10621
|
+
throw new Error("unsupported object");
|
10622
|
+
}
|
10623
|
+
|
10624
|
+
var copy = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject());
|
10625
|
+
var pf = new _data_pathfinder_js__WEBPACK_IMPORTED_MODULE_2__.Pathfinder(copy);
|
10626
|
+
pf.setVia(path, value);
|
10627
|
+
var diffResult = (0,_data_diff_js__WEBPACK_IMPORTED_MODULE_1__.diff)(copy, self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject());
|
10628
|
+
|
10629
|
+
if (diffResult.length > 0) {
|
10630
|
+
pathfinder.setVia(path, value);
|
10631
|
+
}
|
10376
10632
|
}
|
10377
10633
|
/**
|
10378
|
-
* @
|
10379
|
-
* @
|
10380
|
-
* @param {object} change
|
10381
|
-
* @return {void}
|
10634
|
+
* @since 1.27.0
|
10635
|
+
* @return void
|
10382
10636
|
*/
|
10383
10637
|
|
10384
10638
|
|
10385
|
-
function
|
10386
|
-
var
|
10639
|
+
function retrieveFromBindings() {
|
10640
|
+
var self = this;
|
10641
|
+
|
10642
|
+
if (self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.matches('[' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_BIND + ']')) {
|
10643
|
+
retrieveAndSetValue.call(self, element);
|
10644
|
+
}
|
10645
|
+
|
10646
|
+
var _iterator3 = _createForOfIteratorHelper(self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.querySelectorAll('[' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_BIND + ']').entries()),
|
10387
10647
|
_step3;
|
10388
10648
|
|
10389
10649
|
try {
|
10390
10650
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
10391
10651
|
var _step3$value = _slicedToArray(_step3.value, 2),
|
10392
|
-
|
10652
|
+
_element = _step3$value[1];
|
10393
10653
|
|
10394
|
-
|
10654
|
+
retrieveAndSetValue.call(self, _element);
|
10395
10655
|
}
|
10396
10656
|
} catch (err) {
|
10397
10657
|
_iterator3.e(err);
|
@@ -10399,6 +10659,33 @@ function removeElement(change) {
|
|
10399
10659
|
_iterator3.f();
|
10400
10660
|
}
|
10401
10661
|
}
|
10662
|
+
/**
|
10663
|
+
* @private
|
10664
|
+
* @since 1.8.0
|
10665
|
+
* @param {object} change
|
10666
|
+
* @return {void}
|
10667
|
+
*/
|
10668
|
+
|
10669
|
+
|
10670
|
+
function removeElement(change) {
|
10671
|
+
var self = this;
|
10672
|
+
|
10673
|
+
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()),
|
10674
|
+
_step4;
|
10675
|
+
|
10676
|
+
try {
|
10677
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
10678
|
+
var _step4$value = _slicedToArray(_step4.value, 2),
|
10679
|
+
_element2 = _step4$value[1];
|
10680
|
+
|
10681
|
+
_element2.parentNode.removeChild(_element2);
|
10682
|
+
}
|
10683
|
+
} catch (err) {
|
10684
|
+
_iterator4.e(err);
|
10685
|
+
} finally {
|
10686
|
+
_iterator4.f();
|
10687
|
+
}
|
10688
|
+
}
|
10402
10689
|
/**
|
10403
10690
|
* @private
|
10404
10691
|
* @since 1.8.0
|
@@ -10416,56 +10703,56 @@ function insertElement(change) {
|
|
10416
10703
|
var _this2 = this;
|
10417
10704
|
|
10418
10705
|
var self = this;
|
10419
|
-
var subject = self.subject.getRealSubject();
|
10420
|
-
var document = (0,
|
10706
|
+
var subject = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject();
|
10707
|
+
var document = (0,_util_js__WEBPACK_IMPORTED_MODULE_15__.getDocument)();
|
10421
10708
|
var mem = new WeakSet();
|
10422
10709
|
var wd = 0;
|
10423
10710
|
|
10424
10711
|
while (true) {
|
10425
10712
|
var found = false;
|
10426
10713
|
wd++;
|
10427
|
-
var p = (0,
|
10428
|
-
if (!(0,
|
10714
|
+
var p = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(change === null || change === void 0 ? void 0 : change['path']);
|
10715
|
+
if (!(0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isArray)(p)) return this;
|
10429
10716
|
|
10430
10717
|
while (p.length > 0) {
|
10431
10718
|
var current = p.join('.');
|
10432
|
-
var list = this.element.querySelectorAll(':scope [' +
|
10719
|
+
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();
|
10433
10720
|
|
10434
|
-
var
|
10435
|
-
|
10721
|
+
var _iterator5 = _createForOfIteratorHelper(list),
|
10722
|
+
_step5;
|
10436
10723
|
|
10437
10724
|
try {
|
10438
10725
|
var _loop = function _loop() {
|
10439
|
-
var
|
10440
|
-
containerElement =
|
10726
|
+
var _step5$value = _slicedToArray(_step5.value, 2),
|
10727
|
+
containerElement = _step5$value[1];
|
10441
10728
|
|
10442
10729
|
if (mem.has(containerElement)) return "continue";
|
10443
10730
|
mem.add(containerElement);
|
10444
10731
|
found = true;
|
10445
|
-
var attributes = containerElement.getAttribute(
|
10446
|
-
var def = (0,
|
10732
|
+
var attributes = containerElement.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_INSERT);
|
10733
|
+
var def = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(attributes);
|
10447
10734
|
var i = def.indexOf(' ');
|
10448
|
-
var key = (0,
|
10735
|
+
var key = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(def.substr(0, i));
|
10449
10736
|
var refPrefix = key + '-';
|
10450
|
-
var cmd = (0,
|
10737
|
+
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
|
10451
10738
|
|
10452
10739
|
if (cmd.indexOf('|') > 0) {
|
10453
10740
|
throw new Error("pipes are not allowed when cloning a node.");
|
10454
10741
|
}
|
10455
10742
|
|
10456
|
-
var pipe = new
|
10743
|
+
var pipe = new _data_pipe_js__WEBPACK_IMPORTED_MODULE_3__.Pipe(cmd);
|
10457
10744
|
|
10458
|
-
_this2.callbacks.forEach(function (f, n) {
|
10745
|
+
_this2[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].callbacks.forEach(function (f, n) {
|
10459
10746
|
pipe.setCallback(n, f);
|
10460
10747
|
});
|
10461
10748
|
|
10462
10749
|
var value = void 0;
|
10463
10750
|
|
10464
10751
|
try {
|
10465
|
-
containerElement.removeAttribute(
|
10752
|
+
containerElement.removeAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE);
|
10466
10753
|
value = pipe.run(subject);
|
10467
10754
|
} catch (e) {
|
10468
|
-
containerElement.setAttribute(
|
10755
|
+
containerElement.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE, e.message);
|
10469
10756
|
}
|
10470
10757
|
|
10471
10758
|
var dataPath = cmd.split(':').pop();
|
@@ -10475,7 +10762,7 @@ function insertElement(change) {
|
|
10475
10762
|
insertPoint = containerElement.lastChild;
|
10476
10763
|
}
|
10477
10764
|
|
10478
|
-
if (!(0,
|
10765
|
+
if (!(0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isIterable)(value)) {
|
10479
10766
|
throw new Error('the value is not iterable');
|
10480
10767
|
}
|
10481
10768
|
|
@@ -10489,7 +10776,7 @@ function insertElement(change) {
|
|
10489
10776
|
var ref = refPrefix + _i3;
|
10490
10777
|
var currentPath = dataPath + "." + _i3;
|
10491
10778
|
available.add(ref);
|
10492
|
-
var refElement = containerElement.querySelector('[' +
|
10779
|
+
var refElement = containerElement.querySelector('[' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_INSERT_REFERENCE + '="' + ref + '"]');
|
10493
10780
|
|
10494
10781
|
if (refElement instanceof HTMLElement) {
|
10495
10782
|
insertPoint = refElement;
|
@@ -10499,27 +10786,27 @@ function insertElement(change) {
|
|
10499
10786
|
appendNewDocumentFragment(containerElement, key, ref, currentPath);
|
10500
10787
|
}
|
10501
10788
|
|
10502
|
-
var nodes = containerElement.querySelectorAll('[' +
|
10789
|
+
var nodes = containerElement.querySelectorAll('[' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_INSERT_REFERENCE + '*="' + refPrefix + '"]');
|
10503
10790
|
|
10504
10791
|
for (var _i4 = 0, _Object$entries3 = Object.entries(nodes); _i4 < _Object$entries3.length; _i4++) {
|
10505
10792
|
var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i4], 2),
|
10506
10793
|
node = _Object$entries3$_i[1];
|
10507
10794
|
|
10508
|
-
if (!available.has(node.getAttribute(
|
10795
|
+
if (!available.has(node.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_INSERT_REFERENCE))) {
|
10509
10796
|
containerElement.removeChild(node);
|
10510
10797
|
}
|
10511
10798
|
}
|
10512
10799
|
};
|
10513
10800
|
|
10514
|
-
for (
|
10801
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
10515
10802
|
var _ret = _loop();
|
10516
10803
|
|
10517
10804
|
if (_ret === "continue") continue;
|
10518
10805
|
}
|
10519
10806
|
} catch (err) {
|
10520
|
-
|
10807
|
+
_iterator5.e(err);
|
10521
10808
|
} finally {
|
10522
|
-
|
10809
|
+
_iterator5.f();
|
10523
10810
|
}
|
10524
10811
|
|
10525
10812
|
p.pop();
|
@@ -10545,7 +10832,7 @@ function insertElement(change) {
|
|
10545
10832
|
|
10546
10833
|
|
10547
10834
|
function appendNewDocumentFragment(container, key, ref, path) {
|
10548
|
-
var template = (0,
|
10835
|
+
var template = (0,_template_js__WEBPACK_IMPORTED_MODULE_14__.findDocumentTemplate)(key, container);
|
10549
10836
|
var nodes = template.createDocumentFragment();
|
10550
10837
|
|
10551
10838
|
for (var _i5 = 0, _Object$entries4 = Object.entries(nodes.childNodes); _i5 < _Object$entries4.length; _i5++) {
|
@@ -10554,7 +10841,7 @@ function appendNewDocumentFragment(container, key, ref, path) {
|
|
10554
10841
|
|
10555
10842
|
if (node instanceof HTMLElement) {
|
10556
10843
|
applyRecursive(node, key, path);
|
10557
|
-
node.setAttribute(
|
10844
|
+
node.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_INSERT_REFERENCE, ref);
|
10558
10845
|
}
|
10559
10846
|
|
10560
10847
|
container.appendChild(node);
|
@@ -10572,15 +10859,15 @@ function appendNewDocumentFragment(container, key, ref, path) {
|
|
10572
10859
|
|
10573
10860
|
function applyRecursive(node, key, path) {
|
10574
10861
|
if (node instanceof HTMLElement) {
|
10575
|
-
if (node.hasAttribute(
|
10576
|
-
var value = node.getAttribute(
|
10577
|
-
node.setAttribute(
|
10862
|
+
if (node.hasAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_REPLACE)) {
|
10863
|
+
var value = node.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_REPLACE);
|
10864
|
+
node.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_REPLACE, value.replaceAll("path:" + key, "path:" + path));
|
10578
10865
|
}
|
10579
10866
|
|
10580
|
-
if (node.hasAttribute(
|
10581
|
-
var _value = node.getAttribute(
|
10867
|
+
if (node.hasAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES)) {
|
10868
|
+
var _value = node.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES);
|
10582
10869
|
|
10583
|
-
node.setAttribute(
|
10870
|
+
node.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES, _value.replaceAll("path:" + key, "path:" + path));
|
10584
10871
|
}
|
10585
10872
|
|
10586
10873
|
for (var _i6 = 0, _Object$entries5 = Object.entries(node.childNodes); _i6 < _Object$entries5.length; _i6++) {
|
@@ -10602,10 +10889,10 @@ function applyRecursive(node, key, path) {
|
|
10602
10889
|
|
10603
10890
|
function updateContent(change) {
|
10604
10891
|
var self = this;
|
10605
|
-
var subject = self.subject.getRealSubject();
|
10606
|
-
var p = (0,
|
10607
|
-
runUpdateContent.call(this, this.element, p, subject);
|
10608
|
-
var slots = this.element.querySelectorAll('slot');
|
10892
|
+
var subject = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject();
|
10893
|
+
var p = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(change === null || change === void 0 ? void 0 : change['path']);
|
10894
|
+
runUpdateContent.call(this, this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element, p, subject);
|
10895
|
+
var slots = this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element.querySelectorAll('slot');
|
10609
10896
|
|
10610
10897
|
if (slots.length > 0) {
|
10611
10898
|
for (var _i7 = 0, _Object$entries6 = Object.entries(slots); _i7 < _Object$entries6.length; _i7++) {
|
@@ -10614,9 +10901,9 @@ function updateContent(change) {
|
|
10614
10901
|
|
10615
10902
|
for (var _i8 = 0, _Object$entries7 = Object.entries(slot.assignedNodes()); _i8 < _Object$entries7.length; _i8++) {
|
10616
10903
|
var _Object$entries7$_i = _slicedToArray(_Object$entries7[_i8], 2),
|
10617
|
-
|
10904
|
+
_element3 = _Object$entries7$_i[1];
|
10618
10905
|
|
10619
|
-
runUpdateContent.call(this,
|
10906
|
+
runUpdateContent.call(this, _element3, p, subject);
|
10620
10907
|
}
|
10621
10908
|
}
|
10622
10909
|
}
|
@@ -10634,16 +10921,16 @@ function updateContent(change) {
|
|
10634
10921
|
function runUpdateContent(container, parts, subject) {
|
10635
10922
|
var _this3 = this;
|
10636
10923
|
|
10637
|
-
if (!(0,
|
10924
|
+
if (!(0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isArray)(parts)) return;
|
10638
10925
|
if (!(container instanceof HTMLElement)) return;
|
10639
|
-
parts = (0,
|
10926
|
+
parts = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(parts);
|
10640
10927
|
var mem = new WeakSet();
|
10641
10928
|
|
10642
10929
|
while (parts.length > 0) {
|
10643
10930
|
var current = parts.join('.');
|
10644
10931
|
parts.pop(); // Unfortunately, static data is always changed as well, since it is not possible to react to changes here.
|
10645
10932
|
|
10646
|
-
var query = '[' +
|
10933
|
+
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:"]';
|
10647
10934
|
var e = container.querySelectorAll('' + query);
|
10648
10935
|
var iterator = new Set(_toConsumableArray(e));
|
10649
10936
|
|
@@ -10654,21 +10941,21 @@ function runUpdateContent(container, parts, subject) {
|
|
10654
10941
|
iterator.forEach(function (key, element) {
|
10655
10942
|
if (mem.has(element)) return;
|
10656
10943
|
mem.add(element);
|
10657
|
-
var attributes = element.getAttribute(
|
10658
|
-
var cmd = (0,
|
10659
|
-
var pipe = new
|
10944
|
+
var attributes = element.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_REPLACE);
|
10945
|
+
var cmd = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(attributes);
|
10946
|
+
var pipe = new _data_pipe_js__WEBPACK_IMPORTED_MODULE_3__.Pipe(cmd);
|
10660
10947
|
|
10661
|
-
_this3.callbacks.forEach(function (f, n) {
|
10948
|
+
_this3[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].callbacks.forEach(function (f, n) {
|
10662
10949
|
pipe.setCallback(n, f);
|
10663
10950
|
});
|
10664
10951
|
|
10665
10952
|
var value;
|
10666
10953
|
|
10667
10954
|
try {
|
10668
|
-
element.removeAttribute(
|
10955
|
+
element.removeAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE);
|
10669
10956
|
value = pipe.run(subject);
|
10670
10957
|
} catch (e) {
|
10671
|
-
element.setAttribute(
|
10958
|
+
element.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE, e.message);
|
10672
10959
|
}
|
10673
10960
|
|
10674
10961
|
if (value instanceof HTMLElement) {
|
@@ -10693,9 +10980,9 @@ function runUpdateContent(container, parts, subject) {
|
|
10693
10980
|
|
10694
10981
|
|
10695
10982
|
function updateAttributes(change) {
|
10696
|
-
var subject = this.subject.getRealSubject();
|
10697
|
-
var p = (0,
|
10698
|
-
runUpdateAttributes.call(this, this.element, p, subject);
|
10983
|
+
var subject = this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].subject.getRealSubject();
|
10984
|
+
var p = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(change === null || change === void 0 ? void 0 : change['path']);
|
10985
|
+
runUpdateAttributes.call(this, this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].element, p, subject);
|
10699
10986
|
}
|
10700
10987
|
/**
|
10701
10988
|
* @private
|
@@ -10711,15 +10998,15 @@ function runUpdateAttributes(container, parts, subject) {
|
|
10711
10998
|
var _this4 = this;
|
10712
10999
|
|
10713
11000
|
var self = this;
|
10714
|
-
if (!(0,
|
10715
|
-
parts = (0,
|
11001
|
+
if (!(0,_types_is_js__WEBPACK_IMPORTED_MODULE_7__.isArray)(parts)) return;
|
11002
|
+
parts = (0,_util_clone_js__WEBPACK_IMPORTED_MODULE_11__.clone)(parts);
|
10716
11003
|
var mem = new WeakSet();
|
10717
11004
|
|
10718
11005
|
while (parts.length > 0) {
|
10719
11006
|
var current = parts.join('.');
|
10720
11007
|
parts.pop();
|
10721
11008
|
var iterator = new Set();
|
10722
|
-
var query = '[' +
|
11009
|
+
var query = '[' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_SELECT_THIS + '], [' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES + '*="path:' + current + '"], [' + _dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES + '^="static:"]';
|
10723
11010
|
var e = container.querySelectorAll(query);
|
10724
11011
|
|
10725
11012
|
if (e.length > 0) {
|
@@ -10733,27 +11020,27 @@ function runUpdateAttributes(container, parts, subject) {
|
|
10733
11020
|
iterator.forEach(function (key, element) {
|
10734
11021
|
if (mem.has(element)) return;
|
10735
11022
|
mem.add(element);
|
10736
|
-
var attributes = element.getAttribute(
|
11023
|
+
var attributes = element.getAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_UPDATER_ATTRIBUTES);
|
10737
11024
|
|
10738
11025
|
var _loop2 = function _loop2() {
|
10739
11026
|
var _Object$entries8$_i = _slicedToArray(_Object$entries8[_i9], 2),
|
10740
11027
|
def = _Object$entries8$_i[1];
|
10741
11028
|
|
10742
|
-
def = (0,
|
11029
|
+
def = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(def);
|
10743
11030
|
var i = def.indexOf(' ');
|
10744
|
-
var name = (0,
|
10745
|
-
var cmd = (0,
|
10746
|
-
var pipe = new
|
10747
|
-
self.callbacks.forEach(function (f, n) {
|
11031
|
+
var name = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(def.substr(0, i));
|
11032
|
+
var cmd = (0,_util_trimspaces_js__WEBPACK_IMPORTED_MODULE_12__.trimSpaces)(def.substr(i));
|
11033
|
+
var pipe = new _data_pipe_js__WEBPACK_IMPORTED_MODULE_3__.Pipe(cmd);
|
11034
|
+
self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol].callbacks.forEach(function (f, n) {
|
10748
11035
|
pipe.setCallback(n, f, element);
|
10749
11036
|
});
|
10750
11037
|
var value = void 0;
|
10751
11038
|
|
10752
11039
|
try {
|
10753
|
-
element.removeAttribute(
|
11040
|
+
element.removeAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE);
|
10754
11041
|
value = pipe.run(subject);
|
10755
11042
|
} catch (e) {
|
10756
|
-
element.setAttribute(
|
11043
|
+
element.setAttribute(_dom_constants_js__WEBPACK_IMPORTED_MODULE_4__.ATTRIBUTE_ERRORMESSAGE, e.message);
|
10757
11044
|
}
|
10758
11045
|
|
10759
11046
|
if (value === undefined) {
|
@@ -10819,19 +11106,23 @@ function handleInputControlAttributeUpdate(element, name, value) {
|
|
10819
11106
|
} else if (element instanceof HTMLInputElement) {
|
10820
11107
|
switch (element.type) {
|
10821
11108
|
case 'radio':
|
10822
|
-
if (name === 'checked'
|
10823
|
-
|
10824
|
-
|
10825
|
-
|
11109
|
+
if (name === 'checked') {
|
11110
|
+
if (value !== undefined) {
|
11111
|
+
element.checked = true;
|
11112
|
+
} else {
|
11113
|
+
element.checked = false;
|
11114
|
+
}
|
10826
11115
|
}
|
10827
11116
|
|
10828
11117
|
break;
|
10829
11118
|
|
10830
11119
|
case 'checkbox':
|
10831
|
-
if (name === 'checked'
|
10832
|
-
|
10833
|
-
|
10834
|
-
|
11120
|
+
if (name === 'checked') {
|
11121
|
+
if (value !== undefined) {
|
11122
|
+
element.checked = true;
|
11123
|
+
} else {
|
11124
|
+
element.checked = false;
|
11125
|
+
}
|
10835
11126
|
}
|
10836
11127
|
|
10837
11128
|
break;
|
@@ -10851,7 +11142,7 @@ function handleInputControlAttributeUpdate(element, name, value) {
|
|
10851
11142
|
}
|
10852
11143
|
}
|
10853
11144
|
|
10854
|
-
(0,
|
11145
|
+
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_5__.assignToNamespace)('Monster.DOM', Updater);
|
10855
11146
|
|
10856
11147
|
|
10857
11148
|
/***/ }),
|
@@ -10897,7 +11188,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
10897
11188
|
*
|
10898
11189
|
* ```
|
10899
11190
|
* <script type="module">
|
10900
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11191
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
10901
11192
|
* Monster.Util.trimSpaces(" hello ")
|
10902
11193
|
* </script>
|
10903
11194
|
* ```
|
@@ -10906,7 +11197,7 @@ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || func
|
|
10906
11197
|
*
|
10907
11198
|
* ```
|
10908
11199
|
* <script type="module">
|
10909
|
-
* import {trimSpaces} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11200
|
+
* import {trimSpaces} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/util/trimspaces.js';
|
10910
11201
|
* trimSpaces(' hello \\ ')
|
10911
11202
|
* </script>
|
10912
11203
|
* ```
|
@@ -10983,29 +11274,179 @@ function trimSpaces(value) {
|
|
10983
11274
|
__webpack_require__.r(__webpack_exports__);
|
10984
11275
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
10985
11276
|
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_0__.Monster; },
|
10986
|
-
/* harmony export */ "
|
10987
|
-
/* harmony export */ "
|
10988
|
-
/* harmony export */ "getDocumentFragmentFromString": function() { return /* binding */ getDocumentFragmentFromString; }
|
11277
|
+
/* harmony export */ "findTargetElementFromEvent": function() { return /* binding */ findTargetElementFromEvent; },
|
11278
|
+
/* harmony export */ "fireEvent": function() { return /* binding */ fireEvent; }
|
10989
11279
|
/* harmony export */ });
|
10990
11280
|
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
10991
|
-
/* harmony import */ var
|
11281
|
+
/* harmony import */ var _types_is_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
10992
11282
|
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14);
|
11283
|
+
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(43);
|
10993
11284
|
|
10994
11285
|
/**
|
10995
11286
|
* @author schukai GmbH
|
10996
11287
|
*/
|
10997
11288
|
|
10998
|
-
function
|
11289
|
+
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; } } }; }
|
11290
|
+
|
11291
|
+
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); }
|
11292
|
+
|
11293
|
+
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; }
|
11294
|
+
|
10999
11295
|
|
11000
11296
|
|
11001
11297
|
|
11002
11298
|
|
11003
11299
|
/**
|
11004
|
-
*
|
11300
|
+
* You can call the function via the monster namespace `new Monster.DOM.fireEvent()`.
|
11301
|
+
*
|
11302
|
+
* ```
|
11303
|
+
* <script type="module">
|
11304
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
11305
|
+
* console.log(new Monster.DOM.fireEvent())
|
11306
|
+
* </script>
|
11307
|
+
* ```
|
11308
|
+
*
|
11309
|
+
* Alternatively, you can also integrate this function individually.
|
11310
|
+
*
|
11311
|
+
* ```
|
11312
|
+
* <script type="module">
|
11313
|
+
* import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/events.js';
|
11314
|
+
* console.log(fireEvent())
|
11315
|
+
* </script>
|
11316
|
+
* ```
|
11317
|
+
*
|
11318
|
+
* @param {HTMLElement|HTMLCollection|NodeList} element
|
11319
|
+
* @param {string} type
|
11320
|
+
* @return {void}
|
11321
|
+
* @since 1.10.0
|
11322
|
+
* @copyright schukai GmbH
|
11323
|
+
* @memberOf Monster.DOM
|
11324
|
+
* @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection
|
11325
|
+
* @summary Construct and send and event
|
11326
|
+
*/
|
11327
|
+
|
11328
|
+
function fireEvent(element, type) {
|
11329
|
+
var document = (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.getDocument)();
|
11330
|
+
|
11331
|
+
if (element instanceof HTMLElement) {
|
11332
|
+
if (type === 'click') {
|
11333
|
+
element.click();
|
11334
|
+
return;
|
11335
|
+
}
|
11336
|
+
|
11337
|
+
var event = new Event((0,_types_validate_js__WEBPACK_IMPORTED_MODULE_2__.validateString)(type), {
|
11338
|
+
bubbles: true,
|
11339
|
+
cancelable: true
|
11340
|
+
});
|
11341
|
+
element.dispatchEvent(event);
|
11342
|
+
} else if (element instanceof HTMLCollection || element instanceof NodeList) {
|
11343
|
+
var _iterator = _createForOfIteratorHelper(element),
|
11344
|
+
_step;
|
11345
|
+
|
11346
|
+
try {
|
11347
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
11348
|
+
var e = _step.value;
|
11349
|
+
fireEvent(e, type);
|
11350
|
+
}
|
11351
|
+
} catch (err) {
|
11352
|
+
_iterator.e(err);
|
11353
|
+
} finally {
|
11354
|
+
_iterator.f();
|
11355
|
+
}
|
11356
|
+
} else {
|
11357
|
+
throw new TypeError('value is not an instance of HTMLElement or HTMLCollection');
|
11358
|
+
}
|
11359
|
+
}
|
11360
|
+
/**
|
11361
|
+
* This function gets the path `Event.composedPath()` from an event and tries to find the next element
|
11362
|
+
* up the tree `element.closest()` with the attribute and value. If no value, or a value that is undefined or null,
|
11363
|
+
* is specified, only the attribute is searched.
|
11364
|
+
*
|
11365
|
+
* You can call the function via the monster namespace `new Monster.DOM.findTargetElementFromEvent()`.
|
11005
11366
|
*
|
11006
11367
|
* ```
|
11007
11368
|
* <script type="module">
|
11008
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11369
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
11370
|
+
* new Monster.DOM.findTargetElementFromEvent()
|
11371
|
+
* </script>
|
11372
|
+
* ```
|
11373
|
+
*
|
11374
|
+
* Alternatively, you can also integrate this function individually.
|
11375
|
+
*
|
11376
|
+
* ```
|
11377
|
+
* <script type="module">
|
11378
|
+
* import {findTargetElementFromEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/events.js';
|
11379
|
+
* findTargetElementFromEvent()
|
11380
|
+
* </script>
|
11381
|
+
* ```
|
11382
|
+
*
|
11383
|
+
* @since 1.14.0
|
11384
|
+
* @param {Event} event
|
11385
|
+
* @param {string} attributeName
|
11386
|
+
* @param {string|null|undefined} attributeValue
|
11387
|
+
* @throws {Error} unsupported event
|
11388
|
+
* @memberOf Monster.DOM
|
11389
|
+
* @throws {TypeError} value is not a string
|
11390
|
+
* @throws {TypeError} value is not an instance of HTMLElement
|
11391
|
+
* @summary Help function to find the appropriate control
|
11392
|
+
*/
|
11393
|
+
|
11394
|
+
|
11395
|
+
function findTargetElementFromEvent(event, attributeName, attributeValue) {
|
11396
|
+
(0,_types_validate_js__WEBPACK_IMPORTED_MODULE_2__.validateInstance)(event, Event);
|
11397
|
+
|
11398
|
+
if (typeof event.composedPath !== 'function') {
|
11399
|
+
throw new Error('unsupported event');
|
11400
|
+
}
|
11401
|
+
|
11402
|
+
var path = event.composedPath(); // closest cannot be used here, because closest is not correct for slotted elements
|
11403
|
+
|
11404
|
+
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_1__.isArray)(path)) {
|
11405
|
+
for (var i = 0; i < path.length; i++) {
|
11406
|
+
var o = path[i];
|
11407
|
+
|
11408
|
+
if (o instanceof HTMLElement && o.hasAttribute(attributeName) && (attributeValue === undefined || o.getAttribute(attributeName) === attributeValue)) {
|
11409
|
+
return o;
|
11410
|
+
}
|
11411
|
+
}
|
11412
|
+
}
|
11413
|
+
|
11414
|
+
return undefined;
|
11415
|
+
}
|
11416
|
+
|
11417
|
+
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_0__.assignToNamespace)('Monster.DOM', findTargetElementFromEvent, fireEvent);
|
11418
|
+
|
11419
|
+
|
11420
|
+
/***/ }),
|
11421
|
+
/* 43 */
|
11422
|
+
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
11423
|
+
|
11424
|
+
__webpack_require__.r(__webpack_exports__);
|
11425
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11426
|
+
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_0__.Monster; },
|
11427
|
+
/* harmony export */ "getWindow": function() { return /* binding */ getWindow; },
|
11428
|
+
/* harmony export */ "getDocument": function() { return /* binding */ getDocument; },
|
11429
|
+
/* harmony export */ "getDocumentFragmentFromString": function() { return /* binding */ getDocumentFragmentFromString; }
|
11430
|
+
/* harmony export */ });
|
11431
|
+
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
11432
|
+
/* harmony import */ var _types_global_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(16);
|
11433
|
+
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14);
|
11434
|
+
|
11435
|
+
/**
|
11436
|
+
* @author schukai GmbH
|
11437
|
+
*/
|
11438
|
+
|
11439
|
+
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); }
|
11440
|
+
|
11441
|
+
|
11442
|
+
|
11443
|
+
|
11444
|
+
/**
|
11445
|
+
* this method fetches the document object
|
11446
|
+
*
|
11447
|
+
* ```
|
11448
|
+
* <script type="module">
|
11449
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
11009
11450
|
* console.log(Monster.DOM.getDocument())
|
11010
11451
|
* </script>
|
11011
11452
|
* ```
|
@@ -11014,7 +11455,7 @@ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "functi
|
|
11014
11455
|
*
|
11015
11456
|
* ```
|
11016
11457
|
* <script type="module">
|
11017
|
-
* import {getDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11458
|
+
* import {getDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/util.js';
|
11018
11459
|
* console.log(getDocument())
|
11019
11460
|
* </script>
|
11020
11461
|
* ```
|
@@ -11069,7 +11510,7 @@ function getDocument() {
|
|
11069
11510
|
*
|
11070
11511
|
* ```
|
11071
11512
|
* <script type="module">
|
11072
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11513
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
11073
11514
|
* console.log(Monster.DOM.getWindow())
|
11074
11515
|
* </script>
|
11075
11516
|
* ```
|
@@ -11078,7 +11519,7 @@ function getDocument() {
|
|
11078
11519
|
*
|
11079
11520
|
* ```
|
11080
11521
|
* <script type="module">
|
11081
|
-
* import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11522
|
+
* import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/util.js';
|
11082
11523
|
* console.log(getWindow(null))
|
11083
11524
|
* </script>
|
11084
11525
|
* ```
|
@@ -11138,7 +11579,7 @@ function getWindow() {
|
|
11138
11579
|
*
|
11139
11580
|
* ```
|
11140
11581
|
* <script type="module">
|
11141
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11582
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
11142
11583
|
* console.log(Monster.DOM.getDocumentFragmentFromString())
|
11143
11584
|
* </script>
|
11144
11585
|
* ```
|
@@ -11147,7 +11588,7 @@ function getWindow() {
|
|
11147
11588
|
*
|
11148
11589
|
* ```
|
11149
11590
|
* <script type="module">
|
11150
|
-
* import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11591
|
+
* import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/util.js';
|
11151
11592
|
* console.log(getDocumentFragmentFromString('<div></div>'))
|
11152
11593
|
* </script>
|
11153
11594
|
* ```
|
@@ -11199,157 +11640,6 @@ function getDocumentFragmentFromString(html) {
|
|
11199
11640
|
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_0__.assignToNamespace)('Monster.DOM', getWindow, getDocument, getDocumentFragmentFromString);
|
11200
11641
|
|
11201
11642
|
|
11202
|
-
/***/ }),
|
11203
|
-
/* 43 */
|
11204
|
-
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
11205
|
-
|
11206
|
-
__webpack_require__.r(__webpack_exports__);
|
11207
|
-
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11208
|
-
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_0__.Monster; },
|
11209
|
-
/* harmony export */ "findTargetElementFromEvent": function() { return /* binding */ findTargetElementFromEvent; },
|
11210
|
-
/* harmony export */ "fireEvent": function() { return /* binding */ fireEvent; }
|
11211
|
-
/* harmony export */ });
|
11212
|
-
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
|
11213
|
-
/* harmony import */ var _types_is_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9);
|
11214
|
-
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(14);
|
11215
|
-
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(42);
|
11216
|
-
|
11217
|
-
/**
|
11218
|
-
* @author schukai GmbH
|
11219
|
-
*/
|
11220
|
-
|
11221
|
-
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; } } }; }
|
11222
|
-
|
11223
|
-
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); }
|
11224
|
-
|
11225
|
-
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; }
|
11226
|
-
|
11227
|
-
|
11228
|
-
|
11229
|
-
|
11230
|
-
|
11231
|
-
/**
|
11232
|
-
* You can call the function via the monster namespace `new Monster.DOM.fireEvent()`.
|
11233
|
-
*
|
11234
|
-
* ```
|
11235
|
-
* <script type="module">
|
11236
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.25.0/dist/modules/dom/events.js';
|
11237
|
-
* console.log(new Monster.DOM.fireEvent())
|
11238
|
-
* </script>
|
11239
|
-
* ```
|
11240
|
-
*
|
11241
|
-
* Alternatively, you can also integrate this function individually.
|
11242
|
-
*
|
11243
|
-
* ```
|
11244
|
-
* <script type="module">
|
11245
|
-
* import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.25.0/dist/modules/dom/events.js';
|
11246
|
-
* console.log(fireEvent())
|
11247
|
-
* </script>
|
11248
|
-
* ```
|
11249
|
-
*
|
11250
|
-
* @param {HTMLElement|HTMLCollection|NodeList} element
|
11251
|
-
* @param {string} type
|
11252
|
-
* @return {void}
|
11253
|
-
* @since 1.10.0
|
11254
|
-
* @copyright schukai GmbH
|
11255
|
-
* @memberOf Monster.DOM
|
11256
|
-
* @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection
|
11257
|
-
* @summary Construct and send and event
|
11258
|
-
*/
|
11259
|
-
|
11260
|
-
function fireEvent(element, type) {
|
11261
|
-
var document = (0,_util_js__WEBPACK_IMPORTED_MODULE_3__.getDocument)();
|
11262
|
-
|
11263
|
-
if (element instanceof HTMLElement) {
|
11264
|
-
if (type === 'click') {
|
11265
|
-
element.click();
|
11266
|
-
return;
|
11267
|
-
}
|
11268
|
-
|
11269
|
-
var event = new Event((0,_types_validate_js__WEBPACK_IMPORTED_MODULE_2__.validateString)(type), {
|
11270
|
-
bubbles: true,
|
11271
|
-
cancelable: true
|
11272
|
-
});
|
11273
|
-
element.dispatchEvent(event);
|
11274
|
-
} else if (element instanceof HTMLCollection || element instanceof NodeList) {
|
11275
|
-
var _iterator = _createForOfIteratorHelper(element),
|
11276
|
-
_step;
|
11277
|
-
|
11278
|
-
try {
|
11279
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
11280
|
-
var e = _step.value;
|
11281
|
-
fireEvent(e, type);
|
11282
|
-
}
|
11283
|
-
} catch (err) {
|
11284
|
-
_iterator.e(err);
|
11285
|
-
} finally {
|
11286
|
-
_iterator.f();
|
11287
|
-
}
|
11288
|
-
} else {
|
11289
|
-
throw new TypeError('value is not an instance of HTMLElement or HTMLCollection');
|
11290
|
-
}
|
11291
|
-
}
|
11292
|
-
/**
|
11293
|
-
* This function gets the path `Event.composedPath()` from an event and tries to find the next element
|
11294
|
-
* up the tree `element.closest()` with the attribute and value. If no value, or a value that is undefined or null,
|
11295
|
-
* is specified, only the attribute is searched.
|
11296
|
-
*
|
11297
|
-
* You can call the function via the monster namespace `new Monster.DOM.findTargetElementFromEvent()`.
|
11298
|
-
*
|
11299
|
-
* ```
|
11300
|
-
* <script type="module">
|
11301
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.25.0/dist/modules/dom/events.js';
|
11302
|
-
* console.log(new Monster.DOM.findTargetElementFromEvent())
|
11303
|
-
* </script>
|
11304
|
-
* ```
|
11305
|
-
*
|
11306
|
-
* Alternatively, you can also integrate this function individually.
|
11307
|
-
*
|
11308
|
-
* ```
|
11309
|
-
* <script type="module">
|
11310
|
-
* import {findTargetElementFromEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.25.0/dist/modules/dom/events.js';
|
11311
|
-
* console.log(findTargetElementFromEvent())
|
11312
|
-
* </script>
|
11313
|
-
* ```
|
11314
|
-
*
|
11315
|
-
* @since 1.14.0
|
11316
|
-
* @param {Event} event
|
11317
|
-
* @param {string} attributeName
|
11318
|
-
* @param {string|null|undefined} attributeValue
|
11319
|
-
* @throws {Error} unsupported event
|
11320
|
-
* @memberOf Monster.DOM
|
11321
|
-
* @throws {TypeError} value is not a string
|
11322
|
-
* @throws {TypeError} value is not an instance of HTMLElement
|
11323
|
-
* @summary Help function to find the appropriate control
|
11324
|
-
*/
|
11325
|
-
|
11326
|
-
|
11327
|
-
function findTargetElementFromEvent(event, attributeName, attributeValue) {
|
11328
|
-
(0,_types_validate_js__WEBPACK_IMPORTED_MODULE_2__.validateInstance)(event, Event);
|
11329
|
-
|
11330
|
-
if (typeof event.composedPath !== 'function') {
|
11331
|
-
throw new Error('unsupported event');
|
11332
|
-
}
|
11333
|
-
|
11334
|
-
var path = event.composedPath();
|
11335
|
-
var element = path === null || path === void 0 ? void 0 : path[0]; // closest cannot be used here, because closest is not correct for slotted elements
|
11336
|
-
|
11337
|
-
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_1__.isArray)(path)) {
|
11338
|
-
for (var i = 0; i < path.length; i++) {
|
11339
|
-
var o = path[i];
|
11340
|
-
|
11341
|
-
if (o instanceof HTMLElement && o.hasAttribute(attributeName) && (attributeValue === undefined || o.getAttribute(attributeName) === attributeValue)) {
|
11342
|
-
return o;
|
11343
|
-
}
|
11344
|
-
}
|
11345
|
-
}
|
11346
|
-
|
11347
|
-
return undefined;
|
11348
|
-
}
|
11349
|
-
|
11350
|
-
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_0__.assignToNamespace)('Monster.DOM', findTargetElementFromEvent, fireEvent);
|
11351
|
-
|
11352
|
-
|
11353
11643
|
/***/ }),
|
11354
11644
|
/* 44 */
|
11355
11645
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
@@ -11361,7 +11651,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
11361
11651
|
/* harmony export */ });
|
11362
11652
|
/* harmony import */ var _i18n_locale_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(45);
|
11363
11653
|
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2);
|
11364
|
-
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(
|
11654
|
+
/* harmony import */ var _util_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(43);
|
11365
11655
|
|
11366
11656
|
/**
|
11367
11657
|
* @author schukai GmbH
|
@@ -11379,13 +11669,17 @@ var DEFAULT_LANGUAGE = 'en';
|
|
11379
11669
|
/**
|
11380
11670
|
* With this function you can read the language version set by the document.
|
11381
11671
|
* For this the attribute `lang` in the html tag is read. If no attribute is set, `en` is used as default.
|
11672
|
+
*
|
11673
|
+
* ```html
|
11674
|
+
* <html lang="en">
|
11675
|
+
* ```
|
11382
11676
|
*
|
11383
11677
|
* You can call the function via the monster namespace `new Monster.DOM.getLocaleOfDocument()`.
|
11384
11678
|
*
|
11385
11679
|
* ```
|
11386
11680
|
* <script type="module">
|
11387
|
-
* import {
|
11388
|
-
*
|
11681
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
11682
|
+
* new Monster.DOM.getLocaleOfDocument()
|
11389
11683
|
* </script>
|
11390
11684
|
* ```
|
11391
11685
|
*
|
@@ -11393,8 +11687,8 @@ var DEFAULT_LANGUAGE = 'en';
|
|
11393
11687
|
*
|
11394
11688
|
* ```
|
11395
11689
|
* <script type="module">
|
11396
|
-
* import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11397
|
-
*
|
11690
|
+
* import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/dom/locale.js';
|
11691
|
+
* new getLocaleOfDocument()
|
11398
11692
|
* </script>
|
11399
11693
|
* ```
|
11400
11694
|
*
|
@@ -11486,7 +11780,7 @@ var localeStringSymbol = Symbol('localeString');
|
|
11486
11780
|
*
|
11487
11781
|
* ```
|
11488
11782
|
* <script type="module">
|
11489
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11783
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
11490
11784
|
* new Monster.I18n.Locale()
|
11491
11785
|
* </script>
|
11492
11786
|
* ```
|
@@ -11495,7 +11789,7 @@ var localeStringSymbol = Symbol('localeString');
|
|
11495
11789
|
*
|
11496
11790
|
* ```
|
11497
11791
|
* <script type="module">
|
11498
|
-
* import {Locale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11792
|
+
* import {Locale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/i18n/locale.js';
|
11499
11793
|
* new Locale()
|
11500
11794
|
* </script>
|
11501
11795
|
* ```
|
@@ -11654,6 +11948,8 @@ var Locale = /*#__PURE__*/function (_Base) {
|
|
11654
11948
|
return "" + this.localeString;
|
11655
11949
|
}
|
11656
11950
|
/**
|
11951
|
+
* The structure has the following: language, script, region, variants, extlang, privateUse
|
11952
|
+
*
|
11657
11953
|
* @return {Monster.I18n.LocaleMap}
|
11658
11954
|
*/
|
11659
11955
|
|
@@ -11686,7 +11982,7 @@ var Locale = /*#__PURE__*/function (_Base) {
|
|
11686
11982
|
*
|
11687
11983
|
* ```
|
11688
11984
|
* <script type="module">
|
11689
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11985
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
11690
11986
|
* new Monster.I18n.createLocale()
|
11691
11987
|
* </script>
|
11692
11988
|
* ```
|
@@ -11695,7 +11991,7 @@ var Locale = /*#__PURE__*/function (_Base) {
|
|
11695
11991
|
*
|
11696
11992
|
* ```
|
11697
11993
|
* <script type="module">
|
11698
|
-
* import {createLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
11994
|
+
* import {createLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/i18n/locale.js';
|
11699
11995
|
* createLocale()
|
11700
11996
|
* </script>
|
11701
11997
|
* ```
|
@@ -11871,7 +12167,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
11871
12167
|
*
|
11872
12168
|
* ```
|
11873
12169
|
* <script type="module">
|
11874
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12170
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
11875
12171
|
* new Monster.I18n.Provider()
|
11876
12172
|
* </script>
|
11877
12173
|
* ```
|
@@ -11880,7 +12176,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
11880
12176
|
*
|
11881
12177
|
* ```
|
11882
12178
|
* <script type="module">
|
11883
|
-
* import {Provider} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12179
|
+
* import {Provider} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/i18n/provider.js';
|
11884
12180
|
* new Provider()
|
11885
12181
|
* </script>
|
11886
12182
|
* ```
|
@@ -11981,7 +12277,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
11981
12277
|
*
|
11982
12278
|
* ```
|
11983
12279
|
* <script type="module">
|
11984
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12280
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
11985
12281
|
* new Monster.Types.BaseWithOptions()
|
11986
12282
|
* </script>
|
11987
12283
|
* ```
|
@@ -11990,7 +12286,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
11990
12286
|
*
|
11991
12287
|
* ```
|
11992
12288
|
* <script type="module">
|
11993
|
-
* import {BaseWithOptions} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12289
|
+
* import {BaseWithOptions} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/basewithoptions.js';
|
11994
12290
|
* new BaseWithOptions()
|
11995
12291
|
* </script>
|
11996
12292
|
* ```
|
@@ -12131,7 +12427,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12131
12427
|
*
|
12132
12428
|
* ```
|
12133
12429
|
* <script type="module">
|
12134
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12430
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
12135
12431
|
* new Monster.I18n.Translations()
|
12136
12432
|
* </script>
|
12137
12433
|
* ```
|
@@ -12140,23 +12436,33 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12140
12436
|
*
|
12141
12437
|
* ```
|
12142
12438
|
* <script type="module">
|
12143
|
-
* import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12439
|
+
* import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/i18n/translations.js';
|
12144
12440
|
* new Translations()
|
12145
12441
|
* </script>
|
12146
12442
|
* ```
|
12147
12443
|
*
|
12148
12444
|
* @example
|
12149
12445
|
*
|
12150
|
-
* import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12446
|
+
* import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/i18n/translations.js';
|
12447
|
+
* import {parseLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/i18n/locale.js';
|
12448
|
+
*
|
12151
12449
|
* const translation = new Translations(parseLocale('en-GB'));
|
12152
12450
|
*
|
12153
12451
|
* translation.assignTranslations({
|
12154
|
-
*
|
12155
|
-
*
|
12156
|
-
*
|
12452
|
+
* text1: "click",
|
12453
|
+
* text2: {
|
12454
|
+
* 'one': 'click once',
|
12455
|
+
* 'other': 'click n times'
|
12456
|
+
* }
|
12457
|
+
* });
|
12458
|
+
*
|
12459
|
+
* console.log(translation.getText('text1'));
|
12460
|
+
* // ↦ click
|
12157
12461
|
*
|
12158
|
-
* translation.
|
12159
|
-
*
|
12462
|
+
* console.log(translation.getPluralRuleText('text2',1));
|
12463
|
+
* // -> click once
|
12464
|
+
* console.log(translation.getPluralRuleText('text2',2));
|
12465
|
+
* // -> click n times
|
12160
12466
|
*
|
12161
12467
|
* @since 1.13.0
|
12162
12468
|
* @copyright schukai GmbH
|
@@ -12410,7 +12716,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12410
12716
|
*
|
12411
12717
|
* ```
|
12412
12718
|
* <script type="module">
|
12413
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12719
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
12414
12720
|
* new Monster.I18n.Providers.Fetch()
|
12415
12721
|
* </script>
|
12416
12722
|
* ```
|
@@ -12419,15 +12725,24 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12419
12725
|
*
|
12420
12726
|
* ```
|
12421
12727
|
* <script type="module">
|
12422
|
-
* import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12728
|
+
* import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/i18n/providers/fetch.js';
|
12423
12729
|
* new Fetch()
|
12424
12730
|
* </script>
|
12425
12731
|
* ```
|
12732
|
+
*
|
12733
|
+
* @example <caption>das ist ein test</caption>
|
12734
|
+
*
|
12735
|
+
* import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/i18n/providers/fetch.js';
|
12736
|
+
*
|
12737
|
+
* // fetch from API
|
12738
|
+
* const translation = new Fetch('https://example.com/${language}.json').getTranslation('en-GB');
|
12739
|
+
* // ↦ https://example.com/en.json
|
12426
12740
|
*
|
12427
12741
|
* @since 1.13.0
|
12428
12742
|
* @copyright schukai GmbH
|
12429
12743
|
* @memberOf Monster.I18n.Providers
|
12430
12744
|
* @see {@link https://datatracker.ietf.org/doc/html/rfc3066}
|
12745
|
+
* @tutorial i18n-locale-and-formatter
|
12431
12746
|
*/
|
12432
12747
|
|
12433
12748
|
var Fetch = /*#__PURE__*/function (_Provider) {
|
@@ -12437,7 +12752,13 @@ var Fetch = /*#__PURE__*/function (_Provider) {
|
|
12437
12752
|
|
12438
12753
|
/**
|
12439
12754
|
* As options the key `fetch` can be passed. This config object is passed to the fetch method as init.
|
12440
|
-
*
|
12755
|
+
*
|
12756
|
+
* The url may contain placeholders (language, script, region, variants, extlang, privateUse), so you can specify one url for all translations.
|
12757
|
+
*
|
12758
|
+
* ```
|
12759
|
+
* new Fetch('https://www.example.com/assets/${language}.json')
|
12760
|
+
* ```
|
12761
|
+
*
|
12441
12762
|
* @param {string|URL} url
|
12442
12763
|
* @param {Object} options see {@link Monster.I18n.Providers.Fetch#defaults}
|
12443
12764
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/fetch}
|
@@ -12540,14 +12861,20 @@ var Fetch = /*#__PURE__*/function (_Provider) {
|
|
12540
12861
|
|
12541
12862
|
__webpack_require__.r(__webpack_exports__);
|
12542
12863
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
12543
|
-
/* harmony export */ "Monster": function() { return /* reexport safe */
|
12864
|
+
/* harmony export */ "Monster": function() { return /* reexport safe */ _namespace_js__WEBPACK_IMPORTED_MODULE_3__.Monster; },
|
12544
12865
|
/* harmony export */ "Formatter": function() { return /* binding */ Formatter; }
|
12545
12866
|
/* harmony export */ });
|
12546
|
-
/* harmony import */ var
|
12547
|
-
/* harmony import */ var
|
12548
|
-
/* harmony import */ var
|
12549
|
-
/* harmony import */ var
|
12867
|
+
/* harmony import */ var _constants_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(1);
|
12868
|
+
/* harmony import */ var _data_extend_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(21);
|
12869
|
+
/* harmony import */ var _data_pipe_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(22);
|
12870
|
+
/* harmony import */ var _namespace_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2);
|
12871
|
+
/* harmony import */ var _types_basewithoptions_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(47);
|
12872
|
+
/* harmony import */ var _types_is_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(9);
|
12873
|
+
/* harmony import */ var _types_validate_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(14);
|
12550
12874
|
|
12875
|
+
/**
|
12876
|
+
* @author schukai GmbH
|
12877
|
+
*/
|
12551
12878
|
|
12552
12879
|
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); }
|
12553
12880
|
|
@@ -12571,6 +12898,10 @@ function _defineProperties(target, props) { for (var i = 0; i < props.length; i+
|
|
12571
12898
|
|
12572
12899
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
12573
12900
|
|
12901
|
+
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); }
|
12902
|
+
|
12903
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
12904
|
+
|
12574
12905
|
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); }
|
12575
12906
|
|
12576
12907
|
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
@@ -12586,23 +12917,52 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
12586
12917
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
12587
12918
|
|
12588
12919
|
|
12920
|
+
|
12921
|
+
|
12922
|
+
|
12923
|
+
|
12924
|
+
|
12925
|
+
|
12589
12926
|
/**
|
12590
|
-
* @
|
12927
|
+
* @private
|
12928
|
+
* @type {symbol}
|
12591
12929
|
*/
|
12592
12930
|
|
12931
|
+
var internalObjectSymbol = Symbol('internalObject');
|
12932
|
+
/**
|
12933
|
+
* @private
|
12934
|
+
* @type {symbol}
|
12935
|
+
*/
|
12593
12936
|
|
12937
|
+
var watchdogSymbol = Symbol('watchdog');
|
12938
|
+
/**
|
12939
|
+
* @private
|
12940
|
+
* @type {symbol}
|
12941
|
+
*/
|
12594
12942
|
|
12943
|
+
var markerOpenIndexSymbol = Symbol('markerOpenIndex');
|
12944
|
+
/**
|
12945
|
+
* @private
|
12946
|
+
* @type {symbol}
|
12947
|
+
*/
|
12595
12948
|
|
12949
|
+
var markerCloseIndexSymbol = Symbol('markercloseIndex');
|
12950
|
+
/**
|
12951
|
+
* @private
|
12952
|
+
* @type {symbol}
|
12953
|
+
*/
|
12954
|
+
|
12955
|
+
var workingDataSymbol = Symbol('workingData');
|
12596
12956
|
/**
|
12597
12957
|
* 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.
|
12598
12958
|
*
|
12599
12959
|
* Look at the example below. The placeholders use the logic of Pipe.
|
12600
12960
|
*
|
12601
|
-
* You can
|
12961
|
+
* You can create an instance via the monster namespace `new Monster.Text.Formatter()`.
|
12602
12962
|
*
|
12603
12963
|
* ```
|
12604
12964
|
* <script type="module">
|
12605
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12965
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
12606
12966
|
* new Monster.Text.Formatter()
|
12607
12967
|
* </script>
|
12608
12968
|
* ```
|
@@ -12611,19 +12971,42 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12611
12971
|
*
|
12612
12972
|
* ```
|
12613
12973
|
* <script type="module">
|
12614
|
-
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
12974
|
+
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/text/formatter.js';
|
12615
12975
|
* new Formatter()
|
12616
12976
|
* </script>
|
12617
12977
|
* ```
|
12618
12978
|
*
|
12619
12979
|
* ## Marker in marker
|
12620
12980
|
*
|
12621
|
-
* Markers can be nested. Here, the inner marker is resolved first and then the outer marker
|
12981
|
+
* Markers can be nested. Here, the inner marker is resolved first `${subkey} ↦ 1 = ${mykey2}` and then the outer marker `${mykey2}`.
|
12622
12982
|
*
|
12623
12983
|
* ```
|
12984
|
+
* const text = '${mykey${subkey}}';
|
12985
|
+
* let obj = {
|
12986
|
+
* mykey2: "1",
|
12987
|
+
* subkey: "2"
|
12988
|
+
* };
|
12624
12989
|
*
|
12990
|
+
* new Formatter(obj).format(text);
|
12991
|
+
* // ↦ 1
|
12625
12992
|
* ```
|
12626
12993
|
*
|
12994
|
+
* ## Callbacks
|
12995
|
+
*
|
12996
|
+
* The values in a formatter can be adjusted via the commands of the `Transformer` or the`Pipe`.
|
12997
|
+
* There is also the possibility to use callbacks.
|
12998
|
+
*
|
12999
|
+
* const formatter = new Formatter({x: '1'}, {
|
13000
|
+
* callbacks: {
|
13001
|
+
* quote: (value) => {
|
13002
|
+
* return '"' + value + '"'
|
13003
|
+
* }
|
13004
|
+
* }
|
13005
|
+
* });
|
13006
|
+
*
|
13007
|
+
* formatter.format('${x | call:quote}'))
|
13008
|
+
* // ↦ "1"
|
13009
|
+
*
|
12627
13010
|
* ## Marker with parameter
|
12628
13011
|
*
|
12629
13012
|
* A string can also bring its own values. These must then be separated from the key by a separator `::`.
|
@@ -12633,7 +13016,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12633
13016
|
*
|
12634
13017
|
* @example
|
12635
13018
|
*
|
12636
|
-
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13019
|
+
* import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/text/formatter.js';
|
12637
13020
|
*
|
12638
13021
|
* new Formatter({
|
12639
13022
|
* a: {
|
@@ -12642,7 +13025,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12642
13025
|
* },
|
12643
13026
|
* d: "world",
|
12644
13027
|
* }
|
12645
|
-
* }).format("${a.b.c} ${a.d | ucfirst}!");
|
13028
|
+
* }).format("${a.b.c} ${a.d | ucfirst}!"); // with pipe
|
12646
13029
|
*
|
12647
13030
|
* // ↦ Hello World!
|
12648
13031
|
*
|
@@ -12651,8 +13034,8 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12651
13034
|
* @memberOf Monster.Text
|
12652
13035
|
*/
|
12653
13036
|
|
12654
|
-
var Formatter = /*#__PURE__*/function (
|
12655
|
-
_inherits(Formatter,
|
13037
|
+
var Formatter = /*#__PURE__*/function (_BaseWithOptions) {
|
13038
|
+
_inherits(Formatter, _BaseWithOptions);
|
12656
13039
|
|
12657
13040
|
var _super = _createSuper(Formatter);
|
12658
13041
|
|
@@ -12662,52 +13045,70 @@ var Formatter = /*#__PURE__*/function (_Base) {
|
|
12662
13045
|
* @param {object} object
|
12663
13046
|
* @throws {TypeError} value is not a object
|
12664
13047
|
*/
|
12665
|
-
function Formatter(object) {
|
13048
|
+
function Formatter(object, options) {
|
12666
13049
|
var _this;
|
12667
13050
|
|
12668
13051
|
_classCallCheck(this, Formatter);
|
12669
13052
|
|
12670
|
-
_this = _super.call(this);
|
12671
|
-
|
12672
|
-
|
12673
|
-
|
12674
|
-
}
|
12675
|
-
|
12676
|
-
_this.object = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_3__.validateObject)(object);
|
12677
|
-
_this.openMarker = '${';
|
12678
|
-
_this.closeMarker = '}';
|
12679
|
-
_this.parameterDelimiter = '::';
|
12680
|
-
_this.parameterAssignment = '=';
|
13053
|
+
_this = _super.call(this, options);
|
13054
|
+
_this[internalObjectSymbol] = object || {};
|
13055
|
+
_this[markerOpenIndexSymbol] = 0;
|
13056
|
+
_this[markerCloseIndexSymbol] = 0;
|
12681
13057
|
return _this;
|
12682
13058
|
}
|
12683
13059
|
/**
|
12684
|
-
*
|
12685
|
-
*
|
12686
|
-
*
|
12687
|
-
*
|
12688
|
-
*
|
12689
|
-
*
|
12690
|
-
*
|
12691
|
-
* formatter.setParameterChars('i18n{','}');
|
12692
|
-
* ```
|
12693
|
-
*
|
12694
|
-
* @param {string} delimiter
|
12695
|
-
* @param {string} assignment
|
12696
|
-
* @return {Formatter}
|
12697
|
-
* @since 1.24.0
|
12698
|
-
* @throws {TypeError} value is not a string
|
13060
|
+
* @property {object} marker
|
13061
|
+
* @property {array} marker.open=["${"]
|
13062
|
+
* @property {array} marker.close=["${"]
|
13063
|
+
* @property {object} parameter
|
13064
|
+
* @property {string} parameter.delimiter="::"
|
13065
|
+
* @property {string} parameter.assignment="="
|
13066
|
+
* @property {object} callbacks={}
|
12699
13067
|
*/
|
12700
13068
|
|
12701
13069
|
|
12702
13070
|
_createClass(Formatter, [{
|
13071
|
+
key: "defaults",
|
13072
|
+
get: function get() {
|
13073
|
+
return (0,_data_extend_js__WEBPACK_IMPORTED_MODULE_1__.extend)({}, _get(_getPrototypeOf(Formatter.prototype), "defaults", this), {
|
13074
|
+
marker: {
|
13075
|
+
open: ['${'],
|
13076
|
+
close: ['}']
|
13077
|
+
},
|
13078
|
+
parameter: {
|
13079
|
+
delimiter: '::',
|
13080
|
+
assignment: '='
|
13081
|
+
},
|
13082
|
+
callbacks: {}
|
13083
|
+
});
|
13084
|
+
}
|
13085
|
+
/**
|
13086
|
+
* Set new Parameter Character
|
13087
|
+
*
|
13088
|
+
* Default values for the chars are `::` and `=`
|
13089
|
+
*
|
13090
|
+
* ```
|
13091
|
+
* formatter.setParameterChars('#');
|
13092
|
+
* formatter.setParameterChars('[',']');
|
13093
|
+
* formatter.setParameterChars('i18n{','}');
|
13094
|
+
* ```
|
13095
|
+
*
|
13096
|
+
* @param {string} delimiter
|
13097
|
+
* @param {string} assignment
|
13098
|
+
* @return {Formatter}
|
13099
|
+
* @since 1.24.0
|
13100
|
+
* @throws {TypeError} value is not a string
|
13101
|
+
*/
|
13102
|
+
|
13103
|
+
}, {
|
12703
13104
|
key: "setParameterChars",
|
12704
13105
|
value: function setParameterChars(delimiter, assignment) {
|
12705
13106
|
if (delimiter !== undefined) {
|
12706
|
-
this.
|
13107
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['parameter']['delimiter'] = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateString)(delimiter);
|
12707
13108
|
}
|
12708
13109
|
|
12709
13110
|
if (assignment !== undefined) {
|
12710
|
-
this.
|
13111
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['parameter']['assignment'] = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateString)(assignment);
|
12711
13112
|
}
|
12712
13113
|
|
12713
13114
|
return this;
|
@@ -12723,8 +13124,8 @@ var Formatter = /*#__PURE__*/function (_Base) {
|
|
12723
13124
|
* formatter.setMarker('i18n{','}');
|
12724
13125
|
* ```
|
12725
13126
|
*
|
12726
|
-
* @param {string} open
|
12727
|
-
* @param {string} close
|
13127
|
+
* @param {array|string} open
|
13128
|
+
* @param {array|string|undefined} close
|
12728
13129
|
* @return {Formatter}
|
12729
13130
|
* @since 1.12.0
|
12730
13131
|
* @throws {TypeError} value is not a string
|
@@ -12737,8 +13138,10 @@ var Formatter = /*#__PURE__*/function (_Base) {
|
|
12737
13138
|
close = open;
|
12738
13139
|
}
|
12739
13140
|
|
12740
|
-
|
12741
|
-
|
13141
|
+
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_5__.isString)(open)) open = [open];
|
13142
|
+
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_5__.isString)(close)) close = [close];
|
13143
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['marker']['open'] = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateArray)(open);
|
13144
|
+
this[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['marker']['close'] = (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateArray)(close);
|
12742
13145
|
return this;
|
12743
13146
|
}
|
12744
13147
|
/**
|
@@ -12746,17 +13149,58 @@ var Formatter = /*#__PURE__*/function (_Base) {
|
|
12746
13149
|
* @param {string} text
|
12747
13150
|
* @return {string}
|
12748
13151
|
* @throws {TypeError} value is not a string
|
13152
|
+
* @throws {Error} too deep nesting
|
12749
13153
|
*/
|
12750
13154
|
|
12751
13155
|
}, {
|
12752
13156
|
key: "format",
|
12753
13157
|
value: function format(text) {
|
12754
|
-
|
13158
|
+
this[watchdogSymbol] = 0;
|
13159
|
+
this[markerOpenIndexSymbol] = 0;
|
13160
|
+
this[markerCloseIndexSymbol] = 0;
|
13161
|
+
this[workingDataSymbol] = {};
|
13162
|
+
return _format.call(this, text);
|
12755
13163
|
}
|
12756
13164
|
}]);
|
12757
13165
|
|
12758
13166
|
return Formatter;
|
12759
|
-
}(
|
13167
|
+
}(_types_basewithoptions_js__WEBPACK_IMPORTED_MODULE_4__.BaseWithOptions);
|
13168
|
+
/**
|
13169
|
+
* @private
|
13170
|
+
* @return {string}
|
13171
|
+
*/
|
13172
|
+
|
13173
|
+
|
13174
|
+
function _format(text) {
|
13175
|
+
var _self$internalSymbol$, _self$internalSymbol$2, _self$internalSymbol$3, _self$internalSymbol$4;
|
13176
|
+
|
13177
|
+
var self = this;
|
13178
|
+
self[watchdogSymbol]++;
|
13179
|
+
|
13180
|
+
if (this[watchdogSymbol] > 20) {
|
13181
|
+
throw new Error('too deep nesting');
|
13182
|
+
}
|
13183
|
+
|
13184
|
+
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]];
|
13185
|
+
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
|
13186
|
+
|
13187
|
+
if (text.indexOf(openMarker) === -1 || text.indexOf(closeMarker) === -1) {
|
13188
|
+
return text;
|
13189
|
+
}
|
13190
|
+
|
13191
|
+
var result = tokenize.call(this, (0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateString)(text), openMarker, closeMarker);
|
13192
|
+
|
13193
|
+
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]) {
|
13194
|
+
this[markerOpenIndexSymbol]++;
|
13195
|
+
}
|
13196
|
+
|
13197
|
+
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]) {
|
13198
|
+
this[markerCloseIndexSymbol]++;
|
13199
|
+
}
|
13200
|
+
|
13201
|
+
result = _format.call(self, result);
|
13202
|
+
return result;
|
13203
|
+
}
|
12760
13204
|
/**
|
12761
13205
|
* @private
|
12762
13206
|
* @since 1.12.0
|
@@ -12765,12 +13209,17 @@ var Formatter = /*#__PURE__*/function (_Base) {
|
|
12765
13209
|
*/
|
12766
13210
|
|
12767
13211
|
|
12768
|
-
function
|
13212
|
+
function tokenize(text, openMarker, closeMarker) {
|
12769
13213
|
var self = this;
|
12770
13214
|
var formatted = [];
|
13215
|
+
var parameterAssignment = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['parameter']['assignment'];
|
13216
|
+
var parameterDelimiter = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['parameter']['delimiter'];
|
13217
|
+
var callbacks = self[_constants_js__WEBPACK_IMPORTED_MODULE_0__.internalSymbol]['callbacks'];
|
12771
13218
|
|
12772
13219
|
while (true) {
|
12773
|
-
var
|
13220
|
+
var _self$workingDataSymb;
|
13221
|
+
|
13222
|
+
var startIndex = text.indexOf(openMarker); // no marker
|
12774
13223
|
|
12775
13224
|
if (startIndex === -1) {
|
12776
13225
|
formatted.push(text);
|
@@ -12780,19 +13229,18 @@ function tokenizer(text) {
|
|
12780
13229
|
text = text.substring(startIndex);
|
12781
13230
|
}
|
12782
13231
|
|
12783
|
-
var endIndex = text.substring(
|
12784
|
-
if (endIndex !== -1) endIndex +=
|
12785
|
-
var insideStartIndex = text.substring(
|
13232
|
+
var endIndex = text.substring(openMarker.length).indexOf(closeMarker);
|
13233
|
+
if (endIndex !== -1) endIndex += openMarker.length;
|
13234
|
+
var insideStartIndex = text.substring(openMarker.length).indexOf(openMarker);
|
12786
13235
|
|
12787
13236
|
if (insideStartIndex !== -1) {
|
12788
|
-
insideStartIndex +=
|
13237
|
+
insideStartIndex += openMarker.length;
|
12789
13238
|
|
12790
13239
|
if (insideStartIndex < endIndex) {
|
12791
|
-
var
|
12792
|
-
var result = tokenizer.call(self, text.substring(insideStartIndex));
|
13240
|
+
var result = tokenize.call(self, text.substring(insideStartIndex), openMarker, closeMarker);
|
12793
13241
|
text = text.substring(0, insideStartIndex) + result;
|
12794
|
-
endIndex = text.substring(
|
12795
|
-
if (endIndex !== -1) endIndex +=
|
13242
|
+
endIndex = text.substring(openMarker.length).indexOf(closeMarker);
|
13243
|
+
if (endIndex !== -1) endIndex += openMarker.length;
|
12796
13244
|
}
|
12797
13245
|
}
|
12798
13246
|
|
@@ -12801,11 +13249,10 @@ function tokenizer(text) {
|
|
12801
13249
|
return;
|
12802
13250
|
}
|
12803
13251
|
|
12804
|
-
var
|
12805
|
-
var
|
12806
|
-
var
|
12807
|
-
|
12808
|
-
var temp = self.object;
|
13252
|
+
var key = text.substring(openMarker.length, endIndex);
|
13253
|
+
var parts = key.split(parameterDelimiter);
|
13254
|
+
var currentPipe = parts.shift();
|
13255
|
+
self[workingDataSymbol] = (0,_data_extend_js__WEBPACK_IMPORTED_MODULE_1__.extend)({}, self[internalObjectSymbol], self[workingDataSymbol]);
|
12809
13256
|
|
12810
13257
|
var _iterator = _createForOfIteratorHelper(parts),
|
12811
13258
|
_step;
|
@@ -12814,12 +13261,12 @@ function tokenizer(text) {
|
|
12814
13261
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
12815
13262
|
var kv = _step.value;
|
12816
13263
|
|
12817
|
-
var _kv$split = kv.split(
|
13264
|
+
var _kv$split = kv.split(parameterAssignment),
|
12818
13265
|
_kv$split2 = _slicedToArray(_kv$split, 2),
|
12819
13266
|
k = _kv$split2[0],
|
12820
13267
|
v = _kv$split2[1];
|
12821
13268
|
|
12822
|
-
|
13269
|
+
self[workingDataSymbol][k] = v;
|
12823
13270
|
}
|
12824
13271
|
} catch (err) {
|
12825
13272
|
_iterator.e(err);
|
@@ -12827,14 +13274,40 @@ function tokenizer(text) {
|
|
12827
13274
|
_iterator.f();
|
12828
13275
|
}
|
12829
13276
|
|
12830
|
-
|
12831
|
-
|
13277
|
+
var t1 = key.split('|').shift().trim(); // pipe symbol
|
13278
|
+
|
13279
|
+
var t2 = t1.split('::').shift().trim(); // key value delimiter
|
13280
|
+
|
13281
|
+
var t3 = t2.split('.').shift().trim(); // path delimiter
|
13282
|
+
|
13283
|
+
var prefix = (_self$workingDataSymb = self[workingDataSymbol]) !== null && _self$workingDataSymb !== void 0 && _self$workingDataSymb[t3] ? 'path:' : 'static:';
|
13284
|
+
var command = "";
|
13285
|
+
|
13286
|
+
if (prefix && key.indexOf(prefix) !== 0 && key.indexOf('path:') !== 0 && key.indexOf('static:') !== 0) {
|
13287
|
+
command = prefix;
|
13288
|
+
}
|
13289
|
+
|
13290
|
+
command += currentPipe;
|
13291
|
+
var pipe = new _data_pipe_js__WEBPACK_IMPORTED_MODULE_2__.Pipe(command);
|
13292
|
+
|
13293
|
+
if ((0,_types_is_js__WEBPACK_IMPORTED_MODULE_5__.isObject)(callbacks)) {
|
13294
|
+
for (var _i = 0, _Object$entries = Object.entries(callbacks); _i < _Object$entries.length; _i++) {
|
13295
|
+
var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
|
13296
|
+
name = _Object$entries$_i[0],
|
13297
|
+
callback = _Object$entries$_i[1];
|
13298
|
+
|
13299
|
+
pipe.setCallback(name, callback);
|
13300
|
+
}
|
13301
|
+
}
|
13302
|
+
|
13303
|
+
formatted.push((0,_types_validate_js__WEBPACK_IMPORTED_MODULE_6__.validateString)(pipe.run(self[workingDataSymbol])));
|
13304
|
+
text = text.substring(endIndex + closeMarker.length);
|
12832
13305
|
}
|
12833
13306
|
|
12834
13307
|
return formatted.join('');
|
12835
13308
|
}
|
12836
13309
|
|
12837
|
-
(0,
|
13310
|
+
(0,_namespace_js__WEBPACK_IMPORTED_MODULE_3__.assignToNamespace)('Monster.Text', Formatter);
|
12838
13311
|
|
12839
13312
|
|
12840
13313
|
/***/ }),
|
@@ -12888,7 +13361,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12888
13361
|
*
|
12889
13362
|
* ```
|
12890
13363
|
* <script type="module">
|
12891
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13364
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
12892
13365
|
* console.log(new Monster.Logging.Handler())
|
12893
13366
|
* </script>
|
12894
13367
|
* ```
|
@@ -12897,7 +13370,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
12897
13370
|
*
|
12898
13371
|
* ```
|
12899
13372
|
* <script type="module">
|
12900
|
-
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13373
|
+
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/logging/handler.js';
|
12901
13374
|
* console.log(new Handler())
|
12902
13375
|
* </script>
|
12903
13376
|
* ```
|
@@ -13135,7 +13608,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13135
13608
|
*
|
13136
13609
|
* ```
|
13137
13610
|
* <script type="module">
|
13138
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13611
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
13139
13612
|
* console.log(new Monster.Logging.LogEntry())
|
13140
13613
|
* </script>
|
13141
13614
|
* ```
|
@@ -13144,7 +13617,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13144
13617
|
*
|
13145
13618
|
* ```
|
13146
13619
|
* <script type="module">
|
13147
|
-
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13620
|
+
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/logging/logentry.js';
|
13148
13621
|
* console.log(new LogEntry())
|
13149
13622
|
* </script>
|
13150
13623
|
* ```
|
@@ -13330,7 +13803,7 @@ var OFF = 0;
|
|
13330
13803
|
*
|
13331
13804
|
* ```
|
13332
13805
|
* <script type="module">
|
13333
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13806
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
13334
13807
|
* new Monster.Logging.Logger()
|
13335
13808
|
* </script>
|
13336
13809
|
* ```
|
@@ -13339,7 +13812,7 @@ var OFF = 0;
|
|
13339
13812
|
*
|
13340
13813
|
* ```
|
13341
13814
|
* <script type="module">
|
13342
|
-
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
13815
|
+
* import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/logging/logger.js';
|
13343
13816
|
* new Logger()
|
13344
13817
|
* </script>
|
13345
13818
|
* ```
|
@@ -13639,7 +14112,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13639
14112
|
*
|
13640
14113
|
* ```
|
13641
14114
|
* <script type="module">
|
13642
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14115
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
13643
14116
|
* console.log(new Monster.Logging.Handler.ConsoleHandler())
|
13644
14117
|
* </script>
|
13645
14118
|
* ```
|
@@ -13648,7 +14121,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13648
14121
|
*
|
13649
14122
|
* ```
|
13650
14123
|
* <script type="module">
|
13651
|
-
* import {ConsoleHandler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14124
|
+
* import {ConsoleHandler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/logging/handler/console.js';
|
13652
14125
|
* console.log(new ConsoleHandler())
|
13653
14126
|
* </script>
|
13654
14127
|
* ```
|
@@ -13724,7 +14197,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
13724
14197
|
*
|
13725
14198
|
* ```
|
13726
14199
|
* <script type="module">
|
13727
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14200
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
13728
14201
|
* Monster.Math.random(1,10)
|
13729
14202
|
* // ↦ 5
|
13730
14203
|
* </script>
|
@@ -13734,7 +14207,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
13734
14207
|
*
|
13735
14208
|
* ```
|
13736
14209
|
* <script type="module">
|
13737
|
-
* import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14210
|
+
* import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/math/random.js';
|
13738
14211
|
* random(1,10)
|
13739
14212
|
* // ↦ 5
|
13740
14213
|
* </script>
|
@@ -13891,7 +14364,7 @@ var internalCounter = 0;
|
|
13891
14364
|
*
|
13892
14365
|
* ```
|
13893
14366
|
* <script type="module">
|
13894
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14367
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
13895
14368
|
* console.log(new Monster.Types.RandomID())
|
13896
14369
|
* </script>
|
13897
14370
|
* ```
|
@@ -13900,7 +14373,7 @@ var internalCounter = 0;
|
|
13900
14373
|
*
|
13901
14374
|
* ```
|
13902
14375
|
* <script type="module">
|
13903
|
-
* import {RandomID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14376
|
+
* import {RandomID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/randomid.js';
|
13904
14377
|
* console.log(new RandomID())
|
13905
14378
|
* </script>
|
13906
14379
|
* ```
|
@@ -13983,7 +14456,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13983
14456
|
*
|
13984
14457
|
* ```
|
13985
14458
|
* <script type="module">
|
13986
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14459
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
13987
14460
|
* console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3
|
13988
14461
|
* console.log(new Monster.Types.Version('1')) // ↦ 1.0.0
|
13989
14462
|
* </script>
|
@@ -13993,7 +14466,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
13993
14466
|
*
|
13994
14467
|
* ```
|
13995
14468
|
* <script type="module">
|
13996
|
-
* import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14469
|
+
* import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/version.js';
|
13997
14470
|
* console.log(new Version('1.2.3')) // ↦ 1.2.3
|
13998
14471
|
* console.log(new Version('1')) // ↦ 1.0.0
|
13999
14472
|
* </script>
|
@@ -14001,7 +14474,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
14001
14474
|
*
|
14002
14475
|
* @example
|
14003
14476
|
*
|
14004
|
-
* import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14477
|
+
* import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/version.js';
|
14005
14478
|
*
|
14006
14479
|
* new Version('1.0.0') // ↦ 1.0.0
|
14007
14480
|
* new Version(1) // ↦ 1.0.0
|
@@ -14135,7 +14608,7 @@ var monsterVersion;
|
|
14135
14608
|
*
|
14136
14609
|
* ```
|
14137
14610
|
* <script type="module">
|
14138
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14611
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
14139
14612
|
* console.log(Monster.getVersion())
|
14140
14613
|
* </script>
|
14141
14614
|
* ```
|
@@ -14144,7 +14617,7 @@ var monsterVersion;
|
|
14144
14617
|
*
|
14145
14618
|
* ```
|
14146
14619
|
* <script type="module">
|
14147
|
-
* import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14620
|
+
* import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/types/version.js';
|
14148
14621
|
* console.log(getVersion())
|
14149
14622
|
* </script>
|
14150
14623
|
* ```
|
@@ -14163,7 +14636,7 @@ function getVersion() {
|
|
14163
14636
|
/**#@+ dont touch, replaced by make with package.json version */
|
14164
14637
|
|
14165
14638
|
|
14166
|
-
monsterVersion = new Version('1.
|
14639
|
+
monsterVersion = new Version('1.28.0');
|
14167
14640
|
/**#@-*/
|
14168
14641
|
|
14169
14642
|
return monsterVersion;
|
@@ -14219,7 +14692,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
14219
14692
|
*
|
14220
14693
|
* ```
|
14221
14694
|
* <script type="module">
|
14222
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14695
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
14223
14696
|
* new Monster.Util.Comparator()
|
14224
14697
|
* </script>
|
14225
14698
|
* ```
|
@@ -14228,7 +14701,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
14228
14701
|
*
|
14229
14702
|
* ```
|
14230
14703
|
* <script type="module">
|
14231
|
-
* import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14704
|
+
* import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/util/comparator.js';
|
14232
14705
|
* console.log(new Comparator())
|
14233
14706
|
* </script>
|
14234
14707
|
* ```
|
@@ -14253,7 +14726,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
14253
14726
|
*
|
14254
14727
|
* @example
|
14255
14728
|
*
|
14256
|
-
* import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14729
|
+
* import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/util/comparator.js';
|
14257
14730
|
*
|
14258
14731
|
* console.log(new Comparator().lessThanOrEqual(2, 5))
|
14259
14732
|
* // ↦ true
|
@@ -14466,7 +14939,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
14466
14939
|
*
|
14467
14940
|
* ```
|
14468
14941
|
* <script type="module">
|
14469
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14942
|
+
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/monster.js';
|
14470
14943
|
* Monster.Util.deepFreeze({})
|
14471
14944
|
* </script>
|
14472
14945
|
* ```
|
@@ -14475,7 +14948,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
14475
14948
|
*
|
14476
14949
|
* ```
|
14477
14950
|
* <script type="module">
|
14478
|
-
* import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.
|
14951
|
+
* import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.28.0/dist/modules/util/freeze.js';
|
14479
14952
|
* deepFreeze({})
|
14480
14953
|
* </script>
|
14481
14954
|
* ```
|
@@ -14598,12 +15071,12 @@ __webpack_require__.r(__webpack_exports__);
|
|
14598
15071
|
/* harmony import */ var _dom_constants_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(33);
|
14599
15072
|
/* harmony import */ var _dom_customcontrol_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(34);
|
14600
15073
|
/* harmony import */ var _dom_customelement_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(35);
|
14601
|
-
/* harmony import */ var _dom_events_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(
|
15074
|
+
/* harmony import */ var _dom_events_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(42);
|
14602
15075
|
/* harmony import */ var _dom_locale_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(44);
|
14603
15076
|
/* harmony import */ var _dom_template_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(38);
|
14604
15077
|
/* harmony import */ var _dom_theme_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(39);
|
14605
15078
|
/* harmony import */ var _dom_updater_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(40);
|
14606
|
-
/* harmony import */ var _dom_util_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(
|
15079
|
+
/* harmony import */ var _dom_util_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(43);
|
14607
15080
|
/* harmony import */ var _i18n_locale_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(45);
|
14608
15081
|
/* harmony import */ var _i18n_provider_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(46);
|
14609
15082
|
/* harmony import */ var _i18n_providers_fetch_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(49);
|