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

#20

parent b09e82bc
No related branches found
No related tags found
No related merge requests found
Showing
with 22 additions and 20 deletions
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'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(fragment){super();this.attributePrefix=ATTRIBUTEPREFIX;validateInstance(fragment,getGlobalFunction("DocumentFragment"));this.fragment=fragment}setAttributePrefix(prefix){validateString(prefix);this.attributePrefix=prefix;return this}getAttributePrefix(){return this.attributePrefix}createDocumentFragment(data){if(data===undefined){data=new ProxyObserver({})}validateInstance(data,ProxyObserver);let fragment=this.fragment.cloneNode(true);return fragment}}Monster.assignToNamespace("Monster.DOM",Assembler);export{Monster,ATTRIBUTEPREFIX,Assembler}; '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(fragment){super();this.attributePrefix=ATTRIBUTEPREFIX;validateInstance(fragment,getGlobalFunction("DocumentFragment"));this.fragment=fragment}setAttributePrefix(prefix){validateString(prefix);this.attributePrefix=prefix;return this}getAttributePrefix(){return this.attributePrefix}createDocumentFragment(data){if(data===undefined){data=new ProxyObserver({})}validateInstance(data,ProxyObserver);let fragment=this.fragment.cloneNode(true);return fragment}}Monster.assignToNamespace("Monster.DOM",Assembler);export{Monster,ATTRIBUTEPREFIX,Assembler};
/** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{getGlobalObject}from"../types/global.js";import{Monster,validateFunction}from"../types/validate.js";class CustomElement extends HTMLElement{constructor(){super()}static getTag(){throw new Error("the method getTag must be overwritten by the derived class.")}}function registerCustomElement(element){validateFunction(element);getGlobalObject("customElements").define(element.getTag(),element);return}Monster.assignToNamespace("Monster.DOM",CustomElement,registerCustomElement);export{Monster,registerCustomElement,CustomElement};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster,Base}from"../types/base.js";import{Stack}from"../types/stack.js";import{validateInstance}from"../types/validate.js";import{ProxyObserver}from"../types/proxyobserver.js";import{Observer}from"../types/observer.js";import{getGlobalFunction,getGlobalObject}from"../types/global.js";import{isInstance}from"../types/is.js";import{ATTRIBUTEPREFIX}from"./assembler.js";import{ID}from"../types/id.js";const MONSTERDOMHANDLE=Symbol("MonsterHandle");class Handle extends Base{constructor(data){super();let self=this;self.id=new ID;validateInstance(data,ProxyObserver);this.data=data;this.mutationObserver=createMutationObserver.call(this);this.dataObserver=createDataObserver.call(this);this.data.attachObserver(this.dataObserver);this.nodes=new WeakSet;this.updates=new Stack}update(){return}remove(node){if(isInstance(node,getGlobalFunction("Document"))){node=node.firstElementChild}validateInstance(node,getGlobalFunction("HTMLElement"));if(!this.nodes.has(node)){return this}this.mutationObserver.disconnect(node);delete node.dataset[MONSTERDOMHANDLE];node.removeAttribute(ATTRIBUTEPREFIX+"handler");return this}append(node){if(isInstance(node,getGlobalFunction("Document"))){node=node.firstElementChild}validateInstance(node,getGlobalFunction("HTMLElement"));if(this.nodes.has(node)){return this}node.dataset[MONSTERDOMHANDLE]=this;node.setAttribute(ATTRIBUTEPREFIX+"handler",true);this.mutationObserver.observe(node,{attributes:true,childList:true,subtree:true,characterData:true,characterDataOldValue:true,attributeOldValue:true});this.nodes.add(node);return this}}function createDataObserver(){const self=this;return new Observer(()=>{self.update()})}function createMutationObserver(){const self=this;const MutationObserver=getGlobalFunction("MutationObserver");return new MutationObserver((mutationsList,observer)=>{for(const mutation of mutationsList){self.updates.push(mutation)}self.update()})}function getHandleFromNode(node){validateInstance(node,getGlobalFunction("Node"));let handle=node.dataset?.[MONSTERDOMHANDLE];if(handle===undefined){let parentNode=node?.["parentNode"];if(isInstance(parentNode,getGlobalFunction("Node"))){return getHandleFromNode(parentNode)}}return handle}Monster.assignToNamespace("Monster.DOM",getHandleFromNode,Handle);export{Monster,getHandleFromNode,Handle}; 'use strict';import{Monster,Base}from"../types/base.js";import{Stack}from"../types/stack.js";import{validateInstance}from"../types/validate.js";import{ProxyObserver}from"../types/proxyobserver.js";import{Observer}from"../types/observer.js";import{getGlobalFunction,getGlobalObject}from"../types/global.js";import{isInstance}from"../types/is.js";import{ATTRIBUTEPREFIX}from"./assembler.js";import{ID}from"../types/id.js";const MONSTERDOMHANDLE=Symbol("MonsterHandle");class Handle extends Base{constructor(data){super();let self=this;self.id=new ID;validateInstance(data,ProxyObserver);this.data=data;this.mutationObserver=createMutationObserver.call(this);this.dataObserver=createDataObserver.call(this);this.data.attachObserver(this.dataObserver);this.nodes=new WeakSet;this.updates=new Stack}update(){return}remove(node){if(isInstance(node,getGlobalFunction("Document"))){node=node.firstElementChild}validateInstance(node,getGlobalFunction("HTMLElement"));if(!this.nodes.has(node)){return this}this.mutationObserver.disconnect(node);delete node.dataset[MONSTERDOMHANDLE];node.removeAttribute(ATTRIBUTEPREFIX+"handler");return this}append(node){if(isInstance(node,getGlobalFunction("Document"))){node=node.firstElementChild}validateInstance(node,getGlobalFunction("HTMLElement"));if(this.nodes.has(node)){return this}node.dataset[MONSTERDOMHANDLE]=this;node.setAttribute(ATTRIBUTEPREFIX+"handler",true);this.mutationObserver.observe(node,{attributes:true,childList:true,subtree:true,characterData:true,characterDataOldValue:true,attributeOldValue:true});this.nodes.add(node);return this}}function createDataObserver(){const self=this;return new Observer(()=>{self.update()})}function createMutationObserver(){const self=this;const MutationObserver=getGlobalFunction("MutationObserver");return new MutationObserver((mutationsList,observer)=>{for(const mutation of mutationsList){self.updates.push(mutation)}self.update()})}function getHandleFromNode(node){validateInstance(node,getGlobalFunction("Node"));let handle=node.dataset?.[MONSTERDOMHANDLE];if(handle===undefined){let parentNode=node?.["parentNode"];if(isInstance(parentNode,getGlobalFunction("Node"))){return getHandleFromNode(parentNode)}}return handle}Monster.assignToNamespace("Monster.DOM",getHandleFromNode,Handle);export{Monster,getHandleFromNode,Handle};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';const namespace="Monster.DOM"; 'use strict';const namespace="Monster.DOM";
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster,Base}from"../types/base.js";import{getGlobalFunction}from"../types/global.js";import{validateInstance}from"../types/validate.js";class Template extends Base{constructor(template){super();validateInstance(template,getGlobalFunction("HTMLTemplateElement"));this.template=template}getTemplateElement(){return this.template}createDocumentFragment(){return this.template.content.cloneNode(true)}}Monster.assignToNamespace("Monster.DOM",Template);export{Monster,Template}; 'use strict';import{Monster,Base}from"../types/base.js";import{getGlobalFunction}from"../types/global.js";import{validateInstance}from"../types/validate.js";class Template extends Base{constructor(template){super();validateInstance(template,getGlobalFunction("HTMLTemplateElement"));this.template=template}getTemplateElement(){return this.template}createDocumentFragment(){return this.template.content.cloneNode(true)}}Monster.assignToNamespace("Monster.DOM",Template);export{Monster,Template};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster,getGlobal}from"../types/global.js";import{validateString}from"../types/validate.js";function getDocument(){let document=getGlobal()?.["document"];if(typeof document!=="object"){throw new Error("not supported environment")}return document}function getWindow(){let window=getGlobal()?.["window"];if(typeof window!=="object"){throw new Error("not supported environment")}return window}function getDocumentFragmentFromString(html){validateString(html);const document=getDocument();const template=document.createElement("template");template.innerHTML=html;return template.content}Monster.assignToNamespace("Monster.DOM",getWindow,getDocument,getDocumentFragmentFromString);export{Monster,getWindow,getDocument,getDocumentFragmentFromString}; 'use strict';import{Monster,getGlobal}from"../types/global.js";import{validateString}from"../types/validate.js";function getDocument(){let document=getGlobal()?.["document"];if(typeof document!=="object"){throw new Error("not supported environment")}return document}function getWindow(){let window=getGlobal()?.["window"];if(typeof window!=="object"){throw new Error("not supported environment")}return window}function getDocumentFragmentFromString(html){validateString(html);const document=getDocument();const template=document.createElement("template");template.innerHTML=html;return template.content}Monster.assignToNamespace("Monster.DOM",getWindow,getDocument,getDocumentFragmentFromString);export{Monster,getWindow,getDocument,getDocumentFragmentFromString};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'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(entry){validateInstance(entry,LogEntry);if(this.loglevel<entry.getLogLevel()){return false}return true}setLogLevel(loglevel){validateInteger(loglevel);this.loglevel=loglevel;return this}getLogLevel(){return this.loglevel}setAll(){this.setLogLevel(ALL);return this}setTrace(){this.setLogLevel(TRACE);return this}setDebug(){this.setLogLevel(DEBUG);return this}setInfo(){this.setLogLevel(INFO);return this}setWarn(){this.setLogLevel(WARN);return this}setError(){this.setLogLevel(ERROR);return this}setFatal(){this.setLogLevel(FATAL);return this}setOff(){this.setLogLevel(OFF);return this}}Monster.assignToNamespace("Monster.Logging",Handler);export{Monster,Handler}; '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(entry){validateInstance(entry,LogEntry);if(this.loglevel<entry.getLogLevel()){return false}return true}setLogLevel(loglevel){validateInteger(loglevel);this.loglevel=loglevel;return this}getLogLevel(){return this.loglevel}setAll(){this.setLogLevel(ALL);return this}setTrace(){this.setLogLevel(TRACE);return this}setDebug(){this.setLogLevel(DEBUG);return this}setInfo(){this.setLogLevel(INFO);return this}setWarn(){this.setLogLevel(WARN);return this}setError(){this.setLogLevel(ERROR);return this}setFatal(){this.setLogLevel(FATAL);return this}setOff(){this.setLogLevel(OFF);return this}}Monster.assignToNamespace("Monster.Logging",Handler);export{Monster,Handler};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'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}; '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};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';const namespace="Monster.Logging.Handler"; 'use strict';const namespace="Monster.Logging.Handler";
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster}from"../namespace.js";import{validateInteger}from"../types/validate.js";import{Base}from"../types/base.js";class LogEntry extends Base{constructor(loglevel,...args){super();validateInteger(loglevel);this.loglevel=loglevel;this.arguments=args}getLogLevel(){return this.loglevel}getArguments(){return this.arguments}}Monster.assignToNamespace("Monster.Logging",LogEntry);export{Monster,LogEntry}; 'use strict';import{Monster}from"../namespace.js";import{validateInteger}from"../types/validate.js";import{Base}from"../types/base.js";class LogEntry extends Base{constructor(loglevel,...args){super();validateInteger(loglevel);this.loglevel=loglevel;this.arguments=args}getLogLevel(){return this.loglevel}getArguments(){return this.arguments}}Monster.assignToNamespace("Monster.Logging",LogEntry);export{Monster,LogEntry};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'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;const TRACE=64;const DEBUG=32;const INFO=16;const WARN=8;const ERROR=4;const FATAL=2;const OFF=0;class Logger extends Base{constructor(){super();this.handler=new Set}addHandler(handler){validateObject(handler);if(!(handler instanceof Handler)){throw new Error("the handler must be an instance of Handler")}this.handler.add(handler);return this}removeHandler(handler){validateObject(handler);if(!(handler instanceof Handler)){throw new Error("the handler must be an instance of Handler")}this.handler.delete(handler);return this}logTrace(){triggerLog.apply(this,[TRACE,...arguments]);return this}logDebug(){triggerLog.apply(this,[DEBUG,...arguments]);return this}logInfo(){triggerLog.apply(this,[INFO,...arguments]);return this}logWarn(){triggerLog.apply(this,[WARN,...arguments]);return this}logError(){triggerLog.apply(this,[ERROR,...arguments]);return this}logFatal(){triggerLog.apply(this,[FATAL,...arguments]);return this}getLabel(level){validateInteger(level);if(level===ALL)return"ALL";if(level===TRACE)return"TRACE";if(level===DEBUG)return"DEBUG";if(level===INFO)return"INFO";if(level===WARN)return"WARN";if(level===ERROR)return"ERROR";if(level===FATAL)return"FATAL";if(level===OFF)return"OFF";return"unknown"}getLevel(label){validateString(label);if(label==="ALL")return ALL;if(label==="TRACE")return TRACE;if(label==="DEBUG")return DEBUG;if(label==="INFO")return INFO;if(label==="WARN")return WARN;if(label==="ERROR")return ERROR;if(label==="FATAL")return FATAL;if(label==="OFF")return OFF;return 0}}Monster.assignToNamespace("Monster.Logging",Logger);export{Monster,Logger,ALL,TRACE,DEBUG,INFO,WARN,ERROR,FATAL,OFF};function triggerLog(loglevel,...args){var logger=this;for(let handler of logger.handler){handler.log(new LogEntry(loglevel,args))}return logger} '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;const TRACE=64;const DEBUG=32;const INFO=16;const WARN=8;const ERROR=4;const FATAL=2;const OFF=0;class Logger extends Base{constructor(){super();this.handler=new Set}addHandler(handler){validateObject(handler);if(!(handler instanceof Handler)){throw new Error("the handler must be an instance of Handler")}this.handler.add(handler);return this}removeHandler(handler){validateObject(handler);if(!(handler instanceof Handler)){throw new Error("the handler must be an instance of Handler")}this.handler.delete(handler);return this}logTrace(){triggerLog.apply(this,[TRACE,...arguments]);return this}logDebug(){triggerLog.apply(this,[DEBUG,...arguments]);return this}logInfo(){triggerLog.apply(this,[INFO,...arguments]);return this}logWarn(){triggerLog.apply(this,[WARN,...arguments]);return this}logError(){triggerLog.apply(this,[ERROR,...arguments]);return this}logFatal(){triggerLog.apply(this,[FATAL,...arguments]);return this}getLabel(level){validateInteger(level);if(level===ALL)return"ALL";if(level===TRACE)return"TRACE";if(level===DEBUG)return"DEBUG";if(level===INFO)return"INFO";if(level===WARN)return"WARN";if(level===ERROR)return"ERROR";if(level===FATAL)return"FATAL";if(level===OFF)return"OFF";return"unknown"}getLevel(label){validateString(label);if(label==="ALL")return ALL;if(label==="TRACE")return TRACE;if(label==="DEBUG")return DEBUG;if(label==="INFO")return INFO;if(label==="WARN")return WARN;if(label==="ERROR")return ERROR;if(label==="FATAL")return FATAL;if(label==="OFF")return OFF;return 0}}Monster.assignToNamespace("Monster.Logging",Logger);export{Monster,Logger,ALL,TRACE,DEBUG,INFO,WARN,ERROR,FATAL,OFF};function triggerLog(loglevel,...args){var logger=this;for(let handler of logger.handler){handler.log(new LogEntry(loglevel,args))}return logger}
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';const namespace="Monster.Logging"; 'use strict';const namespace="Monster.Logging";
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';const namespace="Monster.Math"; 'use strict';const namespace="Monster.Math";
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster,getGlobal}from"../types/global.js";function random(min,max){if(min===undefined){min=0}if(max===undefined){max=MAX}if(max<min){throw new Error("max must be greater than min")}return Math.round(create(min,max))}var MAX=1000000000;Math.log2=Math.log2||function(n){return Math.log(n)/Math.log(2)};function create(min,max){let crypt;let globalReference=getGlobal();crypt=globalReference?.["crypto"]||globalReference?.["msCrypto"]||globalReference?.["crypto"]||undefined;if(typeof crypt==="undefined"){throw new Error("missing crypt")}let rval=0;const range=max-min;if(range<2){return min}const bitsNeeded=Math.ceil(Math.log2(range));if(bitsNeeded>53){throw new Error("we cannot generate numbers larger than 53 bits.")}const bytesNeeded=Math.ceil(bitsNeeded/8);const mask=Math.pow(2,bitsNeeded)-1;const byteArray=new Uint8Array(bytesNeeded);crypt.getRandomValues(byteArray);let p=(bytesNeeded-1)*8;for(var i=0;i<bytesNeeded;i++){rval+=byteArray[i]*Math.pow(2,p);p-=8}rval=rval&mask;if(rval>=range){return create(min,max)}return min+rval}Monster.assignToNamespace("Monster.Math",random);export{Monster,random}; 'use strict';import{Monster,getGlobal}from"../types/global.js";function random(min,max){if(min===undefined){min=0}if(max===undefined){max=MAX}if(max<min){throw new Error("max must be greater than min")}return Math.round(create(min,max))}var MAX=1000000000;Math.log2=Math.log2||function(n){return Math.log(n)/Math.log(2)};function create(min,max){let crypt;let globalReference=getGlobal();crypt=globalReference?.["crypto"]||globalReference?.["msCrypto"]||globalReference?.["crypto"]||undefined;if(typeof crypt==="undefined"){throw new Error("missing crypt")}let rval=0;const range=max-min;if(range<2){return min}const bitsNeeded=Math.ceil(Math.log2(range));if(bitsNeeded>53){throw new Error("we cannot generate numbers larger than 53 bits.")}const bytesNeeded=Math.ceil(bitsNeeded/8);const mask=Math.pow(2,bitsNeeded)-1;const byteArray=new Uint8Array(bytesNeeded);crypt.getRandomValues(byteArray);let p=(bytesNeeded-1)*8;for(var i=0;i<bytesNeeded;i++){rval+=byteArray[i]*Math.pow(2,p);p-=8}rval=rval&mask;if(rval>=range){return create(min,max)}return min+rval}Monster.assignToNamespace("Monster.Math",random);export{Monster,random};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster}from"./namespace.js";import"./types/base.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/uniquequeue.js";import"./types/validate.js";import"./types/version.js";import"./math/random.js";import"./data/diff.js";import"./data/pathfinder.js";import"./data/pipe.js";import"./data/transformer.js";import"./logging/handler.js";import"./logging/logentry.js";import"./logging/logger.js";import"./logging/handler/console.js";import"./util/clone.js";import"./util/comparator.js";import"./util/freeze.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"./dom/util.js";import"./dom/template.js";import"./dom/handle.js";import"./dom/assembler.js";Monster.Util.deepFreeze(Monster);export{Monster};let rootName;try{rootName=Monster.Types.getGlobalObject("__MonsterRootName__")}catch(e){}if(!rootName)rootName="Monster";Monster.Types.getGlobal()[rootName]=Monster; 'use strict';import{Monster}from"./namespace.js";import"./types/base.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/uniquequeue.js";import"./types/validate.js";import"./types/version.js";import"./math/random.js";import"./data/diff.js";import"./data/pathfinder.js";import"./data/pipe.js";import"./data/transformer.js";import"./logging/handler.js";import"./logging/logentry.js";import"./logging/logger.js";import"./logging/handler/console.js";import"./util/clone.js";import"./util/comparator.js";import"./util/freeze.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"./dom/util.js";import"./dom/template.js";import"./dom/handle.js";import"./dom/assembler.js";import"./dom/customelement.js";Monster.Util.deepFreeze(Monster);export{Monster};let rootName;try{rootName=Monster.Types.getGlobalObject("__MonsterRootName__")}catch(e){}if(!rootName)rootName="Monster";Monster.Types.getGlobal()[rootName]=Monster;
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';class Namespace{constructor(namespace){if(namespace===undefined||typeof namespace!=="string"){throw new Error("namespace is not a string")}this.namespace=namespace}getNamespace(){return this.namespace}toString(){return this.getNamespace()}}export const Monster=new Namespace("Monster");assignToNamespace("Monster",assignToNamespace);function assignToNamespace(ns,...obj){let current=namespaceFor(ns.split("."));for(let i=0,l=obj.length;i<l;i++){current[objectName(obj[i])]=obj[i]}}function objectName(fn){try{if(typeof fn!=="function"){throw new Error("the first argument is not a function or class.")}if(fn.hasOwnProperty("name")){return fn.name}if("function"===typeof fn.toString){let s=fn.toString();let f=s.match(/^\s*function\s+([^\s(]+)/);if(Array.isArray(f)&&typeof f[1]==="string"){return f[1]}let c=s.match(/^\s*class\s+([^\s(]+)/);if(Array.isArray(c)&&typeof c[1]==="string"){return c[1]}}}catch(e){throw new Error("exception "+e)}throw new Error("the name of the class or function cannot be resolved.")}function namespaceFor(parts){var space=Monster,ns="Monster";for(let i=0;i<parts.length;i++){if("Monster"===parts[i]){continue}ns+="."+parts[i];if(!space.hasOwnProperty(parts[i])){space[parts[i]]=new Namespace(ns)}space=space[parts[i]]}return space}export{assignToNamespace}; 'use strict';class Namespace{constructor(namespace){if(namespace===undefined||typeof namespace!=="string"){throw new Error("namespace is not a string")}this.namespace=namespace}getNamespace(){return this.namespace}toString(){return this.getNamespace()}}export const Monster=new Namespace("Monster");assignToNamespace("Monster",assignToNamespace);function assignToNamespace(ns,...obj){let current=namespaceFor(ns.split("."));for(let i=0,l=obj.length;i<l;i++){current[objectName(obj[i])]=obj[i]}}function objectName(fn){try{if(typeof fn!=="function"){throw new Error("the first argument is not a function or class.")}if(fn.hasOwnProperty("name")){return fn.name}if("function"===typeof fn.toString){let s=fn.toString();let f=s.match(/^\s*function\s+([^\s(]+)/);if(Array.isArray(f)&&typeof f[1]==="string"){return f[1]}let c=s.match(/^\s*class\s+([^\s(]+)/);if(Array.isArray(c)&&typeof c[1]==="string"){return c[1]}}}catch(e){throw new Error("exception "+e)}throw new Error("the name of the class or function cannot be resolved.")}function namespaceFor(parts){var space=Monster,ns="Monster";for(let i=0;i<parts.length;i++){if("Monster"===parts[i]){continue}ns+="."+parts[i];if(!space.hasOwnProperty(parts[i])){space[parts[i]]=new Namespace(ns)}space=space[parts[i]]}return space}export{assignToNamespace};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster}from"../namespace.js";class Base extends Object{toString(){return JSON.stringify(this)}}Monster.assignToNamespace("Monster.Types",Base);export{Monster,Base}; 'use strict';import{Monster}from"../namespace.js";class Base extends Object{toString(){return JSON.stringify(this)}}Monster.assignToNamespace("Monster.Types",Base);export{Monster,Base};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster}from"../namespace.js";import{validateFunction,validateString,validateObject}from"./validate.js";var globalReference;(function(){if(typeof globalThis==="object"){globalReference=globalThis;return}Object.defineProperty(Object.prototype,"__monster__",{get:function(){return this},configurable:true});__monster__.globalThis=__monster__;delete Object.prototype.__monster__;globalReference=globalThis})();function getGlobal(){return globalReference}function getGlobalObject(name){validateString(name);let o=globalReference?.[name];if(typeof o==="undefined")throw new Error("the object "+name+" is not defined");validateObject(o);return o}function getGlobalFunction(name){validateString(name);let f=globalReference?.[name];if(typeof f==="undefined")throw new Error("the function "+name+" is not defined");validateFunction(f);return f}Monster.assignToNamespace("Monster.Types",getGlobal,getGlobalObject,getGlobalFunction);export{Monster,getGlobal,getGlobalObject,getGlobalFunction}; 'use strict';import{Monster}from"../namespace.js";import{validateFunction,validateString,validateObject}from"./validate.js";var globalReference;(function(){if(typeof globalThis==="object"){globalReference=globalThis;return}Object.defineProperty(Object.prototype,"__monster__",{get:function(){return this},configurable:true});__monster__.globalThis=__monster__;delete Object.prototype.__monster__;globalReference=globalThis})();function getGlobal(){return globalReference}function getGlobalObject(name){validateString(name);let o=globalReference?.[name];if(typeof o==="undefined")throw new Error("the object "+name+" is not defined");validateObject(o);return o}function getGlobalFunction(name){validateString(name);let f=globalReference?.[name];if(typeof f==="undefined")throw new Error("the function "+name+" is not defined");validateFunction(f);return f}Monster.assignToNamespace("Monster.Types",getGlobal,getGlobalObject,getGlobalFunction);export{Monster,getGlobal,getGlobalObject,getGlobalFunction};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster,Base}from"./base.js";import{validateString}from"./validate.js";let internalCounter=new Map;class ID extends Base{constructor(prefix){super();if(prefix===undefined){prefix="id"}validateString(prefix);if(!internalCounter.has(prefix)){internalCounter.set(prefix,1)}let count=internalCounter.get(prefix);this.id=prefix+count;internalCounter.set(prefix,++count)}toString(){return this.id}}Monster.assignToNamespace("Monster.Types",ID);export{Monster,ID}; 'use strict';import{Monster,Base}from"./base.js";import{validateString}from"./validate.js";let internalCounter=new Map;class ID extends Base{constructor(prefix){super();if(prefix===undefined){prefix="id"}validateString(prefix);if(!internalCounter.has(prefix)){internalCounter.set(prefix,1)}let count=internalCounter.get(prefix);this.id=prefix+count;internalCounter.set(prefix,++count)}toString(){return this.id}}Monster.assignToNamespace("Monster.Types",ID);export{Monster,ID};
/** Monster 1.6.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */ /** Monster 1.7.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
'use strict';import{Monster}from"../namespace.js";function isIterable(value){if(value===undefined)return false;if(value===null)return false;return typeof value?.[Symbol.iterator]==="function"}function isPrimitive(value){var type;if(value===undefined||value===null||value===NaN){return true}type=typeof value;if(type==="string"||type==="number"||type==="boolean"||type==="symbol"){return true}return false}function isBoolean(value){if(value===true||value===false){return true}return false}function isString(value){if(value===undefined||typeof value!=="string"){return false}return true}function isObject(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(typeof value==="object"){return true}return false}function isInstance(value,instance){if(!isObject(value))return false;if(!isFunction(instance))return false;if(!instance.hasOwnProperty("prototype"))return false;return value instanceof instance?true:false}function isArray(value){if(Array.isArray(value)){return true}return false}function isFunction(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(typeof value==="function"){return true}return false}function isInteger(value){return Number.isInteger(value)}Monster.assignToNamespace("Monster.Types",isPrimitive,isBoolean,isString,isObject,isArray,isFunction,isIterable,isInteger);export{Monster,isPrimitive,isBoolean,isString,isObject,isInstance,isArray,isFunction,isIterable,isInteger}; 'use strict';import{Monster}from"../namespace.js";function isIterable(value){if(value===undefined)return false;if(value===null)return false;return typeof value?.[Symbol.iterator]==="function"}function isPrimitive(value){var type;if(value===undefined||value===null||value===NaN){return true}type=typeof value;if(type==="string"||type==="number"||type==="boolean"||type==="symbol"){return true}return false}function isBoolean(value){if(value===true||value===false){return true}return false}function isString(value){if(value===undefined||typeof value!=="string"){return false}return true}function isObject(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(typeof value==="object"){return true}return false}function isInstance(value,instance){if(!isObject(value))return false;if(!isFunction(instance))return false;if(!instance.hasOwnProperty("prototype"))return false;return value instanceof instance?true:false}function isArray(value){if(Array.isArray(value)){return true}return false}function isFunction(value){if(isArray(value))return false;if(isPrimitive(value))return false;if(typeof value==="function"){return true}return false}function isInteger(value){return Number.isInteger(value)}Monster.assignToNamespace("Monster.Types",isPrimitive,isBoolean,isString,isObject,isArray,isFunction,isIterable,isInteger);export{Monster,isPrimitive,isBoolean,isString,isObject,isInstance,isArray,isFunction,isIterable,isInteger};
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment