@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.
- package/CHANGELOG +46 -1
- package/README.md +5 -5
- package/dist/modules/constants.js +2 -2
- package/dist/modules/constraints/abstract.js +2 -2
- package/dist/modules/constraints/abstractoperator.js +2 -2
- package/dist/modules/constraints/andoperator.js +2 -2
- package/dist/modules/constraints/invalid.js +2 -2
- package/dist/modules/constraints/isarray.js +2 -2
- package/dist/modules/constraints/isobject.js +2 -2
- package/dist/modules/constraints/namespace.js +1 -1
- package/dist/modules/constraints/oroperator.js +2 -2
- package/dist/modules/constraints/valid.js +2 -2
- package/dist/modules/data/buildmap.js +2 -2
- package/dist/modules/data/diff.js +2 -2
- package/dist/modules/data/extend.js +2 -2
- package/dist/modules/data/namespace.js +1 -1
- package/dist/modules/data/pathfinder.js +2 -2
- package/dist/modules/data/pipe.js +2 -2
- package/dist/modules/data/transformer.js +2 -2
- package/dist/modules/dom/assembler.js +2 -2
- package/dist/modules/dom/attributes.js +2 -2
- package/dist/modules/dom/constants.js +2 -2
- package/dist/modules/dom/customcontrol.js +2 -0
- package/dist/modules/dom/customelement.js +2 -2
- package/dist/modules/dom/events.js +2 -2
- package/dist/modules/dom/locale.js +2 -2
- package/dist/modules/dom/namespace.js +1 -1
- package/dist/modules/dom/template.js +2 -2
- package/dist/modules/dom/theme.js +2 -2
- package/dist/modules/dom/updater.js +2 -2
- package/dist/modules/dom/util.js +2 -2
- package/dist/modules/i18n/locale.js +2 -2
- package/dist/modules/i18n/namespace.js +1 -1
- package/dist/modules/i18n/provider.js +2 -2
- package/dist/modules/i18n/providers/fetch.js +2 -2
- package/dist/modules/i18n/providers/namespace.js +1 -1
- package/dist/modules/i18n/translations.js +2 -2
- package/dist/modules/logging/handler/console.js +2 -2
- package/dist/modules/logging/handler/namespace.js +1 -1
- package/dist/modules/logging/handler.js +2 -2
- package/dist/modules/logging/logentry.js +2 -2
- package/dist/modules/logging/logger.js +2 -2
- package/dist/modules/logging/namespace.js +1 -1
- package/dist/modules/math/namespace.js +1 -1
- package/dist/modules/math/random.js +2 -2
- package/dist/modules/monster.js +2 -2
- package/dist/modules/namespace.js +2 -2
- package/dist/modules/text/formatter.js +2 -2
- package/dist/modules/text/namespace.js +1 -1
- package/dist/modules/types/base.js +2 -2
- package/dist/modules/types/basewithoptions.js +2 -2
- package/dist/modules/types/global.js +2 -2
- package/dist/modules/types/id.js +2 -2
- package/dist/modules/types/is.js +2 -2
- package/dist/modules/types/namespace.js +1 -1
- package/dist/modules/types/observer.js +2 -2
- package/dist/modules/types/observerlist.js +2 -2
- package/dist/modules/types/proxyobserver.js +2 -2
- package/dist/modules/types/queue.js +2 -2
- package/dist/modules/types/randomid.js +2 -2
- package/dist/modules/types/stack.js +2 -2
- package/dist/modules/types/tokenlist.js +2 -2
- package/dist/modules/types/typeof.js +2 -2
- package/dist/modules/types/uniquequeue.js +2 -2
- package/dist/modules/types/validate.js +2 -2
- package/dist/modules/types/version.js +2 -2
- package/dist/modules/util/clone.js +2 -2
- package/dist/modules/util/comparator.js +2 -2
- package/dist/modules/util/freeze.js +2 -2
- package/dist/modules/util/namespace.js +1 -1
- package/dist/monster.dev.js +8622 -7709
- package/dist/monster.dev.js.map +1 -1
- package/dist/monster.js +2 -9
- package/package.json +1 -1
- package/source/constants.js +7 -6
- package/source/constraints/abstract.js +2 -2
- package/source/constraints/abstractoperator.js +4 -4
- package/source/constraints/andoperator.js +8 -8
- package/source/constraints/invalid.js +6 -6
- package/source/constraints/isarray.js +7 -7
- package/source/constraints/isobject.js +7 -7
- package/source/constraints/namespace.js +2 -2
- package/source/constraints/oroperator.js +8 -8
- package/source/constraints/valid.js +7 -7
- package/source/data/buildmap.js +15 -15
- package/source/data/diff.js +9 -9
- package/source/data/extend.js +55 -13
- package/source/data/namespace.js +2 -2
- package/source/data/pathfinder.js +13 -14
- package/source/data/pipe.js +8 -8
- package/source/data/transformer.js +11 -11
- package/source/dom/assembler.js +7 -7
- package/source/dom/attributes.js +89 -46
- package/source/dom/constants.js +9 -2
- package/source/dom/customcontrol.js +299 -0
- package/source/dom/customelement.js +181 -66
- package/source/dom/events.js +58 -8
- package/source/dom/locale.js +5 -5
- package/source/dom/namespace.js +2 -2
- package/source/dom/template.js +24 -19
- package/source/dom/theme.js +8 -9
- package/source/dom/updater.js +46 -24
- package/source/dom/util.js +10 -10
- package/source/i18n/locale.js +7 -7
- package/source/i18n/namespace.js +1 -1
- package/source/i18n/provider.js +6 -6
- package/source/i18n/providers/fetch.js +10 -10
- package/source/i18n/translations.js +5 -5
- package/source/logging/handler/console.js +5 -5
- package/source/logging/handler/namespace.js +1 -1
- package/source/logging/handler.js +8 -8
- package/source/logging/logentry.js +5 -5
- package/source/logging/logger.js +5 -5
- package/source/logging/namespace.js +2 -2
- package/source/math/namespace.js +2 -2
- package/source/math/random.js +5 -5
- package/source/monster.js +48 -44
- package/source/namespace.js +2 -2
- package/source/text/formatter.js +6 -7
- package/source/text/namespace.js +1 -1
- package/source/types/base.js +4 -5
- package/source/types/basewithoptions.js +10 -9
- package/source/types/global.js +7 -7
- package/source/types/id.js +7 -7
- package/source/types/is.js +22 -22
- package/source/types/namespace.js +2 -2
- package/source/types/observer.js +7 -7
- package/source/types/observerlist.js +4 -4
- package/source/types/proxyobserver.js +32 -26
- package/source/types/queue.js +13 -7
- package/source/types/randomid.js +6 -6
- package/source/types/stack.js +11 -4
- package/source/types/tokenlist.js +9 -9
- package/source/types/typeof.js +5 -5
- package/source/types/uniquequeue.js +14 -7
- package/source/types/validate.js +27 -27
- package/source/types/version.js +9 -9
- package/source/util/clone.js +6 -6
- package/source/util/comparator.js +7 -7
- package/source/util/freeze.js +7 -7
- package/source/util/namespace.js +2 -2
- package/test/cases/data/extend.js +66 -13
- package/test/cases/dom/attributes.js +56 -1
- package/test/cases/dom/customcontrol.js +264 -0
- package/test/cases/dom/customelement.js +112 -51
- package/test/cases/dom/events.js +32 -14
- package/test/cases/dom/template.js +40 -1
- package/test/cases/monster.js +1 -1
- package/test/cases/types/proxyobserver.js +9 -0
- package/test/util/jsdom.js +3 -0
- package/test/web/import.js +1 -0
- package/test/web/monster-dev.html +3 -3
- package/test/web/monster.html +2 -2
- package/test/web/test.html +3 -3
- package/test/web/tests.js +3 -3
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster
|
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";function random(r,t){if((t=void 0===t?MAX:t)<(r=void 0===r?0:r))throw new Error("max must be greater than min");return Math.round(create(r,t))}var MAX=1e9;function create(r,t){let e;var o=getGlobal();if(e=o?.crypto||o?.msCrypto||o?.crypto||void 0,void 0===e)throw new Error("missing crypt");let a=0;var n=t-r;if(n<2)throw new Error("the distance is too small to create a random number.");o=Math.ceil(Math.log2(n));if(53<o)throw new Error("we cannot generate numbers larger than 53 bits.");var i=Math.ceil(o/8),o=Math.pow(2,o)-1,s=new Uint8Array(i);e.getRandomValues(s);let l=8*(i-1);for(var m=0;m<i;m++)a+=s[m]*Math.pow(2,l),l-=8;return a&=o,a>=n?create(r,t):r+a}Math.log2=Math.log2||function(r){return Math.log(r)/Math.log(2)},assignToNamespace("Monster.Math",random);export{Monster,random};
|
package/dist/modules/monster.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import
|
1
|
+
/** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
|
2
|
+
"use strict";import"./constants.js";import"./constraints/abstract.js";import"./constraints/abstractoperator.js";import"./constraints/andoperator.js";import"./constraints/invalid.js";import"./constraints/isarray.js";import"./constraints/isobject.js";import"./constraints/oroperator.js";import"./constraints/valid.js";import"./data/buildmap.js";import"./data/diff.js";import"./data/extend.js";import"./data/pathfinder.js";import"./data/pipe.js";import"./data/transformer.js";import"./dom/assembler.js";import"./dom/attributes.js";import"./dom/constants.js";import"./dom/customcontrol.js";import"./dom/customelement.js";import"./dom/events.js";import"./dom/locale.js";import"./dom/template.js";import"./dom/theme.js";import"./dom/updater.js";import"./dom/util.js";import"./i18n/locale.js";import"./i18n/provider.js";import"./i18n/providers/fetch.js";import"./i18n/translations.js";import"./logging/handler.js";import"./logging/handler/console.js";import"./logging/logentry.js";import"./logging/logger.js";import"./math/random.js";import{Monster}from"./namespace.js";import"./text/formatter.js";import"./types/base.js";import"./types/basewithoptions.js";import"./types/global.js";import"./types/id.js";import"./types/is.js";import"./types/observer.js";import"./types/observerlist.js";import"./types/proxyobserver.js";import"./types/queue.js";import"./types/randomid.js";import"./types/stack.js";import"./types/tokenlist.js";import"./types/typeof.js";import"./types/uniquequeue.js";import"./types/validate.js";import"./types/version.js";import"./util/clone.js";import"./util/comparator.js";import"./util/freeze.js";let rootName;try{rootName=Monster.Types.getGlobalObject("__MonsterRootName__")}catch(t){}rootName=rootName||"Monster",Monster.Types.getGlobal()[rootName]=Monster;export{Monster};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";class Namespace{constructor(e){if(void 0===e||"string"!=typeof e)throw new Error("namespace is not a string");this.namespace=e}getNamespace(){return this.namespace}toString(){return this.getNamespace()}}const Monster=new Namespace("Monster");function assignToNamespace(e,...r){let n=namespaceFor(e.split("."));if(0===r.length)throw new Error("no functions have been passed.");for(let e=0,t=r.length;e<t;e++)n[objectName(r[e])]=r[e];return n}function objectName(t){try{if("function"!=typeof t)throw new Error("the first argument is not a function or class.");if(t.hasOwnProperty("name"))return t.name;if("function"==typeof t.toString){let e=t.toString();var r=e.match(/^\s*function\s+([^\s(]+)/);if(Array.isArray(r)&&"string"==typeof r[1])return r[1];var n=e.match(/^\s*class\s+([^\s(]+)/);if(Array.isArray(n)&&"string"==typeof n[1])return n[1]}}catch(e){throw new Error("exception "+e)}throw new Error("the name of the class or function cannot be resolved.")}function namespaceFor(t){let r=Monster,n="Monster";for(let e=0;e<t.length;e++)"Monster"!==t[e]&&(n+="."+t[e],r.hasOwnProperty(t[e])||(r[t[e]]=new Namespace(n)),r=r[t[e]]);return r}assignToNamespace("Monster",assignToNamespace);export{Monster,assignToNamespace};
|
1
|
+
/** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
|
2
|
+
"use strict";class Namespace{constructor(e){if(void 0===e||"string"!=typeof e)throw new Error("namespace is not a string");this.namespace=e}getNamespace(){return this.namespace}toString(){return this.getNamespace()}}const Monster=new Namespace("Monster");function assignToNamespace(e,...r){let n=namespaceFor(e.split("."));if(0===r.length)throw new Error("no functions have been passed.");for(let e=0,t=r.length;e<t;e++)n[objectName(r[e])]=r[e];return n}function objectName(t){try{if("function"!=typeof t)throw new Error("the first argument is not a function or class.");if(t.hasOwnProperty("name"))return t.name;if("function"==typeof t.toString){let e=t.toString();var r=e.match(/^\s*function\s+([^\s(]+)/);if(Array.isArray(r)&&"string"==typeof r[1])return r[1];var n=e.match(/^\s*class\s+([^\s(]+)/);if(Array.isArray(n)&&"string"==typeof n[1])return n[1]}}catch(e){throw new Error("exception "+e)}throw new Error("the name of the class or function cannot be resolved.")}function namespaceFor(t){let r=Monster,n="Monster";for(let e=0;e<t.length;e++)"Monster"!==t[e]&&(n+="."+t[e],r.hasOwnProperty(t[e])||(r[t[e]]=new Namespace(n)),r=r[t[e]]);return r}assignToNamespace("Monster",assignToNamespace,Namespace);export{Monster,assignToNamespace};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Pipe}from"../data/pipe.js";import{Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateObject,validateString}from"../types/validate.js";class Formatter extends Base{constructor(e){super(),this.object=validateObject(e),this.openMarker="${",this.closeMarker="}"}setMarker(e,r){return void 0===r&&(r=e),this.openMarker=validateString(e),this.closeMarker=validateString(r),this}format(e){return tokenizer.call(this,validateString(e))}}function tokenizer(e){var r=this;let t=[];for(;;){var a=e.indexOf(r.openMarker);if(-1===a){t.push(e);break}0<a&&(t.push(e.substring(0,a)),e=e.substring(a));var s=e.substring(r.openMarker.length).indexOf(r.closeMarker)+r.openMarker.length;if(-1===s)throw new Error("syntax error in formatter template");a="path:"+e.substring(r.openMarker.length,s);t.push(validateString(new Pipe(a).run(r.object))),e=e.substring(s+r.closeMarker.length)}return t.join("")}
|
1
|
+
/** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
|
2
|
+
"use strict";import{Pipe}from"../data/pipe.js";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateObject,validateString}from"../types/validate.js";class Formatter extends Base{constructor(e){super(),this.object=validateObject(e),this.openMarker="${",this.closeMarker="}"}setMarker(e,r){return void 0===r&&(r=e),this.openMarker=validateString(e),this.closeMarker=validateString(r),this}format(e){return tokenizer.call(this,validateString(e))}}function tokenizer(e){var r=this;let t=[];for(;;){var a=e.indexOf(r.openMarker);if(-1===a){t.push(e);break}0<a&&(t.push(e.substring(0,a)),e=e.substring(a));var s=e.substring(r.openMarker.length).indexOf(r.closeMarker)+r.openMarker.length;if(-1===s)throw new Error("syntax error in formatter template");a="path:"+e.substring(r.openMarker.length,s);t.push(validateString(new Pipe(a).run(r.object))),e=e.substring(s+r.closeMarker.length)}return t.join("")}assignToNamespace("Monster.Text",Formatter);export{Monster,Formatter};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
1
|
+
/** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
|
2
2
|
"use strict";const namespace="Monster.Text";
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster}from"../namespace.js";class Base extends Object{toString(){return JSON.stringify(this)}}
|
1
|
+
/** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
|
2
|
+
"use strict";import{assignToNamespace,Monster}from"../namespace.js";class Base extends Object{toString(){return JSON.stringify(this)}}assignToNamespace("Monster.Types",Base);export{Monster,Base};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{
|
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{Base}from"./base.js";import{validateObject}from"./validate.js";const optionsSymbol=Symbol.for(PROPERTY_KEY_INTERNALDATA);class BaseWithOptions extends Base{constructor(t){super(),void 0===t&&(t={}),this[optionsSymbol]=extend({},this.defaults,validateObject(t))}get defaults(){return{}}getOption(t,e){let s;try{s=new Pathfinder(this[optionsSymbol]).getVia(t)}catch(t){}return void 0===s?e:s}}assignToNamespace("Monster.Types",BaseWithOptions);export{Monster,BaseWithOptions};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster}from"../namespace.js";import{validateFunction,validateString
|
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{validateFunction,validateObject,validateString}from"./validate.js";let globalReference;function getGlobal(){return globalReference}function getGlobalObject(e){validateString(e);var t=globalReference?.[e];if(void 0===t)throw new Error("the object "+e+" is not defined");return validateObject(t),t}function getGlobalFunction(e){validateString(e);var t=globalReference?.[e];if(void 0===t)throw new Error("the function "+e+" is not defined");return validateFunction(t),t}!function(){if("object"!=typeof globalThis)if("undefined"==typeof self){if("undefined"==typeof window){if(Object.defineProperty(Object.prototype,"__monster__",{get:function(){return this},configurable:!0}),"object"==typeof __monster__)return __monster__.globalThis=__monster__,delete Object.prototype.__monster__,globalReference=globalThis;try{globalReference=Function("return this")()}catch(e){}throw new Error("unsupported environment.")}globalReference=window}else globalReference=self;else globalReference=globalThis}(),assignToNamespace("Monster.Types",getGlobal,getGlobalObject,getGlobalFunction);export{Monster,getGlobal,getGlobalObject,getGlobalFunction};
|
package/dist/modules/types/id.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster
|
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"./base.js";import{validateString}from"./validate.js";let internalCounter=new Map;class ID extends Base{constructor(e){super(),void 0===e&&(e="id"),validateString(e),internalCounter.has(e)||internalCounter.set(e,1);var t=internalCounter.get(e);this.id=e+t,internalCounter.set(e,++t)}toString(){return this.id}}assignToNamespace("Monster.Types",ID);export{Monster,ID};
|
package/dist/modules/types/is.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster}from"../namespace.js";function isIterable(i){return void 0!==i&&(null!==i&&"function"==typeof i?.[Symbol.iterator])}function isPrimitive(i){return null==i||NaN===i||("string"==(i=typeof i)||"number"==i||"boolean"==i||"symbol"==i)}function isSymbol(i){return"symbol"==typeof i}function isBoolean(i){return!0===i||!1===i}function isString(i){return void 0!==i&&"string"==typeof i}function isObject(i){return!isArray(i)&&(!isPrimitive(i)&&"object"==typeof i)}function isInstance(i,n){return!!isObject(i)&&(!!isFunction(n)&&(!!n.hasOwnProperty("prototype")&&i instanceof n))}function isArray(i){return!!Array.isArray(i)}function isFunction(i){return!isArray(i)&&(!isPrimitive(i)&&"function"==typeof i)}function isInteger(i){return Number.isInteger(i)}
|
1
|
+
/** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
|
2
|
+
"use strict";import{assignToNamespace,Monster}from"../namespace.js";function isIterable(i){return void 0!==i&&(null!==i&&"function"==typeof i?.[Symbol.iterator])}function isPrimitive(i){return null==i||NaN===i||("string"==(i=typeof i)||"number"==i||"boolean"==i||"symbol"==i)}function isSymbol(i){return"symbol"==typeof i}function isBoolean(i){return!0===i||!1===i}function isString(i){return void 0!==i&&"string"==typeof i}function isObject(i){return!isArray(i)&&(!isPrimitive(i)&&"object"==typeof i)}function isInstance(i,n){return!!isObject(i)&&(!!isFunction(n)&&(!!n.hasOwnProperty("prototype")&&i instanceof n))}function isArray(i){return!!Array.isArray(i)}function isFunction(i){return!isArray(i)&&(!isPrimitive(i)&&"function"==typeof i)}function isInteger(i){return Number.isInteger(i)}assignToNamespace("Monster.Types",isPrimitive,isBoolean,isString,isObject,isArray,isFunction,isIterable,isInteger,isSymbol);export{Monster,isPrimitive,isBoolean,isString,isObject,isInstance,isArray,isFunction,isIterable,isInteger,isSymbol};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
1
|
+
/** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
|
2
2
|
"use strict";const namespace="Monster.Types";
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster}from"../namespace.js";import{
|
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"./base.js";import{isObject}from"./is.js";import{TokenList}from"./tokenlist.js";import{UniqueQueue}from"./uniquequeue.js";class Observer extends Base{constructor(e,...t){if(super(),"function"!=typeof e)throw new Error("observer callback must be a function");this.callback=e,this.arguments=t,this.tags=new TokenList,this.queue=new UniqueQueue}addTag(e){return this.tags.add(e),this}removeTag(e){return this.tags.remove(e),this}getTags(){return this.tags.entries()}hasTag(e){return this.tags.contains(e)}update(e){let i=this;return new Promise(function(s,r){isObject(e)?(i.queue.add(e),setTimeout(()=>{try{if(i.queue.isEmpty())return void s();var t=i.queue.poll();let e=i.callback.apply(t,i.arguments);if(isObject(e)&&e instanceof Promise)return void e.then(s).catch(r);s(e)}catch(e){r(e)}},0)):r("subject must be an object")})}}assignToNamespace("Monster.Types",Observer);export{Monster,Observer};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster}from"../namespace.js";import{Base}from"./base.js";import{Observer}from"./observer.js";import{validateInstance}from"./validate.js";class ObserverList extends Base{constructor(){super(),this.observers=[]}attach(e){return validateInstance(e,Observer),this.observers.push(e),this}detach(e){validateInstance(e,Observer);for(var s=0,r=this.observers.length;s<r;s++)this.observers[s]===e&&this.observers.splice(s,1);return this}contains(e){validateInstance(e,Observer);for(var s=0,r=this.observers.length;s<r;s++)if(this.observers[s]===e)return!0;return!1}notify(e){let s=[];for(var r=0,t=this.observers.length;r<t;r++)s.push(this.observers[r].update(e));return Promise.all(s)}}
|
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"./base.js";import{Observer}from"./observer.js";import{validateInstance}from"./validate.js";class ObserverList extends Base{constructor(){super(),this.observers=[]}attach(e){return validateInstance(e,Observer),this.observers.push(e),this}detach(e){validateInstance(e,Observer);for(var s=0,r=this.observers.length;s<r;s++)this.observers[s]===e&&this.observers.splice(s,1);return this}contains(e){validateInstance(e,Observer);for(var s=0,r=this.observers.length;s<r;s++)if(this.observers[s]===e)return!0;return!1}notify(e){let s=[];for(var r=0,t=this.observers.length;r<t;r++)s.push(this.observers[r].update(e));return Promise.all(s)}}assignToNamespace("Monster.Types",ObserverList);export{Monster,ObserverList};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster
|
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"./base.js";import{isArray,isObject,isPrimitive}from"./is.js";import{Observer}from"./observer.js";import{ObserverList}from"./observerlist.js";import{validateObject}from"./validate.js";class ProxyObserver extends Base{constructor(e){super(),this.realSubject=validateObject(e),this.subject=new Proxy(e,getHandler.call(this)),this.objectMap=new WeakMap,this.objectMap.set(this.realSubject,this.subject),this.proxyMap=new WeakMap,this.proxyMap.set(this.subject,this.realSubject),this.observers=new ObserverList}getSubject(){return this.subject}getRealSubject(){return this.realSubject}attachObserver(e){return this.observers.attach(e),this}detachObserver(e){return this.observers.detach(e),this}notifyObservers(){return this.observers.notify(this)}containsObserver(e){return this.observers.contains(e)}}function getHandler(){const a=this,s={get:function(e,t,r){r=Reflect.get(e,t,r);if("symbol"==typeof t)return r;if(isPrimitive(r))return r;if(isArray(r)||isObject(r)){if(a.objectMap.has(r))return a.objectMap.get(r);if(a.proxyMap.has(r))return r;t=new Proxy(r,s);return a.objectMap.set(r,t),a.proxyMap.set(t,r),t}return r},set:function(e,t,r,s){a.proxyMap.has(r)&&(r=a.proxyMap.get(r)),a.proxyMap.has(e)&&(e=a.proxyMap.get(e));let o=Reflect.get(e,t,s);if(a.proxyMap.has(o)&&(o=a.proxyMap.get(o)),o===r)return!0;let i=Reflect.getOwnPropertyDescriptor(e,t);return void 0===i&&(i={writable:!0,enumerable:!0,configurable:!0}),i.value=r,e=Reflect.defineProperty(e,t,i),"symbol"!=typeof t&&a.observers.notify(a),e},deleteProperty:function(e,t){return t in e&&(delete e[t],"symbol"!=typeof t&&a.observers.notify(a),!0)},defineProperty:function(e,t,r){r=Reflect.defineProperty(e,t,r);return"symbol"!=typeof t&&a.observers.notify(a),r},setPrototypeOf:function(e,t){var r=Reflect.setPrototypeOf(object1,t);return"symbol"!=typeof t&&a.observers.notify(a),r}};return s}assignToNamespace("Monster.Types",ProxyObserver);export{Monster,ProxyObserver};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
import{Monster
|
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"./base.js";class Queue extends Base{constructor(){super(),this.data=[]}isEmpty(){return 0===this.data.length}peek(){if(!this.isEmpty())return this.data[0]}add(s){return this.data.push(s),this}clear(){return this.data=[],this}poll(){if(!this.isEmpty())return this.data.shift()}}assignToNamespace("Monster.Types",Queue);export{Monster,Queue};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster
|
1
|
+
/** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
|
2
|
+
"use strict";import{random}from"../math/random.js";import{assignToNamespace,Monster}from"../namespace.js";import{getGlobal}from"./global.js";import{ID}from"./id.js";let internalCounter=0;class RandomID extends ID{constructor(){super(),internalCounter+=1,this.id=getGlobal().btoa(random(1,1e4)).replace(/=/g,"").replace(/^[0-9]+/,"X")+internalCounter}}assignToNamespace("Monster.Types",RandomID);export{Monster,RandomID};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
import{Monster
|
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"./base.js";class Stack extends Base{constructor(){super(),this.data=[]}isEmpty(){return 0===this.data.length}peek(){if(!this.isEmpty())return this.data?.[this.data.length-1]}push(t){return this.data.push(t),this}clear(){return this.data=[],this}pop(){if(!this.isEmpty())return this.data.pop()}}assignToNamespace("Monster.Types",Stack);export{Monster,Stack};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster}from"../namespace.js";import{
|
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{isIterable,isString}from"../types/is.js";import{validateFunction,validateString}from"../types/validate.js";import{Base}from"./base.js";class TokenList extends Base{constructor(t){super(),this.tokens=new Set,void 0!==t&&this.add(t)}getIterator(){return this[Symbol.iterator]()}[Symbol.iterator](){let t=0,e=this.entries();return{next:()=>t<e.length?{value:e?.[t++],done:!1}:{done:!0}}}contains(r){if(isString(r)){r=r.trim();let e=0;return r.split(" ").forEach(t=>!1!==this.tokens.has(t.trim())&&void e++),0<e}if(isIterable(r)){let t=0;for(var e of r){if(validateString(e),!1===this.tokens.has(e.trim()))return!1;t++}return 0<t}return!1}add(t){if(isString(t))t.split(" ").forEach(t=>{this.tokens.add(t.trim())});else if(isIterable(t))for(var e of t)validateString(e),this.tokens.add(e.trim());else if(void 0!==t)throw new TypeError("unsupported value");return this}clear(){return this.tokens.clear(),this}remove(t){if(isString(t))t.split(" ").forEach(t=>{this.tokens.delete(t.trim())});else if(isIterable(t))for(var e of t)validateString(e),this.tokens.delete(e.trim());else if(void 0!==t)throw new TypeError("unsupported value");return this}replace(t,e){if(validateString(t),validateString(e),!this.contains(t))return this;let r=Array.from(this.tokens);t=r.indexOf(t);return-1===t||(r.splice(t,1,e),this.tokens=new Set,this.add(r)),this}toggle(t){if(isString(t))t.split(" ").forEach(t=>{toggleValue.call(this,t)});else if(isIterable(t))for(var e of t)toggleValue.call(this,e);else if(void 0!==t)throw new TypeError("unsupported value");return this}entries(){return Array.from(this.tokens)}forEach(t){return validateFunction(t),this.tokens.forEach(t),this}toString(){return this.entries().join(" ")}}function toggleValue(t){if(!(this instanceof TokenList))throw Error("must be called with TokenList.call");return validateString(t),t=t.trim(),this.contains(t)?this.remove(t):this.add(t),this}assignToNamespace("Monster.Types",TokenList);export{Monster,TokenList};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster}from"../namespace.js";function typeOf(t){let e={}.toString.call(t).match(/\s([a-zA-Z]+)/)[1];return"Object"===e&&(t=/^(class|function)\s+(\w+)/.exec(t.constructor.toString()),e=t&&2<t.length?t[2]:""),e.toLowerCase()}
|
1
|
+
/** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
|
2
|
+
"use strict";import{assignToNamespace,Monster}from"../namespace.js";function typeOf(t){let e={}.toString.call(t).match(/\s([a-zA-Z]+)/)[1];return"Object"===e&&(t=/^(class|function)\s+(\w+)/.exec(t.constructor.toString()),e=t&&2<t.length?t[2]:""),e.toLowerCase()}assignToNamespace("Monster.Types",typeOf);export{Monster,typeOf};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
import{Monster
|
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{Queue}from"./queue.js";import{validateObject}from"./validate.js";class UniqueQueue extends Queue{constructor(){super(),this.unique=new WeakSet}add(e){return validateObject(e),this.unique.has(e)||(this.unique.add(e),super.add(e)),this}clear(){return super.clear(),this.unique=new WeakSet,this}poll(){if(!this.isEmpty()){var e=this.data.shift();return this.unique.delete(e),e}}}assignToNamespace("Monster.Types",UniqueQueue);export{Monster,UniqueQueue};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster}from"../namespace.js";import{
|
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,isBoolean,isFunction,isInstance,isInteger,isIterable,isObject,isPrimitive,isString,isSymbol}from"./is.js";function validateIterable(e){if(!isIterable(e))throw new TypeError("value is not iterable");return e}function validatePrimitive(e){if(!isPrimitive(e))throw new TypeError("value is not a primitive");return e}function validateBoolean(e){if(!isBoolean(e))throw new TypeError("value is not a boolean");return e}function validateString(e){if(!isString(e))throw new TypeError("value is not a string");return e}function validateObject(e){if(!isObject(e))throw new TypeError("value is not a object");return e}function validateInstance(e,i){if(isInstance(e,i))return e;{let e="";throw(isObject(i)||isFunction(i))&&(e=i?.name),e=e&&" "+e,new TypeError("value is not an instance of"+e)}}function validateArray(e){if(!isArray(e))throw new TypeError("value is not an array");return e}function validateSymbol(e){if(!isSymbol(e))throw new TypeError("value is not an symbol");return e}function validateFunction(e){if(!isFunction(e))throw new TypeError("value is not a function");return e}function validateInteger(e){if(!isInteger(e))throw new TypeError("value is not an integer");return e}assignToNamespace("Monster.Types",validatePrimitive,validateBoolean,validateString,validateObject,validateArray,validateFunction,validateIterable,validateInteger);export{Monster,validatePrimitive,validateBoolean,validateString,validateObject,validateInstance,validateArray,validateFunction,validateIterable,validateInteger,validateSymbol};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster}from"../namespace.js";import{Base}from"./base.js";class Version extends Base{constructor(r,t,e){var s;if(super(),"string"==typeof r&&void 0===t&&void 0===e&&(s=r.toString().split("."),r=parseInt(s[0]||0),t=parseInt(s[1]||0),e=parseInt(s[2]||0)),void 0===r)throw new Error("major version is undefined");if(void 0===t&&(t=0),void 0===e&&(e=0),this.major=parseInt(r),this.minor=parseInt(t),this.patch=parseInt(e),isNaN(this.major))throw new Error("major is not a number");if(isNaN(this.minor))throw new Error("minor is not a number");if(isNaN(this.patch))throw new Error("patch is not a number")}toString(){return this.major+"."+this.minor+"."+this.patch}compareTo(r){if("string"!=typeof(r=r instanceof Version?r.toString():r))throw new Error("type exception");if(r===this.toString())return 0;var t=[this.major,this.minor,this.patch],e=r.split("."),s=Math.max(t.length,e.length);for(let r=0;r<s;r+=1){if(t[r]&&!e[r]&&0<parseInt(t[r])||parseInt(t[r])>parseInt(e[r]))return 1;if(e[r]&&!t[r]&&0<parseInt(e[r])||parseInt(t[r])<parseInt(e[r]))return-1}return 0}}
|
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"./base.js";class Version extends Base{constructor(r,t,e){var s;if(super(),"string"==typeof r&&void 0===t&&void 0===e&&(s=r.toString().split("."),r=parseInt(s[0]||0),t=parseInt(s[1]||0),e=parseInt(s[2]||0)),void 0===r)throw new Error("major version is undefined");if(void 0===t&&(t=0),void 0===e&&(e=0),this.major=parseInt(r),this.minor=parseInt(t),this.patch=parseInt(e),isNaN(this.major))throw new Error("major is not a number");if(isNaN(this.minor))throw new Error("minor is not a number");if(isNaN(this.patch))throw new Error("patch is not a number")}toString(){return this.major+"."+this.minor+"."+this.patch}compareTo(r){if("string"!=typeof(r=r instanceof Version?r.toString():r))throw new Error("type exception");if(r===this.toString())return 0;var t=[this.major,this.minor,this.patch],e=r.split("."),s=Math.max(t.length,e.length);for(let r=0;r<s;r+=1){if(t[r]&&!e[r]&&0<parseInt(t[r])||parseInt(t[r])>parseInt(e[r]))return 1;if(e[r]&&!t[r]&&0<parseInt(e[r])||parseInt(t[r])<parseInt(e[r]))return-1}return 0}}assignToNamespace("Monster.Types",Version);let monsterVersion;function getVersion(){return monsterVersion instanceof Version||(monsterVersion=new Version("1.15.2")),monsterVersion}assignToNamespace("Monster",getVersion);export{Monster,Version,getVersion};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster}from"../namespace.js";import{
|
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{isArray,isFunction,isObject,isPrimitive}from"../types/is.js";function clone(n){if(null===n)return n;if(isPrimitive(n))return n;if(isFunction(n))return n;if(isArray(n)){let e=[];for(var t=0,r=n.length;t<r;t++)e[t]=clone(n[t]);return e}if(isObject(n)){if(n instanceof Date){let e=new Date;return e.setTime(n.getTime()),e}if("undefined"!=typeof Element&&n instanceof Element)return n;if("undefined"!=typeof HTMLDocument&&n instanceof HTMLDocument)return n;if("undefined"!=typeof DocumentFragment&&n instanceof DocumentFragment)return n;if(n===getGlobal())return n;if("undefined"!=typeof globalContext&&n===globalContext)return n;if("undefined"!=typeof window&&n===window)return n;if("undefined"!=typeof document&&n===document)return n;if("undefined"!=typeof navigator&&n===navigator)return n;if("undefined"!=typeof JSON&&n===JSON)return n;try{if(n instanceof Proxy)return n}catch(e){}return cloneObject(n)}throw new Error("unable to clone obj! its type isn't supported.")}function cloneObject(e){var n,t;if(e.hasOwnProperty("getClone"),"function"===e.getClone)return e.getClone();for(t in n={},"function"==typeof e.constructor&&"function"==typeof e.constructor.call&&(n=new e.constructor),e)e.hasOwnProperty(t)&&(Monster.Types.isPrimitive(e[t])?n[t]=e[t]:n[t]=clone(e[t]));return n}assignToNamespace("Monster.Util",clone);export{Monster,clone};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster
|
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{isFunction}from"../types/is.js";class Comparator extends Base{constructor(r){if(super(),isFunction(r))this.compare=r;else{if(void 0!==r)throw new TypeError("unsupported type");this.compare=function(r,e){if(typeof r!=typeof e)throw new TypeError("impractical comparison");return r===e?0:r<e?-1:1}}}reverse(){const s=this.compare;return this.compare=(r,e)=>s(e,r),this}equal(r,e){return 0===this.compare(r,e)}greaterThan(r,e){return 0<this.compare(r,e)}greaterThanOrEqual(r,e){return this.greaterThan(r,e)||this.equal(r,e)}lessThanOrEqual(r,e){return this.lessThan(r,e)||this.equal(r,e)}lessThan(r,e){return this.compare(r,e)<0}}assignToNamespace("Monster.Util",Comparator);export{Monster,Comparator};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
2
|
-
"use strict";import{Monster}from"../namespace.js";import{validateObject}from"../types/validate.js";function deepFreeze(e){var t;validateObject(e);for(t of Object.getOwnPropertyNames(e)){var r=e[t];e[t]=r&&"object"==typeof r?deepFreeze(r):r}return Object.freeze(e)}
|
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{validateObject}from"../types/validate.js";function deepFreeze(e){var t;validateObject(e);for(t of Object.getOwnPropertyNames(e)){var r=e[t];e[t]=r&&"object"==typeof r?deepFreeze(r):r}return Object.freeze(e)}assignToNamespace("Monster.Util",deepFreeze);export{Monster,deepFreeze};
|
@@ -1,2 +1,2 @@
|
|
1
|
-
/** Monster 1.
|
1
|
+
/** Monster 1.15.2, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
|
2
2
|
"use strict";const namespace="Monster.Util";
|