@schukai/monster 1.13.0 → 1.15.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (155) hide show
  1. package/CHANGELOG +46 -1
  2. package/README.md +5 -5
  3. package/dist/modules/constants.js +2 -2
  4. package/dist/modules/constraints/abstract.js +2 -2
  5. package/dist/modules/constraints/abstractoperator.js +2 -2
  6. package/dist/modules/constraints/andoperator.js +2 -2
  7. package/dist/modules/constraints/invalid.js +2 -2
  8. package/dist/modules/constraints/isarray.js +2 -2
  9. package/dist/modules/constraints/isobject.js +2 -2
  10. package/dist/modules/constraints/namespace.js +1 -1
  11. package/dist/modules/constraints/oroperator.js +2 -2
  12. package/dist/modules/constraints/valid.js +2 -2
  13. package/dist/modules/data/buildmap.js +2 -2
  14. package/dist/modules/data/diff.js +2 -2
  15. package/dist/modules/data/extend.js +2 -2
  16. package/dist/modules/data/namespace.js +1 -1
  17. package/dist/modules/data/pathfinder.js +2 -2
  18. package/dist/modules/data/pipe.js +2 -2
  19. package/dist/modules/data/transformer.js +2 -2
  20. package/dist/modules/dom/assembler.js +2 -2
  21. package/dist/modules/dom/attributes.js +2 -2
  22. package/dist/modules/dom/constants.js +2 -2
  23. package/dist/modules/dom/customcontrol.js +2 -0
  24. package/dist/modules/dom/customelement.js +2 -2
  25. package/dist/modules/dom/events.js +2 -2
  26. package/dist/modules/dom/locale.js +2 -2
  27. package/dist/modules/dom/namespace.js +1 -1
  28. package/dist/modules/dom/template.js +2 -2
  29. package/dist/modules/dom/theme.js +2 -2
  30. package/dist/modules/dom/updater.js +2 -2
  31. package/dist/modules/dom/util.js +2 -2
  32. package/dist/modules/i18n/locale.js +2 -2
  33. package/dist/modules/i18n/namespace.js +1 -1
  34. package/dist/modules/i18n/provider.js +2 -2
  35. package/dist/modules/i18n/providers/fetch.js +2 -2
  36. package/dist/modules/i18n/providers/namespace.js +1 -1
  37. package/dist/modules/i18n/translations.js +2 -2
  38. package/dist/modules/logging/handler/console.js +2 -2
  39. package/dist/modules/logging/handler/namespace.js +1 -1
  40. package/dist/modules/logging/handler.js +2 -2
  41. package/dist/modules/logging/logentry.js +2 -2
  42. package/dist/modules/logging/logger.js +2 -2
  43. package/dist/modules/logging/namespace.js +1 -1
  44. package/dist/modules/math/namespace.js +1 -1
  45. package/dist/modules/math/random.js +2 -2
  46. package/dist/modules/monster.js +2 -2
  47. package/dist/modules/namespace.js +2 -2
  48. package/dist/modules/text/formatter.js +2 -2
  49. package/dist/modules/text/namespace.js +1 -1
  50. package/dist/modules/types/base.js +2 -2
  51. package/dist/modules/types/basewithoptions.js +2 -2
  52. package/dist/modules/types/global.js +2 -2
  53. package/dist/modules/types/id.js +2 -2
  54. package/dist/modules/types/is.js +2 -2
  55. package/dist/modules/types/namespace.js +1 -1
  56. package/dist/modules/types/observer.js +2 -2
  57. package/dist/modules/types/observerlist.js +2 -2
  58. package/dist/modules/types/proxyobserver.js +2 -2
  59. package/dist/modules/types/queue.js +2 -2
  60. package/dist/modules/types/randomid.js +2 -2
  61. package/dist/modules/types/stack.js +2 -2
  62. package/dist/modules/types/tokenlist.js +2 -2
  63. package/dist/modules/types/typeof.js +2 -2
  64. package/dist/modules/types/uniquequeue.js +2 -2
  65. package/dist/modules/types/validate.js +2 -2
  66. package/dist/modules/types/version.js +2 -2
  67. package/dist/modules/util/clone.js +2 -2
  68. package/dist/modules/util/comparator.js +2 -2
  69. package/dist/modules/util/freeze.js +2 -2
  70. package/dist/modules/util/namespace.js +1 -1
  71. package/dist/monster.dev.js +8622 -7709
  72. package/dist/monster.dev.js.map +1 -1
  73. package/dist/monster.js +2 -9
  74. package/package.json +1 -1
  75. package/source/constants.js +7 -6
  76. package/source/constraints/abstract.js +2 -2
  77. package/source/constraints/abstractoperator.js +4 -4
  78. package/source/constraints/andoperator.js +8 -8
  79. package/source/constraints/invalid.js +6 -6
  80. package/source/constraints/isarray.js +7 -7
  81. package/source/constraints/isobject.js +7 -7
  82. package/source/constraints/namespace.js +2 -2
  83. package/source/constraints/oroperator.js +8 -8
  84. package/source/constraints/valid.js +7 -7
  85. package/source/data/buildmap.js +15 -15
  86. package/source/data/diff.js +9 -9
  87. package/source/data/extend.js +55 -13
  88. package/source/data/namespace.js +2 -2
  89. package/source/data/pathfinder.js +13 -14
  90. package/source/data/pipe.js +8 -8
  91. package/source/data/transformer.js +11 -11
  92. package/source/dom/assembler.js +7 -7
  93. package/source/dom/attributes.js +89 -46
  94. package/source/dom/constants.js +9 -2
  95. package/source/dom/customcontrol.js +299 -0
  96. package/source/dom/customelement.js +181 -66
  97. package/source/dom/events.js +58 -8
  98. package/source/dom/locale.js +5 -5
  99. package/source/dom/namespace.js +2 -2
  100. package/source/dom/template.js +24 -19
  101. package/source/dom/theme.js +8 -9
  102. package/source/dom/updater.js +46 -24
  103. package/source/dom/util.js +10 -10
  104. package/source/i18n/locale.js +7 -7
  105. package/source/i18n/namespace.js +1 -1
  106. package/source/i18n/provider.js +6 -6
  107. package/source/i18n/providers/fetch.js +10 -10
  108. package/source/i18n/translations.js +5 -5
  109. package/source/logging/handler/console.js +5 -5
  110. package/source/logging/handler/namespace.js +1 -1
  111. package/source/logging/handler.js +8 -8
  112. package/source/logging/logentry.js +5 -5
  113. package/source/logging/logger.js +5 -5
  114. package/source/logging/namespace.js +2 -2
  115. package/source/math/namespace.js +2 -2
  116. package/source/math/random.js +5 -5
  117. package/source/monster.js +48 -44
  118. package/source/namespace.js +2 -2
  119. package/source/text/formatter.js +6 -7
  120. package/source/text/namespace.js +1 -1
  121. package/source/types/base.js +4 -5
  122. package/source/types/basewithoptions.js +10 -9
  123. package/source/types/global.js +7 -7
  124. package/source/types/id.js +7 -7
  125. package/source/types/is.js +22 -22
  126. package/source/types/namespace.js +2 -2
  127. package/source/types/observer.js +7 -7
  128. package/source/types/observerlist.js +4 -4
  129. package/source/types/proxyobserver.js +32 -26
  130. package/source/types/queue.js +13 -7
  131. package/source/types/randomid.js +6 -6
  132. package/source/types/stack.js +11 -4
  133. package/source/types/tokenlist.js +9 -9
  134. package/source/types/typeof.js +5 -5
  135. package/source/types/uniquequeue.js +14 -7
  136. package/source/types/validate.js +27 -27
  137. package/source/types/version.js +9 -9
  138. package/source/util/clone.js +6 -6
  139. package/source/util/comparator.js +7 -7
  140. package/source/util/freeze.js +7 -7
  141. package/source/util/namespace.js +2 -2
  142. package/test/cases/data/extend.js +66 -13
  143. package/test/cases/dom/attributes.js +56 -1
  144. package/test/cases/dom/customcontrol.js +264 -0
  145. package/test/cases/dom/customelement.js +112 -51
  146. package/test/cases/dom/events.js +32 -14
  147. package/test/cases/dom/template.js +40 -1
  148. package/test/cases/monster.js +1 -1
  149. package/test/cases/types/proxyobserver.js +9 -0
  150. package/test/util/jsdom.js +3 -0
  151. package/test/web/import.js +1 -0
  152. package/test/web/monster-dev.html +3 -3
  153. package/test/web/monster.html +2 -2
  154. package/test/web/test.html +3 -3
  155. package/test/web/tests.js +3 -3
package/CHANGELOG CHANGED
@@ -2,11 +2,56 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.15.1] - 2021-09-13
6
+
7
+ ### Fixed
8
+
9
+ - [TypeError: t.getElementById is not a function](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/56)
10
+
11
+ ## [1.15.0] - 2021-09-13
12
+
13
+ ### Added
14
+
15
+ - [when changing the option attribute, the options should also change](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/50)
16
+ - [new PROPERTY_KEY_INTERNALDATA internals](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/52)
17
+
18
+ ## Changed
19
+
20
+ - [improvement of the prox handling in the proxobserver](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/55)
21
+ - [move observedAttributes to customelements](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/54)
22
+ - [optimization of the extends handling in distinction to Object.assign](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/53)
23
+ - [change from Monster.assignToNamespace to assignToNamespace an import](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/51)
24
+
25
+ ## [1.14.1] - 2021-09-12
26
+
27
+ ### Fixed
28
+
29
+ - [control and optimize customelement](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/49)
30
+
31
+ ## [1.14.0] - 2021-09-12
32
+
33
+ ### Added
34
+
35
+ - [control and optimize customelement](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/49)
36
+
37
+ ## [1.13.0] - 2021-09-06
38
+
39
+ ### Added
40
+
41
+ - [classes for localization and management of translations](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/48)
42
+
43
+ ## [1.12.0] - 2021-09-05
44
+
45
+ ### Added
46
+
47
+ - [a class to format texts](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/47)
48
+
49
+
5
50
  ## [1.11.1] - 2021-09-05
6
51
 
7
52
  ## Changed
8
53
 
9
- - [improvement of the entry points of the libraries](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/45)
54
+ - [improvement of the entry points of the libraries](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/46)
10
55
 
11
56
 
12
57
  ## [1.11.0] - 2021-09-04
package/README.md CHANGED
@@ -40,7 +40,7 @@ For some functions you need additional [polyfills](#polyfill).
40
40
  <script type="module">
41
41
  import {
42
42
  Monster
43
- } from 'https://unpkg.com/@schukai/monster@1.13.0/dist/modules/monster.js';
43
+ } from 'https://unpkg.com/@schukai/monster@1.15.2/dist/modules/monster.js';
44
44
  let id = document.getElementById('version');
45
45
  id.innerHTML = Monster.getVersion();
46
46
  </script>
