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

Release 1.20.0

parent ffae3931
No related branches found
No related tags found
No related merge requests found
Showing
with 20 additions and 20 deletions
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{getGlobalFunction}from"../types/global.js";import{TokenList}from"../types/tokenlist.js";import{validateInstance,validateString,validateSymbol}from"../types/validate.js";import{ATTRIBUTE_OBJECTLINK}from"./constants.js";function findClosestObjectLink(t){return findClosestByAttribute(t,ATTRIBUTE_OBJECTLINK)}function addToObjectLink(t,e,n){return validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e]&&(t[e]=new Set),addAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString()),t[e].add(n),t}function removeObjectLink(t,e){return validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e]||(removeAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString()),delete t[e]),t}function hasObjectLink(t,e){return validateInstance(t,HTMLElement),validateSymbol(e),void 0!==t?.[e]&&containsAttributeToken(t,ATTRIBUTE_OBJECTLINK,e.toString())}function getLinkedObjects(t,e){if(validateInstance(t,HTMLElement),validateSymbol(e),void 0===t?.[e])throw new Error("there is no object link for "+e.toString());return t?.[e][Symbol.iterator]()}function toggleAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)?t.setAttribute(e,new TokenList(t.getAttribute(e)).toggle(n).toString()):t.setAttribute(e,n),t}function addAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)?t.setAttribute(e,new TokenList(t.getAttribute(e)).add(n).toString()):t.setAttribute(e,n),t}function removeAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,new TokenList(t.getAttribute(e)).remove(n).toString()),t}function containsAttributeToken(t,e,n){return validateInstance(t,HTMLElement),validateString(n),validateString(e),!!t.hasAttribute(e)&&new TokenList(t.getAttribute(e)).contains(n)}function replaceAttributeToken(t,e,n,i){return validateInstance(t,HTMLElement),validateString(n),validateString(i),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,new TokenList(t.getAttribute(e)).replace(n,i).toString()),t}function clearAttributeTokens(t,e){return validateInstance(t,HTMLElement),validateString(e),t.hasAttribute(e)&&t.setAttribute(e,""),t}function findClosestByAttribute(t,e,n){if(validateInstance(t,getGlobalFunction("HTMLElement")),t.hasAttribute(e)&&t.getAttribute(e)===n)return t;let i=validateString(e);void 0!==n&&(i+="="+validateString(n));t=t.closest("["+i+"]");return t instanceof HTMLElement?t:void 0}assignToNamespace("Monster.DOM",getLinkedObjects,addToObjectLink,removeObjectLink,findClosestByAttribute,hasObjectLink,clearAttributeTokens,replaceAttributeToken,containsAttributeToken,removeAttributeToken,addAttributeToken,toggleAttributeToken);export{Monster,addToObjectLink,removeObjectLink,hasObjectLink,findClosestByAttribute,clearAttributeTokens,replaceAttributeToken,containsAttributeToken,removeAttributeToken,addAttributeToken,toggleAttributeToken,getLinkedObjects,findClosestObjectLink};
\ No newline at end of file
'use strict';import{assignToNamespace,Monster}from"../namespace.js";import{getGlobalFunction}from"../types/global.js";import{TokenList}from"../types/tokenlist.js";import{validateInstance,validateString,validateSymbol}from"../types/validate.js";import{ATTRIBUTE_OBJECTLINK}from"./constants.js";function findClosestObjectLink(element){return findClosestByAttribute(element,ATTRIBUTE_OBJECTLINK)}function addToObjectLink(element,symbol,object){validateInstance(element,HTMLElement);validateSymbol(symbol);if(element?.[symbol]===undefined){element[symbol]=new Set}addAttributeToken(element,ATTRIBUTE_OBJECTLINK,symbol.toString());element[symbol].add(object);return element}function removeObjectLink(element,symbol){validateInstance(element,HTMLElement);validateSymbol(symbol);if(element?.[symbol]===undefined){return element}removeAttributeToken(element,ATTRIBUTE_OBJECTLINK,symbol.toString());delete element[symbol];return element}function hasObjectLink(element,symbol){validateInstance(element,HTMLElement);validateSymbol(symbol);if(element?.[symbol]===undefined){return false}return containsAttributeToken(element,ATTRIBUTE_OBJECTLINK,symbol.toString())}function getLinkedObjects(element,symbol){validateInstance(element,HTMLElement);validateSymbol(symbol);if(element?.[symbol]===undefined){throw new Error("there is no object link for "+symbol.toString())}return element?.[symbol][Symbol.iterator]()}function toggleAttributeToken(element,key,token){validateInstance(element,HTMLElement);validateString(token);validateString(key);if(!element.hasAttribute(key)){element.setAttribute(key,token);return element}element.setAttribute(key,new TokenList(element.getAttribute(key)).toggle(token).toString());return element}function addAttributeToken(element,key,token){validateInstance(element,HTMLElement);validateString(token);validateString(key);if(!element.hasAttribute(key)){element.setAttribute(key,token);return element}element.setAttribute(key,new TokenList(element.getAttribute(key)).add(token).toString());return element}function removeAttributeToken(element,key,token){validateInstance(element,HTMLElement);validateString(token);validateString(key);if(!element.hasAttribute(key)){return element}element.setAttribute(key,new TokenList(element.getAttribute(key)).remove(token).toString());return element}function containsAttributeToken(element,key,token){validateInstance(element,HTMLElement);validateString(token);validateString(key);if(!element.hasAttribute(key)){return false}return new TokenList(element.getAttribute(key)).contains(token)}function replaceAttributeToken(element,key,from,to){validateInstance(element,HTMLElement);validateString(from);validateString(to);validateString(key);if(!element.hasAttribute(key)){return element}element.setAttribute(key,new TokenList(element.getAttribute(key)).replace(from,to).toString());return element}function clearAttributeTokens(element,key){validateInstance(element,HTMLElement);validateString(key);if(!element.hasAttribute(key)){return element}element.setAttribute(key,"");return element}function findClosestByAttribute(element,key,value){validateInstance(element,getGlobalFunction("HTMLElement"));if(element.hasAttribute(key)&&element.getAttribute(key)===value){return element}let selector=validateString(key);if(value!==undefined)selector+="="+validateString(value);let result=element.closest("["+selector+"]");if(result instanceof HTMLElement){return result}return undefined}assignToNamespace("Monster.DOM",getLinkedObjects,addToObjectLink,removeObjectLink,findClosestByAttribute,hasObjectLink,clearAttributeTokens,replaceAttributeToken,containsAttributeToken,removeAttributeToken,addAttributeToken,toggleAttributeToken);export{Monster,addToObjectLink,removeObjectLink,hasObjectLink,findClosestByAttribute,clearAttributeTokens,replaceAttributeToken,containsAttributeToken,removeAttributeToken,addAttributeToken,toggleAttributeToken,getLinkedObjects,findClosestObjectLink};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{Monster}from"../namespace.js";const ATTRIBUTE_PREFIX="data-monster-",ATTRIBUTE_OPTIONS=ATTRIBUTE_PREFIX+"options",DEFAULT_THEME="monster",ATTRIBUTE_THEME_PREFIX=ATTRIBUTE_PREFIX+"theme-",ATTRIBUTE_THEME_NAME=ATTRIBUTE_THEME_PREFIX+"name",ATTRIBUTE_UPDATER_ATTRIBUTES=ATTRIBUTE_PREFIX+"attributes",ATTRIBUTE_UPDATER_REPLACE=ATTRIBUTE_PREFIX+"replace",ATTRIBUTE_UPDATER_INSERT=ATTRIBUTE_PREFIX+"insert",ATTRIBUTE_UPDATER_INSERT_REFERENCE=ATTRIBUTE_PREFIX+"insert-reference",ATTRIBUTE_UPDATER_REMOVE=ATTRIBUTE_PREFIX+"remove",ATTRIBUTE_UPDATER_BIND=ATTRIBUTE_PREFIX+"bind",ATTRIBUTE_ROLE=ATTRIBUTE_PREFIX+"role",ATTRIBUTE_OBJECTLINK=ATTRIBUTE_PREFIX+"objectlink",OBJECTLINK_KEY_UPDATER="monsterUpdater";export{Monster,ATTRIBUTE_PREFIX,ATTRIBUTE_OPTIONS,DEFAULT_THEME,ATTRIBUTE_THEME_PREFIX,ATTRIBUTE_ROLE,ATTRIBUTE_THEME_NAME,ATTRIBUTE_UPDATER_ATTRIBUTES,ATTRIBUTE_UPDATER_REPLACE,ATTRIBUTE_UPDATER_INSERT,ATTRIBUTE_UPDATER_INSERT_REFERENCE,ATTRIBUTE_UPDATER_REMOVE,ATTRIBUTE_UPDATER_BIND,ATTRIBUTE_OBJECTLINK,OBJECTLINK_KEY_UPDATER};
\ No newline at end of file
'use strict';import{Monster}from"../namespace.js";const ATTRIBUTE_PREFIX="data-monster-";const ATTRIBUTE_OPTIONS=ATTRIBUTE_PREFIX+"options";const DEFAULT_THEME="monster";const ATTRIBUTE_THEME_PREFIX=ATTRIBUTE_PREFIX+"theme-";const ATTRIBUTE_THEME_NAME=ATTRIBUTE_THEME_PREFIX+"name";const ATTRIBUTE_UPDATER_ATTRIBUTES=ATTRIBUTE_PREFIX+"attributes";const ATTRIBUTE_UPDATER_REPLACE=ATTRIBUTE_PREFIX+"replace";const ATTRIBUTE_UPDATER_INSERT=ATTRIBUTE_PREFIX+"insert";const ATTRIBUTE_UPDATER_INSERT_REFERENCE=ATTRIBUTE_PREFIX+"insert-reference";const ATTRIBUTE_UPDATER_REMOVE=ATTRIBUTE_PREFIX+"remove";const ATTRIBUTE_UPDATER_BIND=ATTRIBUTE_PREFIX+"bind";const ATTRIBUTE_ROLE=ATTRIBUTE_PREFIX+"role";const ATTRIBUTE_OBJECTLINK=ATTRIBUTE_PREFIX+"objectlink";const OBJECTLINK_KEY_UPDATER="monsterUpdater";export{Monster,ATTRIBUTE_PREFIX,ATTRIBUTE_OPTIONS,DEFAULT_THEME,ATTRIBUTE_THEME_PREFIX,ATTRIBUTE_ROLE,ATTRIBUTE_THEME_NAME,ATTRIBUTE_UPDATER_ATTRIBUTES,ATTRIBUTE_UPDATER_REPLACE,ATTRIBUTE_UPDATER_INSERT,ATTRIBUTE_UPDATER_INSERT_REFERENCE,ATTRIBUTE_UPDATER_REMOVE,ATTRIBUTE_UPDATER_BIND,ATTRIBUTE_OBJECTLINK,OBJECTLINK_KEY_UPDATER};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{extend}from"../data/extend.js";import{assignToNamespace,Monster}from"../namespace.js";import{CustomElement}from"./customelement.js";const internalSymbol=Symbol("internalSymbol");class CustomControl extends CustomElement{constructor(){super(),"function"==typeof this.attachInternals&&(this[internalSymbol]=this.attachInternals())}static get formAssociated(){return!0}get defaults(){return extend({},super.defaults)}get value(){throw Error("the value getter must be overwritten by the derived class")}set value(t){throw Error("the value setter must be overwritten by the derived class")}get labels(){return getInternal.call(this)?.labels}get name(){return this.getAttribute("name")}get type(){return this.constructor.getTag()}get validity(){return getInternal.call(this)?.validity}get validationMessage(){return getInternal.call(this)?.validationMessage}get willValidate(){return getInternal.call(this)?.willValidate}get states(){return getInternal.call(this)?.states}get form(){return getInternal.call(this)?.form}setFormValue(t,e){getInternal.call(this).setFormValue(t,e)}setValidity(t,e,r){getInternal.call(this).setValidity(t,e,r)}checkValidity(){return getInternal.call(this)?.checkValidity()}reportValidity(){return getInternal.call(this)?.reportValidity()}}function getInternal(){if(!(internalSymbol in this))throw new Error("ElementInternals is not supported and a polyfill is necessary");return this[internalSymbol]}assignToNamespace("Monster.DOM",CustomControl);export{Monster,CustomControl};
\ No newline at end of file
'use strict';import{extend}from"../data/extend.js";import{assignToNamespace,Monster}from"../namespace.js";import{CustomElement}from"./customelement.js";const internalSymbol=Symbol("internalSymbol");class CustomControl extends CustomElement{constructor(){super();if(typeof this["attachInternals"]==="function"){this[internalSymbol]=this.attachInternals()}}static get formAssociated(){return true}get defaults(){return extend({},super.defaults)}get value(){throw Error("the value getter must be overwritten by the derived class")}set value(value){throw Error("the value setter must be overwritten by the derived class")}get labels(){return getInternal.call(this)?.labels}get name(){return this.getAttribute("name")}get type(){return this.constructor.getTag()}get validity(){return getInternal.call(this)?.validity}get validationMessage(){return getInternal.call(this)?.validationMessage}get willValidate(){return getInternal.call(this)?.willValidate}get states(){return getInternal.call(this)?.states}get form(){return getInternal.call(this)?.form}setFormValue(value,state){getInternal.call(this).setFormValue(value,state)}setValidity(flags,message,anchor){getInternal.call(this).setValidity(flags,message,anchor)}checkValidity(){return getInternal.call(this)?.checkValidity()}reportValidity(){return getInternal.call(this)?.reportValidity()}}function getInternal(){const self=this;if(!(internalSymbol in this)){throw new Error("ElementInternals is not supported and a polyfill is necessary")}return this[internalSymbol]}assignToNamespace("Monster.DOM",CustomControl);export{Monster,CustomControl};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"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{parseDataURL}from"../types/dataurl.js";import{getGlobalObject}from"../types/global.js";import{isArray,isString}from"../types/is.js";import{Observer}from"../types/observer.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateFunction,validateInstance,validateObject}from"../types/validate.js";import{clone}from"../util/clone.js";import{addToObjectLink,getLinkedObjects,hasObjectLink}from"./attributes.js";import{ATTRIBUTE_OPTIONS,OBJECTLINK_KEY_UPDATER}from"./constants.js";import{findDocumentTemplate,Template}from"./template.js";import{Updater}from"./updater.js";const internalDataSymbol=Symbol.for(PROPERTY_KEY_INTERNALDATA),objectLinkSymbol=Symbol.for(OBJECTLINK_KEY_UPDATER),initMethodSymbol=Symbol("initMethodSymbol"),assembleMethodSymbol=Symbol("assembleMethodSymbol");class CustomElement extends HTMLElement{constructor(){super(),this[internalDataSymbol]=new ProxyObserver({options:extend({},this.defaults,getOptionsFromAttributes.call(this))}),initOptionObserver.call(this),this[initMethodSymbol]()}static get observedAttributes(){return[ATTRIBUTE_OPTIONS]}get defaults(){return{shadowMode:"open",delegatesFocus:!0,templates:{main:void 0}}}static getTag(){throw new Error("the method getTag must be overwritten by the derived class.")}static getCSSStyleSheet(){}attachObserver(t){return this[internalDataSymbol].attachObserver(t),this}detachObserver(t){return this[internalDataSymbol].detachObserver(t),this}containsObserver(t){return this[internalDataSymbol].containsObserver(t)}getOption(t,e){let o;try{o=new Pathfinder(this[internalDataSymbol].getRealSubject().options).getVia(t)}catch(t){}return void 0===o?e:o}setOption(t,e){return new Pathfinder(this[internalDataSymbol].getSubject().options).setVia(t,e),this}setOptions(t){isString(t)&&(t=parseOptionsJSON(t));var e=this;return extend(e[internalDataSymbol].getSubject().options,e.defaults,t),e}[initMethodSymbol](){return this}[assembleMethodSymbol](){var t;let e;if(!1!==this.getOption("shadowMode",!1)){try{initShadowRoot.call(this),e=this.shadowRoot.childNodes}catch(t){}try{initCSSStylesheet.call(this)}catch(t){}}e instanceof NodeList||(initHtmlContent.call(this),e=this.childNodes);const o=new Set;addToObjectLink(this,objectLinkSymbol,o);for([,t]of Object.entries(e))if(t instanceof HTMLElement&&!(t instanceof HTMLTemplateElement)){const i=new Updater(t,clone(this[internalDataSymbol].getRealSubject().options));o.add(i),i.run().then(()=>{i.enableEventProcessing()})}return this}connectedCallback(){hasObjectLink(this,objectLinkSymbol)||this[assembleMethodSymbol]()}disconnectedCallback(){}adoptedCallback(){}attributeChangedCallback(t,e,o){t===ATTRIBUTE_OPTIONS&&this.setOptions(o)}hasNode(t){var e=this;return!!containChildNode.call(e,validateInstance(t,Node))||e.shadowRoot instanceof ShadowRoot&&containChildNode.call(e.shadowRoot,t)}}function containChildNode(t){var e;if(this.contains(t))return!0;for([,e]of Object.entries(this.childNodes)){if(e.contains(t))return!0;containChildNode.call(e,t)}return!1}function initOptionObserver(){const i=this;i.attachObserver(new Observer(function(){if(hasObjectLink(i,Symbol.for(OBJECTLINK_KEY_UPDATER)))for(const e of getLinkedObjects(i,Symbol.for(OBJECTLINK_KEY_UPDATER)))for(const o of e){var t=clone(i[internalDataSymbol].getRealSubject().options);Object.assign(o.getSubject(),t)}}))}function getOptionsFromAttributes(){if(this.hasAttribute(ATTRIBUTE_OPTIONS))try{return parseOptionsJSON(this.getAttribute(ATTRIBUTE_OPTIONS))}catch(t){throw new Error("the options attribute "+ATTRIBUTE_OPTIONS+" does not contain a valid json definition (actual: "+this.getAttribute(ATTRIBUTE_OPTIONS)+").")}return{}}function parseOptionsJSON(e){if(isString(e)){try{e=parseDataURL(e).content}catch(t){}try{var t=JSON.parse(e);return validateObject(t),t}catch(t){throw new Error("the options does not contain a valid json definition (actual: "+e+").")}}return{}}function initHtmlContent(){try{let t=findDocumentTemplate(this.constructor.getTag());this.appendChild(t.createDocumentFragment())}catch(t){var e=this.getOption("templates.main","");isString(e)&&0<e.length&&(this.innerHTML=e)}return this}function initCSSStylesheet(){var t=this;if(!(this.shadowRoot instanceof ShadowRoot))return t;var e=this.constructor.getCSSStyleSheet();if(e instanceof CSSStyleSheet)this.shadowRoot.adoptedStyleSheets=[e];else if(isArray(e))this.shadowRoot.adoptedStyleSheets=e;else if(isString(e)){const o=t.shadowRoot.createElement("<style>");o.innerText=e,this.shadowRoot.adoptedStyleSheets=e}return t}function initShadowRoot(){let t,e;try{t=findDocumentTemplate(this.constructor.getTag())}catch(t){if(e=this.getOption("templates.main",""),!isString(e)||void 0===e||""===e)throw new Error("html is not set.")}return this.attachShadow({mode:this.getOption("shadowMode","open"),delegatesFocus:this.getOption("delegatesFocus",!0)}),t instanceof Template?this.shadowRoot.appendChild(t.createDocumentFragment()):this.shadowRoot.innerHTML=e,this}function registerCustomElement(t){validateFunction(t),getGlobalObject("customElements").define(t.getTag(),t)}assignToNamespace("Monster.DOM",CustomElement,registerCustomElement);export{Monster,registerCustomElement,CustomElement,initMethodSymbol,assembleMethodSymbol};
\ No newline at end of file
'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{parseDataURL}from"../types/dataurl.js";import{getGlobalObject}from"../types/global.js";import{isArray,isString}from"../types/is.js";import{Observer}from"../types/observer.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateFunction,validateInstance,validateObject}from"../types/validate.js";import{clone}from"../util/clone.js";import{addToObjectLink,getLinkedObjects,hasObjectLink}from"./attributes.js";import{ATTRIBUTE_OPTIONS,OBJECTLINK_KEY_UPDATER}from"./constants.js";import{findDocumentTemplate,Template}from"./template.js";import{Updater}from"./updater.js";const internalDataSymbol=Symbol.for(PROPERTY_KEY_INTERNALDATA);const objectLinkSymbol=Symbol.for(OBJECTLINK_KEY_UPDATER);const initMethodSymbol=Symbol("initMethodSymbol");const assembleMethodSymbol=Symbol("assembleMethodSymbol");class CustomElement extends HTMLElement{constructor(){super();this[internalDataSymbol]=new ProxyObserver({"options":extend({},this.defaults,getOptionsFromAttributes.call(this))});initOptionObserver.call(this);this[initMethodSymbol]()}static get observedAttributes(){return[ATTRIBUTE_OPTIONS]}get defaults(){return{shadowMode:"open",delegatesFocus:true,templates:{main:undefined}}}static getTag(){throw new Error("the method getTag must be overwritten by the derived class.")}static getCSSStyleSheet(){return undefined}attachObserver(observer){this[internalDataSymbol].attachObserver(observer);return this}detachObserver(observer){this[internalDataSymbol].detachObserver(observer);return this}containsObserver(observer){return this[internalDataSymbol].containsObserver(observer)}getOption(path,defaultValue){let value;try{value=new Pathfinder(this[internalDataSymbol].getRealSubject()["options"]).getVia(path)}catch(e){}if(value===undefined)return defaultValue;return value}setOption(path,value){new Pathfinder(this[internalDataSymbol].getSubject()["options"]).setVia(path,value);return this}setOptions(options){if(isString(options)){options=parseOptionsJSON(options)}const self=this;extend(self[internalDataSymbol].getSubject()["options"],self.defaults,options);return self}[initMethodSymbol](){return this}[assembleMethodSymbol](){const self=this;let elements;if(this.getOption("shadowMode",false)!==false){try{initShadowRoot.call(this);elements=this.shadowRoot.childNodes}catch(e){}try{initCSSStylesheet.call(this)}catch(e){}}if(!(elements instanceof NodeList)){initHtmlContent.call(this);elements=this.childNodes}const updater=new Set;addToObjectLink(this,objectLinkSymbol,updater);for(const[,element]of Object.entries(elements)){if(!(element instanceof HTMLElement))continue;if(element instanceof HTMLTemplateElement)continue;const u=new Updater(element,clone(self[internalDataSymbol].getRealSubject()["options"]));updater.add(u);u.run().then(()=>{u.enableEventProcessing()})}return this}connectedCallback(){let self=this;if(!hasObjectLink(self,objectLinkSymbol)){self[assembleMethodSymbol]()}}disconnectedCallback(){}adoptedCallback(){}attributeChangedCallback(attrName,oldVal,newVal){const self=this;if(attrName===ATTRIBUTE_OPTIONS){self.setOptions(newVal)}}hasNode(node){const self=this;if(containChildNode.call(self,validateInstance(node,Node))){return true}if(!(self.shadowRoot instanceof ShadowRoot)){return false}return containChildNode.call(self.shadowRoot,node)}}function containChildNode(node){const self=this;if(self.contains(node)){return true}for(const[,e]of Object.entries(self.childNodes)){if(e.contains(node)){return true}containChildNode.call(e,node)}return false}function initOptionObserver(){const self=this;self.attachObserver(new Observer(function(){if(!hasObjectLink(self,Symbol.for(OBJECTLINK_KEY_UPDATER))){return}const updaters=getLinkedObjects(self,Symbol.for(OBJECTLINK_KEY_UPDATER));for(const list of updaters){for(const updater of list){let d=clone(self[internalDataSymbol].getRealSubject()["options"]);Object.assign(updater.getSubject(),d)}}}))}function getOptionsFromAttributes(){if(this.hasAttribute(ATTRIBUTE_OPTIONS)){try{return parseOptionsJSON(this.getAttribute(ATTRIBUTE_OPTIONS))}catch(e){throw new Error("the options attribute "+ATTRIBUTE_OPTIONS+" does not contain a valid json definition (actual: "+this.getAttribute(ATTRIBUTE_OPTIONS)+").")}}return{}}function parseOptionsJSON(data){if(isString(data)){try{let dataUrl=parseDataURL(data);data=dataUrl.content}catch(e){}try{let obj=JSON.parse(data);validateObject(obj);return obj}catch(e){throw new Error("the options does not contain a valid json definition (actual: "+data+").")}}return{}}function initHtmlContent(){try{let template=findDocumentTemplate(this.constructor.getTag());this.appendChild(template.createDocumentFragment())}catch(e){let html=this.getOption("templates.main","");if(isString(html)&&html.length>0){this.innerHTML=html}}return this}function initCSSStylesheet(){const self=this;if(!(this.shadowRoot instanceof ShadowRoot)){return self}const styleSheet=this.constructor.getCSSStyleSheet();if(styleSheet instanceof CSSStyleSheet){this.shadowRoot.adoptedStyleSheets=[styleSheet]}else if(isArray(styleSheet)){this.shadowRoot.adoptedStyleSheets=styleSheet}else if(isString(styleSheet)){const style=self.shadowRoot.createElement("<style>");style.innerText=styleSheet;this.shadowRoot.adoptedStyleSheets=styleSheet}return self}function initShadowRoot(){let template,html;try{template=findDocumentTemplate(this.constructor.getTag())}catch(e){html=this.getOption("templates.main","");if(!isString(html)||html===undefined||html===""){throw new Error("html is not set.")}}this.attachShadow({mode:this.getOption("shadowMode","open"),delegatesFocus:this.getOption("delegatesFocus",true)});if(template instanceof Template){this.shadowRoot.appendChild(template.createDocumentFragment());return this}this.shadowRoot.innerHTML=html;return this}function registerCustomElement(element){validateFunction(element);getGlobalObject("customElements").define(element.getTag(),element)}assignToNamespace("Monster.DOM",CustomElement,registerCustomElement);export{Monster,registerCustomElement,CustomElement,initMethodSymbol,assembleMethodSymbol};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{validateInstance,validateString}from"../types/validate.js";import{findClosestByAttribute}from"./attributes.js";import{getDocument}from"./util.js";function fireEvent(e,t){var n;getDocument();if(e instanceof HTMLElement)"click"!==t?(n=new Event(validateString(t),{bubbles:!0,cancelable:!0}),e.dispatchEvent(n)):e.click();else{if(!(e instanceof HTMLCollection||e instanceof NodeList))throw new TypeError("value is not an instance of HTMLElement or HTMLCollection");for(var o of e)fireEvent(o,t)}}function findTargetElementFromEvent(e,t,n){if(validateInstance(e,Event),"function"!=typeof e.composedPath)throw new Error("unsupported event");e=e.composedPath()?.[0];if(e instanceof HTMLElement)return findClosestByAttribute(e,t,n)}assignToNamespace("Monster.DOM",findTargetElementFromEvent,fireEvent);export{Monster,findTargetElementFromEvent,fireEvent};
\ No newline at end of file
'use strict';import{assignToNamespace,Monster}from"../namespace.js";import{isArray}from"../types/is.js";import{validateInstance,validateString}from"../types/validate.js";import{getDocument}from"./util.js";function fireEvent(element,type){const document=getDocument();if(element instanceof HTMLElement){if(type==="click"){element.click();return}let event=new Event(validateString(type),{bubbles:true,cancelable:true});element.dispatchEvent(event)}else if(element instanceof HTMLCollection||element instanceof NodeList){for(let e of element){fireEvent(e,type)}}else{throw new TypeError("value is not an instance of HTMLElement or HTMLCollection")}}function findTargetElementFromEvent(event,attributeName,attributeValue){validateInstance(event,Event);if(typeof event.composedPath!=="function"){throw new Error("unsupported event")}const path=event.composedPath();const element=path?.[0];if(isArray(path)){for(let i=0;i<path.length;i++){const o=path[i];if(o instanceof HTMLElement&&o.hasAttribute(attributeName)&&(attributeValue===undefined||o.getAttribute(attributeName)===attributeValue)){return o}}}return undefined}assignToNamespace("Monster.DOM",findTargetElementFromEvent,fireEvent);export{Monster,findTargetElementFromEvent,fireEvent};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{parseLocale}from"../i18n/locale.js";import{assignToNamespace,Monster}from"../namespace.js";import{getDocument}from"./util.js";const DEFAULT_LANGUAGE="en";function getLocaleOfDocument(){const e=getDocument();let t=e.querySelector("html");if(t instanceof HTMLElement&&t.hasAttribute("lang")){var o=t.getAttribute("lang");if(o)return new parseLocale(o)}return parseLocale(DEFAULT_LANGUAGE)}assignToNamespace("Monster.DOM",getLocaleOfDocument);export{Monster,getLocaleOfDocument};
\ No newline at end of file
'use strict';import{parseLocale}from"../i18n/locale.js";import{assignToNamespace,Monster}from"../namespace.js";import{getDocument}from"./util.js";const DEFAULT_LANGUAGE="en";function getLocaleOfDocument(){const document=getDocument();let html=document.querySelector("html");if(html instanceof HTMLElement&&html.hasAttribute("lang")){let locale=html.getAttribute("lang");if(locale){return new parseLocale(locale)}}return parseLocale(DEFAULT_LANGUAGE)}assignToNamespace("Monster.DOM",getLocaleOfDocument);export{Monster,getLocaleOfDocument};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";const namespace="Monster.DOM";export{namespace};
\ No newline at end of file
'use strict';export const namespace="Monster.DOM";
/** Monster 1.19.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";import{getGlobalFunction,getGlobalObject}from"../types/global.js";import{validateInstance,validateString}from"../types/validate.js";import{getDocumentTheme}from"./theme.js";class Template extends Base{constructor(e){super();var t=getGlobalFunction("HTMLTemplateElement");validateInstance(e,t),this.template=e}getTemplateElement(){return this.template}createDocumentFragment(){return this.template.content.cloneNode(!0)}}function findDocumentTemplate(e,t){validateString(e),t instanceof Document||t instanceof DocumentFragment||(t instanceof Node&&((t=t.getRootNode())instanceof Document||t instanceof DocumentFragment||(t=t.ownerDocument)),t instanceof Document||t instanceof DocumentFragment||(t=getGlobalObject("document")));var n=getGlobalFunction("HTMLTemplateElement");let o=getDocumentTheme();var a=e+"-"+o.getName();let m=t.getElementById(a);if(m instanceof n)return new Template(m);if(m=t.getElementById(e),m instanceof n)return new Template(m);if(t!==getGlobalObject("document"))return findDocumentTemplate(e);throw new Error("template "+e+" not found.")}assignToNamespace("Monster.DOM",Template,findDocumentTemplate);export{Monster,Template,findDocumentTemplate};
\ No newline at end of file
'use strict';import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobalFunction,getGlobalObject}from"../types/global.js";import{validateInstance,validateString}from"../types/validate.js";import{getDocumentTheme}from"./theme.js";class Template extends Base{constructor(template){super();const HTMLTemplateElement=getGlobalFunction("HTMLTemplateElement");validateInstance(template,HTMLTemplateElement);this.template=template}getTemplateElement(){return this.template}createDocumentFragment(){return this.template.content.cloneNode(true)}}function findDocumentTemplate(id,currentNode){validateString(id);if(!(currentNode instanceof Document||currentNode instanceof DocumentFragment)){if(currentNode instanceof Node){currentNode=currentNode.getRootNode();if(!(currentNode instanceof Document||currentNode instanceof DocumentFragment)){currentNode=currentNode.ownerDocument}}if(!(currentNode instanceof Document||currentNode instanceof DocumentFragment)){currentNode=getGlobalObject("document")}}const HTMLTemplateElement=getGlobalFunction("HTMLTemplateElement");let theme=getDocumentTheme();let themedID=id+"-"+theme.getName();let template=currentNode.getElementById(themedID);if(template instanceof HTMLTemplateElement){return new Template(template)}template=currentNode.getElementById(id);if(template instanceof HTMLTemplateElement){return new Template(template)}if(currentNode!==getGlobalObject("document")){return findDocumentTemplate(id)}throw new Error("template "+id+" not found.")}assignToNamespace("Monster.DOM",Template,findDocumentTemplate);export{Monster,Template,findDocumentTemplate};
/** Monster 1.19.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";import{getGlobalObject}from"../types/global.js";import{validateString}from"../types/validate.js";import{ATTRIBUTE_THEME_NAME,DEFAULT_THEME}from"./constants.js";class Theme extends Base{constructor(e){super(),validateString(e),this.name=e}getName(){return this.name}}function getDocumentTheme(){let e=getGlobalObject("document"),t=DEFAULT_THEME,s=e.querySelector("html");var m;return s instanceof HTMLElement&&((m=s.getAttribute(ATTRIBUTE_THEME_NAME))&&(t=m)),new Theme(t)}assignToNamespace("Monster.DOM",Theme,getDocumentTheme);export{Monster,Theme,getDocumentTheme};
\ No newline at end of file
'use strict';import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{getGlobalObject}from"../types/global.js";import{validateString}from"../types/validate.js";import{ATTRIBUTE_THEME_NAME,DEFAULT_THEME}from"./constants.js";class Theme extends Base{constructor(name){super();validateString(name);this.name=name}getName(){return this.name}}function getDocumentTheme(){let document=getGlobalObject("document");let name=DEFAULT_THEME;let element=document.querySelector("html");if(element instanceof HTMLElement){let theme=element.getAttribute(ATTRIBUTE_THEME_NAME);if(theme){name=theme}}return new Theme(name)}assignToNamespace("Monster.DOM",Theme,getDocumentTheme);export{Monster,Theme,getDocumentTheme};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{Diff}from"../data/diff.js";import{Pathfinder}from"../data/pathfinder.js";import{Pipe}from"../data/pipe.js";import{ATTRIBUTE_UPDATER_ATTRIBUTES,ATTRIBUTE_UPDATER_BIND,ATTRIBUTE_UPDATER_INSERT,ATTRIBUTE_UPDATER_INSERT_REFERENCE,ATTRIBUTE_UPDATER_REMOVE,ATTRIBUTE_UPDATER_REPLACE}from"../dom/constants.js";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{isArray,isInstance,isIterable}from"../types/is.js";import{Observer}from"../types/observer.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateArray,validateInstance}from"../types/validate.js";import{clone}from"../util/clone.js";import{findDocumentTemplate}from"./template.js";import{getDocument}from"./util.js";class Updater extends Base{constructor(e,t){super(),this.element=validateInstance(e,HTMLElement);t=void 0===t?{}:t;isInstance(t,ProxyObserver)||(t=new ProxyObserver(t)),this.last={},this.callbacks=new Map,this.callbacks.set("checkstate",getCheckStateCallback.call(this)),this.subject=t.attachObserver(new Observer(()=>{var e,t=this.subject.getRealSubject(),r=Diff(this.last,t);this.last=clone(t);for([,e]of Object.entries(r))removeElement.call(this,e),insertElement.call(this,e),updateContent.call(this,e),updateAttributes.call(this,e)})),this.eventTypes=["keyup","click","change","drop","touchend","input"]}setEventTypes(e){return this.eventTypes=validateArray(e),this}enableEventProcessing(){this.disableEventProcessing();for(const e of this.eventTypes)this.element.addEventListener(e,getControlEventHandler.call(this));return this}disableEventProcessing(){for(const e of this.eventTypes)this.element.removeEventListener(e,getControlEventHandler.call(this));return this}run(){return this.last={__init__:!0},this.subject.notifyObservers()}getSubject(){return this.subject.getSubject()}setCallback(e,t){return this.callbacks.set(e,t),this}}function getCheckStateCallback(){return function(e){if(this instanceof HTMLInputElement){if(-1!==["radio","checkbox"].indexOf(this.type))return this.value+""==e+""?"true":void 0}else if(this instanceof HTMLOptionElement&&isArray(e)&&-1!==e.indexOf(this.value))return"true"}}const symbol=Symbol("EventHandler");function getControlEventHandler(){const i=this;if(i[symbol])return i[symbol];const a=new Pathfinder(this.subject.getSubject());return i[symbol]=r=>{const s=r.target;if(s.hasAttribute(ATTRIBUTE_UPDATER_BIND)){let e=s.getAttribute(ATTRIBUTE_UPDATER_BIND);if(0!==e.indexOf("path:"))throw new Error("the bind argument must start as a value with a path.");e=e.substr(5);let t;if(s instanceof HTMLInputElement)t="checkbox"!==s.type||s.checked?s.value:void 0;else if(s instanceof HTMLTextAreaElement)t=s.value;else if(s instanceof HTMLSelectElement)switch(s.type){case"select-one":t=s.value;break;case"select-multiple":t=s.value;let e=s?.selectedOptions;void 0===e&&(e=s.querySelectorAll(":scope option:checked")),t=Array.from(e).map(({value:e})=>e)}else{if(!(s?.constructor?.prototype&&Object.getOwnPropertyDescriptor(s.constructor.prototype,"value")?.get||s.hasOwnProperty("value")))throw new Error("unsupported object");t=s?.value}r=clone(i.subject.getRealSubject());const n=new Pathfinder(r);n.setVia(e,t),0<new Diff(r,i.subject.getRealSubject()).length&&a.setVia(e,t)}},i[symbol]}function removeElement(e){for(var[,t]of this.element.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_REMOVE+"]").entries())t.parentNode.removeChild(t)}function insertElement(t){var a=this.subject.getRealSubject();getDocument();let o=new WeakSet,r=0;for(;;){let i=!1;r++;let e=clone(t?.path);if(!isArray(e))return this;for(;0<e.length;){var l,s=e.join(".");for([,l]of this.element.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_INSERT+'*="path:'+s+'"]').entries())if(!o.has(l)){o.add(l),i=!0;const m=l.getAttribute(ATTRIBUTE_UPDATER_INSERT);let e=m.trim();var c=e.indexOf(" "),T=e.substr(0,c).trim(),u=T+"-";let t=e.substr(c).trim();if(0<t.indexOf("|"))throw new Error("pipes are not allowed when cloning a node.");let r=new Pipe(t);this.callbacks.forEach((e,t)=>{r.setCallback(t,e)});var E,p,c=r.run(a),f=t.split(":").pop();let s;if(l.hasChildNodes()&&(s=l.lastChild),!isIterable(c))throw new Error("the value is not iterable");let n=new Set;for([E,p]of Object.entries(c)){var h=u+E,d=f+"."+E;n.add(h);var A=l.querySelector("["+ATTRIBUTE_UPDATER_INSERT_REFERENCE+'="'+h+'"]');A instanceof HTMLElement?s=A:appendNewDocumentFragment(l,T,h,d)}var b,c=l.querySelectorAll("["+ATTRIBUTE_UPDATER_INSERT_REFERENCE+'*="'+u+'"]');for([,b]of Object.entries(c))n.has(b.getAttribute(ATTRIBUTE_UPDATER_INSERT_REFERENCE))||l.removeChild(b)}e.pop()}if(!1===i)break;if(200<r++)throw new Error("the maximum depth for the recursion is reached.")}}function appendNewDocumentFragment(e,t,r,s){let n=findDocumentTemplate(t,e);var i,a=n.createDocumentFragment();for([,i]of Object.entries(a.childNodes))i instanceof HTMLElement&&(applyRecursive(i,t,s),i.setAttribute(ATTRIBUTE_UPDATER_INSERT_REFERENCE,r)),e.appendChild(i)}function applyRecursive(t,r,s){if(t instanceof HTMLElement){if(t.hasAttribute(ATTRIBUTE_UPDATER_REPLACE)){let e=t.getAttribute(ATTRIBUTE_UPDATER_REPLACE);t.setAttribute(ATTRIBUTE_UPDATER_REPLACE,e.replace("path:"+r,"path:"+s))}if(t.hasAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES)){let e=t.getAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES);t.setAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES,e.replace("path:"+r,"path:"+s))}for(var[,e]of Object.entries(t.childNodes))applyRecursive(e,r,s)}}function updateContent(e){var t=this.subject.getRealSubject(),e=clone(e?.path);runUpdateContent.call(this,this.element,e,t)}function runUpdateContent(t,r,s){if(isArray(r)){r=clone(r);let e=new WeakSet;for(;0<r.length;){var n,i=r.join(".");r.pop();for([,n]of t.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_REPLACE+'^="path:'+i+'"], ['+ATTRIBUTE_UPDATER_REPLACE+'^="static:"]').entries())if(!e.has(n)){e.add(n);const o=n.getAttribute(ATTRIBUTE_UPDATER_REPLACE);var a=o.trim();let r=new Pipe(a);this.callbacks.forEach((e,t)=>{r.setCallback(t,e)});a=r.run(s);if(a instanceof HTMLElement){for(;n.firstChild;)n.removeChild(n.firstChild);n.addNode(a)}else n.innerHTML=a}}}}function updateAttributes(e){var t=this.subject.getRealSubject(),e=clone(e?.path);runUpdateAttributes.call(this,this.element,e,t)}function runUpdateAttributes(t,r,s){if(isArray(r)){r=clone(r);let e=new WeakSet;for(;0<r.length;){var n=r.join(".");r.pop();for(const[,l]of t.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_ATTRIBUTES+'*="path:'+n+'"]').entries())if(!e.has(l)){e.add(l);const c=l.getAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES);for(var[,i]of Object.entries(c.split(","))){i=i.trim();var a=i.indexOf(" "),o=i.substr(0,a).trim(),a=i.substr(a).trim();let r=new Pipe(a);this.callbacks.forEach((e,t)=>{r.setCallback(t,e,l)});a=r.run(s);void 0===a?l.removeAttribute(o):l.getAttribute(o)!==a&&l.setAttribute(o,a),handleInputControlAttributeUpdate.call(this,l,o,a)}}}}}function handleInputControlAttributeUpdate(e,t,r){if(e instanceof HTMLSelectElement)switch(e.type){case"select-multiple":for(var[s,n]of Object.entries(e.options))-1!==r.indexOf(n.value)?n.selected=!0:n.selected=!1;break;case"select-one":for(var[i,a]of Object.entries(e.options))if(a.value===r){e.selectedIndex=i;break}}else if(e instanceof HTMLInputElement)switch(e.type){case"radio":case"checkbox":e.checked="checked"===t&&void 0!==r;break;default:"value"===t&&(e.value=void 0===r?"":r)}else e instanceof HTMLTextAreaElement&&"value"===t&&(e.value=void 0===r?"":r)}assignToNamespace("Monster.DOM",Updater);export{Monster,Updater};
\ No newline at end of file
'use strict';import{Diff}from"../data/diff.js";import{Pathfinder}from"../data/pathfinder.js";import{Pipe}from"../data/pipe.js";import{ATTRIBUTE_UPDATER_ATTRIBUTES,ATTRIBUTE_UPDATER_BIND,ATTRIBUTE_UPDATER_INSERT,ATTRIBUTE_UPDATER_INSERT_REFERENCE,ATTRIBUTE_UPDATER_REMOVE,ATTRIBUTE_UPDATER_REPLACE}from"../dom/constants.js";import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{isArray,isInstance,isIterable}from"../types/is.js";import{Observer}from"../types/observer.js";import{ProxyObserver}from"../types/proxyobserver.js";import{validateArray,validateInstance}from"../types/validate.js";import{clone}from"../util/clone.js";import{findDocumentTemplate}from"./template.js";import{getDocument}from"./util.js";class Updater extends Base{constructor(element,subject){super();this.element=validateInstance(element,HTMLElement);if(subject===undefined)subject={};let a=subject;if(!isInstance(subject,ProxyObserver)){subject=new ProxyObserver(subject)}this.last={};this.callbacks=new Map;this.callbacks.set("checkstate",getCheckStateCallback.call(this));this.subject=subject.attachObserver(new Observer(()=>{const s=this.subject.getRealSubject();const diff=Diff(this.last,s);this.last=clone(s);for(const[,change]of Object.entries(diff)){removeElement.call(this,change);insertElement.call(this,change);updateContent.call(this,change);updateAttributes.call(this,change)}}));this.eventTypes=["keyup","click","change","drop","touchend","input"]}setEventTypes(types){this.eventTypes=validateArray(types);return this}enableEventProcessing(){this.disableEventProcessing();for(const type of this.eventTypes){this.element.addEventListener(type,getControlEventHandler.call(this))}return this}disableEventProcessing(){for(const type of this.eventTypes){this.element.removeEventListener(type,getControlEventHandler.call(this))}return this}run(){this.last={"__init__":true};return this.subject.notifyObservers()}getSubject(){return this.subject.getSubject()}setCallback(name,callback){this.callbacks.set(name,callback);return this}}function getCheckStateCallback(){const self=this;return function(current){if(this instanceof HTMLInputElement){if(["radio","checkbox"].indexOf(this.type)!==-1){return this.value+""===current+""?"true":undefined}}else if(this instanceof HTMLOptionElement){if(isArray(current)&&current.indexOf(this.value)!==-1){return"true"}return undefined}}}const symbol=Symbol("EventHandler");function getControlEventHandler(){const self=this;if(self[symbol]){return self[symbol]}const pathfinder=new Pathfinder(this.subject.getSubject());self[symbol]=event=>{const element=event.target;if(!element.hasAttribute(ATTRIBUTE_UPDATER_BIND)){return}let path=element.getAttribute(ATTRIBUTE_UPDATER_BIND);if(path.indexOf("path:")!==0){throw new Error("the bind argument must start as a value with a path.")}path=path.substr(5);let value;if(element instanceof HTMLInputElement){switch(element.type){case"checkbox":value=element.checked?element.value:undefined;break;default:value=element.value;break;}}else if(element instanceof HTMLTextAreaElement){value=element.value}else if(element instanceof HTMLSelectElement){switch(element.type){case"select-one":value=element.value;break;case"select-multiple":value=element.value;let options=element?.selectedOptions;if(options===undefined)options=element.querySelectorAll(":scope option:checked");value=Array.from(options).map(({value})=>value);break;}}else if(element?.constructor?.prototype&&!!Object.getOwnPropertyDescriptor(element.constructor.prototype,"value")?.["get"]||element.hasOwnProperty("value")){value=element?.["value"]}else{throw new Error("unsupported object")}const copy=clone(self.subject.getRealSubject());const pf=new Pathfinder(copy);pf.setVia(path,value);const diff=new Diff(copy,self.subject.getRealSubject());if(diff.length>0){pathfinder.setVia(path,value)}};return self[symbol]}function removeElement(change){for(const[,element]of this.element.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_REMOVE+"]").entries()){element.parentNode.removeChild(element)}}function insertElement(change){const self=this;const subject=self.subject.getRealSubject();const document=getDocument();let mem=new WeakSet;let wd=0;while(true){let found=false;wd++;let p=clone(change?.["path"]);if(!isArray(p))return this;while(p.length>0){const current=p.join(".");const list=this.element.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_INSERT+"*=\"path:"+current+"\"]").entries();for(const[,containerElement]of list){if(mem.has(containerElement))continue;mem.add(containerElement);found=true;const attributes=containerElement.getAttribute(ATTRIBUTE_UPDATER_INSERT);let def=attributes.trim();let i=def.indexOf(" ");let key=def.substr(0,i).trim();let refPrefix=key+"-";let cmd=def.substr(i).trim();if(cmd.indexOf("|")>0){throw new Error("pipes are not allowed when cloning a node.")}let pipe=new Pipe(cmd);this.callbacks.forEach((f,n)=>{pipe.setCallback(n,f)});let value=pipe.run(subject);let dataPath=cmd.split(":").pop();let insertPoint;if(containerElement.hasChildNodes()){insertPoint=containerElement.lastChild}if(!isIterable(value)){throw new Error("the value is not iterable")}let available=new Set;for(const[_i,obj]of Object.entries(value)){let ref=refPrefix+_i;let currentPath=dataPath+"."+_i;available.add(ref);let refElement=containerElement.querySelector("["+ATTRIBUTE_UPDATER_INSERT_REFERENCE+"=\""+ref+"\"]");if(refElement instanceof HTMLElement){insertPoint=refElement;continue}appendNewDocumentFragment(containerElement,key,ref,currentPath)}let nodes=containerElement.querySelectorAll("["+ATTRIBUTE_UPDATER_INSERT_REFERENCE+"*=\""+refPrefix+"\"]");for(const[,node]of Object.entries(nodes)){if(!available.has(node.getAttribute(ATTRIBUTE_UPDATER_INSERT_REFERENCE))){containerElement.removeChild(node)}}}p.pop()}if(found===false)break;if(wd++>200){throw new Error("the maximum depth for the recursion is reached.")}}}function appendNewDocumentFragment(container,key,ref,path){let template=findDocumentTemplate(key,container);let nodes=template.createDocumentFragment();for(const[,node]of Object.entries(nodes.childNodes)){if(node instanceof HTMLElement){applyRecursive(node,key,path);node.setAttribute(ATTRIBUTE_UPDATER_INSERT_REFERENCE,ref)}container.appendChild(node)}}function applyRecursive(node,key,path){if(node instanceof HTMLElement){if(node.hasAttribute(ATTRIBUTE_UPDATER_REPLACE)){let value=node.getAttribute(ATTRIBUTE_UPDATER_REPLACE);node.setAttribute(ATTRIBUTE_UPDATER_REPLACE,value.replace("path:"+key,"path:"+path))}if(node.hasAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES)){let value=node.getAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES);node.setAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES,value.replace("path:"+key,"path:"+path))}for(const[,child]of Object.entries(node.childNodes)){applyRecursive(child,key,path)}}}function updateContent(change){const self=this;const subject=self.subject.getRealSubject();let p=clone(change?.["path"]);runUpdateContent.call(this,this.element,p,subject)}function runUpdateContent(container,parts,subject){if(!isArray(parts))return;parts=clone(parts);let mem=new WeakSet;while(parts.length>0){const current=parts.join(".");parts.pop();for(const[,element]of container.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_REPLACE+"^=\"path:"+current+"\"], ["+ATTRIBUTE_UPDATER_REPLACE+"^=\"static:\"]").entries()){if(mem.has(element))continue;mem.add(element);const attributes=element.getAttribute(ATTRIBUTE_UPDATER_REPLACE);let cmd=attributes.trim();let pipe=new Pipe(cmd);this.callbacks.forEach((f,n)=>{pipe.setCallback(n,f)});let value=pipe.run(subject);if(value instanceof HTMLElement){while(element.firstChild){element.removeChild(element.firstChild)}element.addNode(value)}else{element.innerHTML=value}}}}function updateAttributes(change){const subject=this.subject.getRealSubject();let p=clone(change?.["path"]);runUpdateAttributes.call(this,this.element,p,subject)}function runUpdateAttributes(container,parts,subject){const self=this;if(!isArray(parts))return;parts=clone(parts);let mem=new WeakSet;while(parts.length>0){const current=parts.join(".");parts.pop();for(const[,element]of container.querySelectorAll(":scope ["+ATTRIBUTE_UPDATER_ATTRIBUTES+"*=\"path:"+current+"\"]").entries()){if(mem.has(element))continue;mem.add(element);const attributes=element.getAttribute(ATTRIBUTE_UPDATER_ATTRIBUTES);for(let[,def]of Object.entries(attributes.split(","))){def=def.trim();let i=def.indexOf(" ");let name=def.substr(0,i).trim();let cmd=def.substr(i).trim();let pipe=new Pipe(cmd);self.callbacks.forEach((f,n)=>{pipe.setCallback(n,f,element)});let value=pipe.run(subject);if(value===undefined){element.removeAttribute(name)}else if(element.getAttribute(name)!==value){element.setAttribute(name,value)}handleInputControlAttributeUpdate.call(this,element,name,value)}}}}function handleInputControlAttributeUpdate(element,name,value){const self=this;if(element instanceof HTMLSelectElement){switch(element.type){case"select-multiple":for(const[index,opt]of Object.entries(element.options)){if(value.indexOf(opt.value)!==-1){opt.selected=true}else{opt.selected=false}}break;case"select-one":for(const[index,opt]of Object.entries(element.options)){if(opt.value===value){element.selectedIndex=index;break}}break;}}else if(element instanceof HTMLInputElement){switch(element.type){case"radio":if(name==="checked"&&value!==undefined){element.checked=true}else{element.checked=false}break;case"checkbox":if(name==="checked"&&value!==undefined){element.checked=true}else{element.checked=false}break;case"text":default:if(name==="value"){element.value=value===undefined?"":value}break;}}else if(element instanceof HTMLTextAreaElement){if(name==="value"){element.value=value===undefined?"":value}}}assignToNamespace("Monster.DOM",Updater);export{Monster,Updater};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{getGlobal}from"../types/global.js";import{validateString}from"../types/validate.js";function getDocument(){var t=getGlobal()?.document;if("object"!=typeof t)throw new Error("not supported environment");return t}function getWindow(){var t=getGlobal()?.window;if("object"!=typeof t)throw new Error("not supported environment");return t}function getDocumentFragmentFromString(t){validateString(t);const e=getDocument(),n=e.createElement("template");return n.innerHTML=t,n.content}assignToNamespace("Monster.DOM",getWindow,getDocument,getDocumentFragmentFromString);export{Monster,getWindow,getDocument,getDocumentFragmentFromString};
\ No newline at end of file
'use strict';import{assignToNamespace,Monster}from"../namespace.js";import{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}assignToNamespace("Monster.DOM",getWindow,getDocument,getDocumentFragmentFromString);export{Monster,getWindow,getDocument,getDocumentFragmentFromString};
/** Monster 1.19.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";import{validateString}from"../types/validate.js";import{clone}from"../util/clone.js";const propertiesSymbol=Symbol("properties"),localeStringSymbol=Symbol("localeString");class Locale extends Base{constructor(e,i,t,o,a,r){super(),this[propertiesSymbol]={language:void 0===e?void 0:validateString(e),script:void 0===t?void 0:validateString(t),region:void 0===i?void 0:validateString(i),variants:void 0===o?void 0:validateString(o),extlang:void 0===a?void 0:validateString(a),privateUse:void 0===r?void 0:validateString(r)};let n=[];if(void 0!==e&&n.push(e),void 0!==t&&n.push(t),void 0!==i&&n.push(i),void 0!==o&&n.push(o),void 0!==a&&n.push(a),void 0!==r&&n.push(r),0===n.length)throw new Error("unsupported locale");this[localeStringSymbol]=n.join("-")}get localeString(){return this[localeStringSymbol]}get language(){return this[propertiesSymbol].language}get region(){return this[propertiesSymbol].region}get script(){return this[propertiesSymbol].script}get variants(){return this[propertiesSymbol].variants}get extlang(){return this[propertiesSymbol].extlang}get privateUse(){return this[propertiesSymbol].privateValue}toString(){return""+this.localeString}getMap(){return clone(this[propertiesSymbol])}}function parseLocale(e){e=validateString(e).replace(/_/g,"-");let i,t,o,a,r,n,l=new RegExp("^(((en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((([A-Za-z]{2,3}(-([A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-([A-Za-z]{4}))?(-([A-Za-z]{2}|[0-9]{3}))?(-([A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-([0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(x(-[A-Za-z0-9]{1,8})+))?)|(x(-[A-Za-z0-9]{1,8})+))$"),s;if(null!==(s=l.exec(e))&&s.index===l.lastIndex&&l.lastIndex++,null==s)throw new Error("unsupported locale");return void 0!==s[6]&&(i=s[6],1<(a=i.split("-")).length&&(i=a[0],n=a[1])),void 0!==s[14]&&(t=s[14]),void 0!==s[12]&&(r=s[12]),void 0!==s[16]&&(o=s[16]),new Locale(i,t,r,o,n)}assignToNamespace("Monster.I18n",Locale,parseLocale);export{Monster,Locale,parseLocale};
\ No newline at end of file
'use strict';import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateString}from"../types/validate.js";import{clone}from"../util/clone.js";const propertiesSymbol=Symbol("properties");const localeStringSymbol=Symbol("localeString");class Locale extends Base{constructor(language,region,script,variants,extlang,privateUse){super();this[propertiesSymbol]={language:language===undefined?undefined:validateString(language),script:script===undefined?undefined:validateString(script),region:region===undefined?undefined:validateString(region),variants:variants===undefined?undefined:validateString(variants),extlang:extlang===undefined?undefined:validateString(extlang),privateUse:privateUse===undefined?undefined:validateString(privateUse)};let s=[];if(language!==undefined)s.push(language);if(script!==undefined)s.push(script);if(region!==undefined)s.push(region);if(variants!==undefined)s.push(variants);if(extlang!==undefined)s.push(extlang);if(privateUse!==undefined)s.push(privateUse);if(s.length===0){throw new Error("unsupported locale")}this[localeStringSymbol]=s.join("-")}get localeString(){return this[localeStringSymbol]}get language(){return this[propertiesSymbol].language}get region(){return this[propertiesSymbol].region}get script(){return this[propertiesSymbol].script}get variants(){return this[propertiesSymbol].variants}get extlang(){return this[propertiesSymbol].extlang}get privateUse(){return this[propertiesSymbol].privateValue}toString(){return""+this.localeString}getMap(){return clone(this[propertiesSymbol])}}function parseLocale(locale){locale=validateString(locale).replace(/_/g,"-");let language,region,variants,parts,script,extlang,regexRegular="(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang)",regexIrregular="(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)",regexGrandfathered="("+regexIrregular+"|"+regexRegular+")",regexPrivateUse="(x(-[A-Za-z0-9]{1,8})+)",regexSingleton="[0-9A-WY-Za-wy-z]",regexExtension="("+regexSingleton+"(-[A-Za-z0-9]{2,8})+)",regexVariant="([A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3})",regexRegion="([A-Za-z]{2}|[0-9]{3})",regexScript="([A-Za-z]{4})",regexExtlang="([A-Za-z]{3}(-[A-Za-z]{3}){0,2})",regexLanguage="(([A-Za-z]{2,3}(-"+regexExtlang+")?)|[A-Za-z]{4}|[A-Za-z]{5,8})",regexLangtag="("+regexLanguage+"(-"+regexScript+")?"+"(-"+regexRegion+")?"+"(-"+regexVariant+")*"+"(-"+regexExtension+")*"+"(-"+regexPrivateUse+")?"+")",regexLanguageTag="^("+regexGrandfathered+"|"+regexLangtag+"|"+regexPrivateUse+")$",regex=new RegExp(regexLanguageTag),match;if((match=regex.exec(locale))!==null){if(match.index===regex.lastIndex){regex.lastIndex++}}if(match===undefined||match===null){throw new Error("unsupported locale")}if(match[6]!==undefined){language=match[6];parts=language.split("-");if(parts.length>1){language=parts[0];extlang=parts[1]}}if(match[14]!==undefined){region=match[14]}if(match[12]!==undefined){script=match[12]}if(match[16]!==undefined){variants=match[16]}return new Locale(language,region,script,variants,extlang)}assignToNamespace("Monster.I18n",Locale,parseLocale);export{Monster,Locale,parseLocale};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";const namespace="Monster.I18n";export{namespace};
\ No newline at end of file
'use strict';export const namespace="Monster.I18n";
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{assignToNamespace,Monster}from"../namespace.js";import{BaseWithOptions}from"../types/basewithoptions.js";import{Locale}from"./locale.js";import{Translations}from"./translations.js";class Provider extends BaseWithOptions{getTranslations(e){return new Promise((s,o)=>{try{s(new Translations(e))}catch(s){o(s)}})}}assignToNamespace("Monster.I18n",Provider);export{Monster,Provider};
\ No newline at end of file
'use strict';import{assignToNamespace,Monster}from"../namespace.js";import{BaseWithOptions}from"../types/basewithoptions.js";import{Locale}from"./locale.js";import{Translations}from"./translations.js";class Provider extends BaseWithOptions{getTranslations(locale){return new Promise((resolve,reject)=>{try{resolve(new Translations(locale))}catch(e){reject(e)}})}}assignToNamespace("Monster.I18n",Provider);export{Monster,Provider};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";import{PROPERTY_KEY_INTERNALDATA}from"../../constants.js";import{extend}from"../../data/extend.js";import{assignToNamespace,Monster}from"../../namespace.js";import{Formatter}from"../../text/formatter.js";import{getGlobalFunction}from"../../types/global.js";import{isInstance,isString}from"../../types/is.js";import{validateObject,validateString}from"../../types/validate.js";import{parseLocale}from"../locale.js";import{Provider}from"../provider.js";import{Translations}from"../translations.js";const optionsSymbol=Symbol.for(PROPERTY_KEY_INTERNALDATA);class Fetch extends Provider{constructor(t,e){super(e),isInstance(t,URL)&&(t=t.toString()),void 0===e&&(e={}),validateString(t),this.url=t,this[optionsSymbol]=extend({},super.defaults,this.defaults,validateObject(e))}get defaults(){return{fetch:{method:"GET",mode:"cors",cache:"no-cache",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"}}}getTranslations(e){isString(e)&&(e=parseLocale(e));let t=new Formatter(e.getMap());return getGlobalFunction("fetch")(t.format(this.url),this.getOption("fetch",{})).then(t=>t.json()).then(t=>new Translations(e).assignTranslations(t))}}assignToNamespace("Monster.I18n.Providers",Fetch);export{Monster,Fetch};
\ No newline at end of file
'use strict';import{PROPERTY_KEY_INTERNALDATA}from"../../constants.js";import{extend}from"../../data/extend.js";import{assignToNamespace,Monster}from"../../namespace.js";import{Formatter}from"../../text/formatter.js";import{getGlobalFunction}from"../../types/global.js";import{isInstance,isString}from"../../types/is.js";import{validateObject,validateString}from"../../types/validate.js";import{parseLocale}from"../locale.js";import{Provider}from"../provider.js";import{Translations}from"../translations.js";const optionsSymbol=Symbol.for(PROPERTY_KEY_INTERNALDATA);class Fetch extends Provider{constructor(url,options){super(options);if(isInstance(url,URL)){url=url.toString()}if(options===undefined){options={}}validateString(url);this.url=url;this[optionsSymbol]=extend({},super.defaults,this.defaults,validateObject(options))}get defaults(){return{fetch:{method:"GET",mode:"cors",cache:"no-cache",credentials:"omit",redirect:"follow",referrerPolicy:"no-referrer"}}}getTranslations(locale){if(isString(locale)){locale=parseLocale(locale)}let formatter=new Formatter(locale.getMap());return getGlobalFunction("fetch")(formatter.format(this.url),this.getOption("fetch",{})).then(response=>response.json()).then(data=>{return new Translations(locale).assignTranslations(data)})}}assignToNamespace("Monster.I18n.Providers",Fetch);export{Monster,Fetch};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";const namespace="Monster.I18n.Providers";export{namespace};
\ No newline at end of file
'use strict';export const namespace="Monster.I18n.Providers";
/** Monster 1.19.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";import{isObject,isString}from"../types/is.js";import{validateInstance,validateInteger,validateObject,validateString}from"../types/validate.js";import{Locale,parseLocale}from"./locale.js";class Translations extends Base{constructor(t){super(),isString(t)&&(t=parseLocale(t)),this.locale=validateInstance(t,Locale),this.storage=new Map}getText(t,e){if(!this.storage.has(t)){if(void 0===e)throw new Error("key "+t+" not found");return validateString(e)}var r=this.storage.get(t);return isObject(r)?this.getPluralRuleText(t,"other",e):this.storage.get(t)}getPluralRuleText(t,e,r){if(!this.storage.has(t))return validateString(r);let a=validateObject(this.storage.get(t)),s;if(isString(e))s=e.toLocaleString();else{if(0===(e=validateInteger(e))&&a.hasOwnProperty("zero"))return validateString(a.zero);s=new Intl.PluralRules(this.locale.toString()).select(validateInteger(e))}return a.hasOwnProperty(s)?validateString(a[s]):a.hasOwnProperty(DEFAULT_KEY)?validateString(a[DEFAULT_KEY]):validateString(r)}setText(t,e){if(isString(e)||isObject(e))return this.storage.set(validateString(t),e),this;throw new TypeError("value is not a string or object")}assignTranslations(t){validateObject(t);for(var[e,r]of Object.entries(t))this.setText(e,r);return this}}assignToNamespace("Monster.I18n",Translations);export{Monster,Translations};
\ No newline at end of file
'use strict';import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{isObject,isString}from"../types/is.js";import{validateInstance,validateInteger,validateObject,validateString}from"../types/validate.js";import{Locale,parseLocale}from"./locale.js";class Translations extends Base{constructor(locale){super();if(isString(locale)){locale=parseLocale(locale)}this.locale=validateInstance(locale,Locale);this.storage=new Map}getText(key,defaultText){if(!this.storage.has(key)){if(defaultText===undefined){throw new Error("key "+key+" not found")}return validateString(defaultText)}let r=this.storage.get(key);if(isObject(r)){return this.getPluralRuleText(key,"other",defaultText)}return this.storage.get(key)}getPluralRuleText(key,count,defaultText){if(!this.storage.has(key)){return validateString(defaultText)}let r=validateObject(this.storage.get(key));let keyword;if(isString(count)){keyword=count.toLocaleString()}else{count=validateInteger(count);if(count===0){if(r.hasOwnProperty("zero")){return validateString(r["zero"])}}keyword=new Intl.PluralRules(this.locale.toString()).select(validateInteger(count))}if(r.hasOwnProperty(keyword)){return validateString(r[keyword])}if(r.hasOwnProperty(DEFAULT_KEY)){return validateString(r[DEFAULT_KEY])}return validateString(defaultText)}setText(key,text){if(isString(text)||isObject(text)){this.storage.set(validateString(key),text);return this}throw new TypeError("value is not a string or object")}assignTranslations(translations){validateObject(translations);for(const[k,v]of Object.entries(translations)){this.setText(k,v)}return this}}assignToNamespace("Monster.I18n",Translations);export{Monster,Translations};
/** Monster 1.19.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";import{validateInstance,validateInteger}from"../types/validate.js";import{LogEntry}from"./logentry.js";import{ALL,DEBUG,ERROR,FATAL,INFO,OFF,TRACE,WARN}from"./logger.js";class Handler extends Base{constructor(){super(),this.loglevel=OFF}log(e){return validateInstance(e,LogEntry),!(this.loglevel<e.getLogLevel())}setLogLevel(e){return validateInteger(e),this.loglevel=e,this}getLogLevel(){return this.loglevel}setAll(){return this.setLogLevel(ALL),this}setTrace(){return this.setLogLevel(TRACE),this}setDebug(){return this.setLogLevel(DEBUG),this}setInfo(){return this.setLogLevel(INFO),this}setWarn(){return this.setLogLevel(WARN),this}setError(){return this.setLogLevel(ERROR),this}setFatal(){return this.setLogLevel(FATAL),this}setOff(){return this.setLogLevel(OFF),this}}assignToNamespace("Monster.Logging",Handler);export{Monster,Handler};
\ No newline at end of file
'use strict';import{assignToNamespace,Monster}from"../namespace.js";import{Base}from"../types/base.js";import{validateInstance,validateInteger}from"../types/validate.js";import{LogEntry}from"./logentry.js";import{ALL,DEBUG,ERROR,FATAL,INFO,OFF,TRACE,WARN}from"./logger.js";class Handler extends Base{constructor(){super();this.loglevel=OFF}log(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}}assignToNamespace("Monster.Logging",Handler);export{Monster,Handler};
/** Monster 1.19.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";import{getGlobalObject}from"../../types/global.js";import{Handler}from"../handler.js";import{LogEntry}from"../logentry.js";class ConsoleHandler extends Handler{constructor(){super()}log(o){if(super.log(o)){let e=getGlobalObject("console");return e?(e.log(o.toString()),!0):!1}return!1}}assignToNamespace("Monster.Logging.Handler",ConsoleHandler);export{Monster,ConsoleHandler};
\ No newline at end of file
'use strict';import{assignToNamespace,Monster}from"../../namespace.js";import{Base}from"../../types/base.js";import{getGlobalObject}from"../../types/global.js";import{Handler}from"../handler.js";import{LogEntry}from"../logentry.js";class ConsoleHandler extends Handler{constructor(){super()}log(entry){if(super.log(entry)){let console=getGlobalObject("console");if(!console)return false;console.log(entry.toString());return true}return false}}assignToNamespace("Monster.Logging.Handler",ConsoleHandler);export{Monster,ConsoleHandler};
/** Monster 1.19.0, © 2021 schukai GmbH, Released under the AGPL 3.0 License. */
"use strict";const namespace="Monster.Logging.Handler";export{namespace};
\ No newline at end of file
'use strict';export const namespace="Monster.Logging.Handler";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment