diff --git a/application/source/constants.js b/application/source/constants.js index 864ca6060cf96139a74332ed96465ed061c8b54e..127e50cb95b33a26dcd160fab6029b04555b88ed 100644 --- a/application/source/constants.js +++ b/application/source/constants.js @@ -5,6 +5,12 @@ * @author schukai GmbH */ +export { + internalSymbol, + internalStateSymbol +} + + /** * @private * @type {symbol} @@ -21,9 +27,3 @@ const internalSymbol = Symbol('internalData'); */ const internalStateSymbol = Symbol('state'); - -export { - internalSymbol, - internalStateSymbol -} - diff --git a/application/source/constraints/abstract.js b/application/source/constraints/abstract.js index 979829d65bf3ae1297a0277eb882e52d2ab4f4a3..2380cac9ab0ff26fc2c8408999353521a3b296a5 100644 --- a/application/source/constraints/abstract.js +++ b/application/source/constraints/abstract.js @@ -7,6 +7,7 @@ import {Base} from '../types/base.js'; +export {AbstractConstraint} /** * Constraints are used to define conditions that must be met by the value of a variable. @@ -22,7 +23,7 @@ import {Base} from '../types/base.js'; * @memberOf Monster.Constraints * @summary The abstract constraint */ -export class AbstractConstraint extends Base { +class AbstractConstraint extends Base { /** * diff --git a/application/source/constraints/abstractoperator.js b/application/source/constraints/abstractoperator.js index a6eb676bf0aaf73841239b1a954b95461263d7cc..48ff1860c977604867af7fce5d6314728fe31bab 100644 --- a/application/source/constraints/abstractoperator.js +++ b/application/source/constraints/abstractoperator.js @@ -6,6 +6,8 @@ import {AbstractConstraint} from "./abstract.js"; +export {AbstractOperator} + /** * Constraints are used to define conditions that must be met by the value of a variable. * @@ -18,7 +20,7 @@ import {AbstractConstraint} from "./abstract.js"; * @memberOf Monster.Constraints * @summary The abstract operator constraint */ -export class AbstractOperator extends AbstractConstraint { +class AbstractOperator extends AbstractConstraint { /** * diff --git a/application/source/constraints/andoperator.js b/application/source/constraints/andoperator.js index 2d54d91094e85dfd3a17bccecfb5213d0e8b61ba..e60958ebdad070e9799f5b567396eb47f1e2070a 100644 --- a/application/source/constraints/andoperator.js +++ b/application/source/constraints/andoperator.js @@ -4,9 +4,10 @@ * @author schukai GmbH */ - import {AbstractOperator} from "./abstractoperator.js"; +export {AndOperator} + /** * Constraints are used to define conditions that must be met by the value of a variable. * @@ -44,7 +45,7 @@ import {AbstractOperator} from "./abstractoperator.js"; * @memberOf Monster.Constraints * @summary A and operator constraint */ -export class AndOperator extends AbstractOperator { +class AndOperator extends AbstractOperator { /** * this method return a promise containing the result of the check. diff --git a/application/source/constraints/invalid.js b/application/source/constraints/invalid.js index dde2876dbf12289e6f94cac09a2623647740c231..45ad4405fb53e92326189b4a79913cbd3c5c1acd 100644 --- a/application/source/constraints/invalid.js +++ b/application/source/constraints/invalid.js @@ -6,6 +6,8 @@ import {AbstractConstraint} from "./abstract.js"; +export {Invalid} + /** * Constraints are used to define conditions that must be met by the value of a variable. * @@ -34,7 +36,7 @@ import {AbstractConstraint} from "./abstract.js"; * @memberOf Monster.Constraints * @summary A constraint that always invalid */ -export class Invalid extends AbstractConstraint { +class Invalid extends AbstractConstraint { /** * this method return a rejected promise diff --git a/application/source/constraints/isarray.js b/application/source/constraints/isarray.js index 3a091993c89391dd1ad88a58325f8f96ea40c43a..4755e1e1da0887384d8c24c84ec0bf62bd0294ed 100644 --- a/application/source/constraints/isarray.js +++ b/application/source/constraints/isarray.js @@ -7,6 +7,8 @@ import {isArray} from "../types/is.js"; import {AbstractConstraint} from "./abstract.js"; +export {IsArray} + /** * Constraints are used to define conditions that must be met by the value of a variable. * @@ -38,7 +40,7 @@ import {AbstractConstraint} from "./abstract.js"; * @memberOf Monster.Constraints * @summary A constraint to check if a value is an array */ -export class IsArray extends AbstractConstraint { +class IsArray extends AbstractConstraint { /** * this method return a promise containing the result of the check. diff --git a/application/source/constraints/isobject.js b/application/source/constraints/isobject.js index 2b0211b8996dd4f53410a05bb2460bfcd32239e6..02fafc014e7418c70f158d74c894314c70fc855d 100644 --- a/application/source/constraints/isobject.js +++ b/application/source/constraints/isobject.js @@ -7,6 +7,8 @@ import {isObject} from "../types/is.js"; import {AbstractConstraint} from "./abstract.js"; +export {IsObject} + /** * Constraints are used to define conditions that must be met by the value of a variable. * @@ -39,7 +41,7 @@ import {AbstractConstraint} from "./abstract.js"; * @memberOf Monster.Constraints * @summary A constraint to check if a value is an object */ -export class IsObject extends AbstractConstraint { +class IsObject extends AbstractConstraint { /** * this method return a promise containing the result of the check. diff --git a/application/source/constraints/namespace.js b/application/source/constraints/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..47329ca296259d52b34f642f0c9925c7873af38e --- /dev/null +++ b/application/source/constraints/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * Constraints are used to define conditions that must be met by the value of a variable so that the value can be transferred to the system. + * + * @namespace Monster.Constraints + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; \ No newline at end of file diff --git a/application/source/constraints/oroperator.js b/application/source/constraints/oroperator.js index 6972c43c349d6d5651d776f8b0f07a1e11aa93c5..d18b1f5ea0d02f1d757e574eed7c4ec8f7477747 100644 --- a/application/source/constraints/oroperator.js +++ b/application/source/constraints/oroperator.js @@ -6,6 +6,8 @@ import {AbstractOperator} from "./abstractoperator.js"; +export {OrOperator} + /** * Constraints are used to define conditions that must be met by the value of a variable. * @@ -43,7 +45,7 @@ import {AbstractOperator} from "./abstractoperator.js"; * @memberOf Monster.Constraints * @summary A or operator */ -export class OrOperator extends AbstractOperator { +class OrOperator extends AbstractOperator { /** * this method return a promise containing the result of the check. diff --git a/application/source/constraints/valid.js b/application/source/constraints/valid.js index 8c4a51f3c1e924a33a0cdf345f462fb024e47bd9..e0fdcc99beff00fbfb0cae8190d07f303ea40ed2 100644 --- a/application/source/constraints/valid.js +++ b/application/source/constraints/valid.js @@ -6,6 +6,8 @@ import {AbstractConstraint} from "./abstract.js"; +export {Valid} + /** * Constraints are used to define conditions that must be met by the value of a variable. * @@ -34,7 +36,7 @@ import {AbstractConstraint} from "./abstract.js"; * @memberOf Monster.Constraints * @summary A constraint that always valid */ -export class Valid extends AbstractConstraint { +class Valid extends AbstractConstraint { /** * this method return a promise containing the result of the check. diff --git a/application/source/data/buildmap.js b/application/source/data/buildmap.js index d10e93be9f69cd5141c389962b35c9d1f648e459..2cbbf89c70eaf6a5b2ee9ad77104d7563154ccfb 100644 --- a/application/source/data/buildmap.js +++ b/application/source/data/buildmap.js @@ -10,12 +10,13 @@ import {validateString} from "../types/validate.js"; import {clone} from "../util/clone.js"; import {DELIMITER, Pathfinder, WILDCARD} from "./pathfinder.js"; +export {buildMap, PARENT, assembleParts} /** - * @type {string} + * @type {string} * @memberOf Monster.Data */ -export const PARENT = '^'; +const PARENT = '^'; /** @@ -115,7 +116,7 @@ export const PARENT = '^'; * @throws {TypeError} value is neither a string nor a function * @throws {TypeError} the selector callback must return a map */ -export function buildMap(subject, selector, valueTemplate, keyTemplate, filter) { +function buildMap(subject, selector, valueTemplate, keyTemplate, filter) { return assembleParts(subject, selector, filter, function (v, k, m) { k = build(v, keyTemplate, k); v = build(v, valueTemplate); @@ -124,6 +125,7 @@ export function buildMap(subject, selector, valueTemplate, keyTemplate, filter) } + /** * @private * @param {*} subject @@ -133,7 +135,7 @@ export function buildMap(subject, selector, valueTemplate, keyTemplate, filter) * @return {Map} * @throws {TypeError} selector is neither a string nor a function */ -export function assembleParts(subject, selector, filter, callback) { +function assembleParts(subject, selector, filter, callback) { const result = new Map(); diff --git a/application/source/data/buildtree.js b/application/source/data/buildtree.js index db496cc26dfbc5536d0edc79216ff3ed7a22c2be..abd656bf453f1e91d0a5d2daa413960257ccfb5b 100644 --- a/application/source/data/buildtree.js +++ b/application/source/data/buildtree.js @@ -11,6 +11,7 @@ import {NodeList} from "../types/nodelist.js"; import {assembleParts} from "./buildmap.js"; import {extend} from "./extend.js"; +export {buildTree} /** * @private @@ -53,7 +54,7 @@ const rootSymbol = Symbol('root'); * @throws {Error} the object has no value for the specified id * @since 1.26.0 */ -export function buildTree(subject, selector, idKey, parentIDKey, options) { +function buildTree(subject, selector, idKey, parentIDKey, options) { const nodes = new Map; diff --git a/application/source/data/datasource.js b/application/source/data/datasource.js index a0cd11fb1079b6621e4ad8d36d4b59c9e238da9e..86a9a66fd21f4cc2dfe6b75f0d2c608b5987cd9a 100644 --- a/application/source/data/datasource.js +++ b/application/source/data/datasource.js @@ -14,6 +14,7 @@ import {validateObject} from "../types/validate.js"; import {extend} from "./extend.js"; import {Pathfinder} from "./pathfinder.js"; +export {Datasource} /** * @private @@ -49,7 +50,7 @@ const internalDataSymbol = Symbol('internalData'); * @memberOf Monster.Data * @summary The datasource class encapsulates the access to data objects. */ -export class Datasource extends Base { +class Datasource extends Base { /** * diff --git a/application/source/data/datasource/namespace.js b/application/source/data/datasource/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..7e75b751da185390b5cf18e0d86352739244436a --- /dev/null +++ b/application/source/data/datasource/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * Namespace for datasources + * + * @namespace Monster.Data.Datasource + * @memberOf Monster.Data + * @author schukai GmbH + */ +const ns = {}; \ No newline at end of file diff --git a/application/source/data/datasource/restapi.js b/application/source/data/datasource/restapi.js index 18875e3a347b63fc123f9cafa53a1aa84eb12d88..1c2da5d59686c169fa64a5b9f7da705b4dee0ee0 100644 --- a/application/source/data/datasource/restapi.js +++ b/application/source/data/datasource/restapi.js @@ -12,6 +12,8 @@ import {Pathfinder} from "../pathfinder.js"; import {Pipe} from "../pipe.js"; import {WriteError} from "./restapi/writeerror.js"; +export {RestAPI} + /** * The RestAPI is a class that enables a REST API server. * @@ -41,7 +43,7 @@ import {WriteError} from "./restapi/writeerror.js"; * @memberOf Monster.Data.Datasource * @summary The LocalStorage class encapsulates the access to data objects. */ -export class RestAPI extends Datasource { +class RestAPI extends Datasource { /** * diff --git a/application/source/data/datasource/restapi/namespace.js b/application/source/data/datasource/restapi/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..d93ea1b9c5cb66f3852395c8a9004e642b45462a --- /dev/null +++ b/application/source/data/datasource/restapi/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * Namespace for storages + * + * @namespace Monster.Data.Datasource.RestAPI + * @memberOf Monster.Data.Datasource + * @author schukai GmbH + */ +const ns = {}; diff --git a/application/source/data/datasource/restapi/writeerror.js b/application/source/data/datasource/restapi/writeerror.js index d18f7b0f5db5b4c008cdfb1772669f59d7dee264..4da20e033852824deefe2ac7b1a67ba7681aebd4 100644 --- a/application/source/data/datasource/restapi/writeerror.js +++ b/application/source/data/datasource/restapi/writeerror.js @@ -7,6 +7,8 @@ import {internalSymbol} from "../../../constants.js"; import {assignToNamespace, Monster} from '../../../namespace.js'; +export {WriteError} + /** * Error message for API requests with extension of request and validation. * @@ -15,7 +17,7 @@ import {assignToNamespace, Monster} from '../../../namespace.js'; * @memberOf Monster.Data.Datasource.RestAPI * @summary the error is thrown by the rest api in case of error */ -export class WriteError extends Error { +class WriteError extends Error { /** * * @param {string} message diff --git a/application/source/data/datasource/storage.js b/application/source/data/datasource/storage.js index 06d01b61a312b7374ad8a6626d658fe0ae31391a..1d24a6e630ea5ce197baced1033b04eb7c71d96e 100644 --- a/application/source/data/datasource/storage.js +++ b/application/source/data/datasource/storage.js @@ -9,11 +9,13 @@ import {assignToNamespace, Monster} from '../../namespace.js'; import {validateString} from "../../types/validate.js"; import {Datasource} from "../datasource.js"; +export {Storage} + /** * @private * @type {symbol} */ -export const storageObjectSymbol = Symbol('storageObject'); +const storageObjectSymbol = Symbol('storageObject'); /** * The class represents a record. @@ -36,7 +38,7 @@ export const storageObjectSymbol = Symbol('storageObject'); * @memberOf Monster.Data.Datasource * @summary The Storage class encapsulates the access to data objects over WebStorageAPI. */ -export class Storage extends Datasource { +class Storage extends Datasource { /** * diff --git a/application/source/data/datasource/storage/localstorage.js b/application/source/data/datasource/storage/localstorage.js index 4f79ea64d4917494b0a34979296aac1b0302a0a0..ccb4dd2e4c6e3f1b2028018f4479e4c22b13f16c 100644 --- a/application/source/data/datasource/storage/localstorage.js +++ b/application/source/data/datasource/storage/localstorage.js @@ -10,6 +10,8 @@ import {getGlobalObject} from "../../../types/global.js"; import {Datasource} from "../../datasource.js"; import {Storage, storageObjectSymbol} from "../storage.js"; +export {LocalStorage} + /** * The LocalStorage Datasource provides a data store in the browser localStorage. * @@ -25,7 +27,7 @@ import {Storage, storageObjectSymbol} from "../storage.js"; * @memberOf Monster.Data.Datasource.Storage * @summary The LocalStorage class encapsulates the access to data objects. */ -export class LocalStorage extends Storage { +class LocalStorage extends Storage { /** * @throws {Error} this method must be implemented by derived classes. diff --git a/application/source/data/datasource/storage/namespace.js b/application/source/data/datasource/storage/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..c9ad7d404fad5789327f82cf7c95bc2deaf775c8 --- /dev/null +++ b/application/source/data/datasource/storage/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * Namespace for storages + * + * @namespace Monster.Data.Datasource.Storage + * @memberOf Monster.Data.Datasource + * @author schukai GmbH + */ +const ns = {}; diff --git a/application/source/data/datasource/storage/sessionstorage.js b/application/source/data/datasource/storage/sessionstorage.js index 245d8a74fd4692e0617b9c1b994f95d0518f065c..9f98dc2b46b321ae40ee319669f98c299f8b161a 100644 --- a/application/source/data/datasource/storage/sessionstorage.js +++ b/application/source/data/datasource/storage/sessionstorage.js @@ -10,6 +10,8 @@ import {getGlobalObject} from "../../../types/global.js"; import {Datasource} from "../../datasource.js"; import {Storage, storageObjectSymbol} from "../storage.js"; +export {SessionStorage} + /** * The SessionStorage class provides a data source that uses the SessionStorage API on the client. * @@ -25,7 +27,7 @@ import {Storage, storageObjectSymbol} from "../storage.js"; * @memberOf Monster.Data.Datasource.Storage * @summary The LocalStorage class encapsulates the access to data objects. */ -export class SessionStorage extends Storage { +class SessionStorage extends Storage { /** * @throws {Error} this method must be implemented by derived classes. diff --git a/application/source/data/diff.js b/application/source/data/diff.js index 2871ab0adbcb8e1c757aa037086e255bbf0d7fdf..ad4d01b0dcc377867cad9e5a9ef0dfbe553e69aa 100644 --- a/application/source/data/diff.js +++ b/application/source/data/diff.js @@ -8,6 +8,8 @@ import {isArray, isObject} from "../types/is.js"; import {typeOf} from "../types/typeof.js"; +export {diff} + /** * With the diff function you can perform the change of one object to another. The result shows the changes of the second object to the first object. * @@ -69,7 +71,7 @@ import {typeOf} from "../types/typeof.js"; * @copyright schukai GmbH * @memberOf Monster.Data */ -export function diff(first, second) { +function diff(first, second) { return doDiff(first, second) } diff --git a/application/source/data/extend.js b/application/source/data/extend.js index 0fc6ce7e2d67935ecfcac7b8391b91ab9c837a95..51c81a2a4be6ef5d24ddcb2c13306491a2fedc9d 100644 --- a/application/source/data/extend.js +++ b/application/source/data/extend.js @@ -7,6 +7,8 @@ import {isArray, isObject} from "../types/is.js"; import {typeOf} from "../types/typeof.js"; +export {extend} + /** * Extend copies all enumerable own properties from one or * more source objects to a target object. It returns the modified target object. @@ -27,7 +29,7 @@ import {typeOf} from "../types/typeof.js"; * @throws {Error} unsupported argument * @throws {Error} type mismatch */ -export function extend() { +function extend() { let o, i; for (i = 0; i < arguments.length; i++) { diff --git a/application/source/data/namespace.js b/application/source/data/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..e7d47cd0ac5927d653e6ad1f9c98ffa7acfa5dae --- /dev/null +++ b/application/source/data/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * In this namespace you will find classes and methods for handling data. + * + * @namespace Monster.Data + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; \ No newline at end of file diff --git a/application/source/data/pathfinder.js b/application/source/data/pathfinder.js index 4b78c5f8e89f1aba985918a665d457a356be4eec..9900d218882be77a2d0c1d0b775a6109006306cc 100644 --- a/application/source/data/pathfinder.js +++ b/application/source/data/pathfinder.js @@ -9,19 +9,21 @@ import {isArray, isInteger, isObject, isPrimitive} from '../types/is.js'; import {Stack} from "../types/stack.js"; import {validateInteger, validateString} from '../types/validate.js'; +export {Pathfinder} + /** * path separator * * @private * @type {string} */ -export const DELIMITER = '.'; +const DELIMITER = '.'; /** * @private * @type {string} */ -export const WILDCARD = '*'; +const WILDCARD = '*'; /** * Pathfinder is a class to find a path to an object. @@ -120,7 +122,7 @@ export const WILDCARD = '*'; * @copyright schukai GmbH * @memberOf Monster.Data */ -export class Pathfinder extends Base { +class Pathfinder extends Base { /** * @param {array|object|Map|Set} value diff --git a/application/source/data/pipe.js b/application/source/data/pipe.js index c1c7dbe6935dd3014f5e669813bbd97f2cffc94b..ef2e58be847b4d3ab760ab4615935e0e5e8662fe 100644 --- a/application/source/data/pipe.js +++ b/application/source/data/pipe.js @@ -9,8 +9,9 @@ import {Base} from '../types/base.js'; import {validateString} from '../types/validate.js'; import {Transformer} from './transformer.js'; +export {Pipe} -export const DELIMITER = '|'; +const DELIMITER = '|'; /** * The pipe class makes it possible to combine several processing steps. @@ -47,7 +48,7 @@ export const DELIMITER = '|'; * @copyright schukai GmbH * @memberOf Monster.Data */ -export class Pipe extends Base { +class Pipe extends Base { /** * diff --git a/application/source/data/transformer.js b/application/source/data/transformer.js index ec84d48d8507d599f6f882b2416cf05276d37e35..f206d4892127b71d25cb9f3bbce7b2ed12997954 100644 --- a/application/source/data/transformer.js +++ b/application/source/data/transformer.js @@ -18,6 +18,8 @@ import { import {clone} from "../util/clone.js"; import {Pathfinder} from "./pathfinder.js"; +export {Transformer} + /** * The transformer class is a swiss army knife for manipulating values. especially in combination with the pipe, processing chains can be built up. * @@ -123,7 +125,7 @@ import {Pathfinder} from "./pathfinder.js"; * @copyright schukai GmbH * @memberOf Monster.Data */ -export class Transformer extends Base { +class Transformer extends Base { /** * * @param {string} definition diff --git a/application/source/dom/assembler.js b/application/source/dom/assembler.js index 176641040cbf4413ae162752521ce08c56a4a0ce..e04d9e2d0c14db60c3638ad6e5d930407d4c8a48 100644 --- a/application/source/dom/assembler.js +++ b/application/source/dom/assembler.js @@ -9,6 +9,7 @@ import {getGlobalFunction} from "../types/global.js"; import {ProxyObserver} from "../types/proxyobserver.js"; import {validateInstance, validateString} from "../types/validate.js"; +export {ATTRIBUTEPREFIX,Assembler} /** * attribute prefix @@ -16,7 +17,7 @@ import {validateInstance, validateString} from "../types/validate.js"; * @type {string} * @memberOf Monster.DOM */ -export const ATTRIBUTEPREFIX = "data-monster-"; +const ATTRIBUTEPREFIX = "data-monster-"; /** * you can call the method via the monster namespace `new Monster.DOM.Assembler()`. @@ -42,7 +43,7 @@ export const ATTRIBUTEPREFIX = "data-monster-"; * @memberOf Monster.DOM * @summary Allows you to build an html fragment */ -export class Assembler extends Base { +class Assembler extends Base { /** * @param {DocumentFragment} fragment diff --git a/application/source/dom/attributes.js b/application/source/dom/attributes.js index 88410c3f1fffb75674e9c3cd7ba419fdc1fcdc3e..18d7730fb9fdd36aaaa5db358161d957914662c6 100644 --- a/application/source/dom/attributes.js +++ b/application/source/dom/attributes.js @@ -10,6 +10,22 @@ import {TokenList} from "../types/tokenlist.js"; import {validateInstance, validateString, validateSymbol} from "../types/validate.js"; import {ATTRIBUTE_OBJECTLINK} from "./constants.js"; +export { + findClosestObjectLink, + addToObjectLink, + removeObjectLink, + hasObjectLink, + getLinkedObjects, + toggleAttributeToken, + addAttributeToken, + removeAttributeToken, + containsAttributeToken, + replaceAttributeToken, + clearAttributeTokens, + findClosestByAttribute, + findClosestByClass +} + /** * Get the closest object link of a node * @@ -30,13 +46,13 @@ import {ATTRIBUTE_OBJECTLINK} from "./constants.js"; * @memberOf Monster.DOM * @throws {TypeError} value is not an instance of HTMLElement */ -export function findClosestObjectLink(element) { +function findClosestObjectLink(element) { return findClosestByAttribute(element, ATTRIBUTE_OBJECTLINK); } /** * Adds a class attribute to an element. - * + * * ``` * <script type="module"> * import {addToObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; @@ -52,7 +68,7 @@ export function findClosestObjectLink(element) { * @param {Object} object * @return {boolean} */ -export function addToObjectLink(element, symbol, object) { +function addToObjectLink(element, symbol, object) { validateInstance(element, HTMLElement); validateSymbol(symbol) @@ -84,7 +100,7 @@ export function addToObjectLink(element, symbol, object) { * @param {Symbol} symbol * @return {boolean} */ -export function removeObjectLink(element, symbol) { +function removeObjectLink(element, symbol) { validateInstance(element, HTMLElement); validateSymbol(symbol) @@ -117,7 +133,7 @@ export function removeObjectLink(element, symbol) { * @param {Symbol} symbol * @return {boolean} */ -export function hasObjectLink(element, symbol) { +function hasObjectLink(element, symbol) { validateInstance(element, HTMLElement); validateSymbol(symbol) @@ -153,7 +169,7 @@ export function hasObjectLink(element, symbol) { * @return {Iterator} * @throws {Error} there is no object link for symbol */ -export function getLinkedObjects(element, symbol) { +function getLinkedObjects(element, symbol) { validateInstance(element, HTMLElement); validateSymbol(symbol) @@ -187,7 +203,7 @@ export function getLinkedObjects(element, symbol) { * @param {string} token * @return {HTMLElement} */ -export function toggleAttributeToken(element, key, token) { +function toggleAttributeToken(element, key, token) { validateInstance(element, HTMLElement); validateString(token) validateString(key) @@ -220,7 +236,7 @@ export function toggleAttributeToken(element, key, token) { * @param {string} token * @return {HTMLElement} */ -export function addAttributeToken(element, key, token) { +function addAttributeToken(element, key, token) { validateInstance(element, HTMLElement); validateString(token) validateString(key) @@ -255,7 +271,7 @@ export function addAttributeToken(element, key, token) { * @param {string} token * @return {HTMLElement} */ -export function removeAttributeToken(element, key, token) { +function removeAttributeToken(element, key, token) { validateInstance(element, HTMLElement); validateString(token) validateString(key) @@ -289,7 +305,7 @@ export function removeAttributeToken(element, key, token) { * @param {string} token * @return {boolean} */ -export function containsAttributeToken(element, key, token) { +function containsAttributeToken(element, key, token) { validateInstance(element, HTMLElement); validateString(token) validateString(key) @@ -321,7 +337,7 @@ export function containsAttributeToken(element, key, token) { * @param {string} to * @return {HTMLElement} */ -export function replaceAttributeToken(element, key, from, to) { +function replaceAttributeToken(element, key, from, to) { validateInstance(element, HTMLElement); validateString(from) validateString(to) @@ -353,7 +369,7 @@ export function replaceAttributeToken(element, key, from, to) { * @param {string} key * @return {HTMLElement} */ -export function clearAttributeTokens(element, key) { +function clearAttributeTokens(element, key) { validateInstance(element, HTMLElement); validateString(key) @@ -401,7 +417,7 @@ export function clearAttributeTokens(element, key) { * @return {HTMLElement|undefined} * @summary find closest node */ -export function findClosestByAttribute(element, key, value) { +function findClosestByAttribute(element, key, value) { validateInstance(element, getGlobalFunction('HTMLElement')); if (element.hasAttribute(key)) { @@ -454,7 +470,7 @@ export function findClosestByAttribute(element, key, value) { * @return {HTMLElement|undefined} * @summary find closest node */ -export function findClosestByClass(element, className) { +function findClosestByClass(element, className) { validateInstance(element, getGlobalFunction('HTMLElement')); if (element?.classList?.contains(validateString(className))) { @@ -465,6 +481,6 @@ export function findClosestByClass(element, className) { if (result instanceof HTMLElement) { return result; } - + return undefined; } diff --git a/application/source/dom/constants.js b/application/source/dom/constants.js index 42a2c33ba353f122702ad71b4f9cffc228f71541..77377ca4c71431956437625a45abfe0f6c00facd 100644 --- a/application/source/dom/constants.js +++ b/application/source/dom/constants.js @@ -5,20 +5,75 @@ import {Monster} from '../namespace.js'; * @author schukai GmbH */ +export { + DEFAULT_THEME, + ATTRIBUTE_PREFIX, + ATTRIBUTE_OPTIONS, + ATTRIBUTE_OPTIONS_SELECTOR, + ATTRIBUTE_THEME_PREFIX, + ATTRIBUTE_THEME_NAME, + ATTRIBUTE_UPDATER_ATTRIBUTES, + ATTRIBUTE_UPDATER_SELECT_THIS, + ATTRIBUTE_UPDATER_REPLACE, + ATTRIBUTE_UPDATER_INSERT, + ATTRIBUTE_UPDATER_INSERT_REFERENCE, + ATTRIBUTE_UPDATER_REMOVE, + ATTRIBUTE_UPDATER_BIND, + ATTRIBUTE_TEMPLATE_PREFIX, + ATTRIBUTE_ROLE, + ATTRIBUTE_DISABLED, + ATTRIBUTE_VALUE, + ATTRIBUTE_OBJECTLINK, + ATTRIBUTE_ERRORMESSAGE, + TAG_SCRIPT, + TAG_STYLE, + TAG_LINK, + ATTRIBUTE_ID, + ATTRIBUTE_CLASS, + ATTRIBUTE_TITLE, + ATTRIBUTE_SRC, + ATTRIBUTE_HREF, + ATTRIBUTE_TYPE, + ATTRIBUTE_NONCE, + ATTRIBUTE_TRANSLATE, + ATTRIBUTE_TABINDEX, + ATTRIBUTE_SPELLCHECK, + ATTRIBUTE_SLOT, + ATTRIBUTE_PART, + ATTRIBUTE_LANG, + ATTRIBUTE_ITEMTYPE, + ATTRIBUTE_ITEMSCOPE, + ATTRIBUTE_ITEMREF, + ATTRIBUTE_ITEMID, + ATTRIBUTE_ITEMPROP, + ATTRIBUTE_IS, + ATTRIBUTE_INPUTMODE, + ATTRIBUTE_ACCESSKEY, + ATTRIBUTE_AUTOCAPITALIZE, + ATTRIBUTE_AUTOFOCUS, + ATTRIBUTE_CONTENTEDITABLE, + ATTRIBUTE_DIR, + ATTRIBUTE_DRAGGABLE, + ATTRIBUTE_ENTERKEYHINT, + ATTRIBUTE_EXPORTPARTS, + ATTRIBUTE_HIDDEN, + objectUpdaterLinkSymbol, + +} /** * default theme * @memberOf Monster.DOM * @type {string} */ -export const DEFAULT_THEME = 'monster'; +const DEFAULT_THEME = 'monster'; /** * @memberOf Monster.DOM * @since 1.8.0 * @type {string} */ -export const ATTRIBUTE_PREFIX = 'data-monster-'; +const ATTRIBUTE_PREFIX = 'data-monster-'; /** * This is the name of the attribute to pass options to a control @@ -27,7 +82,7 @@ export const ATTRIBUTE_PREFIX = 'data-monster-'; * @since 1.8.0 * @type {string} */ -export const ATTRIBUTE_OPTIONS = ATTRIBUTE_PREFIX + 'options'; +const ATTRIBUTE_OPTIONS = ATTRIBUTE_PREFIX + 'options'; /** * This is the name of the attribute to pass options to a control @@ -36,139 +91,139 @@ export const ATTRIBUTE_OPTIONS = ATTRIBUTE_PREFIX + 'options'; * @since 1.30.0 * @type {string} */ -export const ATTRIBUTE_OPTIONS_SELECTOR = ATTRIBUTE_PREFIX + 'options-selector'; +const ATTRIBUTE_OPTIONS_SELECTOR = ATTRIBUTE_PREFIX + 'options-selector'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -export const ATTRIBUTE_THEME_PREFIX = ATTRIBUTE_PREFIX + 'theme-'; +const ATTRIBUTE_THEME_PREFIX = ATTRIBUTE_PREFIX + 'theme-'; /** * @memberOf Monster.DOM * @type {string} */ -export const ATTRIBUTE_THEME_NAME = ATTRIBUTE_THEME_PREFIX + 'name'; +const ATTRIBUTE_THEME_NAME = ATTRIBUTE_THEME_PREFIX + 'name'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -export const ATTRIBUTE_UPDATER_ATTRIBUTES = ATTRIBUTE_PREFIX + 'attributes'; +const ATTRIBUTE_UPDATER_ATTRIBUTES = ATTRIBUTE_PREFIX + 'attributes'; /** * @memberOf Monster.DOM * @type {string} * @since 1.27.1 */ -export const ATTRIBUTE_UPDATER_SELECT_THIS = ATTRIBUTE_PREFIX + 'select-this'; +const ATTRIBUTE_UPDATER_SELECT_THIS = ATTRIBUTE_PREFIX + 'select-this'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -export const ATTRIBUTE_UPDATER_REPLACE = ATTRIBUTE_PREFIX + 'replace'; +const ATTRIBUTE_UPDATER_REPLACE = ATTRIBUTE_PREFIX + 'replace'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -export const ATTRIBUTE_UPDATER_INSERT = ATTRIBUTE_PREFIX + 'insert'; +const ATTRIBUTE_UPDATER_INSERT = ATTRIBUTE_PREFIX + 'insert'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -export const ATTRIBUTE_UPDATER_INSERT_REFERENCE = ATTRIBUTE_PREFIX + 'insert-reference'; +const ATTRIBUTE_UPDATER_INSERT_REFERENCE = ATTRIBUTE_PREFIX + 'insert-reference'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -export const ATTRIBUTE_UPDATER_REMOVE = ATTRIBUTE_PREFIX + 'remove'; +const ATTRIBUTE_UPDATER_REMOVE = ATTRIBUTE_PREFIX + 'remove'; /** * @memberOf Monster.DOM * @type {string} * @since 1.9.0 */ -export const ATTRIBUTE_UPDATER_BIND = ATTRIBUTE_PREFIX + 'bind'; +const ATTRIBUTE_UPDATER_BIND = ATTRIBUTE_PREFIX + 'bind'; /** * @memberOf Monster.DOM * @type {string} * @since 1.27.0 */ -export const ATTRIBUTE_TEMPLATE_PREFIX = ATTRIBUTE_PREFIX + 'template-prefix'; +const ATTRIBUTE_TEMPLATE_PREFIX = ATTRIBUTE_PREFIX + 'template-prefix'; /** * @memberOf Monster.DOM * @type {string} * @since 1.14.0 */ -export const ATTRIBUTE_ROLE = ATTRIBUTE_PREFIX + 'role'; +const ATTRIBUTE_ROLE = ATTRIBUTE_PREFIX + 'role'; /** * @memberOf Monster.DOM * @type {string} * @since 1.24.0 */ -export const ATTRIBUTE_DISABLED = 'disabled'; +const ATTRIBUTE_DISABLED = 'disabled'; /** * @memberOf Monster.DOM * @type {string} * @since 1.24.0 */ -export const ATTRIBUTE_VALUE = 'value'; +const ATTRIBUTE_VALUE = 'value'; /** * @memberOf Monster.DOM * @type {string} * @since 1.9.0 */ -export const ATTRIBUTE_OBJECTLINK = ATTRIBUTE_PREFIX + 'objectlink'; +const ATTRIBUTE_OBJECTLINK = ATTRIBUTE_PREFIX + 'objectlink'; /** * @memberOf Monster.DOM * @type {string} * @since 1.24.0 */ -export const ATTRIBUTE_ERRORMESSAGE = ATTRIBUTE_PREFIX + 'error'; +const ATTRIBUTE_ERRORMESSAGE = ATTRIBUTE_PREFIX + 'error'; /** * @memberOf Monster.DOM * @type {symbol} * @since 1.24.0 */ -export const objectUpdaterLinkSymbol = Symbol('monsterUpdater'); +const objectUpdaterLinkSymbol = Symbol('monsterUpdater'); /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const TAG_SCRIPT = 'script'; +const TAG_SCRIPT = 'script'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const TAG_STYLE = 'style'; +const TAG_STYLE = 'style'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const TAG_LINK = 'link'; +const TAG_LINK = 'link'; /** * @memberOf Monster.DOM @@ -176,7 +231,7 @@ export const TAG_LINK = 'link'; * @since 1.25.0 */ -export const ATTRIBUTE_ID = 'id'; +const ATTRIBUTE_ID = 'id'; /** * @memberOf Monster.DOM @@ -184,48 +239,48 @@ export const ATTRIBUTE_ID = 'id'; * @since 1.25.0 */ -export const ATTRIBUTE_CLASS = 'class'; +const ATTRIBUTE_CLASS = 'class'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_TITLE = 'title'; +const ATTRIBUTE_TITLE = 'title'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_SRC = 'src'; +const ATTRIBUTE_SRC = 'src'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_HREF = 'href'; +const ATTRIBUTE_HREF = 'href'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_TYPE = 'type'; +const ATTRIBUTE_TYPE = 'type'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_NONCE = 'nonce'; +const ATTRIBUTE_NONCE = 'nonce'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_TRANSLATE = 'translate'; +const ATTRIBUTE_TRANSLATE = 'translate'; /** @@ -233,7 +288,7 @@ export const ATTRIBUTE_TRANSLATE = 'translate'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_TABINDEX = 'tabindex'; +const ATTRIBUTE_TABINDEX = 'tabindex'; /** @@ -241,7 +296,7 @@ export const ATTRIBUTE_TABINDEX = 'tabindex'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_SPELLCHECK = 'spellcheck'; +const ATTRIBUTE_SPELLCHECK = 'spellcheck'; /** @@ -249,7 +304,7 @@ export const ATTRIBUTE_SPELLCHECK = 'spellcheck'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_SLOT = 'slot'; +const ATTRIBUTE_SLOT = 'slot'; /** @@ -257,7 +312,7 @@ export const ATTRIBUTE_SLOT = 'slot'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_PART = 'part'; +const ATTRIBUTE_PART = 'part'; /** @@ -265,7 +320,7 @@ export const ATTRIBUTE_PART = 'part'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_LANG = 'lang'; +const ATTRIBUTE_LANG = 'lang'; /** @@ -273,7 +328,7 @@ export const ATTRIBUTE_LANG = 'lang'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_ITEMTYPE = 'itemtype'; +const ATTRIBUTE_ITEMTYPE = 'itemtype'; /** @@ -281,7 +336,7 @@ export const ATTRIBUTE_ITEMTYPE = 'itemtype'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_ITEMSCOPE = 'itemscope'; +const ATTRIBUTE_ITEMSCOPE = 'itemscope'; /** @@ -289,7 +344,7 @@ export const ATTRIBUTE_ITEMSCOPE = 'itemscope'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_ITEMREF = 'itemref'; +const ATTRIBUTE_ITEMREF = 'itemref'; /** @@ -297,7 +352,7 @@ export const ATTRIBUTE_ITEMREF = 'itemref'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_ITEMID = 'itemid'; +const ATTRIBUTE_ITEMID = 'itemid'; /** @@ -305,7 +360,7 @@ export const ATTRIBUTE_ITEMID = 'itemid'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_ITEMPROP = 'itemprop'; +const ATTRIBUTE_ITEMPROP = 'itemprop'; /** @@ -313,7 +368,7 @@ export const ATTRIBUTE_ITEMPROP = 'itemprop'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_IS = 'is'; +const ATTRIBUTE_IS = 'is'; /** @@ -321,7 +376,7 @@ export const ATTRIBUTE_IS = 'is'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_INPUTMODE = 'inputmode'; +const ATTRIBUTE_INPUTMODE = 'inputmode'; /** @@ -329,42 +384,42 @@ export const ATTRIBUTE_INPUTMODE = 'inputmode'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_ACCESSKEY = 'accesskey'; +const ATTRIBUTE_ACCESSKEY = 'accesskey'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_AUTOCAPITALIZE = 'autocapitalize'; +const ATTRIBUTE_AUTOCAPITALIZE = 'autocapitalize'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_AUTOFOCUS = 'autofocus'; +const ATTRIBUTE_AUTOFOCUS = 'autofocus'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_CONTENTEDITABLE = 'contenteditable'; +const ATTRIBUTE_CONTENTEDITABLE = 'contenteditable'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_DIR = 'dir'; +const ATTRIBUTE_DIR = 'dir'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_DRAGGABLE = 'draggable'; +const ATTRIBUTE_DRAGGABLE = 'draggable'; /** @@ -372,16 +427,16 @@ export const ATTRIBUTE_DRAGGABLE = 'draggable'; * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_ENTERKEYHINT = 'enterkeyhint'; +const ATTRIBUTE_ENTERKEYHINT = 'enterkeyhint'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_EXPORTPARTS = 'exportparts'; +const ATTRIBUTE_EXPORTPARTS = 'exportparts'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -export const ATTRIBUTE_HIDDEN = 'hidden'; +const ATTRIBUTE_HIDDEN = 'hidden'; diff --git a/application/source/dom/customcontrol.js b/application/source/dom/customcontrol.js index b25a1e61525907f129f4331d2ff08b42bc4a2d3a..594b31a94b8aee9fb4c078f919119028f9ec303b 100644 --- a/application/source/dom/customcontrol.js +++ b/application/source/dom/customcontrol.js @@ -8,6 +8,7 @@ import {extend} from "../data/extend.js"; import {ATTRIBUTE_VALUE} from "./constants.js"; import {CustomElement, attributeObserverSymbol} from "./customelement.js"; +export {CustomControl} /** * @private @@ -50,7 +51,7 @@ const attachedInternalSymbol = Symbol('attachedInternal'); * @copyright schukai GmbH * @memberOf Monster.DOM */ -export class CustomControl extends CustomElement { +class CustomControl extends CustomElement { /** * IMPORTANT: CustomControls instances are not created via the constructor, but either via a tag in the HTML or via <code>document.createElement()</code>. diff --git a/application/source/dom/customelement.js b/application/source/dom/customelement.js index b4c609d12f9a0207cf8de898547ba01e914c95e3..f5c60389bf2414932809eb548a6186662b54fed0 100644 --- a/application/source/dom/customelement.js +++ b/application/source/dom/customelement.js @@ -26,25 +26,26 @@ import { import {findDocumentTemplate, Template} from "./template.js"; import {Updater} from "./updater.js"; +export {CustomElement, initMethodSymbol, assembleMethodSymbol, attributeObserverSymbol} /** * @memberOf Monster.DOM * @type {symbol} */ -export const initMethodSymbol = Symbol('initMethodSymbol'); +const initMethodSymbol = Symbol('initMethodSymbol'); /** * @memberOf Monster.DOM * @type {symbol} */ -export const assembleMethodSymbol = Symbol('assembleMethodSymbol'); +const assembleMethodSymbol = Symbol('assembleMethodSymbol'); /** * this symbol holds the attribute observer callbacks. The key is the attribute name. * @memberOf Monster.DOM * @type {symbol} */ -export const attributeObserverSymbol = Symbol('attributeObserver'); +const attributeObserverSymbol = Symbol('attributeObserver'); /** @@ -196,7 +197,7 @@ export const attributeObserverSymbol = Symbol('attributeObserver'); * @extends external:HTMLElement * @summary A base class for HTML5 customcontrols */ -export class CustomElement extends HTMLElement { +class CustomElement extends HTMLElement { /** * A new object is created. First the `initOptions` method is called. Here the diff --git a/application/source/dom/events.js b/application/source/dom/events.js index 4ae37ecb2a71773a4132ee8fe4d9c833f3ef61b6..11b23ac8911b423d10ad23c089cc368cb8da89bf 100644 --- a/application/source/dom/events.js +++ b/application/source/dom/events.js @@ -5,13 +5,15 @@ * @author schukai GmbH */ -import {isArray,isObject} from "../types/is.js"; +import {isArray, isObject} from "../types/is.js"; import {validateInstance, validateString} from "../types/validate.js"; import {getDocument} from "./util.js"; +export {fireEvent, fireCustomEvent, findTargetElementFromEvent} + /** * The function sends an event - * + * * ``` * <script type="module"> * import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/events.js'; @@ -28,7 +30,7 @@ import {getDocument} from "./util.js"; * @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection * @summary Construct and send and event */ -export function fireEvent(element, type) { +function fireEvent(element, type) { const document = getDocument(); @@ -75,7 +77,7 @@ export function fireEvent(element, type) { * @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection * @summary Construct and send and event */ -export function fireCustomEvent(element, type, detail) { +function fireCustomEvent(element, type, detail) { const document = getDocument(); @@ -125,7 +127,7 @@ export function fireCustomEvent(element, type, detail) { * @throws {TypeError} value is not an instance of HTMLElement * @summary Help function to find the appropriate control */ -export function findTargetElementFromEvent(event, attributeName, attributeValue) { +function findTargetElementFromEvent(event, attributeName, attributeValue) { validateInstance(event, Event); if (typeof event.composedPath !== 'function') { diff --git a/application/source/dom/focusmanager.js b/application/source/dom/focusmanager.js index d34e487d4f39fd07d28e6a3b17b5a043480a9770..f6cf19ac97b80239e78447f1e91b4b24483a14b1 100644 --- a/application/source/dom/focusmanager.js +++ b/application/source/dom/focusmanager.js @@ -5,15 +5,15 @@ * @author schukai GmbH */ - import {extend} from "../data/extend.js"; -import {assignToNamespace} from "../namespace.js"; import {BaseWithOptions} from "../types/basewithoptions.js"; import {getGlobalObject} from "../types/global.js"; import {isArray} from "../types/is.js"; import {Stack} from "../types/stack.js"; import {validateInstance, validateString} from "../types/validate.js"; +export {FocusManager} + /** * @private * @type {string} @@ -50,7 +50,7 @@ const stackSymbol = Symbol('stack'); * @throws {Error} unsupported locale * @summary Handle the focus */ -export class FocusManager extends BaseWithOptions { + class FocusManager extends BaseWithOptions { /** * diff --git a/application/source/dom/locale.js b/application/source/dom/locale.js index 255bf04b953d9fde985dfd89c6e829abc8541296..d9853f6f3883a937848d81458322bcf656496ef1 100644 --- a/application/source/dom/locale.js +++ b/application/source/dom/locale.js @@ -8,16 +8,18 @@ import {parseLocale} from "../i18n/locale.js"; import {getDocument} from "./util.js"; +export {getLocaleOfDocument} + /** * @private * @type {string} */ -export const DEFAULT_LANGUAGE = 'en'; +const DEFAULT_LANGUAGE = 'en'; /** * With this function you can read the language version set by the document. * For this the attribute `lang` in the html tag is read. If no attribute is set, `en` is used as default. - * + * * ```html * <html lang="en"> * ``` @@ -38,7 +40,7 @@ export const DEFAULT_LANGUAGE = 'en'; * @throws {Error} unsupported locale * @summary Tries to determine the locale used */ -export function getLocaleOfDocument() { +function getLocaleOfDocument() { const document = getDocument(); diff --git a/application/source/dom/namespace.js b/application/source/dom/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..8545b9dfb965473b66983891b3b0e7716e5b0d37 --- /dev/null +++ b/application/source/dom/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * In this namespace you will find classes and methods for handling the DOM. + * + * @namespace Monster.DOM + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; \ No newline at end of file diff --git a/application/source/dom/ready.js b/application/source/dom/ready.js index 0d03d0e5280d395ad378ca61507678b83dd5e6d0..788abe4f9bb5e6db2d15aa8e780a3fd36185a60b 100644 --- a/application/source/dom/ready.js +++ b/application/source/dom/ready.js @@ -9,10 +9,12 @@ import {Monster} from '../namespace.js'; import {getDocument, getWindow} from "./util.js"; +export {domReady, windowReady} + /** * This variable is a promise that is fulfilled as soon as the dom is available. * - * The DOMContentLoaded event is fired when the original HTML document is fully loaded and parsed + * The DOMContentLoaded event is fired when the original HTML document is fully loaded and parsed * without waiting for stylesheets, images, and subframes to finish loading. * * ``` @@ -31,7 +33,7 @@ import {getDocument, getWindow} from "./util.js"; * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState */ -export const domReady = new Promise(resolve => { +const domReady = new Promise(resolve => { const document = getDocument(); @@ -46,8 +48,8 @@ export const domReady = new Promise(resolve => { /** * This variable is a promise that is fulfilled as soon as the windows is available. * - * The load event fires when the entire page is loaded, including all dependent resources such as stylesheets, - * assets, and images. Unlike DOMContentLoaded, which fires as soon as the DOM of the page is loaded, + * The load event fires when the entire page is loaded, including all dependent resources such as stylesheets, + * assets, and images. Unlike DOMContentLoaded, which fires as soon as the DOM of the page is loaded, * without waiting for the resources to finish loading. * * ``` @@ -66,11 +68,11 @@ export const domReady = new Promise(resolve => { * @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState */ -export const windowReady = new Promise(resolve => { +const windowReady = new Promise(resolve => { const document = getDocument(); const window = getWindow(); - + if (document.readyState === 'complete') { resolve(); } else { diff --git a/application/source/dom/resource.js b/application/source/dom/resource.js index cc038a96197a7dbf0aa28b6a729c65fc9b31bec5..19520bf5bcbf08b2d329bc3f106339a043e3ba8d 100644 --- a/application/source/dom/resource.js +++ b/application/source/dom/resource.js @@ -15,30 +15,31 @@ import {Observer} from "../types/observer.js"; import {ProxyObserver} from "../types/proxyobserver.js"; import {ATTRIBUTE_CLASS, ATTRIBUTE_ID, ATTRIBUTE_TITLE} from "./constants.js"; +export {Resource} /** * @private * @type {string} */ -export const KEY_DOCUMENT = 'document'; +const KEY_DOCUMENT = 'document'; /** * @private * @type {string} */ -export const KEY_QUERY = 'query'; +const KEY_QUERY = 'query'; /** * @private * @type {string} */ -export const KEY_TIMEOUT = 'timeout'; +const KEY_TIMEOUT = 'timeout'; /** * @private * @type {symbol} */ -export const referenceSymbol = Symbol('reference'); + const referenceSymbol = Symbol('reference'); /** * This class is the base class for all resources to be loaded. @@ -55,7 +56,7 @@ export const referenceSymbol = Symbol('reference'); * @memberOf Monster.DOM * @summary A Resource class */ -export class Resource extends BaseWithOptions { + class Resource extends BaseWithOptions { /** * diff --git a/application/source/dom/resource/data.js b/application/source/dom/resource/data.js index a2354b864ec6c4c5af95b7001b6b2394ec832761..25d4393fb2d82f17ecbfac1f6014c4dade27b70e 100644 --- a/application/source/dom/resource/data.js +++ b/application/source/dom/resource/data.js @@ -19,6 +19,8 @@ import { } from "../constants.js"; import {KEY_DOCUMENT, KEY_QUERY, referenceSymbol, Resource} from "../resource.js"; +export {Data} + /** * This class is used by the resource manager to embed data. * @@ -34,7 +36,7 @@ import {KEY_DOCUMENT, KEY_QUERY, referenceSymbol, Resource} from "../resource.js * @memberOf Monster.DOM.Resource * @summary A Data Resource class */ -export class Data extends Resource { +class Data extends Resource { /** * @property {string} mode=cors https://developer.mozilla.org/en-US/docs/Web/API/fetch diff --git a/application/source/dom/resource/link.js b/application/source/dom/resource/link.js index 6abdfa0d0ee5517d085dd4df3df745bc4dbb1e9a..465fa28426998f03043096091496896f860feac7 100644 --- a/application/source/dom/resource/link.js +++ b/application/source/dom/resource/link.js @@ -16,6 +16,7 @@ import { } from "../constants.js"; import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js"; +export {Link} /** * This class is used by the resource manager to embed external resources. @@ -33,7 +34,7 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js"; * @summary A Resource class * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link */ -export class Link extends Resource { +class Link extends Resource { /** * @property {string} as {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as} diff --git a/application/source/dom/resource/link/namespace.js b/application/source/dom/resource/link/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..0ca9a65ae0b290b20d169063349a8a29d4595c6e --- /dev/null +++ b/application/source/dom/resource/link/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * In this namespace you will find classes and methods for links + * + * @namespace Monster.DOM.Resource.Link + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; \ No newline at end of file diff --git a/application/source/dom/resource/link/stylesheet.js b/application/source/dom/resource/link/stylesheet.js index e132ef44d6f0f9854a2b040d83c9e12e64dbe370..63704639c528f2bc79953192306f27aad5411ab6 100644 --- a/application/source/dom/resource/link/stylesheet.js +++ b/application/source/dom/resource/link/stylesheet.js @@ -8,6 +8,7 @@ import {extend} from "../../../data/extend.js"; import {assignToNamespace, Monster} from "../../../namespace.js"; import {Link} from "../link.js"; +export {Stylesheet} /** * This class is used by the resource manager to embed external resources. @@ -25,7 +26,7 @@ import {Link} from "../link.js"; * @summary A Resource class * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link */ -export class Stylesheet extends Link { +class Stylesheet extends Link { /** * @property {string} rel {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-rel} diff --git a/application/source/dom/resource/namespace.js b/application/source/dom/resource/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..b4699df5a8d92e85bdb04f9dddcc5d95113af860 --- /dev/null +++ b/application/source/dom/resource/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * In this namespace you will find classes and methods for handling resources. + * + * @namespace Monster.DOM.Resource + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; diff --git a/application/source/dom/resource/script.js b/application/source/dom/resource/script.js index 17512eef48ebcb53b26d8468358d3a2f621447b0..08ac95ee584e3e19a25473c102c19b0e5bb8d2d6 100644 --- a/application/source/dom/resource/script.js +++ b/application/source/dom/resource/script.js @@ -17,6 +17,7 @@ import { } from "../constants.js"; import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js"; +export {Script} /** * This class is used by the resource manager to embed scripts. @@ -33,7 +34,7 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js"; * @memberOf Monster.DOM.Resource * @summary A Resource class */ -export class Script extends Resource { +class Script extends Resource { /** * @property {boolean} async=true {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async} diff --git a/application/source/dom/resourcemanager.js b/application/source/dom/resourcemanager.js index d754a42d93e82e927add5e2898130d7e94ec248c..91df19a9d5e3c13e4a5ecd89a9eadbb35db21220 100644 --- a/application/source/dom/resourcemanager.js +++ b/application/source/dom/resourcemanager.js @@ -15,6 +15,7 @@ import {Data} from "./resource/data.js"; import {Stylesheet} from "./resource/link/stylesheet.js"; import {Script} from "./resource/script.js"; +export {ResourceManager} /** * The ResourceManager is a singleton that manages all resources. @@ -31,7 +32,7 @@ import {Script} from "./resource/script.js"; * @memberOf Monster.DOM * @summary A Resource class */ -export class ResourceManager extends BaseWithOptions { + class ResourceManager extends BaseWithOptions { /** * diff --git a/application/source/dom/template.js b/application/source/dom/template.js index 834b11ccbc0e13693c00c191c01e327302f993c6..cc4750a6e01e3192bc896b9887a89daf1b58474f 100644 --- a/application/source/dom/template.js +++ b/application/source/dom/template.js @@ -10,9 +10,11 @@ import {validateInstance, validateString} from "../types/validate.js"; import {ATTRIBUTE_TEMPLATE_PREFIX} from "./constants.js"; import {getDocumentTheme} from "./theme.js"; +export {Template} + /** * The template class provides methods for creating templates. - * + * * ``` * <script type="module"> * import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/template.js'; @@ -25,7 +27,7 @@ import {getDocumentTheme} from "./theme.js"; * @memberOf Monster.DOM * @summary A template class */ -export class Template extends Base { +class Template extends Base { /** * * @param {HTMLTemplateElement} template diff --git a/application/source/dom/theme.js b/application/source/dom/theme.js index 33e95a671d0b474345d0719efaa198954eb8a71a..014d3a6a659d7faf4908436f72526955451ecce2 100644 --- a/application/source/dom/theme.js +++ b/application/source/dom/theme.js @@ -9,10 +9,11 @@ import {getGlobalObject} from '../types/global.js'; import {validateString} from "../types/validate.js"; import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js"; +export {Theme, getDocumentTheme} /** * The Theme class provides the functionality for the theme. - * + * * ``` * <script type="module"> * import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/theme.js'; @@ -33,7 +34,7 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js"; * @memberOf Monster.DOM * @summary A theme class */ -export class Theme extends Base { +class Theme extends Base { /** * @@ -72,7 +73,7 @@ export class Theme extends Base { * @memberOf Monster.DOM * @since 1.7.0 */ -export function getDocumentTheme() { +function getDocumentTheme() { let document = getGlobalObject('document'); let name = DEFAULT_THEME; diff --git a/application/source/dom/updater.js b/application/source/dom/updater.js index cfd51de57d3830a16351595cfd857935d05b54ed..a08904c259aa3eaae8b9a278df573360339cd89f 100644 --- a/application/source/dom/updater.js +++ b/application/source/dom/updater.js @@ -30,6 +30,7 @@ import {findTargetElementFromEvent} from "./events.js"; import {findDocumentTemplate} from "./template.js"; import {getDocument} from "./util.js"; +export {Updater} /** * The updater class connects an object with the dom. In this way, structures and contents in the DOM can be programmatically adapted via attributes. @@ -84,7 +85,7 @@ import {getDocument} from "./util.js"; * @throws {TypeError} value is not an instance of HTMLElement * @summary The updater class connects an object with the dom */ -export class Updater extends Base { +class Updater extends Base { /** * @since 1.8.0 @@ -693,7 +694,7 @@ function runUpdateContent(container, parts, subject) { while (element.firstChild) { element.removeChild(element.firstChild); } - + try { element.appendChild(value); } catch (e) { diff --git a/application/source/dom/util.js b/application/source/dom/util.js index 6e6fb7b350c1872daf413aa7d8fe5452866491aa..917c231defc99fe7df73bdfc21f5d1602bf76e6f 100644 --- a/application/source/dom/util.js +++ b/application/source/dom/util.js @@ -7,6 +7,8 @@ import {getGlobal} from "../types/global.js"; import {validateString} from "../types/validate.js"; +export {getDocument, getWindow, getDocumentFragmentFromString} + /** * this method fetches the document object * @@ -50,7 +52,7 @@ import {validateString} from "../types/validate.js"; * @memberOf Monster.DOM * @throws {Error} not supported environment */ -export function getDocument() { +function getDocument() { let document = getGlobal()?.['document']; if (typeof document !== 'object') { throw new Error("not supported environment") @@ -104,7 +106,7 @@ export function getDocument() { * @memberOf Monster.DOM * @throws {Error} not supported environment */ -export function getWindow() { +function getWindow() { let window = getGlobal()?.['window']; if (typeof window !== 'object') { throw new Error("not supported environment") @@ -158,7 +160,7 @@ export function getWindow() { * @throws {Error} not supported environment * @throws {TypeError} value is not a string */ -export function getDocumentFragmentFromString(html) { +function getDocumentFragmentFromString(html) { validateString(html); const document = getDocument(); diff --git a/application/source/dom/worker/factory.js b/application/source/dom/worker/factory.js index 28226d02d2ae69bd601bb740b6e8d80a4007056b..f0522b552af0afb1107cf5df52eecefb08945ac6 100644 --- a/application/source/dom/worker/factory.js +++ b/application/source/dom/worker/factory.js @@ -13,6 +13,8 @@ import {getGlobal, getGlobalFunction} from "../../types/global.js"; import {isFunction} from "../../types/is.js"; import {validateInstance, validateString} from "../../types/validate.js"; +export {Factory} + /** * A factory for creating worker instances. * @@ -28,7 +30,7 @@ import {validateInstance, validateString} from "../../types/validate.js"; * @memberOf Monster.DOM.Worker * @summary A small factory to create worker */ -export class Factory extends Base { +class Factory extends Base { /** diff --git a/application/source/dom/worker/namespace.js b/application/source/dom/worker/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..b5f5430ee9df9ec076c305b4dfe6fe9918713952 --- /dev/null +++ b/application/source/dom/worker/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * In this namespace you will find classes and methods for handling the DOM. + * + * @namespace Monster.DOM.Worker + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; \ No newline at end of file diff --git a/application/source/i18n/formatter.js b/application/source/i18n/formatter.js index ab65ed7bee49498482c50ba7267ac02d8c374175..946114153209425ce02481e223453004e6a462e9 100644 --- a/application/source/i18n/formatter.js +++ b/application/source/i18n/formatter.js @@ -12,6 +12,8 @@ import {Formatter as TextFormatter} from "../text/formatter.js"; import {validateInstance, validateString} from "../types/validate.js"; import {Translations} from "./translations.js"; +export {Formatter} + /** * @private * @type {symbol} @@ -45,7 +47,7 @@ const internalTranslationSymbol = Symbol('internalTranslation') * @copyright schukai GmbH * @memberOf Monster.I18n */ -export class Formatter extends TextFormatter { +class Formatter extends TextFormatter { /** * Default values for the markers are `${` and `}` diff --git a/application/source/i18n/locale.js b/application/source/i18n/locale.js index ad36f18b00f7d0d7e1ba105f082230aeb3626381..34a1f8691b4fbc3f15419f048545064760a2fa7f 100644 --- a/application/source/i18n/locale.js +++ b/application/source/i18n/locale.js @@ -8,6 +8,8 @@ import {Base} from "../types/base.js"; import {validateString} from "../types/validate.js"; import {clone} from "../util/clone.js"; +export {Locale, parseLocale} + /** * @memberOf Monster.I18n * @type {symbol} @@ -22,7 +24,7 @@ const localeStringSymbol = Symbol('localeString'); /** * The Locale class is a base class for the language classes. - * + * * ``` * <script type="module"> * import {Locale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/locale.js'; @@ -66,7 +68,7 @@ const localeStringSymbol = Symbol('localeString'); * @memberOf Monster.I18n * @see https://datatracker.ietf.org/doc/html/rfc3066 */ -export class Locale extends Base { +class Locale extends Base { /** * @param {string} language @@ -264,7 +266,7 @@ export class Locale extends Base { * @throws {TypeError} value is not a string * @throws {Error} unsupported locale */ -export function parseLocale(locale) { +function parseLocale(locale) { locale = validateString(locale).replace(/_/g, "-"); diff --git a/application/source/i18n/namespace.js b/application/source/i18n/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..4088de51a39ec021f75baeca46caffb54e85a1e1 --- /dev/null +++ b/application/source/i18n/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * In this namespace you will find classes and methods for handling locale and localized texts. + * + * @namespace Monster.I18n + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; \ No newline at end of file diff --git a/application/source/i18n/provider.js b/application/source/i18n/provider.js index 7316dd185e6b04670c99502067088c9b4310b5ad..c0d14f6905ae8910f419738836c2ffd0317d7cbb 100644 --- a/application/source/i18n/provider.js +++ b/application/source/i18n/provider.js @@ -8,9 +8,11 @@ import {BaseWithOptions} from "../types/basewithoptions.js"; import {Locale} from "./locale.js" import {Translations} from "./translations.js" +export {Provider} + /** * A provider makes a translation object available. - * + * * ``` * <script type="module"> * import {Provider} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/provider.js'; @@ -23,7 +25,7 @@ import {Translations} from "./translations.js" * @memberOf Monster.I18n * @see {@link https://datatracker.ietf.org/doc/html/rfc3066} */ -export class Provider extends BaseWithOptions { +class Provider extends BaseWithOptions { /** * @param {Locale|string} locale diff --git a/application/source/i18n/providers/fetch.js b/application/source/i18n/providers/fetch.js index ec4647857bc6bf86e854fd78fbc567d59378cdc3..3329929e05f37981fc9e3a4170ac20704b4b4950 100644 --- a/application/source/i18n/providers/fetch.js +++ b/application/source/i18n/providers/fetch.js @@ -15,6 +15,8 @@ import {parseLocale} from "../locale.js"; import {Provider} from "../provider.js"; import {Translations} from "../translations.js"; +export {Fetch} + /** * The fetch provider retrieves a JSON file from the given URL and returns a translation object. * @@ -39,7 +41,7 @@ import {Translations} from "../translations.js"; * @see {@link https://datatracker.ietf.org/doc/html/rfc3066} * @tutorial i18n-locale-and-formatter */ -export class Fetch extends Provider { + class Fetch extends Provider { /** * As options the key `fetch` can be passed. This config object is passed to the fetch method as init. diff --git a/application/source/i18n/providers/namespace.js b/application/source/i18n/providers/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..b02a90f7f2d09801bef1cfcd1c6eaecdd3572c16 --- /dev/null +++ b/application/source/i18n/providers/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * In this namespace you will find classes and methods for handling locale and localized texts. + * + * @namespace Monster.I18n.Providers + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; diff --git a/application/source/i18n/translations.js b/application/source/i18n/translations.js index 1928d5488bd0eb7fa98921eea04bf9cd1e54b515..e14aee33d28a86b459bfefba4fefa2398f71e982 100644 --- a/application/source/i18n/translations.js +++ b/application/source/i18n/translations.js @@ -9,6 +9,7 @@ import {isObject, isString} from "../types/is.js"; import {validateInstance, validateInteger, validateObject, validateString} from "../types/validate.js"; import {Locale, parseLocale} from "./locale.js"; +export {Translations} /** * With this class you can manage translations and access the keys. @@ -48,7 +49,7 @@ import {Locale, parseLocale} from "./locale.js"; * @memberOf Monster.I18n * @see https://datatracker.ietf.org/doc/html/rfc3066 */ -export class Translations extends Base { +class Translations extends Base { /** * diff --git a/application/source/logging/handler.js b/application/source/logging/handler.js index 5eb221b71a7373092619f7eb1c0ae339d3abca6e..fbd30db22f06f196b605fb8f945ad3d9d9b0d438 100644 --- a/application/source/logging/handler.js +++ b/application/source/logging/handler.js @@ -4,12 +4,13 @@ * @author schukai GmbH */ - 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"; +export {Handler} + /** * The log handler is the interface between the log entries and the log listeners. * @@ -24,7 +25,7 @@ import {ALL, DEBUG, ERROR, FATAL, INFO, OFF, TRACE, WARN} from "./logger.js"; * @copyright schukai GmbH * @memberOf Monster.Logging */ -export class Handler extends Base { + class Handler extends Base { constructor() { super(); diff --git a/application/source/logging/handler/console.js b/application/source/logging/handler/console.js index 9f74a9e0373f46299ed58524b7624813dbb27991..5ada86fc71cfa549a34d6b8fc48443f6af35e966 100644 --- a/application/source/logging/handler/console.js +++ b/application/source/logging/handler/console.js @@ -10,6 +10,8 @@ import {getGlobalObject} from "../../types/global.js"; import {Handler} from '../handler.js'; import {LogEntry} from "../logentry.js"; +export {ConsoleHandler} + /** * You can create an object of the class simply by using the namespace `new Monster.Logging.Handler.ConsoleHandler()`. * @@ -24,7 +26,7 @@ import {LogEntry} from "../logentry.js"; * @copyright schukai GmbH * @memberOf Monster.Logging.Handler */ -export class ConsoleHandler extends Handler { + class ConsoleHandler extends Handler { constructor() { super(); } diff --git a/application/source/logging/handler/namespace.js b/application/source/logging/handler/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..09107030e42952f06b0ebfb3b4e24186a2a425a5 --- /dev/null +++ b/application/source/logging/handler/namespace.js @@ -0,0 +1,8 @@ +'use strict'; + +/** + * @namespace Monster.Logging.Handler + * @memberOf Monster.Logging + * @author schukai GmbH + */ +const ns = {}; diff --git a/application/source/logging/logentry.js b/application/source/logging/logentry.js index f137ab2f12088c7e61c97ed66664a23760954eb7..00bce9aa782742a67cb38fac7fe3a9772c6c788f 100644 --- a/application/source/logging/logentry.js +++ b/application/source/logging/logentry.js @@ -8,6 +8,7 @@ import {Base} from '../types/base.js'; import {validateInteger} from '../types/validate.js'; +export {LogEntry} /** * A log entry for the logger @@ -23,7 +24,7 @@ import {validateInteger} from '../types/validate.js'; * @copyright schukai GmbH * @memberOf Monster.Logging */ -export class LogEntry extends Base { + class LogEntry extends Base { /** * * @param {Integer} loglevel diff --git a/application/source/logging/logger.js b/application/source/logging/logger.js index ca43dfd4eaeb6260775f86f857bf4774a3030559..068c164c71a7b750c3d349d176897e5b623976b8 100644 --- a/application/source/logging/logger.js +++ b/application/source/logging/logger.js @@ -10,55 +10,56 @@ import {LogEntry} from '../logging/logentry.js'; import {Base} from '../types/base.js'; import {validateInteger, validateObject, validateString} from '../types/validate.js'; +export {Logger, ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF}; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -export const ALL = 255; +const ALL = 255; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -export const TRACE = 64; +const TRACE = 64; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -export const DEBUG = 32; +const DEBUG = 32; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -export const INFO = 16; +const INFO = 16; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -export const WARN = 8; +const WARN = 8; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -export const ERROR = 4; +const ERROR = 4; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -export const FATAL = 2; +const FATAL = 2; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -export const OFF = 0; +const OFF = 0; /** * The logger is a class that takes care of logging. @@ -74,7 +75,7 @@ export const OFF = 0; * @copyright schukai GmbH * @memberOf Monster.Logging */ -export class Logger extends Base { +class Logger extends Base { /** * diff --git a/application/source/logging/namespace.js b/application/source/logging/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..53e4d9411fc230ecc1907e047eaaeef0a5cd18cb --- /dev/null +++ b/application/source/logging/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * Namespace for logging. + * + * @namespace Monster.Logging + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; \ No newline at end of file diff --git a/application/source/math/namespace.js b/application/source/math/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..b8c1f1b7b289fbab84ec995f4c13c776ec1a6dbd --- /dev/null +++ b/application/source/math/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * Namespace for math. + * + * @namespace Monster.Math + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; \ No newline at end of file diff --git a/application/source/math/random.js b/application/source/math/random.js index 3a8efed111a7e60df2ebf063e88c88f5af6e88da..32ce3d9980b324af299be2939a69490fa13ffe0d 100644 --- a/application/source/math/random.js +++ b/application/source/math/random.js @@ -7,6 +7,7 @@ import {getGlobal} from '../types/global.js'; +export {random} /** * this function uses crypt and returns a random number. @@ -30,7 +31,7 @@ import {getGlobal} from '../types/global.js'; * @since 1.0.0 * @copyright schukai GmbH */ -export function random(min, max) { + function random(min, max) { if (min === undefined) { min = 0; diff --git a/application/source/monster.js b/application/source/monster.js index 91d6960fbed3abcf2296644096bbbd1918a1ca37..6c9c8c62be7ff98640da28fe3ff450b2731e5743 100644 --- a/application/source/monster.js +++ b/application/source/monster.js @@ -5,6 +5,13 @@ * @author schukai GmbH */ + +/** + * Main namespace for Monster. + * + * @namespace Monster + * @author schukai GmbH + */ 'use strict'; import './constants.js'; @@ -92,6 +99,7 @@ import './data/datasource/storage/localstorage.js'; import './data/datasource/restapi/writeerror.js'; import './math/random.js'; +export {Monster} /** * This class has no other purpose than to exist. @@ -100,6 +108,6 @@ import './math/random.js'; * @copyright schukai GmbH * @memberOf Monster */ -export class Monster { +class Monster { } diff --git a/application/source/text/formatter.js b/application/source/text/formatter.js index 2c004426c0bf494e9909addd095b586326d895d1..ced2881b68eb4703953b367c03f9f25a899045d6 100644 --- a/application/source/text/formatter.js +++ b/application/source/text/formatter.js @@ -13,6 +13,7 @@ import {isObject, isString} from "../types/is.js"; import {validateArray, validateString} from "../types/validate.js"; import {getMonsterVersion} from "../types/version.js"; +export {Formatter} /** * @private @@ -114,7 +115,7 @@ const workingDataSymbol = Symbol('workingData'); * @copyright schukai GmbH * @memberOf Monster.Text */ -export class Formatter extends BaseWithOptions { + class Formatter extends BaseWithOptions { /** * Default values for the markers are `${` and `}` diff --git a/application/source/text/namespace.js b/application/source/text/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..3988eaeb768d395cdb3cd3c80feb49071b0cc396 --- /dev/null +++ b/application/source/text/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * Namespace for texts. + * + * @namespace Monster.Text + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; diff --git a/application/source/types/base.js b/application/source/types/base.js index 79b10056440a13ddcbf58649daab5a7be9b8fc6c..6fc9ced06633f0add4594ed1657cb12629fba833 100644 --- a/application/source/types/base.js +++ b/application/source/types/base.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ - +export {Base} /** * This is the base class from which all monster classes are derived. @@ -22,7 +22,7 @@ * @copyright schukai GmbH * @memberOf Monster.Types */ -export class Base extends Object { + class Base extends Object { /** * diff --git a/application/source/types/basewithoptions.js b/application/source/types/basewithoptions.js index a98e92a4c735b88299b5c235571982837ba3d7bf..f76af555a2538238825d61bcf09b68b6fc80cbdc 100644 --- a/application/source/types/basewithoptions.js +++ b/application/source/types/basewithoptions.js @@ -11,18 +11,20 @@ import {Pathfinder} from "../data/pathfinder.js"; import {Base} from "./base.js"; import {validateObject} from "./validate.js"; +export {BaseWithOptions} + /** * This is the base class with options from which some monster classes are derived. * * This class is actually only used as a base class. - * + * * ```html * <script type="module"> * import {BaseWithOptions} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/basewithoptions.js'; * new BaseWithOptions() * </script> * ``` - * + * * Classes that require the possibility of options can be derived directly from this class. * Derived classes almost always override the `defaul` getter with their own values. * @@ -35,14 +37,14 @@ import {validateObject} from "./validate.js"; * } * } * ``` - * + * * The class was formerly called Object. * * @since 1.13.0 * @copyright schukai GmbH * @memberOf Monster.Types */ -export class BaseWithOptions extends Base { +class BaseWithOptions extends Base { /** * @@ -60,17 +62,17 @@ export class BaseWithOptions extends Base { } /** - * This getter provides the options. Derived classes overwrite - * this getter with their own values. It is good karma to always include + * This getter provides the options. Derived classes overwrite + * this getter with their own values. It is good karma to always include * the values from the parent class. - * + * * ```javascript * get defaults() { * return Object.assign({}, super.defaults, { * mykey: true * }); * } - * + * * ``` * * @return {object} diff --git a/application/source/types/binary.js b/application/source/types/binary.js index 19e0eae7fadbda51f523663b73ef16308d4c73d5..4a4a8f4a1ab6153fbe39d54be785539cd9171288 100644 --- a/application/source/types/binary.js +++ b/application/source/types/binary.js @@ -1,12 +1,11 @@ 'use strict'; -import {assignToNamespace} from "../namespace.js"; - - /** * @author schukai GmbH */ -import {Monster, validateString} from "./validate.js"; +import {validateString} from "./validate.js"; + +export {toBinary, fromBinary} /** * You can call the function via the monster namespace `Monster.Types.toBinary()`. @@ -24,7 +23,7 @@ import {Monster, validateString} from "./validate.js"; * @memberOf Monster.Types * @since 1.18.0 */ -export function toBinary(string) { +function toBinary(string) { const codeUnits = new Uint16Array(validateString(string).length); for (let i = 0; i < codeUnits.length; i++) { codeUnits[i] = string.charCodeAt(i); @@ -56,7 +55,7 @@ export function toBinary(string) { * @memberOf Monster.Types * @since 1.18.0 */ -export function fromBinary(binary) { +function fromBinary(binary) { const bytes = new Uint8Array(validateString(binary).length); for (let i = 0; i < bytes.length; i++) { bytes[i] = binary.charCodeAt(i); diff --git a/application/source/types/dataurl.js b/application/source/types/dataurl.js index 790b08761736c96752fbda3b8285ac9ec0be9dac..f1483c8c681085d41ce7d2d55f31bb2e3279c668 100644 --- a/application/source/types/dataurl.js +++ b/application/source/types/dataurl.js @@ -1,20 +1,24 @@ 'use strict'; -import {assignToNamespace} from "../namespace.js"; + /** * @author schukai GmbH */ + import {Base, Monster} from "./base.js"; import {isString} from "./is.js"; import {MediaType, parseMediaType} from "./mediatype.js"; import {validateBoolean, validateInstance, validateString} from "./validate.js"; +export {DataUrl, parseDataURL} + /** * @private * @type {symbol} */ const internal = Symbol('internal'); + /** * You can create an object via the monster namespace `new Monster.Types.DataUrl()`. * @@ -31,7 +35,7 @@ const internal = Symbol('internal'); * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs * @see https://datatracker.ietf.org/doc/html/rfc2397 */ -export class DataUrl extends Base { +class DataUrl extends Base { /** * @@ -111,7 +115,7 @@ export class DataUrl extends Base { * @throws {TypeError} malformed data url * @memberOf Monster.Types */ -export function parseDataURL(dataurl) { +function parseDataURL(dataurl) { validateString(dataurl); diff --git a/application/source/types/id.js b/application/source/types/id.js index 24f40ab817c1d5884ab39d26e380d3f9e185d823..a68596fbe07c2cd2363f3ed48d87abaca4436042 100644 --- a/application/source/types/id.js +++ b/application/source/types/id.js @@ -7,6 +7,8 @@ import {Base} from './base.js'; import {validateString} from "./validate.js"; +export {ID} + /** * @private * @type {Map<string, integer>} @@ -34,7 +36,7 @@ let internalCounter = new Map; * @memberOf Monster.Types * @summary Automatic generation of ids */ -export class ID extends Base { + class ID extends Base { /** * create new id with prefix diff --git a/application/source/types/is.js b/application/source/types/is.js index 4990aa3016085b4e7ba5805035d1175987e0be56..5ae43250e24265cb7358aa5d3bd6cc0cba679553 100644 --- a/application/source/types/is.js +++ b/application/source/types/is.js @@ -4,11 +4,12 @@ * @author schukai GmbH */ +export {isIterable, isPrimitive, isSymbol, isBoolean, isString, isObject, isInstance, isArray, isFunction, isInteger} /** * With this function you can check if a value is iterable. - * + * * This method is used in the library to have consistent names. * * You can call the method via the monster namespace `Monster.Types.isPrimitive()`. @@ -28,7 +29,7 @@ * @copyright schukai GmbH * @memberOf Monster.Types */ -export function isIterable(value) { +function isIterable(value) { if (value === undefined) return false; if (value === null) return false; return typeof value?.[Symbol.iterator] === 'function'; @@ -37,7 +38,7 @@ export function isIterable(value) { /** * Checks whether the value passed is a primitive (string, number, boolean, NaN, undefined, null or symbol) - * + * * This method is used in the library to have consistent names. * * ``` @@ -54,7 +55,7 @@ export function isIterable(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -export function isPrimitive(value) { +function isPrimitive(value) { var type; if (value === undefined || value === null) { @@ -72,7 +73,7 @@ export function isPrimitive(value) { /** * Checks whether the value passed is a symbol - * + * * This method is used in the library to have consistent names. * * ``` @@ -89,13 +90,13 @@ export function isPrimitive(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -export function isSymbol(value) { +function isSymbol(value) { return ('symbol' === typeof value) ? true : false; } /** * Checks whether the value passed is a boolean. - * + * * This method is used in the library to have consistent names. * * ``` @@ -113,7 +114,7 @@ export function isSymbol(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -export function isBoolean(value) { +function isBoolean(value) { if (value === true || value === false) { return true; @@ -124,7 +125,7 @@ export function isBoolean(value) { /** * Checks whether the value passed is a string - * + * * This method is used in the library to have consistent names. * * ``` @@ -141,7 +142,7 @@ export function isBoolean(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -export function isString(value) { +function isString(value) { if (value === undefined || typeof value !== 'string') { return false; } @@ -150,7 +151,7 @@ export function isString(value) { /** * Checks whether the value passed is a object - * + * * This method is used in the library to have consistent names. * * ``` @@ -167,7 +168,7 @@ export function isString(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -export function isObject(value) { +function isObject(value) { if (isArray(value)) return false; if (isPrimitive(value)) return false; @@ -181,7 +182,7 @@ export function isObject(value) { /** * Checks whether the value passed is a object and instance of instance. - * + * * This method is used in the library to have consistent names. * * ``` @@ -199,19 +200,17 @@ export function isObject(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -export function isInstance(value, instance) { - +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; - } /** * Checks whether the value passed is a array - * - * This method is used in the library to have consistent names. + * + * This method is used in the library to have consistent names. * * ``` * <script type="module"> @@ -228,14 +227,14 @@ export function isInstance(value, instance) { * @memberOf Monster.Types * @see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray */ -export function isArray(value) { +function isArray(value) { return Array.isArray(value); } /** * Checks whether the value passed is a function - * - * This method is used in the library to have consistent names. + * + * This method is used in the library to have consistent names. * * ``` * <script type="module"> @@ -252,7 +251,7 @@ export function isArray(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -export function isFunction(value) { +function isFunction(value) { if (isArray(value)) return false; if (isPrimitive(value)) return false; @@ -266,8 +265,8 @@ export function isFunction(value) { /** * Checks whether the value passed is an integer. - * - * This method is used in the library to have consistent names. + * + * This method is used in the library to have consistent names. * * ``` * <script type="module"> @@ -284,7 +283,7 @@ export function isFunction(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -export function isInteger(value) { +function isInteger(value) { return Number.isInteger(value); } diff --git a/application/source/types/mediatype.js b/application/source/types/mediatype.js index fd9bfb1a51baf67aa85e8ecd27c9c6b8a3306da0..e6a35eb242dfe1679c07d1cb78f01990ab5f9d66 100644 --- a/application/source/types/mediatype.js +++ b/application/source/types/mediatype.js @@ -1,13 +1,15 @@ 'use strict'; -import {assignToNamespace} from "../namespace.js"; + /** * @author schukai GmbH */ + import {Base, Monster} from "./base.js"; import {isString} from "./is.js"; import {validateArray, validateString} from "./validate.js"; +export {MediaType, parseMediaType} /** * @private @@ -37,7 +39,7 @@ const internal = Symbol('internal'); * @copyright schukai GmbH * @memberOf Monster.Types */ -export class MediaType extends Base { +class MediaType extends Base { /** * @@ -159,7 +161,7 @@ export class MediaType extends Base { * @throws {TypeError} malformed data url * @memberOf Monster.Types */ -export function parseMediaType(mediatype) { +function parseMediaType(mediatype) { const regex = /(?<type>[A-Za-z]+|\*)\/(?<subtype>([a-zA-Z0-9.\+_\-]+)|\*|)(?<parameter>\s*;\s*([a-zA-Z0-9]+)\s*(=\s*("?[A-Za-z0-9_\-]+"?))?)*/g; const result = regex.exec(validateString(mediatype)); diff --git a/application/source/types/namespace.js b/application/source/types/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..a9edabdf4f0520e06b00f0e7e860a15f9aa5a36d --- /dev/null +++ b/application/source/types/namespace.js @@ -0,0 +1,11 @@ +'use strict'; + +/** + * Namespace for types. + * + * @namespace Monster.Types + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; + diff --git a/application/source/types/node.js b/application/source/types/node.js index 0c06d69b532eb8990e77e0b3b371d1e9c96e646c..f6f245bd58edc8246d28866f0ff4edb03b93a9fa 100644 --- a/application/source/types/node.js +++ b/application/source/types/node.js @@ -4,13 +4,13 @@ * @author schukai GmbH */ - - import {Base} from './base.js'; import {isPrimitive} from "./is.js"; import {NodeList} from './nodelist.js'; import {validateInstance} from './validate.js'; +export {Node} + /** * @private * @type {symbol} @@ -40,7 +40,7 @@ const treeStructureSymbol = Symbol('treeStructure'); * @summary A Node Class * @see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Iteration_protocols */ -export class Node extends Base { +class Node extends Base { /** * @param {*} [value] @@ -155,7 +155,7 @@ export class Node extends Base { let label = this[internalValueSymbol]; if (!isPrimitive(label)) label = JSON.stringify(this[internalValueSymbol]) - parts.push( label); + parts.push(label); } if (!this.hasChildNodes()) { diff --git a/application/source/types/nodelist.js b/application/source/types/nodelist.js index 24532a3c11496c52b2ef4e9d0c14b8b203eede56..5e79c7caaf3b0134456b69da4b8722e7969991f6 100644 --- a/application/source/types/nodelist.js +++ b/application/source/types/nodelist.js @@ -8,6 +8,8 @@ import {isArray, isInstance} from "./is.js"; import {Node} from "./node.js"; import {validateInstance} from "./validate.js"; +export {NodeList} + /** * You can create the instance via the monster namespace `new Monster.Types.NodeList()`. * @@ -23,7 +25,7 @@ import {validateInstance} from "./validate.js"; * @memberOf Monster.Types * @summary A NodeList class */ -export class NodeList extends Set { +class NodeList extends Set { /** * @throws {Error} invalid value type @@ -34,8 +36,8 @@ export class NodeList extends Set { const self = this - if(values===undefined) return; - + if (values === undefined) return; + if (isArray(values)) { values.forEach(value => self.add(value)); } else if (isInstance(values, NodeList)) { @@ -102,11 +104,11 @@ export class NodeList extends Set { */ toString() { let parts = []; - - for(const node of this.toArray()) { - parts.push(node.toString()) + + for (const node of this.toArray()) { + parts.push(node.toString()) } - + return parts.join("\n"); } diff --git a/application/source/types/noderecursiveiterator.js b/application/source/types/noderecursiveiterator.js index 411e73dac9379a69efb72faa69561572481407b2..c04c46cc5e43c8c3e9e365b150c97faa8ea8d31e 100644 --- a/application/source/types/noderecursiveiterator.js +++ b/application/source/types/noderecursiveiterator.js @@ -4,7 +4,6 @@ * @author schukai GmbH */ - import {internalSymbol} from "../constants.js"; import {Base} from './base.js'; @@ -13,6 +12,7 @@ import {Node} from "./node.js"; import {NodeList} from "./nodelist.js"; import {validateInstance} from "./validate.js"; +export {NodeRecursiveIterator} /** * @private @@ -69,7 +69,7 @@ const isNodeListSymbol = Symbol('isNodeList'); * @memberOf Monster.Types * @summary An iterator to run recursively through a tree of nodes */ -export class NodeRecursiveIterator extends Base { + class NodeRecursiveIterator extends Base { /** * @param {Node} [data] diff --git a/application/source/types/observer.js b/application/source/types/observer.js index f6d5d317b286b188f0baad3019a2139bb01f6c1b..d7689f983d8ec616342190e8deed965f27784f5a 100644 --- a/application/source/types/observer.js +++ b/application/source/types/observer.js @@ -4,12 +4,13 @@ * @author schukai GmbH */ - import {Base} from './base.js'; import {isObject} from './is.js'; import {TokenList} from './tokenlist.js'; import {UniqueQueue} from './uniquequeue.js'; +export {Observer} + /** * An observer manages a callback function * @@ -56,7 +57,7 @@ import {UniqueQueue} from './uniquequeue.js'; * @copyright schukai GmbH * @memberOf Monster.Types */ -export class Observer extends Base { +class Observer extends Base { /** * diff --git a/application/source/types/observerlist.js b/application/source/types/observerlist.js index 79cc16602d1faf8c414bb8c27b4db0fb677640c8..47ad7efab860f1e9573eb2e06f97b3f60db7b012 100644 --- a/application/source/types/observerlist.js +++ b/application/source/types/observerlist.js @@ -4,11 +4,12 @@ * @author schukai GmbH */ - import {Base} from './base.js'; import {Observer} from "./observer.js"; import {validateInstance} from "./validate.js"; +export {ObserverList} + /** * With the help of the ObserverList class, observer can be managed. * @@ -24,7 +25,7 @@ import {validateInstance} from "./validate.js"; * @copyright schukai GmbH * @memberOf Monster.Types */ -export class ObserverList extends Base { +class ObserverList extends Base { /** * diff --git a/application/source/types/proxyobserver.js b/application/source/types/proxyobserver.js index a2fe765dc4dbfcd8b0af8208272a5cf177ef9177..c741c9bb94b0e03cc453d81865c5756109a2ea50 100644 --- a/application/source/types/proxyobserver.js +++ b/application/source/types/proxyobserver.js @@ -11,6 +11,8 @@ import {ObserverList} from "./observerlist.js"; import {validateObject} from "./validate.js"; import {extend} from "../data/extend.js"; +export {ProxyObserver} + /** * An observer manages a callback function * @@ -57,7 +59,7 @@ import {extend} from "../data/extend.js"; * @copyright schukai GmbH * @memberOf Monster.Types */ -export class ProxyObserver extends Base { + class ProxyObserver extends Base { /** * diff --git a/application/source/types/queue.js b/application/source/types/queue.js index f6505c3fddf976e9d094908f3cb1dd6529c67fc2..cb7b4814a96560fa0969bebb0bc2b519570c6273 100644 --- a/application/source/types/queue.js +++ b/application/source/types/queue.js @@ -6,9 +6,11 @@ import {Base} from './base.js'; +export {Queue} + /** * You can create the instance via the monster namespace `new Monster.Types.Queue()`. - * + * * ``` * <script type="module"> * import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/queue.js'; @@ -44,7 +46,7 @@ import {Base} from './base.js'; * @memberOf Monster.Types * @summary A Queue (Fifo) */ -export class Queue extends Base { +class Queue extends Base { /** * diff --git a/application/source/types/randomid.js b/application/source/types/randomid.js index c592e5d14f06f834be6804bc5c131fdcd3f5bee7..22d6e5bbc34a39f5cd8a50a5fe0ce4cfb4824f47 100644 --- a/application/source/types/randomid.js +++ b/application/source/types/randomid.js @@ -1,13 +1,16 @@ 'use strict'; -import {random} from "../math/random.js"; + /** * @author schukai GmbH */ +import {random} from "../math/random.js"; import {getGlobal} from "./global.js"; import {ID} from "./id.js"; +export {RandomID} + /** * @private * @type {number} @@ -29,7 +32,7 @@ let internalCounter = 0; * @memberOf Monster.Types * @summary class to generate random numbers */ -export class RandomID extends ID { +class RandomID extends ID { /** * create new object diff --git a/application/source/types/regex.js b/application/source/types/regex.js index b9cd220422f515ddaa6c2fda015805fd419a8bf3..21fad26a21c4a61f12397692c626740fafa28d1d 100644 --- a/application/source/types/regex.js +++ b/application/source/types/regex.js @@ -4,13 +4,14 @@ * @author schukai GmbH */ - import {assignToNamespace, Monster} from "../namespace.js"; import {validateString} from "./validate.js"; +export {escapeString} + /** * This function prefixes all special characters that may appear in a regex with a slash. - * + * * ``` * <script type="module"> * import {escapeString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; @@ -25,7 +26,7 @@ import {validateString} from "./validate.js"; * @memberOf Monster.Types * @throws {TypeError} value is not a string */ -export function escapeString(value) { +function escapeString(value) { return validateString(value) .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') .replace(/-/g, '\\x2d'); diff --git a/application/source/types/stack.js b/application/source/types/stack.js index 983196c7bb922a806a63c6a078c5ae0069727383..4f0df4aaf8cde564f1030b2775de8baa36d99969 100644 --- a/application/source/types/stack.js +++ b/application/source/types/stack.js @@ -4,12 +4,13 @@ * @author schukai GmbH */ - import {Base} from './base.js'; +export {Stack} + /** * You can call the method via the monster namespace `new Monster.Types.Queue()`. - * + * * ``` * <script type="module"> * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/stack.js'; @@ -21,7 +22,7 @@ import {Base} from './base.js'; * @copyright schukai GmbH * @memberOf Monster.Types */ -export class Stack extends Base { +class Stack extends Base { /** * diff --git a/application/source/types/tokenlist.js b/application/source/types/tokenlist.js index b94567ea660abd87977c6dc784bf45d770ecf15d..d1b7f069fee39217646f054bcd60789b3e5a42a4 100644 --- a/application/source/types/tokenlist.js +++ b/application/source/types/tokenlist.js @@ -4,11 +4,12 @@ * @author schukai GmbH */ - import {isIterable, isString} from '../types/is.js'; import {validateFunction, validateString} from '../types/validate.js'; import {Base} from './base.js'; +export {TokenList} + /** * A tokenlist allows you to manage tokens (individual character strings such as css classes in an attribute string). * @@ -32,7 +33,7 @@ import {Base} from './base.js'; * @copyright schukai GmbH * @memberOf Monster.Types */ -export class TokenList extends Base { +class TokenList extends Base { /** * diff --git a/application/source/types/typeof.js b/application/source/types/typeof.js index c1eb8b3a2faa2501263d71bb88ae85d835fc1c19..19bf6bcc0a469479d7b42f2761b916b9691ad155 100644 --- a/application/source/types/typeof.js +++ b/application/source/types/typeof.js @@ -4,8 +4,7 @@ * @author schukai GmbH */ - - +export {typeOf} /** * The built-in typeof method is known to have some historical weaknesses. This function tries to provide a better and more accurate result. diff --git a/application/source/types/uniquequeue.js b/application/source/types/uniquequeue.js index a61b4c83a14d61b497497b4737b82d9e3b467d89..b21cb77948931048a937e0472e6cac51c55f76ee 100644 --- a/application/source/types/uniquequeue.js +++ b/application/source/types/uniquequeue.js @@ -4,10 +4,11 @@ * @author schukai GmbH */ - import {Queue} from "./queue.js"; import {validateObject} from "./validate.js"; +export {UniqueQueue} + /** * A UniqueQueue is a queue that contains items only once. * @@ -23,7 +24,7 @@ import {validateObject} from "./validate.js"; * @memberOf Monster.Types * @summary A queue for unique values */ -export class UniqueQueue extends Queue { + class UniqueQueue extends Queue { /** * diff --git a/application/source/types/uuid.js b/application/source/types/uuid.js index f709b5e73722e87e174d484f42d62cdf922cdc38..bfa449ad554968f5eefd450e0d4dfecf40131b33 100644 --- a/application/source/types/uuid.js +++ b/application/source/types/uuid.js @@ -11,6 +11,8 @@ import {isObject} from '../types/is.js'; import {Base} from "./base.js"; import {getGlobalObject} from "./global.js"; +export {UUID} + /** * The UUID class makes it possible to get a unique UUID for an object. * @@ -26,7 +28,7 @@ import {getGlobalObject} from "./global.js"; * @memberOf Monster.Types * @throws {Error} unsupported */ -export class UUID extends Base { + class UUID extends Base { /** * diff --git a/application/source/types/validate.js b/application/source/types/validate.js index 1bc7e6259c5227cc29c288e572068849177e8c27..bd57ea6acae092f22bbd38fd855dec57a74e571d 100644 --- a/application/source/types/validate.js +++ b/application/source/types/validate.js @@ -4,7 +4,6 @@ * @author schukai GmbH */ - import { isArray, isBoolean, @@ -18,6 +17,19 @@ import { isSymbol } from './is.js'; +export { + validateIterable, + validatePrimitive, + validateBoolean, + validateString, + validateObject, + validateInstance, + validateArray, + validateSymbol, + validateFunction, + validateInteger +} + /** * This method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown. * @@ -39,7 +51,7 @@ import { * @see {@link Monster.Types.isPrimitive} * @see {@link Monster.Types#isPrimitive} */ -export function validateIterable(value) { +function validateIterable(value) { if (!isIterable(value)) { throw new TypeError('value is not iterable') } @@ -67,7 +79,7 @@ export function validateIterable(value) { * @see {@link Monster.Types.isPrimitive} * @see {@link Monster.Types#isPrimitive} */ -export function validatePrimitive(value) { +function validatePrimitive(value) { if (!isPrimitive(value)) { throw new TypeError('value is not a primitive') } @@ -94,7 +106,7 @@ export function validatePrimitive(value) { * @throws {TypeError} value is not primitive */ -export function validateBoolean(value) { +function validateBoolean(value) { if (!isBoolean(value)) { throw new TypeError('value is not a boolean') } @@ -119,7 +131,7 @@ export function validateBoolean(value) { * @memberOf Monster.Types * @throws {TypeError} value is not a string */ -export function validateString(value) { +function validateString(value) { if (!isString(value)) { throw new TypeError('value is not a string') } @@ -146,7 +158,7 @@ export function validateString(value) { * @memberOf Monster.Types * @throws {TypeError} value is not a object */ -export function validateObject(value) { +function validateObject(value) { if (!isObject(value)) { throw new TypeError('value is not a object') } @@ -172,7 +184,7 @@ export function validateObject(value) { * @memberOf Monster.Types * @throws {TypeError} value is not an instance of */ -export function validateInstance(value, instance) { +function validateInstance(value, instance) { if (!isInstance(value, instance)) { let n = ""; if (isObject(instance) || isFunction(instance)) { @@ -206,7 +218,7 @@ export function validateInstance(value, instance) { * @memberOf Monster.Types * @throws {TypeError} value is not an array */ -export function validateArray(value) { +function validateArray(value) { if (!isArray(value)) { throw new TypeError('value is not an array') } @@ -231,7 +243,7 @@ export function validateArray(value) { * @memberOf Monster.Types * @throws {TypeError} value is not an symbol */ -export function validateSymbol(value) { +function validateSymbol(value) { if (!isSymbol(value)) { throw new TypeError('value is not an symbol') } @@ -257,7 +269,7 @@ export function validateSymbol(value) { * @memberOf Monster.Types * @throws {TypeError} value is not a function */ -export function validateFunction(value) { +function validateFunction(value) { if (!isFunction(value)) { throw new TypeError('value is not a function') } @@ -283,7 +295,7 @@ export function validateFunction(value) { * @memberOf Monster.Types * @throws {TypeError} value is not an integer */ -export function validateInteger(value) { +function validateInteger(value) { if (!isInteger(value)) { throw new TypeError('value is not an integer') } diff --git a/application/source/types/version.js b/application/source/types/version.js index 5c635227b1326c68ba3e863ce45dc5ca23059588..e52999147743c7a85dd5125b6d7c1ae8a393dbb8 100644 --- a/application/source/types/version.js +++ b/application/source/types/version.js @@ -1,8 +1,13 @@ 'use strict'; +/** + * @author schukai GmbH + */ import {Base} from './base.js'; +export {Version, getMonsterVersion} + /** * The version object contains a sematic version number * @@ -29,7 +34,7 @@ import {Base} from './base.js'; * @memberOf Monster.Types * @summary The version object contains a sematic version number */ -export class Version extends Base { +class Version extends Base { /** * @@ -156,7 +161,7 @@ let monsterVersion; * @author schukai GmbH * @memberOf Monster */ -export function getMonsterVersion() { +function getMonsterVersion() { if (monsterVersion instanceof Version) { return monsterVersion; } diff --git a/application/source/util/clone.js b/application/source/util/clone.js index a48f2d578e6152aabe6ab4ad4dc2b27b12427e7e..4f8e44953156678a413f5354ae8176907d92f8e7 100644 --- a/application/source/util/clone.js +++ b/application/source/util/clone.js @@ -10,6 +10,7 @@ import {isArray, isFunction, isObject, isPrimitive} from '../types/is.js'; import {typeOf} from "../types/typeof.js"; import {validateObject} from "../types/validate.js"; +export {clone} /** * With this function, objects can be cloned. @@ -34,7 +35,7 @@ import {validateObject} from "../types/validate.js"; * @copyright schukai GmbH * @throws {Error} unable to clone obj! its type isn't supported. */ -export function clone(obj) { +function clone(obj) { // typeof null results in 'object'. https://2ality.com/2013/10/typeof-null.html if (null === obj) { @@ -144,3 +145,4 @@ function cloneObject(obj) { return copy; } + diff --git a/application/source/util/comparator.js b/application/source/util/comparator.js index 1939bdf65d9b080d199205f0e0a60a9d55acc90b..9bef5e8ac767f4e5788bec9138880172ab1016f1 100644 --- a/application/source/util/comparator.js +++ b/application/source/util/comparator.js @@ -7,6 +7,8 @@ import {Base} from '../types/base.js'; import {isFunction} from '../types/is.js'; +export {Comparator} + /** * The comparator allows a comparison function to be abstracted. * @@ -51,7 +53,7 @@ import {isFunction} from '../types/is.js'; * @since 1.3.0 * @memberOf Monster.Util */ -export class Comparator extends Base { +class Comparator extends Base { /** * create new comparator diff --git a/application/source/util/deadmansswitch.js b/application/source/util/deadmansswitch.js index b6bb6d8a3753f460bfd5a9fe668cbded53a40b75..454e3cc0bb4d0b8484b85d89b63c5d59f700f8d5 100644 --- a/application/source/util/deadmansswitch.js +++ b/application/source/util/deadmansswitch.js @@ -4,13 +4,14 @@ * @author schukai GmbH */ - import {internalSymbol} from "../constants.js"; import {Base} from "../types/base.js"; import {isInteger} from "../types/is.js"; import {validateFunction, validateInteger} from "../types/validate.js"; +export {DeadMansSwitch} + /** * The dead man's switch allows to set a timer which can be reset again and again within a defined period of time. * @@ -37,7 +38,7 @@ import {validateFunction, validateInteger} from "../types/validate.js"; * @memberOf Monster.Util * @summary Class to be able to execute function chains */ -export class DeadMansSwitch extends Base { + class DeadMansSwitch extends Base { /** * Create new dead man's switch diff --git a/application/source/util/freeze.js b/application/source/util/freeze.js index a0c0619ce400ac2ff3e1629e56d7b18a90e8c9a4..f7e312beb2345849f03bccd54b6b8d4acef242d4 100644 --- a/application/source/util/freeze.js +++ b/application/source/util/freeze.js @@ -4,9 +4,10 @@ * @author schukai GmbH */ - import {validateObject} from '../types/validate.js'; +export {deepFreeze} + /** * Deep freeze a object * @@ -24,7 +25,7 @@ import {validateObject} from '../types/validate.js'; * @copyright schukai GmbH * @throws {TypeError} value is not a object */ -export function deepFreeze(object) { + function deepFreeze(object) { validateObject(object) diff --git a/application/source/util/namespace.js b/application/source/util/namespace.js new file mode 100644 index 0000000000000000000000000000000000000000..28c12f662f9db562caf8899f0bd4cf396ae3da28 --- /dev/null +++ b/application/source/util/namespace.js @@ -0,0 +1,10 @@ +'use strict'; + +/** + * Namespace for utilities. + * + * @namespace Monster.Util + * @memberOf Monster + * @author schukai GmbH + */ +const ns = {}; \ No newline at end of file diff --git a/application/source/util/processing.js b/application/source/util/processing.js index 5019656ba6418986c3329af9b3f2226a3c653ab8..7bb73ac108cae6e9ebd918f89fdff0648c2b8075 100644 --- a/application/source/util/processing.js +++ b/application/source/util/processing.js @@ -4,7 +4,6 @@ * @author schukai GmbH */ - import {internalSymbol} from "../constants.js"; import {Base} from "../types/base.js"; import {getGlobalFunction} from "../types/global.js"; @@ -12,6 +11,8 @@ import {isFunction, isInteger} from "../types/is.js"; import {Queue} from "../types/queue.js"; import {validateFunction, validateInteger} from "../types/validate.js"; +export {Processing} + /** * @private */ @@ -102,7 +103,7 @@ class Callback { * @memberOf Monster.Util * @summary Class to be able to execute function chains */ -export class Processing extends Base { +class Processing extends Base { /** * Create new Processing diff --git a/application/source/util/trimspaces.js b/application/source/util/trimspaces.js index 6a4ef3d3deaa86f5cf37d6f37266d645db74a788..1b6323e41003a61d2827d7dbbcaff09f0ab14b4c 100644 --- a/application/source/util/trimspaces.js +++ b/application/source/util/trimspaces.js @@ -8,6 +8,8 @@ import {ID} from "../types/id.js"; import {isObject} from "../types/is.js"; import {validateString} from "../types/validate.js"; +export {trimSpaces} + /** * This special trim function allows to trim spaces that have been protected by a special escape character. * @@ -32,7 +34,7 @@ import {validateString} from "../types/validate.js"; * @return {string} * @throws {TypeError} value is not a string */ -export function trimSpaces(value) { + function trimSpaces(value) { validateString(value); diff --git a/deployment/jsdoc.json b/deployment/jsdoc.json index 190b41297bf55ca27b26f1ceb0c1d31ff23327d0..718fed03e28df9d592dd88f773b7eb7f0d0a253b 100644 --- a/deployment/jsdoc.json +++ b/deployment/jsdoc.json @@ -3,18 +3,19 @@ "allowUnknownTags": true }, "source": { - "include": "application/source/", + "include": "../application/source/", "includePattern": "\\.js$", "excludePattern": "" }, "plugins": [ "plugins/markdown", - "jsdoc-plantuml" + "jsdoc-plantuml", + "@pixi/jsdoc-template/plugins/es6-fix" ], "opts": { "template": "node_modules/clean-jsdoc-theme", "encoding": "utf8", - "destination": "deployment/build/docs/", + "destination": "build/docs/", "recurse": true, "verbose": true, "theme_opts": { @@ -32,21 +33,12 @@ ], "search": true, "add_style_path": [ - { - "href": "https://monsterjs.org/assets/prettify.css", - "crossorigin": "anonymous", - "rel": "stylesheet" - } ], "add_script_path": [ { "src": "https://code.jquery.com/jquery-3.5.1.js", "integrity": "sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=", "crossorigin": "anonymous" - }, - { - "src": "https://monsterjs.org/js/doc/monster-versions.js", - "crossorigin": "anonymous" } ], "footer": "<a href='https://about.schukai.com/de/impressum/'>Imprint</a>", @@ -87,17 +79,17 @@ "cleverLinks": true, "monospaceLinks": false, "default": { - "outputSourceFiles": true + "outputSourceFiles": false } }, "plantuml": { "puml": { "create": true, - "destination": "deployment/build/docs/puml" + "destination": "build/docs/puml" }, "images": { "create": true, - "destination": "deployment/build/docs/images", + "destination": "build/docs/images", "defaultFormat": "svg" } }