@@ -51,8 +51,8 @@ For some functions you need additional [polyfills](#polyfill).
51
51
  `nomodule` for backwards compatibility
52
52
 
53
53
  ```
54
- <script type="module" src="https://unpkg.com/@schukai/monster@1.13.0/dist/modules/monster.js"></script>
55
- <script nomodule src="https://unpkg.com/@schukai/monster@1.13.0/dist/monster.js"></script>
54
+ <script type="module" src="https://unpkg.com/@schukai/monster@1.15.2/dist/modules/monster.js"></script>
55
+ <script nomodule src="https://unpkg.com/@schukai/monster@1.15.2/dist/monster.js"></script>
56
56
  ```
57
57
  ### Polyfill
58
58
 
@@ -61,7 +61,7 @@ We do try to work around some browser bugs, but on the whole we don't use polyfi
61
61
  However, many functions can be mapped via [polyfill.io](https://polyfill.io/) and thus the compatibility can be increased.
62
62
 
63
63
  ```
64
- <script id="polyfill" src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.map,Array.prototype.reduce,ArrayBuffer,DataView,document,DocumentFragment,Element,Event,globalThis,HTMLDocument,Intl,JSON,Map,Math.log2,Number.isInteger,Object.assign,Object.defineProperty,Object.entries,Object.freeze,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.keys,Promise,Reflect,Reflect.defineProperty,Reflect.get,Reflect.getOwnPropertyDescriptor,Reflect.setPrototypeOf,Set,String.prototype.trim,Symbol,Symbol.for,Symbol.iterator,Uint8Array,URL,WeakMap,WeakSet"
64
+ <script id="polyfill" src="https://polyfill.io/v3/polyfill.min.js?features=Array.from,Array.isArray,Array.prototype.entries,Array.prototype.fill,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.map,Array.prototype.reduce,ArrayBuffer,DataView,document,Document,DocumentFragment,Element,Event,globalThis,HTMLDocument,HTMLTemplateElement,Intl,JSON,Map,Math.log2,Number.isInteger,Object.assign,Object.defineProperty,Object.entries,Object.freeze,Object.getOwnPropertyDescriptor,Object.getOwnPropertyNames,Object.getPrototypeOf,Object.keys,Promise,Reflect,Reflect.defineProperty,Reflect.get,Reflect.getOwnPropertyDescriptor,Reflect.setPrototypeOf,Set,String.prototype.trim,Symbol,Symbol.for,Symbol.iterator,Uint8Array,URL,WeakMap,WeakSet"
65
65
  crossorigin="anonymous"
66
66
  referrerpolicy="no-referrer"></script>
67
67
  ```
@@ -78,7 +78,7 @@ After that, all classes are accessible via `MyMonster`. For example `MyMonster.g
78
78
 
79
79
  ## Documentation
80
80
 
81
- To check out docs and examples, visit [monsterjs.org/en/doc/1.13.0/](https://monsterjs.org/en/doc/1.13.0/).
81
+ To check out docs and examples, visit [monsterjs.org/en/doc/1.15.2/](https://monsterjs.org/en/doc/1.15.2/).
82
82
 
83
83
  ## Questions
84
84
 
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"./namespace.js";const PROPERTY_KEY_OPTIONS="monsterOptions";export{Monster,PROPERTY_KEY_OPTIONS};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{Monster}from"./namespace.js";const PROPERTY_KEY_INTERNALDATA="monsterInternalData";export{Monster,PROPERTY_KEY_INTERNALDATA};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";import{Base}from"../types/base.js";class AbstractConstraint extends Base{constructor(){super()}isValid(s){return Promise.reject(s)}}Monster.assignToNamespace("Monster.Constraints",AbstractConstraint);export{Monster,AbstractConstraint};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";class AbstractConstraint extends Base{constructor(){super()}isValid(s){return Promise.reject(s)}}assignToNamespace("Monster.Constraints",AbstractConstraint);export{Monster,AbstractConstraint};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,AbstractConstraint}from"./abstract.js";class AbstractOperator extends AbstractConstraint{constructor(t,r){if(super(),!(t instanceof AbstractConstraint&&r instanceof AbstractConstraint))throw new TypeError("parameters must be from type AbstractConstraint");this.operantA=t,this.operantB=r}}Monster.assignToNamespace("Monster.Constraints",AbstractOperator);export{Monster,AbstractOperator};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class AbstractOperator extends AbstractConstraint{constructor(t,r){if(super(),!(t instanceof AbstractConstraint&&r instanceof AbstractConstraint))throw new TypeError("parameters must be from type AbstractConstraint");this.operantA=t,this.operantB=r}}assignToNamespace("Monster.Constraints",AbstractOperator);export{Monster,AbstractOperator};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,AbstractConstraint}from"./abstract.js";import{AbstractOperator}from"./abstractoperator.js";class AndOperator extends AbstractOperator{isValid(t){return Promise.all([this.operantA.isValid(t),this.operantB.isValid(t)])}}Monster.assignToNamespace("Monster.Constraints",AndOperator);export{Monster,AndOperator};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractOperator}from"./abstractoperator.js";class AndOperator extends AbstractOperator{isValid(r){return Promise.all([this.operantA.isValid(r),this.operantB.isValid(r)])}}assignToNamespace("Monster.Constraints",AndOperator);export{Monster,AndOperator};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,AbstractConstraint}from"./abstract.js";class Invalid extends AbstractConstraint{isValid(t){return Promise.reject(t)}}Monster.assignToNamespace("Monster.Constraints",Invalid);export{Monster,Invalid};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class Invalid extends AbstractConstraint{isValid(s){return Promise.reject(s)}}assignToNamespace("Monster.Constraints",Invalid);export{Monster,Invalid};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,AbstractConstraint}from"./abstract.js";import{isArray}from"../types/is.js";class IsArray extends AbstractConstraint{isValid(r){return isArray(r)?Promise.resolve(r):Promise.reject(r)}}Monster.assignToNamespace("Monster.Constraints",IsArray);export{Monster,IsArray};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray}from"../types/is.js";import{AbstractConstraint}from"./abstract.js";class IsArray extends AbstractConstraint{isValid(s){return isArray(s)?Promise.resolve(s):Promise.reject(s)}}assignToNamespace("Monster.Constraints",IsArray);export{Monster,IsArray};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,AbstractConstraint}from"./abstract.js";import{isObject}from"../types/is.js";class IsObject extends AbstractConstraint{isValid(s){return isObject(s)?Promise.resolve(s):Promise.reject(s)}}Monster.assignToNamespace("Monster.Constraints",IsObject);export{Monster,IsObject};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isObject}from"../types/is.js";import{AbstractConstraint}from"./abstract.js";class IsObject extends AbstractConstraint{isValid(s){return isObject(s)?Promise.resolve(s):Promise.reject(s)}}assignToNamespace("Monster.Constraints",IsObject);export{Monster,IsObject};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
2
  "use strict";const namespace="Monster.Constraints";
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,AbstractOperator}from"./abstractoperator.js";class OrOperator extends AbstractOperator{isValid(o){var a=this;return new Promise(function(t,r){let e,n;a.operantA.isValid(o).then(function(){t()}).catch(function(){(e=!1)===n&&r()}),a.operantB.isValid(o).then(function(){t()}).catch(function(){(n=!1)===e&&r()})})}}Monster.assignToNamespace("Monster.Constraints",OrOperator);export{Monster,OrOperator};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractOperator}from"./abstractoperator.js";class OrOperator extends AbstractOperator{isValid(s){var o=this;return new Promise(function(t,r){let a,e;o.operantA.isValid(s).then(function(){t()}).catch(function(){(a=!1)===e&&r()}),o.operantB.isValid(s).then(function(){t()}).catch(function(){(e=!1)===a&&r()})})}}assignToNamespace("Monster.Constraints",OrOperator);export{Monster,OrOperator};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,AbstractConstraint}from"./abstract.js";class Valid extends AbstractConstraint{isValid(s){return Promise.resolve(s)}}Monster.assignToNamespace("Monster.Constraints",Valid);export{Monster,Valid};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{AbstractConstraint}from"./abstract.js";class Valid extends AbstractConstraint{isValid(s){return Promise.resolve(s)}}assignToNamespace("Monster.Constraints",Valid);export{Monster,Valid};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";import{isFunction}from"../types/is.js";import{validateString}from"../types/validate.js";import{Pathfinder}from"./pathfinder.js";function buildMap(t,e,i,r,n){validateString(e);const o=new Map;let a=new Pathfinder(t),l=a.getVia(e);return l instanceof Map&&l.forEach((t,e,a)=>{isFunction(n)&&!0!==n.call(a,t,e)||(e=build(t,r,e),t=build(t,i),o.set(e,t))}),o}function build(t,a,e){if(void 0===a)return e||t;validateString(a);const i=[...a.matchAll(/(?<placeholder>\$\{(?<path>[a-z.-_0-9]*)\})/gm)];let r=new Pathfinder(t);return 0===i.length?r.getVia(a):(i.forEach(t=>{var e=t?.groups,t=e?.placeholder;void 0!==t&&(e=e?.path,e=r.getVia(e),a=a.replaceAll(t,e))}),a)}Monster.assignToNamespace("Monster.Data",buildMap);export{Monster,buildMap};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isFunction}from"../types/is.js";import{validateString}from"../types/validate.js";import{Pathfinder}from"./pathfinder.js";function buildMap(t,a,i,r,n){validateString(a);const o=new Map;let e=new Pathfinder(t),s=e.getVia(a);return s instanceof Map&&s.forEach((t,a,e)=>{isFunction(n)&&!0!==n.call(e,t,a)||(a=build(t,r,a),t=build(t,i),o.set(a,t))}),o}function build(t,e,a){if(void 0===e)return a||t;validateString(e);const i=[...e.matchAll(/(?<placeholder>\${(?<path>[a-z.-_0-9]*)})/gm)];let r=new Pathfinder(t);return 0===i.length?r.getVia(e):(i.forEach(t=>{var a=t?.groups,t=a?.placeholder;void 0!==t&&(a=a?.path,a=r.getVia(a),e=e.replaceAll(t,a))}),e)}assignToNamespace("Monster.Data",buildMap);export{Monster,buildMap};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,isArray,isObject}from"../types/is.js";function Diff(e,t){return doDiff(e,t)}function getKeys(e,t,n){if(isArray(n)){const o=e.length>t.length?new Array(e.length):new Array(t.length);return o.fill(0),new Set(o.map((e,t)=>t))}return new Set(Object.keys(e).concat(Object.keys(t)))}function doDiff(t,n,e,o){var r=typeof t,s=typeof n;const i=e||[],a=o||[];return r==s&&"object"==r?getKeys(t,n,r).forEach(e=>{Object.prototype.hasOwnProperty.call(t,e)?Object.prototype.hasOwnProperty.call(n,e)?doDiff(t[e],n[e],i.concat(e),a):a.push(buildResult(t[e],n[e],"delete",i.concat(e))):a.push(buildResult(t[e],n[e],"add",i.concat(e)))}):void 0!==(s=getOperator(t,n,r,s))&&a.push(buildResult(t,n,s,e)),a}function buildResult(e,t,n,o){const r={operator:n,path:o};return"add"!==n&&(r.first={value:e,type:typeof e},!isObject(e)||void 0!==(e=Object.getPrototypeOf(e)?.constructor?.name)&&(r.first.instance=e)),"add"!==n&&"update"!==n||(r.second={value:t,type:typeof t},!isObject(t)||void 0!==(t=Object.getPrototypeOf(t)?.constructor?.name)&&(r.second.instance=t)),r}function isNotEqual(e,t){return typeof e!=typeof t||(e instanceof Date&&t instanceof Date?e.getTime()!==t.getTime():e!==t)}function getOperator(e,t){let n;var o=typeof e,r=typeof t;return"undefined"==o&&"undefined"!=r?n="add":"undefined"!=o&&"undefined"==r?n="delete":isNotEqual(e,t)&&(n="update"),n}Monster.assignToNamespace("Monster.Data",Diff);export{Monster,Diff};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray,isObject}from"../types/is.js";function Diff(e,t){return doDiff(e,t)}function getKeys(e,t,n){if(isArray(n)){const o=e.length>t.length?new Array(e.length):new Array(t.length);return o.fill(0),new Set(o.map((e,t)=>t))}return new Set(Object.keys(e).concat(Object.keys(t)))}function doDiff(t,n,e,o){var r=typeof t,s=typeof n;const a=e||[],i=o||[];return r==s&&"object"==r?getKeys(t,n,r).forEach(e=>{Object.prototype.hasOwnProperty.call(t,e)?Object.prototype.hasOwnProperty.call(n,e)?doDiff(t[e],n[e],a.concat(e),i):i.push(buildResult(t[e],n[e],"delete",a.concat(e))):i.push(buildResult(t[e],n[e],"add",a.concat(e)))}):void 0!==(s=getOperator(t,n,r,s))&&i.push(buildResult(t,n,s,e)),i}function buildResult(e,t,n,o){const r={operator:n,path:o};return"add"!==n&&(r.first={value:e,type:typeof e},!isObject(e)||void 0!==(e=Object.getPrototypeOf(e)?.constructor?.name)&&(r.first.instance=e)),"add"!==n&&"update"!==n||(r.second={value:t,type:typeof t},!isObject(t)||void 0!==(t=Object.getPrototypeOf(t)?.constructor?.name)&&(r.second.instance=t)),r}function isNotEqual(e,t){return typeof e!=typeof t||(e instanceof Date&&t instanceof Date?e.getTime()!==t.getTime():e!==t)}function getOperator(e,t){let n;var o=typeof e,r=typeof t;return"undefined"==o&&"undefined"!=r?n="add":"undefined"!=o&&"undefined"==r?n="delete":isNotEqual(e,t)&&(n="update"),n}assignToNamespace("Monster.Data",Diff);export{Monster,Diff};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,isObject}from"../types/is.js";function extend(){for(var e={},t=0;t<arguments.length;t++)if(isObject(e))for(var r in arguments[t])arguments[t].hasOwnProperty(r)&&(e[r]=isObject(arguments[t][r])?extend(e[r]||{},arguments[t][r]):arguments[t][r]);return e}Monster.assignToNamespace("Monster.Data",extend);export{Monster,extend};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isArray,isObject}from"../types/is.js";import{typeOf}from"../types/typeof.js";function extend(){let e,r;for(r=0;r<arguments.length;r++){var t=arguments[r];if(!isObject(t)&&!isArray(t))throw new Error("unsuported argument "+JSON.stringify(t));if(void 0!==e)for(var s in t){var i=t?.[s];if(i!==e?.[s])if(isObject(i)||isArray(i)){if(void 0===e[s]&&(isArray(i)?e[s]=[]:e[s]={}),typeOf(e[s])!==typeOf(i))throw new Error("type mismatch: "+JSON.stringify(e[s])+" != "+JSON.stringify(i));e[s]=extend(e[s],i)}else e[s]=i}else e=t}return e}assignToNamespace("Monster.Data",extend);export{Monster,extend};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
2
  "use strict";const namespace="Monster.Data";
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";import{isObject,isArray,isInteger}from"../types/is.js";import{validateString,validateInteger}from"../types/validate.js";import{Base}from"../types/base.js";import{Stack}from"../types/stack.js";const DELIMITER=".",WILDCARD="*";class Pathfinder extends Base{constructor(t){super(),this.object=t,this.wildCard=WILDCARD}setWildCard(t){return validateString(t),this.wildCard=t,this}getVia(t){return getValueViaPath.call(this,this.object,validateString(t))}setVia(t,e){return validateString(t),setValueViaPath.call(this,this.object,t,e),this}deleteVia(t){return validateString(t),deleteValueViaPath.call(this,this.object,t),this}exists(t){validateString(t);try{return getValueViaPath.call(this,this.object,t,!0),!0}catch(t){}return!1}}function iterate(t,e,a){const i=new Map;if(isObject(t)||isArray(t))for(var[r,s]of Object.entries(t))i.set(r,getValueViaPath.call(this,s,e,a));else{var n=e.split(DELIMITER).shift();i.set(n,getValueViaPath.call(this,t,e,a))}return i}function getValueViaPath(e,t,a){if(""===t)return e;let i=t.split(DELIMITER),r=i.shift();if(r===this.wildCard)return iterate.call(this,e,i.join(DELIMITER),a);if(isObject(e)||isArray(e)){let t;if(e instanceof Map||e instanceof WeakMap)t=e.get(r);else if(e instanceof Set||e instanceof WeakSet)r=parseInt(r),validateInteger(r),t=[...e][r];else{if("function"==typeof WeakRef&&e instanceof WeakRef)throw Error("unsupported action for this data type");t=(isArray(e)&&(r=parseInt(r),validateInteger(r)),e?.[r])}if(isObject(t)||isArray(t))return getValueViaPath.call(this,t,i.join(DELIMITER),a);if(0<i.length)throw Error("the journey is not at its end ("+i.join(DELIMITER)+")");if(!0===a&&!e.hasOwnProperty(r))throw Error("unknown value");return t}throw TypeError("unsupported type "+typeof e)}function setValueViaPath(e,t,a){validateString(t);let i=t.split(DELIMITER),r=i.pop();var s,t=i.join(DELIMITER);let n=new Stack,o=t;for(;;){try{getValueViaPath.call(this,e,o,!0);break}catch(t){}if(n.push(o),i.pop(),o=i.join(DELIMITER),""===o)break}for(;!n.isEmpty();){o=n.pop();let t={};n.isEmpty()||(s=n.peek().split(DELIMITER).pop(),isInteger(parseInt(s))&&(t=[])),setValueViaPath.call(this,e,o,t)}let l=getValueViaPath.call(this,e,t);if(!isObject(e)&&!isArray(e))throw TypeError("unsupported type: "+typeof e);if(l instanceof Map||l instanceof WeakMap)l.set(r,a);else if(l instanceof Set||l instanceof WeakSet)l.append(a);else{if("function"==typeof WeakRef&&l instanceof WeakRef)throw Error("unsupported action for this data type");isArray(l)&&(r=parseInt(r),validateInteger(r)),assignProperty(l,r,a)}}function assignProperty(t,e,a){t.hasOwnProperty(e)&&void 0===a&&delete t[e],t[e]=a}function deleteValueViaPath(t,e){const a=e.split(DELIMITER);let i=a.pop();e=a.join(DELIMITER);const r=getValueViaPath.call(this,t,e);if(r instanceof Map)r.delete(i);else{if(r instanceof Set||r instanceof WeakMap||r instanceof WeakSet||"function"==typeof WeakRef&&r instanceof WeakRef)throw Error("unsupported action for this data type");isArray(r)&&(i=parseInt(i),validateInteger(i)),delete r[i]}}Monster.assignToNamespace("Monster.Data",Pathfinder);export{Monster,Pathfinder};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{isArray,isInteger,isObject}from"../types/is.js";import{Stack}from"../types/stack.js";import{validateInteger,validateString}from"../types/validate.js";const DELIMITER=".",WILDCARD="*";class Pathfinder extends Base{constructor(t){super(),this.object=t,this.wildCard=WILDCARD}setWildCard(t){return validateString(t),this.wildCard=t,this}getVia(t){return getValueViaPath.call(this,this.object,validateString(t))}setVia(t,e){return validateString(t),setValueViaPath.call(this,this.object,t,e),this}deleteVia(t){return validateString(t),deleteValueViaPath.call(this,this.object,t),this}exists(t){validateString(t);try{return getValueViaPath.call(this,this.object,t,!0),!0}catch(t){}return!1}}function iterate(t,e,a){const i=new Map;if(isObject(t)||isArray(t))for(var[r,s]of Object.entries(t))i.set(r,getValueViaPath.call(this,s,e,a));else{var n=e.split(DELIMITER).shift();i.set(n,getValueViaPath.call(this,t,e,a))}return i}function getValueViaPath(e,t,a){if(""===t)return e;let i=t.split(DELIMITER),r=i.shift();if(r===this.wildCard)return iterate.call(this,e,i.join(DELIMITER),a);if(isObject(e)||isArray(e)){let t;if(e instanceof Map||e instanceof WeakMap)t=e.get(r);else if(e instanceof Set||e instanceof WeakSet)r=parseInt(r),validateInteger(r),t=[...e][r];else{if("function"==typeof WeakRef&&e instanceof WeakRef)throw Error("unsupported action for this data type");t=(isArray(e)&&(r=parseInt(r),validateInteger(r)),e?.[r])}if(isObject(t)||isArray(t))return getValueViaPath.call(this,t,i.join(DELIMITER),a);if(0<i.length)throw Error("the journey is not at its end ("+i.join(DELIMITER)+")");if(!0===a&&!e.hasOwnProperty(r))throw Error("unknown value");return t}throw TypeError("unsupported type "+typeof e)}function setValueViaPath(e,t,a){validateString(t);let i=t.split(DELIMITER),r=i.pop();var s,t=i.join(DELIMITER);let n=new Stack,o=t;for(;;){try{getValueViaPath.call(this,e,o,!0);break}catch(t){}if(n.push(o),i.pop(),o=i.join(DELIMITER),""===o)break}for(;!n.isEmpty();){o=n.pop();let t={};n.isEmpty()||(s=n.peek().split(DELIMITER).pop(),isInteger(parseInt(s))&&(t=[])),setValueViaPath.call(this,e,o,t)}let l=getValueViaPath.call(this,e,t);if(!isObject(e)&&!isArray(e))throw TypeError("unsupported type: "+typeof e);if(l instanceof Map||l instanceof WeakMap)l.set(r,a);else if(l instanceof Set||l instanceof WeakSet)l.append(a);else{if("function"==typeof WeakRef&&l instanceof WeakRef)throw Error("unsupported action for this data type");isArray(l)&&(r=parseInt(r),validateInteger(r)),assignProperty(l,r,a)}}function assignProperty(t,e,a){t.hasOwnProperty(e)&&void 0===a&&delete t[e],t[e]=a}function deleteValueViaPath(t,e){const a=e.split(DELIMITER);let i=a.pop();e=a.join(DELIMITER);const r=getValueViaPath.call(this,t,e);if(r instanceof Map)r.delete(i);else{if(r instanceof Set||r instanceof WeakMap||r instanceof WeakSet||"function"==typeof WeakRef&&r instanceof WeakRef)throw Error("unsupported action for this data type");isArray(r)&&(i=parseInt(i),validateInteger(i)),delete r[i]}}assignToNamespace("Monster.Data",Pathfinder);export{Monster,Pathfinder};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";import{Transformer}from"./transformer.js";import{Base}from"../types/base.js";import{validateFunction,validateString}from"../types/validate.js";const DELIMITER="|";class Pipe extends Base{constructor(e){super(),validateString(e),this.pipe=e.split(DELIMITER).map(e=>new Transformer(e))}setCallback(e,r,t){for(var[,s]of Object.entries(this.pipe))s.setCallback(e,r,t);return this}run(e){return this.pipe.reduce((e,r,t,s)=>r.run(e),e)}}Monster.assignToNamespace("Monster.Data",Pipe);export{Monster,Pipe};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateString}from"../types/validate.js";import{Transformer}from"./transformer.js";const DELIMITER="|";class Pipe extends Base{constructor(e){super(),validateString(e),this.pipe=e.split(DELIMITER).map(e=>new Transformer(e))}setCallback(e,s,r){for(var[,t]of Object.entries(this.pipe))t.setCallback(e,s,r);return this}run(e){return this.pipe.reduce((e,s,r,t)=>s.run(e),e)}}assignToNamespace("Monster.Data",Pipe);export{Monster,Pipe};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobal}from"../types/global.js";import{validateString,validatePrimitive,validateFunction,validateInteger,validateObject}from"../types/validate.js";import{isObject,isString,isArray}from"../types/is.js";import{ID}from"../types/id.js";import{clone}from"../util/clone.js";import{Pathfinder}from"./pathfinder.js";class Transformer extends Base{constructor(e){super(),validateString(e),this.args=disassemble(e),this.command=this.args.shift(),this.callbacks=new Map}setCallback(e,t,r){return validateString(e),validateFunction(t),void 0!==r&&validateObject(r),this.callbacks.set(e,{callback:t,context:r}),this}run(e){return transform.apply(this,[e])}}function disassemble(e){validateString(e);let a=new Map;var t;for(t of e.matchAll(/((?<pattern>\\(?<char>.)){1})/gim)){var r,s,n=t?.groups;isObject(n)&&(s=n?.char,(r=n?.pattern)&&s&&(n="__"+(new ID).toString()+"__",a.set(n,s),e=e.replace(r,n)))}let i=e.split(":");return i=i.map(function(e){let t=e.trim();for(var r of a)t=t.replace(r[0],r[1]);return t}),i}function convertToString(e){return isObject(e)&&e.hasOwnProperty("toString")&&(e=e.toString()),validateString(e),e}function transform(s){let n=clone(this.args),i;switch(this.command){case"static":return this.args.join(":");case"tolower":case"strtolower":case"tolowercase":return validateString(s),s.toLowerCase();case"toupper":case"strtoupper":case"touppercase":return validateString(s),s.toUpperCase();case"tostring":return""+s;case"tointeger":var o=parseInt(s);return validateInteger(o),o;case"tojson":return JSON.stringify(s);case"fromjson":return JSON.parse(s);case"trim":return validateString(s),s.trim();case"rawurlencode":return validateString(s),encodeURIComponent(s).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A");case"call":let e;var c=n.shift();let t=getGlobal();return isObject(s)&&s.hasOwnProperty(c)?e=s[c]:this.callbacks.has(c)?(o=this.callbacks.get(c),e=o?.callback,t=o?.context):"object"==typeof window&&window.hasOwnProperty(c)&&(e=window[c]),validateFunction(e),n.unshift(s),e.call(t,...n);case"plain":case"plaintext":return validateString(s),(new DOMParser).parseFromString(s,"text/html").body.textContent||"";case"if":case"?":validatePrimitive(s);let r=n.shift()||void 0,a=n.shift()||void 0;return"value"===r&&(r=s),"\\value"===r&&(r="value"),"value"===a&&(a=s),"\\value"===a&&(a="value"),void 0!==s&&""!==s&&"off"!==s&&"false"!==s&&!1!==s||"on"===s||"true"===s||!0===s?r:a;case"ucfirst":return validateString(s),s.charAt(0).toUpperCase()+s.substr(1);case"ucwords":return validateString(s),s.replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g,function(e){return e.toUpperCase()});case"count":case"length":if((isString(s)||isObject(s)||isArray(s))&&s.hasOwnProperty("length"))return s.length;throw new TypeError("unsupported type "+typeof s);case"base64":return convertToString(s),btoa(s);case"empty":return"";case"undefined":return;case"prefix":return validateString(s),n?.[0]+s;case"suffix":return validateString(s),s+n?.[0];case"uniqid":return(new ID).toString();case"key":case"property":case"index":i=n.shift()||"undefined";var l=n.shift()||"";if(s instanceof Map)return s.has(i)?s.get(i):l;if(isObject(s)||isArray(s))return s?.[i]||l;throw new Error("type not supported");case"path":return i=n.shift()||"undefined",new Pathfinder(s).getVia(i);case"substring":validateString(s);c=parseInt(n[0])||0,l=(parseInt(n[1])||0)+c;return s.substring(c,l);case"nop":return s;case"default":return void 0!==s?s:n[0];default:throw new Error("unknown command "+this.command)}return s}Monster.assignToNamespace("Monster.Data",Transformer);export{Monster,Transformer};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobal}from"../types/global.js";import{ID}from"../types/id.js";import{isArray,isObject,isString}from"../types/is.js";import{validateFunction,validateInteger,validateObject,validatePrimitive,validateString}from"../types/validate.js";import{clone}from"../util/clone.js";import{Pathfinder}from"./pathfinder.js";class Transformer extends Base{constructor(e){super(),validateString(e),this.args=disassemble(e),this.command=this.args.shift(),this.callbacks=new Map}setCallback(e,t,r){return validateString(e),validateFunction(t),void 0!==r&&validateObject(r),this.callbacks.set(e,{callback:t,context:r}),this}run(e){return transform.apply(this,[e])}}function disassemble(e){validateString(e);let a=new Map;var t;for(t of e.matchAll(/((?<pattern>\\(?<char>.)){1})/gim)){var r,s,n=t?.groups;isObject(n)&&(s=n?.char,(r=n?.pattern)&&s&&(n="__"+(new ID).toString()+"__",a.set(n,s),e=e.replace(r,n)))}let i=e.split(":");return i=i.map(function(e){let t=e.trim();for(var r of a)t=t.replace(r[0],r[1]);return t}),i}function convertToString(e){return isObject(e)&&e.hasOwnProperty("toString")&&(e=e.toString()),validateString(e),e}function transform(s){let n=clone(this.args),i;switch(this.command){case"static":return this.args.join(":");case"tolower":case"strtolower":case"tolowercase":return validateString(s),s.toLowerCase();case"toupper":case"strtoupper":case"touppercase":return validateString(s),s.toUpperCase();case"tostring":return""+s;case"tointeger":var o=parseInt(s);return validateInteger(o),o;case"tojson":return JSON.stringify(s);case"fromjson":return JSON.parse(s);case"trim":return validateString(s),s.trim();case"rawurlencode":return validateString(s),encodeURIComponent(s).replace(/!/g,"%21").replace(/'/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A");case"call":let e;var c=n.shift();let t=getGlobal();return isObject(s)&&s.hasOwnProperty(c)?e=s[c]:this.callbacks.has(c)?(o=this.callbacks.get(c),e=o?.callback,t=o?.context):"object"==typeof window&&window.hasOwnProperty(c)&&(e=window[c]),validateFunction(e),n.unshift(s),e.call(t,...n);case"plain":case"plaintext":return validateString(s),(new DOMParser).parseFromString(s,"text/html").body.textContent||"";case"if":case"?":validatePrimitive(s);let r=n.shift()||void 0,a=n.shift()||void 0;return"value"===r&&(r=s),"\\value"===r&&(r="value"),"value"===a&&(a=s),"\\value"===a&&(a="value"),void 0!==s&&""!==s&&"off"!==s&&"false"!==s&&!1!==s||"on"===s||"true"===s||!0===s?r:a;case"ucfirst":return validateString(s),s.charAt(0).toUpperCase()+s.substr(1);case"ucwords":return validateString(s),s.replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g,function(e){return e.toUpperCase()});case"count":case"length":if((isString(s)||isObject(s)||isArray(s))&&s.hasOwnProperty("length"))return s.length;throw new TypeError("unsupported type "+typeof s);case"base64":return convertToString(s),btoa(s);case"empty":return"";case"undefined":return;case"prefix":return validateString(s),n?.[0]+s;case"suffix":return validateString(s),s+n?.[0];case"uniqid":return(new ID).toString();case"key":case"property":case"index":i=n.shift()||"undefined";var l=n.shift()||"";if(s instanceof Map)return s.has(i)?s.get(i):l;if(isObject(s)||isArray(s))return s?.[i]||l;throw new Error("type not supported");case"path":return i=n.shift()||"undefined",new Pathfinder(s).getVia(i);case"substring":validateString(s);c=parseInt(n[0])||0,l=(parseInt(n[1])||0)+c;return s.substring(c,l);case"nop":return s;case"default":return void 0!==s?s:n[0];default:throw new Error("unknown command "+this.command)}return s}assignToNamespace("Monster.Data",Transformer);export{Monster,Transformer};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,Base}from"../types/base.js";import{validateInstance,validateString}from"../types/validate.js";import{getGlobalFunction}from"../types/global.js";import{ProxyObserver}from"../types/proxyobserver.js";const ATTRIBUTEPREFIX="data-monster-";class Assembler extends Base{constructor(e){super(),this.attributePrefix=ATTRIBUTEPREFIX,validateInstance(e,getGlobalFunction("DocumentFragment")),this.fragment=e}setAttributePrefix(e){return validateString(e),this.attributePrefix=e,this}getAttributePrefix(){return this.attributePrefix}createDocumentFragment(e){return void 0===e&&(e=new ProxyObserver({})),validateInstance(e,ProxyObserver),this.fragment.cloneNode(!0)}}Monster.assignToNamespace("Monster.DOM",Assembler);export{Monster,ATTRIBUTEPREFIX,Assembler};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobalFunction}from"../types/global.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateInstance,validateString}from"../types/validate.js";const ATTRIBUTEPREFIX="data-monster-";class Assembler extends Base{constructor(e){super(),this.attributePrefix=ATTRIBUTEPREFIX,validateInstance(e,getGlobalFunction("DocumentFragment")),this.fragment=e}setAttributePrefix(e){return validateString(e),this.attributePrefix=e,this}getAttributePrefix(){return this.attributePrefix}createDocumentFragment(e){return void 0===e&&(e=new ProxyObserver({})),validateInstance(e,ProxyObserver),this.fragment.cloneNode(!0)}}assignToNamespace("Monster.DOM",Assembler);export{Monster,ATTRIBUTEPREFIX,Assembler};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";import{getGlobalFunction}from"../types/global.js";import{isInstance}from"../types/is.js";import{TokenList}from"../types/tokenlist.js";import{validateInstance,validateString,validateSymbol}from"../types/validate.js";import{ATTRIBUTE_OBJECTLINK}from"./constants.js";function findClosestObjectLink(t){if(validateInstance(t,getGlobalFunction("Node")),!1===t.hasAttribute(ATTRIBUTE_OBJECTLINK)){var e=t?.parentNode;if(isInstance(e,getGlobalFunction("Node")))return findClosestObjectLink(e)}return t}function addToObjectLink(t,e,n){return validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e]&&(t[e]=new Set),addAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString()),t[e].add(n),t}function removeObjectLink(t,e){return validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e]||(removeAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString()),delete t[e]),t}function hasObjectLink(t,e){return validateInstance(t,HTMLElement),validateSymbol(e),void 0!==t?.[e]&&containsAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString())}function getLinkedObjects(t,e){if(validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e])throw new Error("there is no object link for "+e.toString());return t?.[e][Symbol.iterator]()}function toggleAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)?t.setAttribute(e,new TokenList(t.getAttribute(e)).toggle(n).toString()):t.setAttribute(e,n),t}function addAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)?t.setAttribute(e,new TokenList(t.getAttribute(e)).add(n).toString()):t.setAttribute(e,n),t}function removeAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,new TokenList(t.getAttribute(e)).remove(n).toString()),t}function containsAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),!!t.hasAttribute(e)&&new TokenList(t.getAttribute(e)).contains(n)}function replaceAttributeToken(t,e,n,i){return validateInstance(t,HTMLElement),validateString(n),validateString(i),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,new TokenList(t.getAttribute(e)).replace(n,i).toString()),t}function clearAttributeTokens(t,e){return validateInstance(t,HTMLElement),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,""),t}Monster.assignToNamespace("Monster.DOM",getLinkedObjects,addToObjectLink,removeObjectLink,hasObjectLink,clearAttributeTokens,replaceAttributeToken,containsAttributeToken,removeAttributeToken,addAttributeToken,toggleAttributeToken);export{Monster,addToObjectLink,removeObjectLink,hasObjectLink,clearAttributeTokens,replaceAttributeToken,containsAttributeToken,removeAttributeToken,addAttributeToken,toggleAttributeToken,getLinkedObjects,findClosestObjectLink};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{getGlobalFunction}from"../types/global.js";import{TokenList}from"../types/tokenlist.js";import{validateInstance,validateString,validateSymbol}from"../types/validate.js";import{ATTRIBUTE_OBJECTLINK}from"./constants.js";function findClosestObjectLink(t){return findClosestByAttribute(t,ATTRIBUTE_OBJECTLINK)}function addToObjectLink(t,e,n){return validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e]&&(t[e]=new Set),addAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString()),t[e].add(n),t}function removeObjectLink(t,e){return validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e]||(removeAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString()),delete t[e]),t}function hasObjectLink(t,e){return validateInstance(t,HTMLElement),validateSymbol(e),void 0!==t?.[e]&&containsAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString())}function getLinkedObjects(t,e){if(validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e])throw new Error("there is no object link for "+e.toString());return t?.[e][Symbol.iterator]()}function toggleAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)?t.setAttribute(e,new TokenList(t.getAttribute(e)).toggle(n).toString()):t.setAttribute(e,n),t}function addAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)?t.setAttribute(e,new TokenList(t.getAttribute(e)).add(n).toString()):t.setAttribute(e,n),t}function removeAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,new TokenList(t.getAttribute(e)).remove(n).toString()),t}function containsAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),!!t.hasAttribute(e)&&new TokenList(t.getAttribute(e)).contains(n)}function replaceAttributeToken(t,e,n,i){return validateInstance(t,HTMLElement),validateString(n),validateString(i),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,new TokenList(t.getAttribute(e)).replace(n,i).toString()),t}function clearAttributeTokens(t,e){return validateInstance(t,HTMLElement),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,""),t}function findClosestByAttribute(t,e,n){if(validateInstance(t,getGlobalFunction("HTMLElement")),t.hasAttribute(e)&&t.getAttribute(e)===n)return t;let i=validateString(e);void 0!==n&&(i+="="+validateString(n));t=t.closest("["+i+"]");return t instanceof HTMLElement?t:void 0}assignToNamespace("Monster.DOM",getLinkedObjects,addToObjectLink,removeObjectLink,findClosestByAttribute,hasObjectLink,clearAttributeTokens,replaceAttributeToken,containsAttributeToken,removeAttributeToken,addAttributeToken,toggleAttributeToken);export{Monster,addToObjectLink,removeObjectLink,hasObjectLink,findClosestByAttribute,clearAttributeTokens,replaceAttributeToken,containsAttributeToken,removeAttributeToken,addAttributeToken,toggleAttributeToken,getLinkedObjects,findClosestObjectLink};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";const ATTRIBUTE_PREFIX="data-monster-",ATTRIBUTE_OPTIONS=ATTRIBUTE_PREFIX+"options",DEFAULT_THEME="monster",ATTRIBUTE_THEME_PREFIX=ATTRIBUTE_PREFIX+"theme-",ATTRIBUTE_THEME_NAME=ATTRIBUTE_THEME_PREFIX+"name",ATTRIBUTE_UPDATER_ATTRIBUTES=ATTRIBUTE_PREFIX+"attributes",ATTRIBUTE_UPDATER_REPLACE=ATTRIBUTE_PREFIX+"replace",ATTRIBUTE_UPDATER_INSERT=ATTRIBUTE_PREFIX+"insert",ATTRIBUTE_UPDATER_INSERT_REFERENCE=ATTRIBUTE_PREFIX+"insert-reference",ATTRIBUTE_UPDATER_REMOVE=ATTRIBUTE_PREFIX+"remove",ATTRIBUTE_UPDATER_BIND=ATTRIBUTE_PREFIX+"bind",ATTRIBUTE_OBJECTLINK=ATTRIBUTE_PREFIX+"objectlink",OBJECTLINK_KEY_UPDATER="monsterUpdater";export{Monster,ATTRIBUTE_PREFIX,ATTRIBUTE_OPTIONS,DEFAULT_THEME,ATTRIBUTE_THEME_PREFIX,ATTRIBUTE_THEME_NAME,ATTRIBUTE_UPDATER_ATTRIBUTES,ATTRIBUTE_UPDATER_REPLACE,ATTRIBUTE_UPDATER_INSERT,ATTRIBUTE_UPDATER_INSERT_REFERENCE,ATTRIBUTE_UPDATER_REMOVE,ATTRIBUTE_UPDATER_BIND,ATTRIBUTE_OBJECTLINK,OBJECTLINK_KEY_UPDATER};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{Monster}from"../namespace.js";const ATTRIBUTE_PREFIX="data-monster-",ATTRIBUTE_OPTIONS=ATTRIBUTE_PREFIX+"options",DEFAULT_THEME="monster",ATTRIBUTE_THEME_PREFIX=ATTRIBUTE_PREFIX+"theme-",ATTRIBUTE_THEME_NAME=ATTRIBUTE_THEME_PREFIX+"name",ATTRIBUTE_UPDATER_ATTRIBUTES=ATTRIBUTE_PREFIX+"attributes",ATTRIBUTE_UPDATER_REPLACE=ATTRIBUTE_PREFIX+"replace",ATTRIBUTE_UPDATER_INSERT=ATTRIBUTE_PREFIX+"insert",ATTRIBUTE_UPDATER_INSERT_REFERENCE=ATTRIBUTE_PREFIX+"insert-reference",ATTRIBUTE_UPDATER_REMOVE=ATTRIBUTE_PREFIX+"remove",ATTRIBUTE_UPDATER_BIND=ATTRIBUTE_PREFIX+"bind",ATTRIBUTE_ROLE=ATTRIBUTE_PREFIX+"role",ATTRIBUTE_OBJECTLINK=ATTRIBUTE_PREFIX+"objectlink",OBJECTLINK_KEY_UPDATER="monsterUpdater";export{Monster,ATTRIBUTE_PREFIX,ATTRIBUTE_OPTIONS,DEFAULT_THEME,ATTRIBUTE_THEME_PREFIX,ATTRIBUTE_ROLE,ATTRIBUTE_THEME_NAME,ATTRIBUTE_UPDATER_ATTRIBUTES,ATTRIBUTE_UPDATER_REPLACE,ATTRIBUTE_UPDATER_INSERT,ATTRIBUTE_UPDATER_INSERT_REFERENCE,ATTRIBUTE_UPDATER_REMOVE,ATTRIBUTE_UPDATER_BIND,ATTRIBUTE_OBJECTLINK,OBJECTLINK_KEY_UPDATER};
@@ -0,0 +1,2 @@
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{extend}from"../data/extend.js";import{assignToNamespace,Monster}from"../namespace.js";import{CustomElement}from"./customelement.js";const internalSymbol=Symbol("internalSymbol");class CustomControl extends CustomElement{constructor(){super(),"function"==typeof this.attachInternals&&(this[internalSymbol]=this.attachInternals())}static get formAssociated(){return!0}get defaults(){return extend({},super.defaults)}get value(){throw Error("the value getter must be overwritten by the derived class")}set value(t){throw Error("the value setter must be overwritten by the derived class")}get labels(){return getInternal.call(this)?.labels}get name(){return this.getAttribute("name")}get type(){return this.constructor.getTag()}get validity(){return getInternal.call(this)?.validity}get validationMessage(){return getInternal.call(this)?.validationMessage}get willValidate(){return getInternal.call(this)?.willValidate}get states(){return getInternal.call(this)?.states}get form(){return getInternal.call(this)?.form}setFormValue(t,e){getInternal.call(this).setFormValue(t,e)}setValidity(t,e,r){getInternal.call(this).setValidity(t,e,r)}checkValidity(){return getInternal.call(this)?.checkValidity()}reportValidity(){return getInternal.call(this)?.reportValidity()}}function getInternal(){if(!(internalSymbol in this))throw new Error("ElementInternals is not supported and a polyfill is necessary");return this[internalSymbol]}assignToNamespace("Monster.DOM",CustomControl);export{Monster,CustomControl};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,Updater}from"./updater.js";import{extend}from"../data/extend.js";import{Pathfinder}from"../data/pathfinder.js";import{ATTRIBUTE_OPTIONS,OBJECTLINK_KEY_UPDATER}from"./constants.js";import{findDocumentTemplate,Template}from"./template.js";import{addToObjectLink,hasObjectLink}from"./attributes.js";import{getGlobalObject}from"../types/global.js";import{validateFunction,validateObject}from"../types/validate.js";import{isString}from"../types/is.js";import{getDocument}from"./util.js";import{PROPERTY_KEY_OPTIONS}from"../constants.js";const optionsSymbol=Symbol.for(PROPERTY_KEY_OPTIONS),objectLinkSymbol=Symbol.for(OBJECTLINK_KEY_UPDATER),initMethodSymbol=Symbol("initMethodSymbol"),assembleMethodSymbol=Symbol("assembleMethodSymbol"),document=getDocument();class CustomElement extends HTMLElement{constructor(){super(),this[optionsSymbol]=extend({},this.defaults,getOptionsFromAttributes.call(this)),this[initMethodSymbol]()}get defaults(){return{shadowMode:"open",delegatesFocus:!0,templates:{main:void 0}}}getOption(t,e){let o;try{o=new Pathfinder(this[optionsSymbol]).getVia(t)}catch(t){}return void 0===o?e:o}[initMethodSymbol](){return this}[assembleMethodSymbol](){var t;let e;if(!1!==this.getOption("shadowMode",!1))try{initShadowRoot.call(this),e=this.shadowRoot.childNodes}catch(t){}e instanceof NodeList||(initHtmlContent.call(this),e=this.childNodes);const o=new Set;addToObjectLink(this,objectLinkSymbol,o);for([,t]of Object.entries(e))if(t instanceof HTMLElement){const i=new Updater(t,this[optionsSymbol]);o.add(i),i.run().then(()=>{i.enableEventProcessing()})}return this}connectedCallback(){let t=this;hasObjectLink(t,objectLinkSymbol)||setTimeout(()=>{t[assembleMethodSymbol]()},0)}disconnectedCallback(){}adoptedCallback(){}attributeChangedCallback(t,e,o){}static getTag(){throw new Error("the method getTag must be overwritten by the derived class.")}static getCSSStyleSheet(){}}function getOptionsFromAttributes(){if(this.hasAttribute(ATTRIBUTE_OPTIONS))try{var t=JSON.parse(this.getAttribute(ATTRIBUTE_OPTIONS));return validateObject(t),t}catch(t){throw new Error("the options attribute "+ATTRIBUTE_OPTIONS+" does not contain a valid json definition (actual: "+this.getAttribute(ATTRIBUTE_OPTIONS)+").")}return{}}function initHtmlContent(){try{let t=findDocumentTemplate(this.constructor.getTag());this.appendChild(t.createDocumentFragment())}catch(t){var e=this.getOption("templates.main","");isString(e)&&0<e.length&&(this.innerHTML=e)}return this}function initShadowRoot(){let t,e;try{t=findDocumentTemplate(this.constructor.getTag())}catch(t){if(e=this.getOption("templates.main",""),!isString(e)||void 0===e||""===e)throw new Error("html is not set.")}this.attachShadow({mode:this.getOption("shadowMode","open"),delegatesFocus:this.getOption("delegatesFocus",!0)});var o=this.constructor.getCSSStyleSheet();return o instanceof CSSStyleSheet&&(this.shadowRoot.adoptedStyleSheets=[o]),t instanceof Template?this.shadowRoot.appendChild(t.createDocumentFragment()):this.shadowRoot.innerHTML=e,this}function registerCustomElement(t){validateFunction(t),getGlobalObject("customElements").define(t.getTag(),t)}Monster.assignToNamespace("Monster.DOM",CustomElement,registerCustomElement);export{Monster,registerCustomElement,CustomElement,initMethodSymbol,assembleMethodSymbol};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{PROPERTY_KEY_INTERNALDATA}from"../constants.js";import{extend}from"../data/extend.js";import{Pathfinder}from"../data/pathfinder.js";import{assignToNamespace,Monster}from"../namespace.js";import{getGlobalObject}from"../types/global.js";import{isString}from"../types/is.js";import{Observer}from"../types/observer.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateFunction,validateObject}from"../types/validate.js";import{clone}from"../util/clone.js";import{addToObjectLink,getLinkedObjects,hasObjectLink}from"./attributes.js";import{ATTRIBUTE_OPTIONS,OBJECTLINK_KEY_UPDATER}from"./constants.js";import{findDocumentTemplate,Template}from"./template.js";import{Updater}from"./updater.js";const internalDataSymbol=Symbol.for(PROPERTY_KEY_INTERNALDATA),objectLinkSymbol=Symbol.for(OBJECTLINK_KEY_UPDATER),initMethodSymbol=Symbol("initMethodSymbol"),assembleMethodSymbol=Symbol("assembleMethodSymbol");class CustomElement extends HTMLElement{constructor(){super(),this[internalDataSymbol]=new ProxyObserver({options:extend({},this.defaults,getOptionsFromAttributes.call(this))}),initOptionObserver.call(this),this[initMethodSymbol]()}static get observedAttributes(){return[ATTRIBUTE_OPTIONS]}get defaults(){return{shadowMode:"open",delegatesFocus:!0,templates:{main:void 0}}}static getTag(){throw new Error("the method getTag must be overwritten by the derived class.")}static getCSSStyleSheet(){}attachObserver(t){return this[internalDataSymbol].attachObserver(t),this}detachObserver(t){return this[internalDataSymbol].detachObserver(t),this}containsObserver(t){return this[internalDataSymbol].containsObserver(t)}getOption(t,e){let o;try{o=new Pathfinder(this[internalDataSymbol].getRealSubject().options).getVia(t)}catch(t){}return void 0===o?e:o}setOption(t,e){return new Pathfinder(this[internalDataSymbol].getSubject().options).setVia(t,e),this}setOptions(t){isString(t)&&(t=parseOptionsJSON(t));var e=this;return extend(e[internalDataSymbol].getSubject().options,e.defaults,t),e}[initMethodSymbol](){return this}[assembleMethodSymbol](){var t;let e;if(!1!==this.getOption("shadowMode",!1))try{initShadowRoot.call(this),e=this.shadowRoot.childNodes}catch(t){}e instanceof NodeList||(initHtmlContent.call(this),e=this.childNodes);const o=new Set;addToObjectLink(this,objectLinkSymbol,o);for([,t]of Object.entries(e))if(t instanceof HTMLElement&&!(t instanceof HTMLTemplateElement)){const n=new Updater(t,clone(this[internalDataSymbol].getRealSubject().options));o.add(n),n.run().then(()=>{n.enableEventProcessing()})}return this}connectedCallback(){let t=this;hasObjectLink(t,objectLinkSymbol)||setTimeout(()=>{t[assembleMethodSymbol]()},0)}disconnectedCallback(){}adoptedCallback(){}attributeChangedCallback(t,e,o){t===ATTRIBUTE_OPTIONS&&this.setOptions(o)}}function initOptionObserver(){const n=this;n.attachObserver(new Observer(function(){if(hasObjectLink(n,Symbol.for(OBJECTLINK_KEY_UPDATER)))for(const e of getLinkedObjects(n,Symbol.for(OBJECTLINK_KEY_UPDATER)))for(const o of e){var t=clone(n[internalDataSymbol].getRealSubject().options);Object.assign(o.getSubject(),t)}}))}function getOptionsFromAttributes(){if(this.hasAttribute(ATTRIBUTE_OPTIONS))try{return parseOptionsJSON(this.getAttribute(ATTRIBUTE_OPTIONS))}catch(t){throw new Error("the options attribute "+ATTRIBUTE_OPTIONS+" does not contain a valid json definition (actual: "+this.getAttribute(ATTRIBUTE_OPTIONS)+").")}return{}}function parseOptionsJSON(e){if(isString(e))try{var t=JSON.parse(e);return validateObject(t),t}catch(t){throw new Error("the options does not contain a valid json definition (actual: "+e+").")}return{}}function initHtmlContent(){try{let t=findDocumentTemplate(this.constructor.getTag());this.appendChild(t.createDocumentFragment())}catch(t){var e=this.getOption("templates.main","");isString(e)&&0<e.length&&(this.innerHTML=e)}return this}function initShadowRoot(){let t,e;try{t=findDocumentTemplate(this.constructor.getTag())}catch(t){if(e=this.getOption("templates.main",""),!isString(e)||void 0===e||""===e)throw new Error("html is not set.")}this.attachShadow({mode:this.getOption("shadowMode","open"),delegatesFocus:this.getOption("delegatesFocus",!0)});var o=this.constructor.getCSSStyleSheet();return o instanceof CSSStyleSheet&&(this.shadowRoot.adoptedStyleSheets=[o]),t instanceof Template?this.shadowRoot.appendChild(t.createDocumentFragment()):this.shadowRoot.innerHTML=e,this}function registerCustomElement(t){validateFunction(t),getGlobalObject("customElements").define(t.getTag(),t)}assignToNamespace("Monster.DOM",CustomElement,registerCustomElement);export{Monster,registerCustomElement,CustomElement,initMethodSymbol,assembleMethodSymbol};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,validateInstance,validateString}from"../types/validate.js";import{getDocument}from"./util.js";function fireEvent(e,t){var n;getDocument();if(e instanceof HTMLElement)"click"!==t?(n=new Event(validateString(t),{bubbles:!0,cancelable:!0}),e.dispatchEvent(n)):e.click();else{if(!(e instanceof HTMLCollection||e instanceof NodeList))throw new TypeError("value is not an instance of HTMLElement or HTMLCollection");for(var i of e)fireEvent(i,t)}}Monster.assignToNamespace("Monster.DOM",fireEvent);export{Monster,fireEvent};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{validateInstance,validateString}from"../types/validate.js";import{findClosestByAttribute}from"./attributes.js";import{getDocument}from"./util.js";function fireEvent(e,t){var n;getDocument();if(e instanceof HTMLElement)"click"!==t?(n=new Event(validateString(t),{bubbles:!0,cancelable:!0}),e.dispatchEvent(n)):e.click();else{if(!(e instanceof HTMLCollection||e instanceof NodeList))throw new TypeError("value is not an instance of HTMLElement or HTMLCollection");for(var o of e)fireEvent(o,t)}}function findTargetElementFromEvent(e,t,n){if(validateInstance(e,Event),"function"!=typeof e.composedPath)throw new Error("unsupported event");e=e.composedPath()?.[0];if(e instanceof HTMLElement)return findClosestByAttribute(e,t,n)}assignToNamespace("Monster.DOM",findTargetElementFromEvent,fireEvent);export{Monster,findTargetElementFromEvent,fireEvent};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,parseLocale}from"../i18n/locale.js";import{getDocument}from"./util.js";const DEFAULT_LANGUAGE="en";function getLocaleOfDocument(){const e=getDocument();let t=e.querySelector("html");if(t instanceof HTMLElement&&t.hasAttribute("lang")){var o=t.getAttribute("lang");if(o)return new parseLocale(o)}return parseLocale(DEFAULT_LANGUAGE)}Monster.assignToNamespace("Monster.DOM",getLocaleOfDocument);export{Monster,getLocaleOfDocument};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{parseLocale}from"../i18n/locale.js";import{assignToNamespace,Monster}from"../namespace.js";import{getDocument}from"./util.js";const DEFAULT_LANGUAGE="en";function getLocaleOfDocument(){const e=getDocument();let t=e.querySelector("html");if(t instanceof HTMLElement&&t.hasAttribute("lang")){var o=t.getAttribute("lang");if(o)return new parseLocale(o)}return parseLocale(DEFAULT_LANGUAGE)}assignToNamespace("Monster.DOM",getLocaleOfDocument);export{Monster,getLocaleOfDocument};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
2
  "use strict";const namespace="Monster.DOM";
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,Base}from"../types/base.js";import{validateString}from"../types/validate.js";import{getGlobalFunction,getGlobalObject}from"../types/global.js";import{validateInstance}from"../types/validate.js";import{getDocumentTheme}from"./theme.js";class Template extends Base{constructor(e){super();var t=getGlobalFunction("HTMLTemplateElement");validateInstance(e,t),this.template=e}getTemplateElement(){return this.template}createDocumentFragment(){return this.template.content.cloneNode(!0)}}function findDocumentTemplate(e,t){validateString(e),t instanceof Node||(t=getGlobalObject("document"));var n=getGlobalFunction("HTMLTemplateElement");let a=getDocumentTheme();var o=e+"-"+a.getName();let m=t.getElementById(o);if(m instanceof n)return new Template(m);if(m=t.getElementById(e),m instanceof n)return new Template(m);if(t!==getGlobalObject("document"))return findDocumentTemplate(e);throw new Error("template "+e+" not found.")}Monster.assignToNamespace("Monster.DOM",Template,findDocumentTemplate);export{Monster,Template,findDocumentTemplate};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobalFunction,getGlobalObject}from"../types/global.js";import{validateInstance,validateString}from"../types/validate.js";import{getDocumentTheme}from"./theme.js";class Template extends Base{constructor(e){super();var t=getGlobalFunction("HTMLTemplateElement");validateInstance(e,t),this.template=e}getTemplateElement(){return this.template}createDocumentFragment(){return this.template.content.cloneNode(!0)}}function findDocumentTemplate(e,t){validateString(e),t instanceof Document||t instanceof DocumentFragment||(t=t instanceof Node?t.ownerDocument:t)instanceof Document||t instanceof DocumentFragment||(t=getGlobalObject("document"));var n=getGlobalFunction("HTMLTemplateElement");let a=getDocumentTheme();var o=e+"-"+a.getName();let m=t.getElementById(o);if(m instanceof n)return new Template(m);if(m=t.getElementById(e),m instanceof n)return new Template(m);if(t!==getGlobalObject("document"))return findDocumentTemplate(e);throw new Error("template "+e+" not found.")}assignToNamespace("Monster.DOM",Template,findDocumentTemplate);export{Monster,Template,findDocumentTemplate};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,Base}from"../types/base.js";import{validateString}from"../types/validate.js";import{getGlobalObject}from"../types/global.js";import{ATTRIBUTE_THEME_NAME,DEFAULT_THEME}from"./constants.js";class Theme extends Base{constructor(e){super(),validateString(e),this.name=e}getName(){return this.name}}function getDocumentTheme(){let e=getGlobalObject("document"),t=DEFAULT_THEME,s=e.querySelector("html");var o;return s instanceof HTMLElement&&((o=s.getAttribute(ATTRIBUTE_THEME_NAME))&&(t=o)),new Theme(t)}Monster.assignToNamespace("Monster.DOM",Theme,getDocumentTheme);export{Monster,Theme,getDocumentTheme};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobalObject}from"../types/global.js";import{validateString}from"../types/validate.js";import{ATTRIBUTE_THEME_NAME,DEFAULT_THEME}from"./constants.js";class Theme extends Base{constructor(e){super(),validateString(e),this.name=e}getName(){return this.name}}function getDocumentTheme(){let e=getGlobalObject("document"),t=DEFAULT_THEME,s=e.querySelector("html");var m;return s instanceof HTMLElement&&((m=s.getAttribute(ATTRIBUTE_THEME_NAME))&&(t=m)),new Theme(t)}assignToNamespace("Monster.DOM",Theme,getDocumentTheme);export{Monster,Theme,getDocumentTheme};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Pathfinder}from"../data/pathfinder.js";import{Pipe}from"../data/pipe.js";import{Base,Monster}from"../types/base.js";import{isInstance,isArray}from"../types/is.js";import{Observer}from"../types/observer.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateInstance,validateArray}from"../types/validate.js";import{clone}from"../util/clone.js";import{Diff}from"../data/diff.js";import{ATTRIBUTE_UPDATER_REPLACE,ATTRIBUTE_UPDATER_ATTRIBUTES,ATTRIBUTE_UPDATER_INSERT,ATTRIBUTE_UPDATER_REMOVE,ATTRIBUTE_UPDATER_INSERT_REFERENCE,ATTRIBUTE_UPDATER_BIND}from"../dom/constants.js";import{findDocumentTemplate}from"./template.js";import{getDocument}from"./util.js";class Updater extends Base{constructor(e,t){super(),this.element=validateInstance(e,HTMLElement),void 0===t&&(t={}),isInstance(t,ProxyObserver)||(t=new ProxyObserver(t)),this.last={},this.callbacks=new Map,this.callbacks.set("checkstate",getCheckStateCallback.call(this)),this.subject=t.attachObserver(new Observer(()=>{var e,t=this.subject.getRealSubject(),r=Diff(this.last,t);this.last=clone(t);for([,e]of Object.entries(r))removeElement.call(this,e),insertElement.call(this,e),updateContent.call(this,e),updateAttributes.call(this,e)})),this.eventTypes=["keyup","click","change","drop","touchend","input"]}setEventTypes(e){return this.eventTypes=validateArray(e),this}enableEventProcessing(){this.disableEventProcessing();for(const e of this.eventTypes)this.element.addEventListener(e,getControlEventHandler.call(this));return this}disableEventProcessing(){for(const e of this.eventTypes)this.element.removeEventListener(e,getControlEventHandler.call(this));return this}run(){return this.last={__init__:!0},this.subject.notifyObservers()}getSubject(){return this.subject.getSubject()}setCallback(e,t){return this.callbacks.set(e,t),this}}function getCheckStateCallback(){return function(e){if(this instanceof HTMLInputElement){if(-1!==["radio","checkbox"].indexOf(this.type))return this.value+""==e+""?"true":void 0}else if(this instanceof HTMLOptionElement&&isArray(e)&&-1!==e.indexOf(this.value))return"true"}}const symbol=Symbol("EventHandler");function getControlEventHandler(){const i=this;if(i[symbol])return i[symbol];const a=new Pathfinder(this.subject.getSubject());return i[symbol]=r=>{const s=r.target;if(s.hasAttribute(ATTRIBUTE_UPDATER_BIND)){let e=s.getAttribute(ATTRIBUTE_UPDATER_BIND);if(0!==e.indexOf("path:"))throw new Error("the bind argument must start as a value with a path.");e=e.substr(5);let t;if(s instanceof HTMLInputElement)t="checkbox"!==s.type||s.checked?s.value:void 0;else if(s instanceof HTMLTextAreaElement)t=s.value;else{if(!(s instanceof HTMLSelectElement))throw new Error("unsupported object");switch(s.type){case"select-one":t=s.value;break;case"select-multiple":t=s.value;let e=s?.selectedOptions;void 0===e&&(e=s.querySelectorAll(":scope option:checked")),t=Array.from(e).map(({value:e})=>e)}}r=clone(i.subject.getRealSubject());const n=new Pathfinder(r);n.setVia(e,t),0<new Diff(r,i.subject.getRealSubject()).length&&a.setVia(e,t)}},i[symbol]}function removeElement(e){for(var[,t]of this.element.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_REMOVE+"]").entries())t.parentNode.removeChild(t)}function insertElement(t){var a=this.subject.getRealSubject();getDocument();let o=new WeakSet,r=0;for(;;){let i=!1;r++;let e=clone(t?.path);if(!isArray(e))return this;for(;0<e.length;){var l,s=e.join(".");for([,l]of this.element.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_INSERT+'*="path:'+s+'"]').entries())if(!o.has(l)){o.add(l),i=!0;const R=l.getAttribute(ATTRIBUTE_UPDATER_INSERT);let e=R.trim();var c=e.indexOf(" "),T=e.substr(0,c).trim(),u=T+"-";let t=e.substr(c).trim();if(0<t.indexOf("|"))throw new Error("pipes are not allowed when cloning a node.");let r=new Pipe(t);this.callbacks.forEach((e,t)=>{r.setCallback(t,e)});var E,f,c=r.run(a),h=t.split(":").pop();let s;if(l.hasChildNodes()&&(s=l.lastChild),!isArray(c))throw new Error("the value is not iterable");let n=new Set;for([E,f]of Object.entries(c)){var p=u+E,d=h+"."+E;n.add(p);var A=l.querySelector("["+ATTRIBUTE_UPDATER_INSERT_REFERENCE+'="'+p+'"]');A instanceof HTMLElement?s=A:appendNewDocumentFragment(l,T,p,d)}var b,c=l.querySelectorAll("["+ATTRIBUTE_UPDATER_INSERT_REFERENCE+'*="'+u+'"]');for([,b]of Object.entries(c))n.has(b.getAttribute(ATTRIBUTE_UPDATER_INSERT_REFERENCE))||l.removeChild(b)}e.pop()}if(!1===i)break;if(200<r++)throw new Error("the maximum depth for the recursion is reached.")}}function appendNewDocumentFragment(e,t,r,s){let n=e.getRootNode();n=n||getDocument();let i=findDocumentTemplate(t,n);var a,o=i.createDocumentFragment();for([,a]of Object.entries(o.childNodes))a instanceof HTMLElement&&(applyRecursive(a,t,s),a.setAttribute(ATTRIBUTE_UPDATER_INSERT_REFERENCE,r)),e.appendChild(a)}function applyRecursive(t,r,s){if(t instanceof HTMLElement){if(t.hasAttribute(ATTRIBUTE_UPDATER_REPLACE)){let e=t.getAttribute(ATTRIBUTE_UPDATER_REPLACE);t.setAttribute(ATTRIBUTE_UPDATER_REPLACE,e.replace("path:"+r,"path:"+s))}if(t.hasAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES)){let e=t.getAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES);t.setAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES,e.replace("path:"+r,"path:"+s))}for(var[,e]of Object.entries(t.childNodes))applyRecursive(e,r,s)}}function updateContent(e){var t=this.subject.getRealSubject(),e=clone(e?.path);runUpdateContent.call(this,this.element,e,t)}function runUpdateContent(t,r,s){if(isArray(r)){r=clone(r);let e=new WeakSet;for(;0<r.length;){var n,i=r.join(".");r.pop();for([,n]of t.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_REPLACE+'^="path:'+i+'"], ['+ATTRIBUTE_UPDATER_REPLACE+'^="static:"]').entries())if(!e.has(n)){e.add(n);const o=n.getAttribute(ATTRIBUTE_UPDATER_REPLACE);var a=o.trim();let r=new Pipe(a);this.callbacks.forEach((e,t)=>{r.setCallback(t,e)});a=r.run(s);if(a instanceof HTMLElement){for(;n.firstChild;)n.removeChild(n.firstChild);n.addNode(a)}else n.innerHTML=a}}}}function updateAttributes(e){var t=this.subject.getRealSubject(),e=clone(e?.path);runUpdateAttributes.call(this,this.element,e,t)}function runUpdateAttributes(t,r,s){if(isArray(r)){r=clone(r);let e=new WeakSet;for(;0<r.length;){var n=r.join(".");r.pop();for(const[,l]of t.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_ATTRIBUTES+'*="path:'+n+'"]').entries())if(!e.has(l)){e.add(l);const c=l.getAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES);for(var[,i]of Object.entries(c.split(","))){i=i.trim();var a=i.indexOf(" "),o=i.substr(0,a).trim(),a=i.substr(a).trim();let r=new Pipe(a);this.callbacks.forEach((e,t)=>{r.setCallback(t,e,l)});a=r.run(s);void 0===a?l.removeAttribute(o):l.getAttribute(o)!==a&&l.setAttribute(o,a),handleInputControlAttributeUpdate.call(this,l,o,a)}}}}}function handleInputControlAttributeUpdate(e,t,r){if(e instanceof HTMLSelectElement)switch(e.type){case"select-multiple":for(var[s,n]of Object.entries(e.options))-1!==r.indexOf(n.value)?n.selected=!0:n.selected=!1;break;case"select-one":for(var[i,a]of Object.entries(e.options))if(a.value===r){e.selectedIndex=i;break}}else if(e instanceof HTMLInputElement)switch(e.type){case"radio":case"checkbox":e.checked="checked"===t&&void 0!==r;break;default:"value"===t&&(e.value=void 0===r?"":r)}else e instanceof HTMLTextAreaElement&&"value"===t&&(e.value=void 0===r?"":r)}Monster.assignToNamespace("Monster.DOM",Updater);export{Monster,Updater};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{Diff}from"../data/diff.js";import{Pathfinder}from"../data/pathfinder.js";import{Pipe}from"../data/pipe.js";import{ATTRIBUTE_UPDATER_ATTRIBUTES,ATTRIBUTE_UPDATER_BIND,ATTRIBUTE_UPDATER_INSERT,ATTRIBUTE_UPDATER_INSERT_REFERENCE,ATTRIBUTE_UPDATER_REMOVE,ATTRIBUTE_UPDATER_REPLACE}from"../dom/constants.js";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{isArray,isInstance,isIterable}from"../types/is.js";import{Observer}from"../types/observer.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateArray,validateInstance}from"../types/validate.js";import{clone}from"../util/clone.js";import{findDocumentTemplate}from"./template.js";import{getDocument}from"./util.js";class Updater extends Base{constructor(e,t){super(),this.element=validateInstance(e,HTMLElement);t=void 0===t?{}:t;isInstance(t,ProxyObserver)||(t=new ProxyObserver(t)),this.last={},this.callbacks=new Map,this.callbacks.set("checkstate",getCheckStateCallback.call(this)),this.subject=t.attachObserver(new Observer(()=>{var e,t=this.subject.getRealSubject(),r=Diff(this.last,t);this.last=clone(t);for([,e]of Object.entries(r))removeElement.call(this,e),insertElement.call(this,e),updateContent.call(this,e),updateAttributes.call(this,e)})),this.eventTypes=["keyup","click","change","drop","touchend","input"]}setEventTypes(e){return this.eventTypes=validateArray(e),this}enableEventProcessing(){this.disableEventProcessing();for(const e of this.eventTypes)this.element.addEventListener(e,getControlEventHandler.call(this));return this}disableEventProcessing(){for(const e of this.eventTypes)this.element.removeEventListener(e,getControlEventHandler.call(this));return this}run(){return this.last={__init__:!0},this.subject.notifyObservers()}getSubject(){return this.subject.getSubject()}setCallback(e,t){return this.callbacks.set(e,t),this}}function getCheckStateCallback(){return function(e){if(this instanceof HTMLInputElement){if(-1!==["radio","checkbox"].indexOf(this.type))return this.value+""==e+""?"true":void 0}else if(this instanceof HTMLOptionElement&&isArray(e)&&-1!==e.indexOf(this.value))return"true"}}const symbol=Symbol("EventHandler");function getControlEventHandler(){const i=this;if(i[symbol])return i[symbol];const a=new Pathfinder(this.subject.getSubject());return i[symbol]=r=>{const s=r.target;if(s.hasAttribute(ATTRIBUTE_UPDATER_BIND)){let e=s.getAttribute(ATTRIBUTE_UPDATER_BIND);if(0!==e.indexOf("path:"))throw new Error("the bind argument must start as a value with a path.");e=e.substr(5);let t;if(s instanceof HTMLInputElement)t="checkbox"!==s.type||s.checked?s.value:void 0;else if(s instanceof HTMLTextAreaElement)t=s.value;else if(s instanceof HTMLSelectElement)switch(s.type){case"select-one":t=s.value;break;case"select-multiple":t=s.value;let e=s?.selectedOptions;void 0===e&&(e=s.querySelectorAll(":scope option:checked")),t=Array.from(e).map(({value:e})=>e)}else{if(!(s?.constructor?.prototype&&Object.getOwnPropertyDescriptor(s.constructor.prototype,"value")?.get||s.hasOwnProperty("value")))throw new Error("unsupported object");t=s?.value}r=clone(i.subject.getRealSubject());const n=new Pathfinder(r);n.setVia(e,t),0<new Diff(r,i.subject.getRealSubject()).length&&a.setVia(e,t)}},i[symbol]}function removeElement(e){for(var[,t]of this.element.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_REMOVE+"]").entries())t.parentNode.removeChild(t)}function insertElement(t){var a=this.subject.getRealSubject();getDocument();let o=new WeakSet,r=0;for(;;){let i=!1;r++;let e=clone(t?.path);if(!isArray(e))return this;for(;0<e.length;){var l,s=e.join(".");for([,l]of this.element.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_INSERT+'*="path:'+s+'"]').entries())if(!o.has(l)){o.add(l),i=!0;const m=l.getAttribute(ATTRIBUTE_UPDATER_INSERT);let e=m.trim();var c=e.indexOf(" "),T=e.substr(0,c).trim(),u=T+"-";let t=e.substr(c).trim();if(0<t.indexOf("|"))throw new Error("pipes are not allowed when cloning a node.");let r=new Pipe(t);this.callbacks.forEach((e,t)=>{r.setCallback(t,e)});var E,p,c=r.run(a),f=t.split(":").pop();let s;if(l.hasChildNodes()&&(s=l.lastChild),!isIterable(c))throw new Error("the value is not iterable");let n=new Set;for([E,p]of Object.entries(c)){var h=u+E,d=f+"."+E;n.add(h);var A=l.querySelector("["+ATTRIBUTE_UPDATER_INSERT_REFERENCE+'="'+h+'"]');A instanceof HTMLElement?s=A:appendNewDocumentFragment(l,T,h,d)}var b,c=l.querySelectorAll("["+ATTRIBUTE_UPDATER_INSERT_REFERENCE+'*="'+u+'"]');for([,b]of Object.entries(c))n.has(b.getAttribute(ATTRIBUTE_UPDATER_INSERT_REFERENCE))||l.removeChild(b)}e.pop()}if(!1===i)break;if(200<r++)throw new Error("the maximum depth for the recursion is reached.")}}function appendNewDocumentFragment(e,t,r,s){let n=findDocumentTemplate(t,e);var i,a=n.createDocumentFragment();for([,i]of Object.entries(a.childNodes))i instanceof HTMLElement&&(applyRecursive(i,t,s),i.setAttribute(ATTRIBUTE_UPDATER_INSERT_REFERENCE,r)),e.appendChild(i)}function applyRecursive(t,r,s){if(t instanceof HTMLElement){if(t.hasAttribute(ATTRIBUTE_UPDATER_REPLACE)){let e=t.getAttribute(ATTRIBUTE_UPDATER_REPLACE);t.setAttribute(ATTRIBUTE_UPDATER_REPLACE,e.replace("path:"+r,"path:"+s))}if(t.hasAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES)){let e=t.getAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES);t.setAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES,e.replace("path:"+r,"path:"+s))}for(var[,e]of Object.entries(t.childNodes))applyRecursive(e,r,s)}}function updateContent(e){var t=this.subject.getRealSubject(),e=clone(e?.path);runUpdateContent.call(this,this.element,e,t)}function runUpdateContent(t,r,s){if(isArray(r)){r=clone(r);let e=new WeakSet;for(;0<r.length;){var n,i=r.join(".");r.pop();for([,n]of t.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_REPLACE+'^="path:'+i+'"], ['+ATTRIBUTE_UPDATER_REPLACE+'^="static:"]').entries())if(!e.has(n)){e.add(n);const o=n.getAttribute(ATTRIBUTE_UPDATER_REPLACE);var a=o.trim();let r=new Pipe(a);this.callbacks.forEach((e,t)=>{r.setCallback(t,e)});a=r.run(s);if(a instanceof HTMLElement){for(;n.firstChild;)n.removeChild(n.firstChild);n.addNode(a)}else n.innerHTML=a}}}}function updateAttributes(e){var t=this.subject.getRealSubject(),e=clone(e?.path);runUpdateAttributes.call(this,this.element,e,t)}function runUpdateAttributes(t,r,s){if(isArray(r)){r=clone(r);let e=new WeakSet;for(;0<r.length;){var n=r.join(".");r.pop();for(const[,l]of t.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_ATTRIBUTES+'*="path:'+n+'"]').entries())if(!e.has(l)){e.add(l);const c=l.getAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES);for(var[,i]of Object.entries(c.split(","))){i=i.trim();var a=i.indexOf(" "),o=i.substr(0,a).trim(),a=i.substr(a).trim();let r=new Pipe(a);this.callbacks.forEach((e,t)=>{r.setCallback(t,e,l)});a=r.run(s);void 0===a?l.removeAttribute(o):l.getAttribute(o)!==a&&l.setAttribute(o,a),handleInputControlAttributeUpdate.call(this,l,o,a)}}}}}function handleInputControlAttributeUpdate(e,t,r){if(e instanceof HTMLSelectElement)switch(e.type){case"select-multiple":for(var[s,n]of Object.entries(e.options))-1!==r.indexOf(n.value)?n.selected=!0:n.selected=!1;break;case"select-one":for(var[i,a]of Object.entries(e.options))if(a.value===r){e.selectedIndex=i;break}}else if(e instanceof HTMLInputElement)switch(e.type){case"radio":case"checkbox":e.checked="checked"===t&&void 0!==r;break;default:"value"===t&&(e.value=void 0===r?"":r)}else e instanceof HTMLTextAreaElement&&"value"===t&&(e.value=void 0===r?"":r)}assignToNamespace("Monster.DOM",Updater);export{Monster,Updater};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,getGlobal}from"../types/global.js";import{validateString}from"../types/validate.js";function getDocument(){var t=getGlobal()?.document;if("object"!=typeof t)throw new Error("not supported environment");return t}function getWindow(){var t=getGlobal()?.window;if("object"!=typeof t)throw new Error("not supported environment");return t}function getDocumentFragmentFromString(t){validateString(t);const e=getDocument(),n=e.createElement("template");return n.innerHTML=t,n.content}Monster.assignToNamespace("Monster.DOM",getWindow,getDocument,getDocumentFragmentFromString);export{Monster,getWindow,getDocument,getDocumentFragmentFromString};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{getGlobal}from"../types/global.js";import{validateString}from"../types/validate.js";function getDocument(){var t=getGlobal()?.document;if("object"!=typeof t)throw new Error("not supported environment");return t}function getWindow(){var t=getGlobal()?.window;if("object"!=typeof t)throw new Error("not supported environment");return t}function getDocumentFragmentFromString(t){validateString(t);const e=getDocument(),n=e.createElement("template");return n.innerHTML=t,n.content}assignToNamespace("Monster.DOM",getWindow,getDocument,getDocumentFragmentFromString);export{Monster,getWindow,getDocument,getDocumentFragmentFromString};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,Base}from"../types/base.js";import{validateString}from"../types/validate.js";import{clone}from"../util/clone.js";const propertiesSymbol=Symbol("properties"),localeStringSymbol=Symbol("localeString");class Locale extends Base{constructor(e,i,t,o,r,a){super(),this[propertiesSymbol]={language:void 0===e?void 0:validateString(e),script:void 0===t?void 0:validateString(t),region:void 0===i?void 0:validateString(i),variants:void 0===o?void 0:validateString(o),extlang:void 0===r?void 0:validateString(r),privateUse:void 0===a?void 0:validateString(a)};let n=[];if(void 0!==e&&n.push(e),void 0!==t&&n.push(t),void 0!==i&&n.push(i),void 0!==o&&n.push(o),void 0!==r&&n.push(r),void 0!==a&&n.push(a),0===n.length)throw new Error("unsupported locale");this[localeStringSymbol]=n.join("-")}get localeString(){return this[localeStringSymbol]}get language(){return this[propertiesSymbol].language}get region(){return this[propertiesSymbol].region}get script(){return this[propertiesSymbol].script}get variants(){return this[propertiesSymbol].variants}get extlang(){return this[propertiesSymbol].extlang}get privateUse(){return this[propertiesSymbol].privateValue}toString(){return""+this.localeString}getMap(){return clone(this[propertiesSymbol])}}function parseLocale(e){e=validateString(e).replace(/_/g,"-");let i,t,o,r,a,n,l=new RegExp("^(((en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((([A-Za-z]{2,3}(-([A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-([A-Za-z]{4}))?(-([A-Za-z]{2}|[0-9]{3}))?(-([A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-([0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(x(-[A-Za-z0-9]{1,8})+))?)|(x(-[A-Za-z0-9]{1,8})+))$"),s;if(null!==(s=l.exec(e))&&s.index===l.lastIndex&&l.lastIndex++,null==s)throw new Error("unsupported locale");return void 0!==s[6]&&(i=s[6],1<(r=i.split("-")).length&&(i=r[0],n=r[1])),void 0!==s[14]&&(t=s[14]),void 0!==s[12]&&(a=s[12]),void 0!==s[16]&&(o=s[16]),new Locale(i,t,a,o,n)}Monster.assignToNamespace("Monster.I18n",Locale,parseLocale);export{Monster,Locale,parseLocale};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateString}from"../types/validate.js";import{clone}from"../util/clone.js";const propertiesSymbol=Symbol("properties"),localeStringSymbol=Symbol("localeString");class Locale extends Base{constructor(e,i,t,o,a,r){super(),this[propertiesSymbol]={language:void 0===e?void 0:validateString(e),script:void 0===t?void 0:validateString(t),region:void 0===i?void 0:validateString(i),variants:void 0===o?void 0:validateString(o),extlang:void 0===a?void 0:validateString(a),privateUse:void 0===r?void 0:validateString(r)};let n=[];if(void 0!==e&&n.push(e),void 0!==t&&n.push(t),void 0!==i&&n.push(i),void 0!==o&&n.push(o),void 0!==a&&n.push(a),void 0!==r&&n.push(r),0===n.length)throw new Error("unsupported locale");this[localeStringSymbol]=n.join("-")}get localeString(){return this[localeStringSymbol]}get language(){return this[propertiesSymbol].language}get region(){return this[propertiesSymbol].region}get script(){return this[propertiesSymbol].script}get variants(){return this[propertiesSymbol].variants}get extlang(){return this[propertiesSymbol].extlang}get privateUse(){return this[propertiesSymbol].privateValue}toString(){return""+this.localeString}getMap(){return clone(this[propertiesSymbol])}}function parseLocale(e){e=validateString(e).replace(/_/g,"-");let i,t,o,a,r,n,l=new RegExp("^(((en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((([A-Za-z]{2,3}(-([A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-([A-Za-z]{4}))?(-([A-Za-z]{2}|[0-9]{3}))?(-([A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-([0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(x(-[A-Za-z0-9]{1,8})+))?)|(x(-[A-Za-z0-9]{1,8})+))$"),s;if(null!==(s=l.exec(e))&&s.index===l.lastIndex&&l.lastIndex++,null==s)throw new Error("unsupported locale");return void 0!==s[6]&&(i=s[6],1<(a=i.split("-")).length&&(i=a[0],n=a[1])),void 0!==s[14]&&(t=s[14]),void 0!==s[12]&&(r=s[12]),void 0!==s[16]&&(o=s[16]),new Locale(i,t,r,o,n)}assignToNamespace("Monster.I18n",Locale,parseLocale);export{Monster,Locale,parseLocale};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
2
  "use strict";const namespace="Monster.I18n";
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,BaseWithOptions}from"../types/basewithoptions.js";import{Locale}from"./locale.js";import{Translations}from"./translations.js";class Provider extends BaseWithOptions{getTranslations(o){return new Promise((s,t)=>{try{s(new Translations(o))}catch(s){t(s)}})}}Monster.assignToNamespace("Monster.I18n",Provider);export{Monster,Provider};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{BaseWithOptions}from"../types/basewithoptions.js";import{Locale}from"./locale.js";import{Translations}from"./translations.js";class Provider extends BaseWithOptions{getTranslations(e){return new Promise((s,o)=>{try{s(new Translations(e))}catch(s){o(s)}})}}assignToNamespace("Monster.I18n",Provider);export{Monster,Provider};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Formatter}from"../../text/formatter.js";import{Monster}from"../../types/base.js";import{getGlobalFunction}from"../../types/global.js";import{validateInstance,validateObject,validateString}from"../../types/validate.js";import{isString,isObject,isInstance}from"../../types/is.js";import{parseLocale}from"../locale.js";import{Provider}from"../provider.js";import{PROPERTY_KEY_OPTIONS}from"../../constants.js";import{Translations}from"../translations.js";const optionsSymbol=Symbol.for(PROPERTY_KEY_OPTIONS);class Fetch extends Provider{constructor(t,e){super(e),isInstance(t,URL)&&(t=t.toString()),void 0===e&&(e={}),validateString(t),this.url=t,this[optionsSymbol]=Object.assign({},super.defaults,this.defaults,validateObject(e))}get defaults(){return{fetch:{method:"GET",mode:"cors",cache:"no-cache",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"}}}getTranslations(e){isString(e)&&(e=parseLocale(e));let t=new Formatter(e.getMap());return getGlobalFunction("fetch")(t.format(this.url),this.getOption("fetch",{})).then(t=>t.json()).then(t=>new Translations(e).assignTranslations(t))}}Monster.assignToNamespace("Monster.I18n.Providers",Fetch);export{Monster,Fetch};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{PROPERTY_KEY_INTERNALDATA}from"../../constants.js";import{extend}from"../../data/extend.js";import{assignToNamespace,Monster}from"../../namespace.js";import{Formatter}from"../../text/formatter.js";import{getGlobalFunction}from"../../types/global.js";import{isInstance,isString}from"../../types/is.js";import{validateObject,validateString}from"../../types/validate.js";import{parseLocale}from"../locale.js";import{Provider}from"../provider.js";import{Translations}from"../translations.js";const optionsSymbol=Symbol.for(PROPERTY_KEY_INTERNALDATA);class Fetch extends Provider{constructor(t,e){super(e),isInstance(t,URL)&&(t=t.toString()),void 0===e&&(e={}),validateString(t),this.url=t,this[optionsSymbol]=extend({},super.defaults,this.defaults,validateObject(e))}get defaults(){return{fetch:{method:"GET",mode:"cors",cache:"no-cache",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"}}}getTranslations(e){isString(e)&&(e=parseLocale(e));let t=new Formatter(e.getMap());return getGlobalFunction("fetch")(t.format(this.url),this.getOption("fetch",{})).then(t=>t.json()).then(t=>new Translations(e).assignTranslations(t))}}assignToNamespace("Monster.I18n.Providers",Fetch);export{Monster,Fetch};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
2
  "use strict";const namespace="Monster.I18n.Providers";
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster,Base}from"../types/base.js";import{isObject,isString}from"../types/is.js";import{validateInstance,validateInteger,validateObject,validateString}from"../types/validate.js";import{Locale,parseLocale}from"./locale.js";class Translations extends Base{constructor(t){super(),isString(t)&&(t=parseLocale(t)),this.locale=validateInstance(t,Locale),this.storage=new Map}getText(t,e){if(!this.storage.has(t)){if(void 0===e)throw new Error("key "+t+" not found");return validateString(e)}var r=this.storage.get(t);return isObject(r)?this.getPluralRuleText(t,"other",e):this.storage.get(t)}getPluralRuleText(t,e,r){if(!this.storage.has(t))return validateString(r);let a=validateObject(this.storage.get(t)),s;if(isString(e))s=e.toLocaleString();else{if(0===(e=validateInteger(e))&&a.hasOwnProperty("zero"))return validateString(a.zero);s=new Intl.PluralRules(this.locale.toString()).select(validateInteger(e))}return a.hasOwnProperty(s)?validateString(a[s]):a.hasOwnProperty(DEFAULT_KEY)?validateString(a[DEFAULT_KEY]):validateString(r)}setText(t,e){if(isString(e)||isObject(e))return this.storage.set(validateString(t),e),this;throw new TypeError("value is not a string or object")}assignTranslations(t){validateObject(t);for(var[e,r]of Object.entries(t))this.setText(e,r);return this}}Monster.assignToNamespace("Monster.I18n",Translations);export{Monster,Translations};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{isObject,isString}from"../types/is.js";import{validateInstance,validateInteger,validateObject,validateString}from"../types/validate.js";import{Locale,parseLocale}from"./locale.js";class Translations extends Base{constructor(t){super(),isString(t)&&(t=parseLocale(t)),this.locale=validateInstance(t,Locale),this.storage=new Map}getText(t,e){if(!this.storage.has(t)){if(void 0===e)throw new Error("key "+t+" not found");return validateString(e)}var r=this.storage.get(t);return isObject(r)?this.getPluralRuleText(t,"other",e):this.storage.get(t)}getPluralRuleText(t,e,r){if(!this.storage.has(t))return validateString(r);let a=validateObject(this.storage.get(t)),s;if(isString(e))s=e.toLocaleString();else{if(0===(e=validateInteger(e))&&a.hasOwnProperty("zero"))return validateString(a.zero);s=new Intl.PluralRules(this.locale.toString()).select(validateInteger(e))}return a.hasOwnProperty(s)?validateString(a[s]):a.hasOwnProperty(DEFAULT_KEY)?validateString(a[DEFAULT_KEY]):validateString(r)}setText(t,e){if(isString(e)||isObject(e))return this.storage.set(validateString(t),e),this;throw new TypeError("value is not a string or object")}assignTranslations(t){validateObject(t);for(var[e,r]of Object.entries(t))this.setText(e,r);return this}}assignToNamespace("Monster.I18n",Translations);export{Monster,Translations};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../../namespace.js";import{Base}from"../../types/base.js";import{Handler}from"../../logging/handler.js";class ConsoleHandler extends Base{constructor(){super()}}Monster.assignToNamespace("Monster.Logging",ConsoleHandler);export{Monster,Handler};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{Handler}from"../../logging/handler.js";import{Base}from"../../types/base.js";import{assignToNamespace,Monster}from"../namespace.js";class ConsoleHandler extends Base{constructor(){super()}}assignToNamespace("Monster.Logging",ConsoleHandler);export{Monster,Handler};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
2
  "use strict";const namespace="Monster.Logging.Handler";
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";import{Base}from"../types/base.js";import{ALL,DEBUG,ERROR,FATAL,INFO,OFF,TRACE,WARN}from"./logger.js";import{LogEntry}from"./logentry.js";import{validateInstance,validateInteger}from"../types/validate.js";class Handler extends Base{constructor(){super(),this.loglevel=OFF}log(e){return validateInstance(e,LogEntry),!(this.loglevel<e.getLogLevel())}setLogLevel(e){return validateInteger(e),this.loglevel=e,this}getLogLevel(){return this.loglevel}setAll(){return this.setLogLevel(ALL),this}setTrace(){return this.setLogLevel(TRACE),this}setDebug(){return this.setLogLevel(DEBUG),this}setInfo(){return this.setLogLevel(INFO),this}setWarn(){return this.setLogLevel(WARN),this}setError(){return this.setLogLevel(ERROR),this}setFatal(){return this.setLogLevel(FATAL),this}setOff(){return this.setLogLevel(OFF),this}}Monster.assignToNamespace("Monster.Logging",Handler);export{Monster,Handler};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateInstance,validateInteger}from"../types/validate.js";import{LogEntry}from"./logentry.js";import{ALL,DEBUG,ERROR,FATAL,INFO,OFF,TRACE,WARN}from"./logger.js";class Handler extends Base{constructor(){super(),this.loglevel=OFF}log(e){return validateInstance(e,LogEntry),!(this.loglevel<e.getLogLevel())}setLogLevel(e){return validateInteger(e),this.loglevel=e,this}getLogLevel(){return this.loglevel}setAll(){return this.setLogLevel(ALL),this}setTrace(){return this.setLogLevel(TRACE),this}setDebug(){return this.setLogLevel(DEBUG),this}setInfo(){return this.setLogLevel(INFO),this}setWarn(){return this.setLogLevel(WARN),this}setError(){return this.setLogLevel(ERROR),this}setFatal(){return this.setLogLevel(FATAL),this}setOff(){return this.setLogLevel(OFF),this}}assignToNamespace("Monster.Logging",Handler);export{Monster,Handler};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";import{validateInteger}from"../types/validate.js";import{Base}from"../types/base.js";class LogEntry extends Base{constructor(e,...t){super(),validateInteger(e),this.loglevel=e,this.arguments=t}getLogLevel(){return this.loglevel}getArguments(){return this.arguments}}Monster.assignToNamespace("Monster.Logging",LogEntry);export{Monster,LogEntry};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateInteger}from"../types/validate.js";class LogEntry extends Base{constructor(e,...t){super(),validateInteger(e),this.loglevel=e,this.arguments=t}getLogLevel(){return this.loglevel}getArguments(){return this.arguments}}assignToNamespace("Monster.Logging",LogEntry);export{Monster,LogEntry};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
- "use strict";import{Monster}from"../namespace.js";import{validateInteger,validateObject,validateString}from"../types/validate.js";import{Handler}from"../logging/handler.js";import{LogEntry}from"../logging/logentry.js";import{Base}from"../types/base.js";const ALL=255,TRACE=64,DEBUG=32,INFO=16,WARN=8,ERROR=4,FATAL=2,OFF=0;class Logger extends Base{constructor(){super(),this.handler=new Set}addHandler(r){if(validateObject(r),!(r instanceof Handler))throw new Error("the handler must be an instance of Handler");return this.handler.add(r),this}removeHandler(r){if(validateObject(r),!(r instanceof Handler))throw new Error("the handler must be an instance of Handler");return this.handler.delete(r),this}logTrace(){return triggerLog.apply(this,[TRACE,...arguments]),this}logDebug(){return triggerLog.apply(this,[DEBUG,...arguments]),this}logInfo(){return triggerLog.apply(this,[INFO,...arguments]),this}logWarn(){return triggerLog.apply(this,[WARN,...arguments]),this}logError(){return triggerLog.apply(this,[ERROR,...arguments]),this}logFatal(){return triggerLog.apply(this,[FATAL,...arguments]),this}getLabel(r){return validateInteger(r),r===ALL?"ALL":r===TRACE?"TRACE":r===DEBUG?"DEBUG":r===INFO?"INFO":r===WARN?"WARN":r===ERROR?"ERROR":r===FATAL?"FATAL":r===OFF?"OFF":"unknown"}getLevel(r){return validateString(r),"ALL"===r?ALL:"TRACE"===r?TRACE:"DEBUG"===r?DEBUG:"INFO"===r?INFO:"WARN"===r?WARN:"ERROR"===r?ERROR:"FATAL"===r?FATAL:"OFF"===r?OFF:0}}function triggerLog(r,...e){var t;for(t of this.handler)t.log(new LogEntry(r,e));return this}Monster.assignToNamespace("Monster.Logging",Logger);export{Monster,Logger,ALL,TRACE,DEBUG,INFO,WARN,ERROR,FATAL,OFF};
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
+ "use strict";import{Handler}from"../logging/handler.js";import{LogEntry}from"../logging/logentry.js";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateInteger,validateObject,validateString}from"../types/validate.js";const ALL=255,TRACE=64,DEBUG=32,INFO=16,WARN=8,ERROR=4,FATAL=2,OFF=0;class Logger extends Base{constructor(){super(),this.handler=new Set}addHandler(e){if(validateObject(e),!(e instanceof Handler))throw new Error("the handler must be an instance of Handler");return this.handler.add(e),this}removeHandler(e){if(validateObject(e),!(e instanceof Handler))throw new Error("the handler must be an instance of Handler");return this.handler.delete(e),this}logTrace(){return triggerLog.apply(this,[TRACE,...arguments]),this}logDebug(){return triggerLog.apply(this,[DEBUG,...arguments]),this}logInfo(){return triggerLog.apply(this,[INFO,...arguments]),this}logWarn(){return triggerLog.apply(this,[WARN,...arguments]),this}logError(){return triggerLog.apply(this,[ERROR,...arguments]),this}logFatal(){return triggerLog.apply(this,[FATAL,...arguments]),this}getLabel(e){return validateInteger(e),e===ALL?"ALL":e===TRACE?"TRACE":e===DEBUG?"DEBUG":e===INFO?"INFO":e===WARN?"WARN":e===ERROR?"ERROR":e===FATAL?"FATAL":e===OFF?"OFF":"unknown"}getLevel(e){return validateString(e),"ALL"===e?ALL:"TRACE"===e?TRACE:"DEBUG"===e?DEBUG:"INFO"===e?INFO:"WARN"===e?WARN:"ERROR"===e?ERROR:"FATAL"===e?FATAL:"OFF"===e?OFF:0}}function triggerLog(e,...r){var t;for(t of this.handler)t.log(new LogEntry(e,r));return this}assignToNamespace("Monster.Logging",Logger);export{Monster,Logger,ALL,TRACE,DEBUG,INFO,WARN,ERROR,FATAL,OFF};
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
2
  "use strict";const namespace="Monster.Logging";
@@ -1,2 +1,2 @@
1
- /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
1
+ /** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
2
2
  "use strict";const namespace="Monster.Math";