Skip to content
Snippets Groups Projects
Commit 11efd986 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

Merge branch 'MONSTER/-/dcfc7cb2-973e-411e-8023-5b2823478339' into 'master'

Release 1.13.0

See merge request oss/libraries/javascript/monster!16
parents e064a1ba de340c85
No related branches found
No related tags found
No related merge requests found
Showing
with 38 additions and 23 deletions
This diff is collapsed.
...@@ -2,11 +2,24 @@ ...@@ -2,11 +2,24 @@
All notable changes to this project will be documented in this file. All notable changes to this project will be documented in this file.
## [1.13.0] - 2021-09-06
### Added
- [classes for localization and management of translations](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/48)
## [1.12.0] - 2021-09-05
### Added
- [a class to format texts](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/47)
## [1.11.1] - 2021-09-05 ## [1.11.1] - 2021-09-05
## Changed ## Changed
- [improvement of the entry points of the libraries](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/45) - [improvement of the entry points of the libraries](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/46)
## [1.11.0] - 2021-09-04 ## [1.11.0] - 2021-09-04
......
...@@ -40,7 +40,7 @@ For some functions you need additional [polyfills](#polyfill). ...@@ -40,7 +40,7 @@ For some functions you need additional [polyfills](#polyfill).
<script type="module"> <script type="module">
import { import {
Monster Monster
} from 'https://unpkg.com/@schukai/monster@1.12.0/dist/modules/monster.js'; } from 'https://unpkg.com/@schukai/monster@1.13.0/dist/modules/monster.js';
let id = document.getElementById('version'); let id = document.getElementById('version');
id.innerHTML = Monster.getVersion(); id.innerHTML = Monster.getVersion();
</script> </script>
...@@ -51,8 +51,8 @@ For some functions you need additional [polyfills](#polyfill). ...@@ -51,8 +51,8 @@ For some functions you need additional [polyfills](#polyfill).
`nomodule` for backwards compatibility `nomodule` for backwards compatibility
``` ```
<script type="module" src="https://unpkg.com/@schukai/monster@1.12.0/dist/modules/monster.js"></script> <script type="module" src="https://unpkg.com/@schukai/monster@1.13.0/dist/modules/monster.js"></script>
<script nomodule src="https://unpkg.com/@schukai/monster@1.12.0/dist/monster.js"></script> <script nomodule src="https://unpkg.com/@schukai/monster@1.13.0/dist/monster.js"></script>
``` ```
### Polyfill ### Polyfill
...@@ -61,7 +61,7 @@ We do try to work around some browser bugs, but on the whole we don't use polyfi ...@@ -61,7 +61,7 @@ We do try to work around some browser bugs, but on the whole we don't use polyfi
However, many functions can be mapped via [polyfill.io](https://polyfill.io/) and thus the compatibility can be increased. However, many functions can be mapped via [polyfill.io](https://polyfill.io/) and thus the compatibility can be increased.
``` ```
<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,JSON,Map,Math.log2,Number.isInteger,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,WeakMap,WeakSet" <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"
crossorigin="anonymous" crossorigin="anonymous"
referrerpolicy="no-referrer"></script> referrerpolicy="no-referrer"></script>
``` ```
...@@ -78,7 +78,7 @@ After that, all classes are accessible via `MyMonster`. For example `MyMonster.g ...@@ -78,7 +78,7 @@ After that, all classes are accessible via `MyMonster`. For example `MyMonster.g
## Documentation ## Documentation
To check out docs and examples, visit [monsterjs.org/en/doc/1.12.0/](https://monsterjs.org/en/doc/1.12.0/). To check out docs and examples, visit [monsterjs.org/en/doc/1.13.0/](https://monsterjs.org/en/doc/1.13.0/).
## Questions ## Questions
......
/** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{Monster}from"./namespace.js";const PROPERTY_KEY_OPTIONS="monsterOptions";export{Monster,PROPERTY_KEY_OPTIONS};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";const namespace="Monster.Constraints"; "use strict";const namespace="Monster.Constraints";
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";const namespace="Monster.Data"; "use strict";const namespace="Monster.Data";
\ No newline at end of file
This diff is collapsed.
/** Monster 1.12.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.13.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment