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

Merge branch 'MONSTER/-/1a931052-1bac-4c69-9304-f66a3f9eb797' into 'master'

Release 1.28.0

See merge request oss/libraries/javascript/monster!40
parents 0ce302e9 06fc2bd0
No related branches found
No related tags found
No related merge requests found
Showing
with 49 additions and 39 deletions
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -2,6 +2,17 @@ ...@@ -2,6 +2,17 @@
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.28.0] - 2021-12-11
## Added
- [new data-monster-select-this attribute](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/105)
- [Node.toString()](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/107)
## Changed
- [add rootReference to buildTree ](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/106)
## [1.27.0] - 2021-12-06 ## [1.27.0] - 2021-12-06
## Added ## Added
...@@ -19,7 +30,6 @@ All notable changes to this project will be documented in this file. ...@@ -19,7 +30,6 @@ All notable changes to this project will be documented in this file.
- [themed templates are not found from the shadowroot](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/101) - [themed templates are not found from the shadowroot](https://gitlab.schukai.com/oss/libraries/javascript/monster/-/issues/101)
## [1.26.0] - 2021-12-02 ## [1.26.0] - 2021-12-02
## Added ## Added
......
...@@ -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.27.0/dist/modules/monster.js'; } from 'https://unpkg.com/@schukai/monster@1.28.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.27.0/dist/modules/monster.js"></script> <script type="module" src="https://unpkg.com/@schukai/monster@1.28.0/dist/modules/monster.js"></script>
<script nomodule src="https://unpkg.com/@schukai/monster@1.27.0/dist/monster.js"></script> <script nomodule src="https://unpkg.com/@schukai/monster@1.28.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.filter,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.sort,ArrayBuffer,atob,DataView,document,Document,DocumentFragment,Element,Event,fetch,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.endsWith,String.prototype.startsWith,String.prototype.trim,Symbol,Symbol.iterator,Uint16Array,Uint8Array,URL,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.filter,Array.prototype.forEach,Array.prototype.indexOf,Array.prototype.keys,Array.prototype.lastIndexOf,Array.prototype.map,Array.prototype.reduce,Array.prototype.sort,ArrayBuffer,atob,DataView,document,Document,DocumentFragment,Element,Event,fetch,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.endsWith,String.prototype.padStart,String.prototype.startsWith,String.prototype.trim,Symbol,Symbol.iterator,Uint16Array,Uint8Array,URL,WeakMap,WeakSet"
crossorigin="anonymous" crossorigin="anonymous"
referrerpolicy="no-referrer"></script> referrerpolicy="no-referrer"></script>
``` ```
......
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.28.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{Monster}from"./namespace.js";const internalSymbol=Symbol("internalData"),internalStateSymbol=Symbol("state");export{Monster,internalSymbol,internalStateSymbol}; "use strict";import{Monster}from"./namespace.js";const internalSymbol=Symbol("internalData"),internalStateSymbol=Symbol("state");export{Monster,internalSymbol,internalStateSymbol};
\ No newline at end of file
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.28.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.28.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.28.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.28.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.28.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.28.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.28.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";const namespace="Monster.Constraints";export{namespace}; "use strict";const namespace="Monster.Constraints";export{namespace};
\ No newline at end of file
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.28.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.28.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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}; "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};
\ No newline at end of file
/** Monster 1.27.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.28.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isFunction,isObject,isString}from"../types/is.js";import{validateString}from"../types/validate.js";import{clone}from"../util/clone.js";import{DELIMITER,Pathfinder,WILDCARD}from"./pathfinder.js";function buildMap(t,e,a,n,i){return assembleParts(t,e,i,function(t,e,i){e=build(t,n,e),t=build(t,a),this.set(e,t)})}function assembleParts(t,e,a,n){const r=new Map;let i;if(isFunction(e)){if(i=e(t),!(i instanceof Map))throw new TypeError("the selector callback must return a map")}else{if(!isString(e))throw new TypeError("value is neither a string nor a function");i=new Map,buildFlatMap.call(i,t,e)}return i instanceof Map&&i.forEach((t,e,i)=>{isFunction(a)&&!0!==a.call(i,t,e)||n.call(r,t,e,i)}),r}function buildFlatMap(i,t,a,n){var r=this;const s=new Map;var e=r.size;void 0===a&&(a=[]);let o=t.split(DELIMITER),l,c=[];do{if(l=o.shift(),c.push(l),l===WILDCARD){let t=new Pathfinder(i),e;try{e=t.getVia(c.join(DELIMITER))}catch(t){e=new Map}for(const[h,d]of e){let e=clone(a);c.map(t=>{e.push(t===WILDCARD?h:t)});var p=e.join(DELIMITER);let t=buildFlatMap.call(r,d,o.join(DELIMITER),e,d);isObject(t)&&(t["^"]=n),s.set(p,t)}}}while(0<o.length);if(e===r.size)for(var[f,u]of s)r.set(f,u);return i}function build(t,a,n){if(void 0===a)return n||t;validateString(a);const e=[...a.matchAll(/(?<placeholder>\${(?<path>[a-z\^A-Z.\-_0-9]*)})/gm)];let r=new Pathfinder(t);return 0===e.length?r.getVia(a):(e.forEach(e=>{var i=e?.groups,e=i?.placeholder;if(void 0!==e){i=i?.path;let t=r.getVia(i);void 0===t&&(t=n),a=a.replaceAll(e,t)}}),a)}assignToNamespace("Monster.Data",buildMap);export{Monster,buildMap,assembleParts}; "use strict";import{assignToNamespace,Monster}from"../namespace.js";import{isFunction,isObject,isString}from"../types/is.js";import{validateString}from"../types/validate.js";import{clone}from"../util/clone.js";import{DELIMITER,Pathfinder,WILDCARD}from"./pathfinder.js";function buildMap(t,e,a,n,i){return assembleParts(t,e,i,function(t,e,i){e=build(t,n,e),t=build(t,a),this.set(e,t)})}function assembleParts(t,e,a,n){const r=new Map;let i;if(isFunction(e)){if(i=e(t),!(i instanceof Map))throw new TypeError("the selector callback must return a map")}else{if(!isString(e))throw new TypeError("value is neither a string nor a function");i=new Map,buildFlatMap.call(i,t,e)}return i instanceof Map&&i.forEach((t,e,i)=>{isFunction(a)&&!0!==a.call(i,t,e)||n.call(r,t,e,i)}),r}function buildFlatMap(i,t,a,n){var r=this;const s=new Map;var e=r.size;void 0===a&&(a=[]);let o=t.split(DELIMITER),l,c=[];do{if(l=o.shift(),c.push(l),l===WILDCARD){let t=new Pathfinder(i),e;try{e=t.getVia(c.join(DELIMITER))}catch(t){e=new Map}for(const[d,h]of e){let e=clone(a);c.map(t=>{e.push(t===WILDCARD?d:t)});var p=e.join(DELIMITER);let t=buildFlatMap.call(r,h,o.join(DELIMITER),e,h);isObject(t)&&void 0!==n&&(t["^"]=n),s.set(p,t)}}}while(0<o.length);if(e===r.size)for(var[f,u]of s)r.set(f,u);return i}function build(t,a,n){if(void 0===a)return n||t;validateString(a);const e=[...a.matchAll(/(?<placeholder>\${(?<path>[a-z\^A-Z.\-_0-9]*)})/gm)];let r=new Pathfinder(t);return 0===e.length?r.getVia(a):(e.forEach(e=>{var i=e?.groups,e=i?.placeholder;if(void 0!==e){i=i?.path;let t=r.getVia(i);void 0===t&&(t=n),a=a.replaceAll(e,t)}}),a)}assignToNamespace("Monster.Data",buildMap);export{Monster,buildMap,assembleParts};
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment