diff --git a/application/source/constraints/abstract.js b/application/source/constraints/abstract.js index 8813074f93867e79406e34e7af2996aa55794366..979829d65bf3ae1297a0277eb882e52d2ab4f4a3 100644 --- a/application/source/constraints/abstract.js +++ b/application/source/constraints/abstract.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from '../types/base.js'; @@ -22,7 +22,7 @@ import {Base} from '../types/base.js'; * @memberOf Monster.Constraints * @summary The abstract constraint */ -class AbstractConstraint extends Base { +export class AbstractConstraint extends Base { /** * @@ -41,6 +41,3 @@ class AbstractConstraint extends Base { return Promise.reject(value); } } - -assignToNamespace('Monster.Constraints', AbstractConstraint); -export {Monster, AbstractConstraint} \ No newline at end of file diff --git a/application/source/constraints/abstractoperator.js b/application/source/constraints/abstractoperator.js index 90d15a415d840ecd5af986f23ae2dc30550b7f18..a6eb676bf0aaf73841239b1a954b95461263d7cc 100644 --- a/application/source/constraints/abstractoperator.js +++ b/application/source/constraints/abstractoperator.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {AbstractConstraint} from "./abstract.js"; /** @@ -18,7 +18,7 @@ import {AbstractConstraint} from "./abstract.js"; * @memberOf Monster.Constraints * @summary The abstract operator constraint */ -class AbstractOperator extends AbstractConstraint { +export class AbstractOperator extends AbstractConstraint { /** * @@ -41,5 +41,3 @@ class AbstractOperator extends AbstractConstraint { } -assignToNamespace('Monster.Constraints', AbstractOperator); -export {Monster, AbstractOperator} \ No newline at end of file diff --git a/application/source/constraints/andoperator.js b/application/source/constraints/andoperator.js index 654745482d681cb22518e864b06a2065d6d03538..2d54d91094e85dfd3a17bccecfb5213d0e8b61ba 100644 --- a/application/source/constraints/andoperator.js +++ b/application/source/constraints/andoperator.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {AbstractOperator} from "./abstractoperator.js"; /** @@ -16,25 +16,16 @@ import {AbstractOperator} from "./abstractoperator.js"; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Constraint.AndOperator(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/andoperator.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/andoperator.js'; * new AndOperator(); * </script> * ``` * * @example * - * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/valid.js'; - * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/invalid.js'; - * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/andoperator.js'; + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/valid.js'; + * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/invalid.js'; + * import {AndOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/andoperator.js'; * * new AndOperator( * new Valid(), new Valid()).isValid() @@ -53,7 +44,7 @@ import {AbstractOperator} from "./abstractoperator.js"; * @memberOf Monster.Constraints * @summary A and operator constraint */ -class AndOperator extends AbstractOperator { +export class AndOperator extends AbstractOperator { /** * this method return a promise containing the result of the check. @@ -66,6 +57,3 @@ class AndOperator extends AbstractOperator { } } - -assignToNamespace('Monster.Constraints', AndOperator); -export {Monster, AndOperator} diff --git a/application/source/constraints/invalid.js b/application/source/constraints/invalid.js index 1550600e5c707cc547a30f2ec1df8eb93285cfd8..dde2876dbf12289e6f94cac09a2623647740c231 100644 --- a/application/source/constraints/invalid.js +++ b/application/source/constraints/invalid.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {AbstractConstraint} from "./abstract.js"; /** @@ -13,27 +13,16 @@ import {AbstractConstraint} from "./abstract.js"; * * The invalid constraint allows an always invalid query to be performed. this constraint is mainly intended for testing. * - * You can call the method via the monster namespace `new Monster.Constraint.Invalid()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Constraint.Invalid(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/invalid.js'; + * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/invalid.js'; * new Invalid(); * </script> * ``` * * @example * - * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/invalid.js'; + * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/invalid.js'; * * new Invalid().isValid() * .then(()=>console.log(true)) @@ -45,7 +34,7 @@ import {AbstractConstraint} from "./abstract.js"; * @memberOf Monster.Constraints * @summary A constraint that always invalid */ -class Invalid extends AbstractConstraint { +export class Invalid extends AbstractConstraint { /** * this method return a rejected promise @@ -58,6 +47,3 @@ class Invalid extends AbstractConstraint { } } - -assignToNamespace('Monster.Constraints', Invalid); -export {Monster, Invalid} diff --git a/application/source/constraints/isarray.js b/application/source/constraints/isarray.js index 03d48732e42375153d1e994431d4dcc629ba7179..3a091993c89391dd1ad88a58325f8f96ea40c43a 100644 --- a/application/source/constraints/isarray.js +++ b/application/source/constraints/isarray.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {isArray} from "../types/is.js"; import {AbstractConstraint} from "./abstract.js"; @@ -12,27 +12,16 @@ import {AbstractConstraint} from "./abstract.js"; * * The uniform API of the constraints allows chains to be formed. * - * You can call the method via the monster namespace `new Monster.Constraint.IsObject()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Constraint.IsArray() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/isarray.js'; + * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/isarray.js'; * console.log(new IsArray()) * </script> * ``` * * @example * - * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/isarray.js'; + * import {IsArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/isarray.js'; * * new IsArray() * .isValid([]) @@ -49,7 +38,7 @@ import {AbstractConstraint} from "./abstract.js"; * @memberOf Monster.Constraints * @summary A constraint to check if a value is an array */ -class IsArray extends AbstractConstraint { +export class IsArray extends AbstractConstraint { /** * this method return a promise containing the result of the check. @@ -66,6 +55,3 @@ class IsArray extends AbstractConstraint { } } - -assignToNamespace('Monster.Constraints', IsArray); -export {Monster, IsArray} diff --git a/application/source/constraints/isobject.js b/application/source/constraints/isobject.js index e9fd31ef496862310c402e653a69eca7757293b2..2b0211b8996dd4f53410a05bb2460bfcd32239e6 100644 --- a/application/source/constraints/isobject.js +++ b/application/source/constraints/isobject.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {isObject} from "../types/is.js"; import {AbstractConstraint} from "./abstract.js"; @@ -12,27 +12,16 @@ import {AbstractConstraint} from "./abstract.js"; * * The uniform API of the constraints allows chains to be formed. * - * You can call the method via the monster namespace `new Monster.Constraint.IsObject()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.Constraint.IsObject()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/isobject.js'; + * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/isobject.js'; * console.log(new IsObject()) * </script> * ``` * * @example * - * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/isobject.js'; + * import {IsObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/isobject.js'; * * new IsObject() * .isValid({}) @@ -50,7 +39,7 @@ import {AbstractConstraint} from "./abstract.js"; * @memberOf Monster.Constraints * @summary A constraint to check if a value is an object */ -class IsObject extends AbstractConstraint { +export class IsObject extends AbstractConstraint { /** * this method return a promise containing the result of the check. @@ -67,6 +56,3 @@ class IsObject extends AbstractConstraint { } } - -assignToNamespace('Monster.Constraints', IsObject); -export {Monster, IsObject} diff --git a/application/source/constraints/namespace.js b/application/source/constraints/namespace.js deleted file mode 100644 index 4cc4d6bf717dbcdab6651f688b7f791e0e1009df..0000000000000000000000000000000000000000 --- a/application/source/constraints/namespace.js +++ /dev/null @@ -1,15 +0,0 @@ -'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 Constraints - * @memberOf Monster - * @author schukai GmbH - */ - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.Constraints"; \ No newline at end of file diff --git a/application/source/constraints/oroperator.js b/application/source/constraints/oroperator.js index a28c09e68d39df0b13be0a5418f3e1a940baf9e5..6972c43c349d6d5651d776f8b0f07a1e11aa93c5 100644 --- a/application/source/constraints/oroperator.js +++ b/application/source/constraints/oroperator.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {AbstractOperator} from "./abstractoperator.js"; /** @@ -15,25 +15,16 @@ import {AbstractOperator} from "./abstractoperator.js"; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Constraint.OrOperator(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraint/oroperator.js'; + * import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraint/oroperator.js'; * new OrOperator(); * </script> * ``` * * @example * - * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/valid.js'; - * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/invalid.js'; - * import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/oroperator.js'; + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/valid.js'; + * import {Invalid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/invalid.js'; + * import {OrOperator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/oroperator.js'; * * new OrOperator( * new Valid(), new Invalid()).isValid() @@ -52,7 +43,7 @@ import {AbstractOperator} from "./abstractoperator.js"; * @memberOf Monster.Constraints * @summary A or operator */ -class OrOperator extends AbstractOperator { +export class OrOperator extends AbstractOperator { /** * this method return a promise containing the result of the check. @@ -92,6 +83,3 @@ class OrOperator extends AbstractOperator { } - -assignToNamespace('Monster.Constraints', OrOperator); -export {Monster, OrOperator} diff --git a/application/source/constraints/valid.js b/application/source/constraints/valid.js index b4cf8117406faee5a8026b4dfbfa716c8da4546a..8c4a51f3c1e924a33a0cdf345f462fb024e47bd9 100644 --- a/application/source/constraints/valid.js +++ b/application/source/constraints/valid.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {AbstractConstraint} from "./abstract.js"; /** @@ -13,27 +13,16 @@ import {AbstractConstraint} from "./abstract.js"; * * The valid constraint allows an always valid query to be performed. this constraint is mainly intended for testing. * - * You can call the method via the monster namespace `new Monster.Constraint.Valid()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Constraint.Valid(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/valid.js'; + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/valid.js'; * new Valid(); * </script> * ``` * * @example * - * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/constraints/valid.js'; + * import {Valid} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/constraints/valid.js'; * * new Valid().isValid() * .then(()=>console.log(true)) @@ -45,7 +34,7 @@ import {AbstractConstraint} from "./abstract.js"; * @memberOf Monster.Constraints * @summary A constraint that always valid */ -class Valid extends AbstractConstraint { +export class Valid extends AbstractConstraint { /** * this method return a promise containing the result of the check. @@ -58,6 +47,3 @@ class Valid extends AbstractConstraint { } } - -assignToNamespace('Monster.Constraints', Valid); -export {Monster, Valid} diff --git a/application/source/data/buildmap.js b/application/source/data/buildmap.js index 24b6948c43036b096cfa2887ac6c32971ae28427..b3a343db3c276593c196b1e4221ce1a57e47156e 100644 --- a/application/source/data/buildmap.js +++ b/application/source/data/buildmap.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {isFunction, isObject, isString} from "../types/is.js"; import {validateString} from "../types/validate.js"; import {clone} from "../util/clone.js"; @@ -23,20 +23,9 @@ export const PARENT = '^'; * Either a simple definition `a.b.c` or a template `${a.b.c}` can be specified as the path. * Key and value can be either a definition or a template. The key does not have to be defined. * - * You can call the method via the monster namespace `Monster.Data.buildMap()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Data.buildMap()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/buildmap.js'; + * import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/buildmap.js'; * console.log(buildMap()) * </script> * ``` @@ -47,7 +36,7 @@ export const PARENT = '^'; * * @example * - * import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/buildmap.js'; + * import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/buildmap.js'; * // a typical data structure as reported by an api * * let map; @@ -125,7 +114,7 @@ export const PARENT = '^'; * @throws {TypeError} value is neither a string nor a function * @throws {TypeError} the selector callback must return a map */ -function buildMap(subject, selector, valueTemplate, keyTemplate, filter) { +export 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); @@ -143,7 +132,7 @@ function buildMap(subject, selector, valueTemplate, keyTemplate, filter) { * @return {Map} * @throws {TypeError} selector is neither a string nor a function */ -function assembleParts(subject, selector, filter, callback) { +export function assembleParts(subject, selector, filter, callback) { const result = new Map(); @@ -261,7 +250,7 @@ function buildFlatMap(subject, selector, key, parentMap) { * Alternatively to a string selector a callback can be specified. this must return a map. * * @example - * import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/buildmap.js'; + * import {buildMap} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/buildmap.js'; * * let obj = { * "data": [ @@ -427,7 +416,3 @@ function build(subject, definition, defaultValue) { return definition; } - - -assignToNamespace('Monster.Data', buildMap); -export {Monster, buildMap, assembleParts} diff --git a/application/source/data/buildtree.js b/application/source/data/buildtree.js index 78c7b6ecd517f65733ec99de8f6dbb24007a57f7..db496cc26dfbc5536d0edc79216ff3ed7a22c2be 100644 --- a/application/source/data/buildtree.js +++ b/application/source/data/buildtree.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {isArray, isObject} from "../types/is.js"; import {Node} from "../types/node.js"; import {NodeList} from "../types/nodelist.js"; @@ -34,20 +34,9 @@ const rootSymbol = Symbol('root'); /** * With the help of the function `buildTree()`, nodes can be easily created from data objects. * - * You can call the method via the monster namespace `Monster.Data.buildTree()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/buildtree.js'; - * Monster.Data.buildTree() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {buildTree} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/buildtree.js'; + * import {buildTree} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/buildtree.js'; * buildTree() * </script> * ``` @@ -64,7 +53,7 @@ const rootSymbol = Symbol('root'); * @throws {Error} the object has no value for the specified id * @since 1.26.0 */ -function buildTree(subject, selector, idKey, parentIDKey, options) { +export function buildTree(subject, selector, idKey, parentIDKey, options) { const nodes = new Map; @@ -123,7 +112,3 @@ function buildTree(subject, selector, idKey, parentIDKey, options) { return list; } - - -assignToNamespace('Monster.Data', buildTree); -export {Monster, buildTree} diff --git a/application/source/data/datasource.js b/application/source/data/datasource.js index 875a3b26fcce06035f54d135a7886824db92feb6..a0cd11fb1079b6621e4ad8d36d4b59c9e238da9e 100644 --- a/application/source/data/datasource.js +++ b/application/source/data/datasource.js @@ -5,7 +5,7 @@ */ import {internalSymbol} from "../constants.js"; -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from "../types/base.js"; import {parseDataURL} from "../types/dataurl.js"; import {isString} from "../types/is.js"; @@ -27,27 +27,16 @@ const internalDataSymbol = Symbol('internalData'); * The datasource class is the basis for dealing with different data sources. * It provides a unified interface for accessing data * - * You can create an object of this class using the monster namespace `Monster.Data.Datasource()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Data.Datasource() - * </script> - * ``` - * - * Alternatively you can import the class directly - * * ``` * <script type="module"> - * import {Datasource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/datasource.js'; + * import {Datasource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/datasource.js'; * new Datasource() * </script> * ``` * * @example * - * import {Datasource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/datasource.js' + * import {Datasource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/datasource.js' * * class MyDatasource extends Datasource { * @@ -60,7 +49,7 @@ const internalDataSymbol = Symbol('internalData'); * @memberOf Monster.Data * @summary The datasource class encapsulates the access to data objects. */ -class Datasource extends Base { +export class Datasource extends Base { /** * @@ -240,7 +229,3 @@ function parseOptionsJSON(data) { return {}; } - - -assignToNamespace('Monster.Data', Datasource); -export {Monster, Datasource} diff --git a/application/source/data/datasource/namespace.js b/application/source/data/datasource/namespace.js deleted file mode 100644 index 31e3e545e4c360744646f1d587adc5f84a7ccbf0..0000000000000000000000000000000000000000 --- a/application/source/data/datasource/namespace.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** - * Namespace for datasources - * - * @namespace Monster.Data.Datasource - * @memberOf Monster.Data - * @author schukai GmbH - */ - - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.Data.Datasource"; \ No newline at end of file diff --git a/application/source/data/datasource/restapi.js b/application/source/data/datasource/restapi.js index 8df7cb79bbbe2530bbf2879e24c01086aed71e6c..18875e3a347b63fc123f9cafa53a1aa84eb12d88 100644 --- a/application/source/data/datasource/restapi.js +++ b/application/source/data/datasource/restapi.js @@ -13,27 +13,18 @@ import {Pipe} from "../pipe.js"; import {WriteError} from "./restapi/writeerror.js"; /** - * You can create an object of this class using the monster namespace `Monster.Data.Datasource.RestAPI()`. - * + * The RestAPI is a class that enables a REST API server. + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Data.Datasource.RestAPI() - * </script> - * ``` - * - * Alternatively you can import the class directly - * - * ``` - * <script type="module"> - * import {RestAPI} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/datasource/restapi.js'; + * import {RestAPI} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/datasource/restapi.js'; * new RestAPI() * </script> * ``` * * @example * - * import {RestAPI} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/datasource/restapi.js'; + * import {RestAPI} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/datasource/restapi.js'; * * const ds = new RestAPI({ * url: 'https://httpbin.org/get' @@ -50,7 +41,7 @@ import {WriteError} from "./restapi/writeerror.js"; * @memberOf Monster.Data.Datasource * @summary The LocalStorage class encapsulates the access to data objects. */ -class RestAPI extends Datasource { +export class RestAPI extends Datasource { /** * @@ -260,7 +251,3 @@ class RestAPI extends Datasource { * @memberOf Monster.Data * @see Monster.Data.Datasource */ - - -assignToNamespace('Monster.Data.Datasource', RestAPI); -export {Monster, RestAPI} diff --git a/application/source/data/datasource/restapi/writeerror.js b/application/source/data/datasource/restapi/writeerror.js index ae4cac057ad9a19bde6834b835d7d693b3272ff1..d18f7b0f5db5b4c008cdfb1772669f59d7dee264 100644 --- a/application/source/data/datasource/restapi/writeerror.js +++ b/application/source/data/datasource/restapi/writeerror.js @@ -15,7 +15,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 */ -class WriteError extends Error { +export class WriteError extends Error { /** * * @param {string} message @@ -43,7 +43,3 @@ class WriteError extends Error { return this[internalSymbol]['validation'] } } - - -assignToNamespace('Monster.Data.Datasource.RestAPI', WriteError); -export {Monster, WriteError} \ No newline at end of file diff --git a/application/source/data/datasource/storage.js b/application/source/data/datasource/storage.js index 4d4a6049e99d499c4c23201553a07c258f38a409..06d01b61a312b7374ad8a6626d658fe0ae31391a 100644 --- a/application/source/data/datasource/storage.js +++ b/application/source/data/datasource/storage.js @@ -13,30 +13,21 @@ import {Datasource} from "../datasource.js"; * @private * @type {symbol} */ -const storageObjectSymbol = Symbol('storageObject'); +export const storageObjectSymbol = Symbol('storageObject'); /** - * You can create an object of this class using the monster namespace `Monster.Data.Datasource.Storage()`. - * + * The class represents a record. + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Data.Datasource.Storage() - * </script> - * ``` - * - * Alternatively you can import the class directly - * - * ``` - * <script type="module"> - * import {Storage} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/datasource/storage.js'; + * import {Storage} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/datasource/storage.js'; * new Storage() * </script> * ``` * * @example * - * import {Storage} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/datasource/storage.js'; + * import {Storage} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/datasource/storage.js'; * * new Datasource(); * @@ -45,7 +36,7 @@ const storageObjectSymbol = Symbol('storageObject'); * @memberOf Monster.Data.Datasource * @summary The Storage class encapsulates the access to data objects over WebStorageAPI. */ -class Storage extends Datasource { +export class Storage extends Datasource { /** * @@ -125,7 +116,3 @@ class Storage extends Datasource { } } - - -assignToNamespace('Monster.Data.Datasource', Storage); -export {Monster, Storage, storageObjectSymbol} diff --git a/application/source/data/datasource/storage/localstorage.js b/application/source/data/datasource/storage/localstorage.js index 8094fe589a451f6624da750a9443a19700b6e6f1..4f79ea64d4917494b0a34979296aac1b0302a0a0 100644 --- a/application/source/data/datasource/storage/localstorage.js +++ b/application/source/data/datasource/storage/localstorage.js @@ -10,24 +10,12 @@ import {getGlobalObject} from "../../../types/global.js"; import {Datasource} from "../../datasource.js"; import {Storage, storageObjectSymbol} from "../storage.js"; - /** + * The LocalStorage Datasource provides a data store in the browser localStorage. * - * - * You can create an object of this class using the monster namespace `Monster.Data.Datasource.Storage.LocalStorage()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Data.Datasource.Storage.LocalStorage() - * </script> - * ``` - * - * Alternatively you can import the class directly - * * ``` * <script type="module"> - * import {LocalStorage} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/datasource/storage/localstorage.js'; + * import {LocalStorage} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/datasource/storage/localstorage.js'; * new LocalStorage() * </script> * ``` @@ -37,7 +25,7 @@ import {Storage, storageObjectSymbol} from "../storage.js"; * @memberOf Monster.Data.Datasource.Storage * @summary The LocalStorage class encapsulates the access to data objects. */ -class LocalStorage extends Storage { +export class LocalStorage extends Storage { /** * @throws {Error} this method must be implemented by derived classes. @@ -59,6 +47,3 @@ class LocalStorage extends Storage { } - -assignToNamespace('Monster.Data.Datasource.Storage', LocalStorage); -export {Monster, LocalStorage} diff --git a/application/source/data/datasource/storage/namespace.js b/application/source/data/datasource/storage/namespace.js deleted file mode 100644 index 122d1e020e09b49f5673da8b502dc1a61c5f6036..0000000000000000000000000000000000000000 --- a/application/source/data/datasource/storage/namespace.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** - * Namespace for storages - * - * @namespace Monster.Data.Datasource.Storage - * @memberOf Monster.Data.Datasource - * @author schukai GmbH - */ - - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.Data.Datasource.Storage"; \ No newline at end of file diff --git a/application/source/data/datasource/storage/sessionstorage.js b/application/source/data/datasource/storage/sessionstorage.js index 5cbbe6880df2044614844d65c17812cbf232fe10..245d8a74fd4692e0617b9c1b994f95d0518f065c 100644 --- a/application/source/data/datasource/storage/sessionstorage.js +++ b/application/source/data/datasource/storage/sessionstorage.js @@ -11,20 +11,11 @@ import {Datasource} from "../../datasource.js"; import {Storage, storageObjectSymbol} from "../storage.js"; /** - * You can create an object of this class using the monster namespace `Monster.Data.Datasource.Storage.SessionStorage()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Data.Datasource.Storage.SessionStorage() - * </script> - * ``` - * - * Alternatively you can import the class directly - * + * The SessionStorage class provides a data source that uses the SessionStorage API on the client. + * * ``` * <script type="module"> - * import {SessionStorage} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/datasource/storage/sessionstorage.js'; + * import {SessionStorage} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/datasource/storage/sessionstorage.js'; * new SessionStorage() * </script> * ``` @@ -34,7 +25,7 @@ import {Storage, storageObjectSymbol} from "../storage.js"; * @memberOf Monster.Data.Datasource.Storage * @summary The LocalStorage class encapsulates the access to data objects. */ -class SessionStorage extends Storage { +export class SessionStorage extends Storage { /** * @throws {Error} this method must be implemented by derived classes. @@ -56,6 +47,3 @@ class SessionStorage extends Storage { } } - -assignToNamespace('Monster.Data.Datasource.Storage', SessionStorage); -export {Monster, SessionStorage} diff --git a/application/source/data/diff.js b/application/source/data/diff.js index 086bca728e87a4140859f5b352335c64d0283868..2871ab0adbcb8e1c757aa037086e255bbf0d7fdf 100644 --- a/application/source/data/diff.js +++ b/application/source/data/diff.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {isArray, isObject} from "../types/is.js"; import {typeOf} from "../types/typeof.js"; @@ -13,27 +13,16 @@ import {typeOf} from "../types/typeof.js"; * * The operator `add` means that something has been added to the second object. `delete` means that something has been deleted from the second object compared to the first object. * - * You can call the method via the monster namespace `Monster.Data.Diff()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Data.Diff(a, b) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/diff.js'; + * import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/diff.js'; * Diff(a, b) * </script> * ``` * * @example * - * import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/diff.js'; + * import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/diff.js'; * * // given are two objects x and y. * @@ -80,7 +69,7 @@ import {typeOf} from "../types/typeof.js"; * @copyright schukai GmbH * @memberOf Monster.Data */ -function diff(first, second) { +export function diff(first, second) { return doDiff(first, second) } @@ -244,6 +233,3 @@ function getOperator(a, b) { return operator; } - -assignToNamespace('Monster.Data', diff); -export {Monster, diff} diff --git a/application/source/data/extend.js b/application/source/data/extend.js index 821b2df50011926b17116435021fb416c48210a4..0fc6ce7e2d67935ecfcac7b8391b91ab9c837a95 100644 --- a/application/source/data/extend.js +++ b/application/source/data/extend.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {isArray, isObject} from "../types/is.js"; import {typeOf} from "../types/typeof.js"; @@ -11,20 +11,9 @@ import {typeOf} from "../types/typeof.js"; * Extend copies all enumerable own properties from one or * more source objects to a target object. It returns the modified target object. * - * You can call the method via the monster namespace `Monster.Data.extend()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Data.extend(a, b) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {extend} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/extend.js'; + * import {extend} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/extend.js'; * extend(a, b) * </script> * ``` @@ -38,7 +27,7 @@ import {typeOf} from "../types/typeof.js"; * @throws {Error} unsupported argument * @throws {Error} type mismatch */ -function extend() { +export function extend() { let o, i; for (i = 0; i < arguments.length; i++) { @@ -86,7 +75,3 @@ function extend() { return o; } - - -assignToNamespace('Monster.Data', extend); -export {Monster, extend} diff --git a/application/source/data/namespace.js b/application/source/data/namespace.js deleted file mode 100644 index c4f008b29835c5e038ce5b222148fb3d7c9e685f..0000000000000000000000000000000000000000 --- a/application/source/data/namespace.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** - * In this namespace you will find classes and methods for handling data. - * - * @namespace Monster.Data - * @memberOf Monster - * @author schukai GmbH - */ - - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.Data"; \ No newline at end of file diff --git a/application/source/data/pathfinder.js b/application/source/data/pathfinder.js index aa520cb0a27f5bb44e62095636fc57aa1f178a02..4b78c5f8e89f1aba985918a665d457a356be4eec 100644 --- a/application/source/data/pathfinder.js +++ b/application/source/data/pathfinder.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from '../types/base.js'; import {isArray, isInteger, isObject, isPrimitive} from '../types/is.js'; import {Stack} from "../types/stack.js"; @@ -24,20 +24,11 @@ export const DELIMITER = '.'; export const WILDCARD = '*'; /** - * You can call the method via the monster namespace `new Monster.Data.Pathfinder()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.Data.Pathfinder()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * + * Pathfinder is a class to find a path to an object. + * * ``` * <script type="module"> - * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/pathfinder.js'; + * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/pathfinder.js'; * console.log(new Pathfinder()) * </script> * ``` @@ -79,7 +70,7 @@ export const WILDCARD = '*'; * * @example * - * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/pathfinder.js'; + * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/pathfinder.js'; * * let value = new Pathfinder({ * a: { @@ -105,7 +96,7 @@ export const WILDCARD = '*'; * * @example * - * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/pathfinder.js'; + * import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/pathfinder.js'; * * let p = new Pathfinder({ * a: { @@ -129,7 +120,7 @@ export const WILDCARD = '*'; * @copyright schukai GmbH * @memberOf Monster.Data */ -class Pathfinder extends Base { +export class Pathfinder extends Base { /** * @param {array|object|Map|Set} value @@ -232,8 +223,6 @@ class Pathfinder extends Base { } -assignToNamespace('Monster.Data', Pathfinder); -export {Monster, Pathfinder} /** * diff --git a/application/source/data/pipe.js b/application/source/data/pipe.js index 242b078ac5c33e8c35c9caa3728a68699c7366ba..c1c7dbe6935dd3014f5e669813bbd97f2cffc94b 100644 --- a/application/source/data/pipe.js +++ b/application/source/data/pipe.js @@ -4,31 +4,20 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from '../types/base.js'; import {validateString} from '../types/validate.js'; import {Transformer} from './transformer.js'; -const DELIMITER = '|'; +export const DELIMITER = '|'; /** * The pipe class makes it possible to combine several processing steps. * - * You can call the method via the monster namespace `new Monster.Data.Pipe()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Data.Pipe() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/pipe.js'; + * import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/pipe.js'; * new Pipe() * </script> * ``` @@ -39,7 +28,7 @@ const DELIMITER = '|'; * the word is then converted to uppercase letters and a prefix Hello is added. the two backslash safe the space char. * * @example - * import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/pipe.js'; + * import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/pipe.js'; * * let obj = { * a: { @@ -58,7 +47,7 @@ const DELIMITER = '|'; * @copyright schukai GmbH * @memberOf Monster.Data */ -class Pipe extends Base { +export class Pipe extends Base { /** * @@ -106,6 +95,3 @@ class Pipe extends Base { }, value); } } - -assignToNamespace('Monster.Data', Pipe); -export {Monster, Pipe} diff --git a/application/source/data/transformer.js b/application/source/data/transformer.js index 430351b6ffc2f3529b91b00d3bb5b036b8322e1e..ec84d48d8507d599f6f882b2416cf05276d37e35 100644 --- a/application/source/data/transformer.js +++ b/application/source/data/transformer.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from '../types/base.js'; import {getGlobal, getGlobalObject} from "../types/global.js"; import {ID} from '../types/id.js'; @@ -21,20 +21,9 @@ import {Pathfinder} from "./pathfinder.js"; /** * The transformer class is a swiss army knife for manipulating values. especially in combination with the pipe, processing chains can be built up. * - * You can call the method via the monster namespace `new Monster.Data.Transformer()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Data.Transformer() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/transformer.js'; + * import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/transformer.js'; * new Transformer() * </script> * ``` @@ -120,7 +109,7 @@ import {Pathfinder} from "./pathfinder.js"; * * @example * - * import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/data/transformer.js'; + * import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/transformer.js'; * * const transformer = new Transformer("tolower") * @@ -134,7 +123,7 @@ import {Pathfinder} from "./pathfinder.js"; * @copyright schukai GmbH * @memberOf Monster.Data */ -class Transformer extends Base { +export class Transformer extends Base { /** * * @param {string} definition @@ -185,9 +174,6 @@ class Transformer extends Base { } } -assignToNamespace('Monster.Data', Transformer); -export {Monster, Transformer} - /** * * @param {string} command diff --git a/application/source/dom/assembler.js b/application/source/dom/assembler.js index 65dd7338217294c6e540948b2eed259b060013e4..176641040cbf4413ae162752521ce08c56a4a0ce 100644 --- a/application/source/dom/assembler.js +++ b/application/source/dom/assembler.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from '../types/base.js'; import {getGlobalFunction} from "../types/global.js"; import {ProxyObserver} from "../types/proxyobserver.js"; @@ -16,7 +16,7 @@ import {validateInstance, validateString} from "../types/validate.js"; * @type {string} * @memberOf Monster.DOM */ -const ATTRIBUTEPREFIX = "data-monster-"; +export const ATTRIBUTEPREFIX = "data-monster-"; /** * you can call the method via the monster namespace `new Monster.DOM.Assembler()`. @@ -32,7 +32,7 @@ const ATTRIBUTEPREFIX = "data-monster-"; * * ``` * <script type="module"> - * import {Assembler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/assembler.js'; + * import {Assembler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/assembler.js'; * console.log(new Assembler()) * </script> * ``` @@ -42,7 +42,7 @@ const ATTRIBUTEPREFIX = "data-monster-"; * @memberOf Monster.DOM * @summary Allows you to build an html fragment */ -class Assembler extends Base { +export class Assembler extends Base { /** * @param {DocumentFragment} fragment @@ -95,6 +95,3 @@ class Assembler extends Base { } } - -assignToNamespace('Monster.DOM', Assembler); -export {Monster, ATTRIBUTEPREFIX, Assembler} diff --git a/application/source/dom/attributes.js b/application/source/dom/attributes.js index 75e8dcbd46d57bc3b49579d2cb3272508cf383c4..88410c3f1fffb75674e9c3cd7ba419fdc1fcdc3e 100644 --- a/application/source/dom/attributes.js +++ b/application/source/dom/attributes.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {getGlobalFunction} from "../types/global.js"; import {TokenList} from "../types/tokenlist.js"; import {validateInstance, validateString, validateSymbol} from "../types/validate.js"; @@ -16,20 +16,9 @@ import {ATTRIBUTE_OBJECTLINK} from "./constants.js"; * if a node is specified without a object link, a recursive search upwards is performed until the corresponding * object link is found, or undefined is returned. * - * you can call the method via the monster namespace `Monster.DOM.getUpdaterFromNode()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.DOM.findClosestObjectLink()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {getUpdaterFromNode} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/updater.js'; + * import {getUpdaterFromNode} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/updater.js'; * console.log(findClosestObjectLink()) * </script> * ``` @@ -41,25 +30,16 @@ import {ATTRIBUTE_OBJECTLINK} from "./constants.js"; * @memberOf Monster.DOM * @throws {TypeError} value is not an instance of HTMLElement */ -function findClosestObjectLink(element) { +export function findClosestObjectLink(element) { return findClosestByAttribute(element, ATTRIBUTE_OBJECTLINK); } /** - * You can call the method via the monster namespace `new Monster.DOM.addToObjectLink()`. - * + * Adds a class attribute to an element. + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.addToObjectLink(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {addToObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {addToObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * addToObjectLink(); * </script> * ``` @@ -72,7 +52,7 @@ function findClosestObjectLink(element) { * @param {Object} object * @return {boolean} */ -function addToObjectLink(element, symbol, object) { +export function addToObjectLink(element, symbol, object) { validateInstance(element, HTMLElement); validateSymbol(symbol) @@ -88,20 +68,11 @@ function addToObjectLink(element, symbol, object) { } /** - * You can call the method via the monster namespace `new Monster.DOM.removeObjectLink()`. + * Removes an object from an element * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.removeObjectLink(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {removeObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {removeObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * removeObjectLink(); * </script> * ``` @@ -113,7 +84,7 @@ function addToObjectLink(element, symbol, object) { * @param {Symbol} symbol * @return {boolean} */ -function removeObjectLink(element, symbol) { +export function removeObjectLink(element, symbol) { validateInstance(element, HTMLElement); validateSymbol(symbol) @@ -130,20 +101,11 @@ function removeObjectLink(element, symbol) { /** - * You can call the method via the monster namespace `new Monster.DOM.hasObjectLink()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.hasObjectLink(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. + * Checks if an element has an object link * * ``` * <script type="module"> - * import {hasObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {hasObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * hasObjectLink(); * </script> * ``` @@ -155,7 +117,7 @@ function removeObjectLink(element, symbol) { * @param {Symbol} symbol * @return {boolean} */ -function hasObjectLink(element, symbol) { +export function hasObjectLink(element, symbol) { validateInstance(element, HTMLElement); validateSymbol(symbol) @@ -176,20 +138,9 @@ function hasObjectLink(element, symbol) { * * With the method {@see {@link addToObjectLink}} the objects can be added. * - * You can call the method via the monster namespace `new Monster.DOM.getLinkedObjects()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.getLinkedObjects(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {getLinkedObjects} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {getLinkedObjects} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * getLinkedObjects(); * </script> * ``` @@ -202,7 +153,7 @@ function hasObjectLink(element, symbol) { * @return {Iterator} * @throws {Error} there is no object link for symbol */ -function getLinkedObjects(element, symbol) { +export function getLinkedObjects(element, symbol) { validateInstance(element, HTMLElement); validateSymbol(symbol) @@ -221,20 +172,9 @@ function getLinkedObjects(element, symbol) { * * Tokens are always separated by a space. * - * You can call the method via the monster namespace `new Monster.DOM.toggleAttributeToken()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.toggleAttributeToken(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {toggleAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {toggleAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * toggleAttributeToken(); * </script> * ``` @@ -247,7 +187,7 @@ function getLinkedObjects(element, symbol) { * @param {string} token * @return {HTMLElement} */ -function toggleAttributeToken(element, key, token) { +export function toggleAttributeToken(element, key, token) { validateInstance(element, HTMLElement); validateString(token) validateString(key) @@ -265,20 +205,9 @@ function toggleAttributeToken(element, key, token) { /** * This method can be used to add a token to an attribute. Tokens are always separated by a space. * - * You can call the method via the monster namespace `new Monster.DOM.addAttributeToken()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.addAttributeToken(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {addAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {addAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * addAttributeToken(); * </script> * ``` @@ -291,7 +220,7 @@ function toggleAttributeToken(element, key, token) { * @param {string} token * @return {HTMLElement} */ -function addAttributeToken(element, key, token) { +export function addAttributeToken(element, key, token) { validateInstance(element, HTMLElement); validateString(token) validateString(key) @@ -311,20 +240,9 @@ function addAttributeToken(element, key, token) { * * Tokens are always separated by a space. * - * You can call the method via the monster namespace `new Monster.DOM.removeAttributeToken()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.removeAttributeToken(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {removeAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {removeAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * removeAttributeToken(); * </script> * ``` @@ -337,7 +255,7 @@ function addAttributeToken(element, key, token) { * @param {string} token * @return {HTMLElement} */ -function removeAttributeToken(element, key, token) { +export function removeAttributeToken(element, key, token) { validateInstance(element, HTMLElement); validateString(token) validateString(key) @@ -356,20 +274,9 @@ function removeAttributeToken(element, key, token) { * * Tokens are always separated by a space. * - * You can call the method via the monster namespace `new Monster.DOM.containsAttributeToken()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.containsAttributeToken(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {containsAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {containsAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * containsAttributeToken(); * </script> * ``` @@ -382,7 +289,7 @@ function removeAttributeToken(element, key, token) { * @param {string} token * @return {boolean} */ -function containsAttributeToken(element, key, token) { +export function containsAttributeToken(element, key, token) { validateInstance(element, HTMLElement); validateString(token) validateString(key) @@ -398,20 +305,9 @@ function containsAttributeToken(element, key, token) { /** * Tokens are always separated by a space. * - * You can call the method via the monster namespace `new Monster.DOM.replaceAttributeToken()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.replaceAttributeToken(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {replaceAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {replaceAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * replaceAttributeToken(); * </script> * ``` @@ -425,7 +321,7 @@ function containsAttributeToken(element, key, token) { * @param {string} to * @return {HTMLElement} */ -function replaceAttributeToken(element, key, from, to) { +export function replaceAttributeToken(element, key, from, to) { validateInstance(element, HTMLElement); validateString(from) validateString(to) @@ -443,20 +339,9 @@ function replaceAttributeToken(element, key, from, to) { /** * Tokens are always separated by a space. * - * You can call the method via the monster namespace `new Monster.DOM.clearAttributeTokens()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.clearAttributeTokens(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * clearAttributeTokens(); * </script> * ``` @@ -468,7 +353,7 @@ function replaceAttributeToken(element, key, from, to) { * @param {string} key * @return {HTMLElement} */ -function clearAttributeTokens(element, key) { +export function clearAttributeTokens(element, key) { validateInstance(element, HTMLElement); validateString(key) @@ -500,20 +385,9 @@ function clearAttributeTokens(element, key) { * findClosestByAttribute(document.getElementById('1'),'data-my-attribute', '2'); // ↦ node with id 2 * ``` * - * You can call the method via the monster namespace `new Monster.DOM.findClosestByAttribute()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.findClosestByAttribute(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {findClosestByAttribute} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {findClosestByAttribute} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * findClosestByAttribute(); * </script> * ``` @@ -527,7 +401,7 @@ function clearAttributeTokens(element, key) { * @return {HTMLElement|undefined} * @summary find closest node */ -function findClosestByAttribute(element, key, value) { +export function findClosestByAttribute(element, key, value) { validateInstance(element, getGlobalFunction('HTMLElement')); if (element.hasAttribute(key)) { @@ -565,20 +439,9 @@ function findClosestByAttribute(element, key, value) { * findClosestByClass(document.getElementById('2'),'myclass'); // ↦ node with id 2 * ``` * - * You can call the method via the monster namespace `new Monster.DOM.findClosestByClass()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.findClosestByClass(); - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {findClosestByClass} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/attributes.js'; + * import {findClosestByClass} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.js'; * findClosestByClass(); * </script> * ``` @@ -591,7 +454,7 @@ function findClosestByAttribute(element, key, value) { * @return {HTMLElement|undefined} * @summary find closest node */ -function findClosestByClass(element, className) { +export function findClosestByClass(element, className) { validateInstance(element, getGlobalFunction('HTMLElement')); if (element?.classList?.contains(validateString(className))) { @@ -605,22 +468,3 @@ function findClosestByClass(element, className) { return undefined; } - -// exports -assignToNamespace('Monster.DOM', findClosestByClass, getLinkedObjects, addToObjectLink, removeObjectLink, findClosestByAttribute, hasObjectLink, clearAttributeTokens, replaceAttributeToken, containsAttributeToken, removeAttributeToken, addAttributeToken, toggleAttributeToken); -export { - Monster, - addToObjectLink, - removeObjectLink, - hasObjectLink, - findClosestByAttribute, - clearAttributeTokens, - replaceAttributeToken, - containsAttributeToken, - removeAttributeToken, - addAttributeToken, - toggleAttributeToken, - getLinkedObjects, - findClosestObjectLink, - findClosestByClass -} diff --git a/application/source/dom/constants.js b/application/source/dom/constants.js index 07e663f8101e84356cb96092c31800cf70fd9bd1..42a2c33ba353f122702ad71b4f9cffc228f71541 100644 --- a/application/source/dom/constants.js +++ b/application/source/dom/constants.js @@ -11,14 +11,14 @@ import {Monster} from '../namespace.js'; * @memberOf Monster.DOM * @type {string} */ -const DEFAULT_THEME = 'monster'; +export const DEFAULT_THEME = 'monster'; /** * @memberOf Monster.DOM * @since 1.8.0 * @type {string} */ -const ATTRIBUTE_PREFIX = 'data-monster-'; +export const ATTRIBUTE_PREFIX = 'data-monster-'; /** * This is the name of the attribute to pass options to a control @@ -27,7 +27,7 @@ const ATTRIBUTE_PREFIX = 'data-monster-'; * @since 1.8.0 * @type {string} */ -const ATTRIBUTE_OPTIONS = ATTRIBUTE_PREFIX + 'options'; +export const ATTRIBUTE_OPTIONS = ATTRIBUTE_PREFIX + 'options'; /** * This is the name of the attribute to pass options to a control @@ -36,139 +36,139 @@ const ATTRIBUTE_OPTIONS = ATTRIBUTE_PREFIX + 'options'; * @since 1.30.0 * @type {string} */ -const ATTRIBUTE_OPTIONS_SELECTOR = ATTRIBUTE_PREFIX + 'options-selector'; +export const ATTRIBUTE_OPTIONS_SELECTOR = ATTRIBUTE_PREFIX + 'options-selector'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -const ATTRIBUTE_THEME_PREFIX = ATTRIBUTE_PREFIX + 'theme-'; +export const ATTRIBUTE_THEME_PREFIX = ATTRIBUTE_PREFIX + 'theme-'; /** * @memberOf Monster.DOM * @type {string} */ -const ATTRIBUTE_THEME_NAME = ATTRIBUTE_THEME_PREFIX + 'name'; +export const ATTRIBUTE_THEME_NAME = ATTRIBUTE_THEME_PREFIX + 'name'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -const ATTRIBUTE_UPDATER_ATTRIBUTES = ATTRIBUTE_PREFIX + 'attributes'; +export const ATTRIBUTE_UPDATER_ATTRIBUTES = ATTRIBUTE_PREFIX + 'attributes'; /** * @memberOf Monster.DOM * @type {string} * @since 1.27.1 */ -const ATTRIBUTE_UPDATER_SELECT_THIS = ATTRIBUTE_PREFIX + 'select-this'; +export const ATTRIBUTE_UPDATER_SELECT_THIS = ATTRIBUTE_PREFIX + 'select-this'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -const ATTRIBUTE_UPDATER_REPLACE = ATTRIBUTE_PREFIX + 'replace'; +export const ATTRIBUTE_UPDATER_REPLACE = ATTRIBUTE_PREFIX + 'replace'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -const ATTRIBUTE_UPDATER_INSERT = ATTRIBUTE_PREFIX + 'insert'; +export const ATTRIBUTE_UPDATER_INSERT = ATTRIBUTE_PREFIX + 'insert'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -const ATTRIBUTE_UPDATER_INSERT_REFERENCE = ATTRIBUTE_PREFIX + 'insert-reference'; +export const ATTRIBUTE_UPDATER_INSERT_REFERENCE = ATTRIBUTE_PREFIX + 'insert-reference'; /** * @memberOf Monster.DOM * @type {string} * @since 1.8.0 */ -const ATTRIBUTE_UPDATER_REMOVE = ATTRIBUTE_PREFIX + 'remove'; +export const ATTRIBUTE_UPDATER_REMOVE = ATTRIBUTE_PREFIX + 'remove'; /** * @memberOf Monster.DOM * @type {string} * @since 1.9.0 */ -const ATTRIBUTE_UPDATER_BIND = ATTRIBUTE_PREFIX + 'bind'; +export const ATTRIBUTE_UPDATER_BIND = ATTRIBUTE_PREFIX + 'bind'; /** * @memberOf Monster.DOM * @type {string} * @since 1.27.0 */ -const ATTRIBUTE_TEMPLATE_PREFIX = ATTRIBUTE_PREFIX + 'template-prefix'; +export const ATTRIBUTE_TEMPLATE_PREFIX = ATTRIBUTE_PREFIX + 'template-prefix'; /** * @memberOf Monster.DOM * @type {string} * @since 1.14.0 */ -const ATTRIBUTE_ROLE = ATTRIBUTE_PREFIX + 'role'; +export const ATTRIBUTE_ROLE = ATTRIBUTE_PREFIX + 'role'; /** * @memberOf Monster.DOM * @type {string} * @since 1.24.0 */ -const ATTRIBUTE_DISABLED = 'disabled'; +export const ATTRIBUTE_DISABLED = 'disabled'; /** * @memberOf Monster.DOM * @type {string} * @since 1.24.0 */ -const ATTRIBUTE_VALUE = 'value'; +export const ATTRIBUTE_VALUE = 'value'; /** * @memberOf Monster.DOM * @type {string} * @since 1.9.0 */ -const ATTRIBUTE_OBJECTLINK = ATTRIBUTE_PREFIX + 'objectlink'; +export const ATTRIBUTE_OBJECTLINK = ATTRIBUTE_PREFIX + 'objectlink'; /** * @memberOf Monster.DOM * @type {string} * @since 1.24.0 */ -const ATTRIBUTE_ERRORMESSAGE = ATTRIBUTE_PREFIX + 'error'; +export const ATTRIBUTE_ERRORMESSAGE = ATTRIBUTE_PREFIX + 'error'; /** * @memberOf Monster.DOM * @type {symbol} * @since 1.24.0 */ -const objectUpdaterLinkSymbol = Symbol('monsterUpdater'); +export const objectUpdaterLinkSymbol = Symbol('monsterUpdater'); /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const TAG_SCRIPT = 'script'; +export const TAG_SCRIPT = 'script'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const TAG_STYLE = 'style'; +export const TAG_STYLE = 'style'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const TAG_LINK = 'link'; +export const TAG_LINK = 'link'; /** * @memberOf Monster.DOM @@ -176,7 +176,7 @@ const TAG_LINK = 'link'; * @since 1.25.0 */ -const ATTRIBUTE_ID = 'id'; +export const ATTRIBUTE_ID = 'id'; /** * @memberOf Monster.DOM @@ -184,48 +184,48 @@ const ATTRIBUTE_ID = 'id'; * @since 1.25.0 */ -const ATTRIBUTE_CLASS = 'class'; +export const ATTRIBUTE_CLASS = 'class'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_TITLE = 'title'; +export const ATTRIBUTE_TITLE = 'title'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_SRC = 'src'; +export const ATTRIBUTE_SRC = 'src'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_HREF = 'href'; +export const ATTRIBUTE_HREF = 'href'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_TYPE = 'type'; +export const ATTRIBUTE_TYPE = 'type'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_NONCE = 'nonce'; +export const ATTRIBUTE_NONCE = 'nonce'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_TRANSLATE = 'translate'; +export const ATTRIBUTE_TRANSLATE = 'translate'; /** @@ -233,7 +233,7 @@ const ATTRIBUTE_TRANSLATE = 'translate'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_TABINDEX = 'tabindex'; +export const ATTRIBUTE_TABINDEX = 'tabindex'; /** @@ -241,7 +241,7 @@ const ATTRIBUTE_TABINDEX = 'tabindex'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_SPELLCHECK = 'spellcheck'; +export const ATTRIBUTE_SPELLCHECK = 'spellcheck'; /** @@ -249,7 +249,7 @@ const ATTRIBUTE_SPELLCHECK = 'spellcheck'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_SLOT = 'slot'; +export const ATTRIBUTE_SLOT = 'slot'; /** @@ -257,7 +257,7 @@ const ATTRIBUTE_SLOT = 'slot'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_PART = 'part'; +export const ATTRIBUTE_PART = 'part'; /** @@ -265,7 +265,7 @@ const ATTRIBUTE_PART = 'part'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_LANG = 'lang'; +export const ATTRIBUTE_LANG = 'lang'; /** @@ -273,7 +273,7 @@ const ATTRIBUTE_LANG = 'lang'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_ITEMTYPE = 'itemtype'; +export const ATTRIBUTE_ITEMTYPE = 'itemtype'; /** @@ -281,7 +281,7 @@ const ATTRIBUTE_ITEMTYPE = 'itemtype'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_ITEMSCOPE = 'itemscope'; +export const ATTRIBUTE_ITEMSCOPE = 'itemscope'; /** @@ -289,7 +289,7 @@ const ATTRIBUTE_ITEMSCOPE = 'itemscope'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_ITEMREF = 'itemref'; +export const ATTRIBUTE_ITEMREF = 'itemref'; /** @@ -297,7 +297,7 @@ const ATTRIBUTE_ITEMREF = 'itemref'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_ITEMID = 'itemid'; +export const ATTRIBUTE_ITEMID = 'itemid'; /** @@ -305,7 +305,7 @@ const ATTRIBUTE_ITEMID = 'itemid'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_ITEMPROP = 'itemprop'; +export const ATTRIBUTE_ITEMPROP = 'itemprop'; /** @@ -313,7 +313,7 @@ const ATTRIBUTE_ITEMPROP = 'itemprop'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_IS = 'is'; +export const ATTRIBUTE_IS = 'is'; /** @@ -321,7 +321,7 @@ const ATTRIBUTE_IS = 'is'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_INPUTMODE = 'inputmode'; +export const ATTRIBUTE_INPUTMODE = 'inputmode'; /** @@ -329,42 +329,42 @@ const ATTRIBUTE_INPUTMODE = 'inputmode'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_ACCESSKEY = 'accesskey'; +export const ATTRIBUTE_ACCESSKEY = 'accesskey'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_AUTOCAPITALIZE = 'autocapitalize'; +export const ATTRIBUTE_AUTOCAPITALIZE = 'autocapitalize'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_AUTOFOCUS = 'autofocus'; +export const ATTRIBUTE_AUTOFOCUS = 'autofocus'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_CONTENTEDITABLE = 'contenteditable'; +export const ATTRIBUTE_CONTENTEDITABLE = 'contenteditable'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_DIR = 'dir'; +export const ATTRIBUTE_DIR = 'dir'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_DRAGGABLE = 'draggable'; +export const ATTRIBUTE_DRAGGABLE = 'draggable'; /** @@ -372,73 +372,16 @@ const ATTRIBUTE_DRAGGABLE = 'draggable'; * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_ENTERKEYHINT = 'enterkeyhint'; +export const ATTRIBUTE_ENTERKEYHINT = 'enterkeyhint'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_EXPORTPARTS = 'exportparts'; +export const ATTRIBUTE_EXPORTPARTS = 'exportparts'; /** * @memberOf Monster.DOM * @type {string} * @since 1.25.0 */ -const ATTRIBUTE_HIDDEN = 'hidden'; - - -export { - Monster, - ATTRIBUTE_HIDDEN, - ATTRIBUTE_EXPORTPARTS, - ATTRIBUTE_ENTERKEYHINT, - ATTRIBUTE_DRAGGABLE, - ATTRIBUTE_DIR, - ATTRIBUTE_CONTENTEDITABLE, - ATTRIBUTE_AUTOFOCUS, - ATTRIBUTE_AUTOCAPITALIZE, - ATTRIBUTE_ACCESSKEY, - TAG_SCRIPT, - TAG_LINK, - ATTRIBUTE_INPUTMODE, - ATTRIBUTE_IS, - ATTRIBUTE_ITEMPROP, - ATTRIBUTE_ITEMID, - ATTRIBUTE_ITEMREF, - ATTRIBUTE_ITEMSCOPE, - TAG_STYLE, - ATTRIBUTE_ITEMTYPE, - ATTRIBUTE_HREF, - ATTRIBUTE_LANG, - ATTRIBUTE_PART, - ATTRIBUTE_SLOT, - ATTRIBUTE_SPELLCHECK, - ATTRIBUTE_SRC, - ATTRIBUTE_TABINDEX, - ATTRIBUTE_TRANSLATE, - ATTRIBUTE_NONCE, - ATTRIBUTE_TYPE, - ATTRIBUTE_TITLE, - ATTRIBUTE_CLASS, - ATTRIBUTE_ID, - ATTRIBUTE_PREFIX, - ATTRIBUTE_OPTIONS, - DEFAULT_THEME, - ATTRIBUTE_THEME_PREFIX, - ATTRIBUTE_ROLE, - ATTRIBUTE_THEME_NAME, - ATTRIBUTE_UPDATER_ATTRIBUTES, - ATTRIBUTE_UPDATER_REPLACE, - ATTRIBUTE_UPDATER_INSERT, - ATTRIBUTE_UPDATER_INSERT_REFERENCE, - ATTRIBUTE_UPDATER_REMOVE, - ATTRIBUTE_UPDATER_BIND, - ATTRIBUTE_OBJECTLINK, - ATTRIBUTE_DISABLED, - ATTRIBUTE_ERRORMESSAGE, - ATTRIBUTE_VALUE, - objectUpdaterLinkSymbol, - ATTRIBUTE_TEMPLATE_PREFIX, - ATTRIBUTE_UPDATER_SELECT_THIS, - ATTRIBUTE_OPTIONS_SELECTOR -} \ No newline at end of file +export const ATTRIBUTE_HIDDEN = 'hidden'; diff --git a/application/source/dom/customcontrol.js b/application/source/dom/customcontrol.js index 510f95712483814d10a90dfbfaa3f903196ad784..b25a1e61525907f129f4331d2ff08b42bc4a2d3a 100644 --- a/application/source/dom/customcontrol.js +++ b/application/source/dom/customcontrol.js @@ -4,7 +4,7 @@ import {extend} from "../data/extend.js"; /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {ATTRIBUTE_VALUE} from "./constants.js"; import {CustomElement, attributeObserverSymbol} from "./customelement.js"; @@ -50,7 +50,7 @@ const attachedInternalSymbol = Symbol('attachedInternal'); * @copyright schukai GmbH * @memberOf Monster.DOM */ -class CustomControl extends CustomElement { +export 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>. @@ -328,6 +328,3 @@ function initObserver() { } } - -assignToNamespace('Monster.DOM', CustomControl); -export {Monster, CustomControl} diff --git a/application/source/dom/customelement.js b/application/source/dom/customelement.js index 0a76fbd9cc45eec72def8775bef77eb0c0c80156..b4c609d12f9a0207cf8de898547ba01e914c95e3 100644 --- a/application/source/dom/customelement.js +++ b/application/source/dom/customelement.js @@ -7,7 +7,7 @@ import {internalSymbol} from "../constants.js"; import {extend} from "../data/extend.js"; import {Pathfinder} from "../data/pathfinder.js"; -import {assignToNamespace, Monster} from '../namespace.js'; + import {parseDataURL} from "../types/dataurl.js"; import {getGlobalObject} from "../types/global.js"; import {isArray, isFunction, isObject, isString} from "../types/is.js"; @@ -31,20 +31,20 @@ import {Updater} from "./updater.js"; * @memberOf Monster.DOM * @type {symbol} */ -const initMethodSymbol = Symbol('initMethodSymbol'); +export const initMethodSymbol = Symbol('initMethodSymbol'); /** * @memberOf Monster.DOM * @type {symbol} */ -const assembleMethodSymbol = Symbol('assembleMethodSymbol'); +export const assembleMethodSymbol = Symbol('assembleMethodSymbol'); /** * this symbol holds the attribute observer callbacks. The key is the attribute name. * @memberOf Monster.DOM * @type {symbol} */ -const attributeObserverSymbol = Symbol('attributeObserver'); +export const attributeObserverSymbol = Symbol('attributeObserver'); /** @@ -196,7 +196,7 @@ const attributeObserverSymbol = Symbol('attributeObserver'); * @extends external:HTMLElement * @summary A base class for HTML5 customcontrols */ -class CustomElement extends HTMLElement { +export class CustomElement extends HTMLElement { /** * A new object is created. First the `initOptions` method is called. Here the @@ -560,7 +560,7 @@ class CustomElement extends HTMLElement { * @since 1.23.0 * @throws {Error} query must be a string */ -function getSlottedElements(query, name) { +export function getSlottedElements(query, name) { const self = this; const result = new Set; @@ -932,7 +932,7 @@ function initShadowRoot() { * @memberOf Monster.DOM * @throws {DOMException} Failed to execute 'define' on 'CustomElementRegistry': is not a valid custom element name */ -function registerCustomElement(element) { +export function registerCustomElement(element) { validateFunction(element); getGlobalObject('customElements').define(element.getTag(), element); } @@ -946,7 +946,7 @@ function registerCustomElement(element) { * @since 1.23.0 * @memberOf Monster.DOM */ -function assignUpdaterToElement(elements, object) { +export function assignUpdaterToElement(elements, object) { const updaters = new Set; @@ -977,15 +977,3 @@ function assignUpdaterToElement(elements, object) { return result; } - -assignToNamespace('Monster.DOM', CustomElement, registerCustomElement, assignUpdaterToElement); -export { - Monster, - registerCustomElement, - CustomElement, - initMethodSymbol, - assembleMethodSymbol, - assignUpdaterToElement, - attributeObserverSymbol, - getSlottedElements -} diff --git a/application/source/dom/events.js b/application/source/dom/events.js index 4d1ebed5c1600b881d4d0ff496d59ed60a1b088c..4ae37ecb2a71773a4132ee8fe4d9c833f3ef61b6 100644 --- a/application/source/dom/events.js +++ b/application/source/dom/events.js @@ -4,26 +4,17 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {isArray,isObject} from "../types/is.js"; import {validateInstance, validateString} from "../types/validate.js"; import {getDocument} from "./util.js"; /** - * You can call the function via the monster namespace `new Monster.DOM.fireEvent()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.fireEvent() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * + * The function sends an event + * * ``` * <script type="module"> - * import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/events.js'; + * import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/events.js'; * fireEvent() * </script> * ``` @@ -37,7 +28,7 @@ import {getDocument} from "./util.js"; * @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection * @summary Construct and send and event */ -function fireEvent(element, type) { +export function fireEvent(element, type) { const document = getDocument(); @@ -70,16 +61,7 @@ function fireEvent(element, type) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.fireCustomEvent() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {fireCustomEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/events.js'; + * import {fireCustomEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/events.js'; * fireCustomEvent() * </script> * ``` @@ -93,7 +75,7 @@ function fireEvent(element, type) { * @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection * @summary Construct and send and event */ -function fireCustomEvent(element, type, detail) { +export function fireCustomEvent(element, type, detail) { const document = getDocument(); @@ -126,20 +108,9 @@ function fireCustomEvent(element, type, detail) { * up the tree `element.closest()` with the attribute and value. If no value, or a value that is undefined or null, * is specified, only the attribute is searched. * - * You can call the function via the monster namespace `new Monster.DOM.findTargetElementFromEvent()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.findTargetElementFromEvent() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {findTargetElementFromEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/events.js'; + * import {findTargetElementFromEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/events.js'; * findTargetElementFromEvent() * </script> * ``` @@ -154,7 +125,7 @@ function fireCustomEvent(element, type, detail) { * @throws {TypeError} value is not an instance of HTMLElement * @summary Help function to find the appropriate control */ -function findTargetElementFromEvent(event, attributeName, attributeValue) { +export function findTargetElementFromEvent(event, attributeName, attributeValue) { validateInstance(event, Event); if (typeof event.composedPath !== 'function') { @@ -179,7 +150,3 @@ function findTargetElementFromEvent(event, attributeName, attributeValue) { return undefined; } - - -assignToNamespace('Monster.DOM', findTargetElementFromEvent, fireEvent, fireCustomEvent); -export {Monster, findTargetElementFromEvent, fireEvent, fireCustomEvent} diff --git a/application/source/dom/focusmanager.js b/application/source/dom/focusmanager.js index 31d6dbbbd3b6aee62b914b0971fd42b38489f03c..d34e487d4f39fd07d28e6a3b17b5a043480a9770 100644 --- a/application/source/dom/focusmanager.js +++ b/application/source/dom/focusmanager.js @@ -37,20 +37,9 @@ const stackSymbol = Symbol('stack'); /** * With the focusmanager the focus can be stored in a document, recalled and moved. * - * You can create the object via the monster namespace `new Monster.DOM.FocusManager()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.FocusManager() - * </script> - * ``` - * - * Alternatively, you can also integrate this object individually. - * - * ``` - * <script type="module"> - * import {FocusManager} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/focusmanager.js'; + * import {FocusManager} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/focusmanager.js'; * new FocusManager() * </script> * ``` @@ -61,7 +50,7 @@ const stackSymbol = Symbol('stack'); * @throws {Error} unsupported locale * @summary Handle the focus */ -class FocusManager extends BaseWithOptions { +export class FocusManager extends BaseWithOptions { /** * @@ -239,10 +228,6 @@ class FocusManager extends BaseWithOptions { } -assignToNamespace('Monster.DOM', FocusManager); -export {FocusManager} - - diff --git a/application/source/dom/locale.js b/application/source/dom/locale.js index 3a8cb41b2f15f57c3849cca750a8dfb75a95f066..255bf04b953d9fde985dfd89c6e829abc8541296 100644 --- a/application/source/dom/locale.js +++ b/application/source/dom/locale.js @@ -5,14 +5,14 @@ */ import {parseLocale} from "../i18n/locale.js"; -import {assignToNamespace, Monster} from '../namespace.js'; + import {getDocument} from "./util.js"; /** * @private * @type {string} */ -const DEFAULT_LANGUAGE = 'en'; +export const DEFAULT_LANGUAGE = 'en'; /** * With this function you can read the language version set by the document. @@ -26,16 +26,7 @@ const DEFAULT_LANGUAGE = 'en'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.getLocaleOfDocument() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/locale.js'; + * import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/locale.js'; * new getLocaleOfDocument() * </script> * ``` @@ -47,7 +38,7 @@ const DEFAULT_LANGUAGE = 'en'; * @throws {Error} unsupported locale * @summary Tries to determine the locale used */ -function getLocaleOfDocument() { +export function getLocaleOfDocument() { const document = getDocument(); @@ -61,6 +52,3 @@ function getLocaleOfDocument() { return parseLocale(DEFAULT_LANGUAGE); } - -assignToNamespace('Monster.DOM', getLocaleOfDocument); -export {Monster, getLocaleOfDocument} diff --git a/application/source/dom/namespace.js b/application/source/dom/namespace.js deleted file mode 100644 index 753607f8d8e93b8b198eb7b4481f25f72b783f09..0000000000000000000000000000000000000000 --- a/application/source/dom/namespace.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; - -/** - * In this namespace you will find classes and methods for handling the DOM. - * - * @namespace Monster.DOM - * @memberOf Monster - * @author schukai GmbH - */ - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.DOM"; \ No newline at end of file diff --git a/application/source/dom/ready.js b/application/source/dom/ready.js index 9fd6fea370f409d56542ba171ea03991945b1031..0d03d0e5280d395ad378ca61507678b83dd5e6d0 100644 --- a/application/source/dom/ready.js +++ b/application/source/dom/ready.js @@ -17,7 +17,7 @@ import {getDocument, getWindow} from "./util.js"; * * ``` * <script type="module"> - * import {domReady} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/ready.js'; + * import {domReady} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/ready.js'; * domReady().then(()=>{ * // ... * }) @@ -31,7 +31,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 */ -const domReady = new Promise(resolve => { +export const domReady = new Promise(resolve => { const document = getDocument(); @@ -52,7 +52,7 @@ const domReady = new Promise(resolve => { * * ``` * <script type="module"> - * import {windowReady} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/ready.js'; + * import {windowReady} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/ready.js'; * windowReady().then(()=>{ * // ... * }) @@ -66,7 +66,7 @@ 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 */ -const windowReady = new Promise(resolve => { +export const windowReady = new Promise(resolve => { const document = getDocument(); const window = getWindow(); @@ -77,5 +77,3 @@ const windowReady = new Promise(resolve => { window.addEventListener('load', resolve); } }); - -export {Monster, windowReady, domReady} diff --git a/application/source/dom/resource.js b/application/source/dom/resource.js index 4558f76d6eb22702e9e748b02b527bb8c1f77b16..cc038a96197a7dbf0aa28b6a729c65fc9b31bec5 100644 --- a/application/source/dom/resource.js +++ b/application/source/dom/resource.js @@ -43,20 +43,9 @@ export const referenceSymbol = Symbol('reference'); /** * This class is the base class for all resources to be loaded. * - * You can call the method via the monster namespace `new Monster.DOM.Resource()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.Resource() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Resource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/resource.js'; + * import {Resource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/resource.js'; * new Resource() * </script> * ``` @@ -66,7 +55,7 @@ export const referenceSymbol = Symbol('reference'); * @memberOf Monster.DOM * @summary A Resource class */ -class Resource extends BaseWithOptions { +export class Resource extends BaseWithOptions { /** * @@ -262,7 +251,3 @@ function addEvents() { return self; } - - -assignToNamespace('Monster.DOM', Resource); -export {Monster, Resource} diff --git a/application/source/dom/resource/data.js b/application/source/dom/resource/data.js index 1a0de992962cabbc8cb0afe4654126c21b8b5ea3..a2354b864ec6c4c5af95b7001b6b2394ec832761 100644 --- a/application/source/dom/resource/data.js +++ b/application/source/dom/resource/data.js @@ -19,24 +19,12 @@ import { } from "../constants.js"; import {KEY_DOCUMENT, KEY_QUERY, referenceSymbol, Resource} from "../resource.js"; - /** * This class is used by the resource manager to embed data. * - * You can call the method via the monster namespace `new Monster.DOM.Resource.Data()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.Resource.Data() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {Data} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/resource/data.js'; + * import {Data} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/resource/data.js'; * new Data() * </script> * ``` @@ -46,7 +34,7 @@ import {KEY_DOCUMENT, KEY_QUERY, referenceSymbol, Resource} from "../resource.js * @memberOf Monster.DOM.Resource * @summary A Data Resource class */ -class Data extends Resource { +export class Data extends Resource { /** * @property {string} mode=cors https://developer.mozilla.org/en-US/docs/Web/API/fetch @@ -164,7 +152,3 @@ function appendToDocument() { return self; } - - -assignToNamespace('Monster.DOM.Resource', Data); -export {Monster, Data} diff --git a/application/source/dom/resource/link.js b/application/source/dom/resource/link.js index 354a675bbbe4242db6bb6124481c8b3a55f05a9c..6abdfa0d0ee5517d085dd4df3df745bc4dbb1e9a 100644 --- a/application/source/dom/resource/link.js +++ b/application/source/dom/resource/link.js @@ -20,20 +20,9 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js"; /** * This class is used by the resource manager to embed external resources. * - * You can call the method via the monster namespace `new Monster.DOM.Resource.Link()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.Resource.Link() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Link} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/resource/link.js'; + * import {Link} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/resource/link.js'; * new Link() * </script> * ``` @@ -44,7 +33,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 */ -class Link extends Resource { +export class Link extends Resource { /** * @property {string} as {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as} @@ -119,7 +108,3 @@ function createElement() { return self; } - - -assignToNamespace('Monster.DOM.Resource', Link); -export {Monster, Link} diff --git a/application/source/dom/resource/link/stylesheet.js b/application/source/dom/resource/link/stylesheet.js index 9615fa5357c038191dd6f4b18ae6064ed78c8f2c..e132ef44d6f0f9854a2b040d83c9e12e64dbe370 100644 --- a/application/source/dom/resource/link/stylesheet.js +++ b/application/source/dom/resource/link/stylesheet.js @@ -12,20 +12,9 @@ import {Link} from "../link.js"; /** * This class is used by the resource manager to embed external resources. * - * You can call the method via the monster namespace `new Monster.DOM.Resource.Link.Stylesheet()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.Resource.Link.Stylesheet() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {Style} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/resource/link/stylesheet.js'; + * import {Style} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/resource/link/stylesheet.js'; * new Stylesheet() * </script> * ``` @@ -36,7 +25,7 @@ import {Link} from "../link.js"; * @summary A Resource class * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link */ -class Stylesheet extends Link { +export class Stylesheet extends Link { /** * @property {string} rel {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-rel} @@ -49,6 +38,3 @@ class Stylesheet extends Link { } - -assignToNamespace('Monster.DOM.Resource.Link', Stylesheet); -export {Monster, Stylesheet} diff --git a/application/source/dom/resource/script.js b/application/source/dom/resource/script.js index 544426cb25db9458c76a7715f51ecabfca5e5174..17512eef48ebcb53b26d8468358d3a2f621447b0 100644 --- a/application/source/dom/resource/script.js +++ b/application/source/dom/resource/script.js @@ -21,20 +21,9 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js"; /** * This class is used by the resource manager to embed scripts. * - * You can call the method via the monster namespace `new Monster.DOM.Resource.Script()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.Resource.Script() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Script} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/resource/script.js'; + * import {Script} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/resource/script.js'; * new Script() * </script> * ``` @@ -44,7 +33,7 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js"; * @memberOf Monster.DOM.Resource * @summary A Resource class */ -class Script extends Resource { +export class Script extends Resource { /** * @property {boolean} async=true {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async} @@ -106,7 +95,3 @@ function createElement() { return self; } - - -assignToNamespace('Monster.DOM.Resource', Script); -export {Monster, Script} diff --git a/application/source/dom/resourcemanager.js b/application/source/dom/resourcemanager.js index d90bc3775cda8e478185adfbfc3ee30472f1a2d4..d754a42d93e82e927add5e2898130d7e94ec248c 100644 --- a/application/source/dom/resourcemanager.js +++ b/application/source/dom/resourcemanager.js @@ -17,20 +17,11 @@ import {Script} from "./resource/script.js"; /** - * You can call the method via the monster namespace `new Monster.DOM.ResourceManager()`. - * + * The ResourceManager is a singleton that manages all resources. + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.ResourceManager() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Resource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/resourcemanager.js'; + * import {Resource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/resourcemanager.js'; * new ResourceManager() * </script> * ``` @@ -40,7 +31,7 @@ import {Script} from "./resource/script.js"; * @memberOf Monster.DOM * @summary A Resource class */ -class ResourceManager extends BaseWithOptions { +export class ResourceManager extends BaseWithOptions { /** * @@ -208,7 +199,3 @@ function addResource(type, url, options) { (self.getOption('resources')?.[type]).push(resource); return self; } - - -assignToNamespace('Monster.DOM', ResourceManager); -export {Monster, ResourceManager} diff --git a/application/source/dom/template.js b/application/source/dom/template.js index e5b54b60de157b86a06d95cc8addbf53aadf0967..834b11ccbc0e13693c00c191c01e327302f993c6 100644 --- a/application/source/dom/template.js +++ b/application/source/dom/template.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from '../types/base.js'; import {getGlobalFunction, getGlobalObject} from '../types/global.js'; import {validateInstance, validateString} from "../types/validate.js"; @@ -11,20 +11,11 @@ import {ATTRIBUTE_TEMPLATE_PREFIX} from "./constants.js"; import {getDocumentTheme} from "./theme.js"; /** - * you can call the method via the monster namespace `new Monster.DOM.Template()`. - * + * The template class provides methods for creating templates. + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.Template() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/template.js'; + * import {Template} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/template.js'; * new Template() * </script> * ``` @@ -34,7 +25,7 @@ import {getDocumentTheme} from "./theme.js"; * @memberOf Monster.DOM * @summary A template class */ -class Template extends Base { +export class Template extends Base { /** * * @param {HTMLTemplateElement} template @@ -86,23 +77,14 @@ class Template extends Base { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.DOM.findDocumentTemplate() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/template.js'; + * import {findTemplate} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/template.js'; * findDocumentTemplate() * </script> * ``` * * @example * - * import { findDocumentTemplate } from "https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/template.js"; + * import { findDocumentTemplate } from "https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/template.js"; * * const template = document.createElement("template"); * template.id = "myTemplate"; @@ -139,7 +121,7 @@ class Template extends Base { * @throws {Error} template id not found. * @throws {TypeError} value is not a string */ -function findDocumentTemplate(id, currentNode) { +export function findDocumentTemplate(id, currentNode) { validateString(id); const document = getGlobalObject('document'); @@ -219,8 +201,3 @@ function findDocumentTemplate(id, currentNode) { throw new Error("template " + id + " not found.") } - -assignToNamespace('Monster.DOM', Template, findDocumentTemplate); -export {Monster, Template, findDocumentTemplate} - - diff --git a/application/source/dom/theme.js b/application/source/dom/theme.js index 677ac4b6ab3fbf96ef1338f9b99a600750744762..33e95a671d0b474345d0719efaa198954eb8a71a 100644 --- a/application/source/dom/theme.js +++ b/application/source/dom/theme.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from '../types/base.js'; import {getGlobalObject} from '../types/global.js'; import {validateString} from "../types/validate.js"; @@ -11,27 +11,18 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js"; /** - * You can call the method via the monster namespace `new Monster.DOM.Theme()`. - * + * The Theme class provides the functionality for the theme. + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.DOM.Theme()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/theme.js'; + * import {Theme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/theme.js'; * console.log(new Theme()) * </script> * ``` * * @example * - * import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/theme.js'; + * import {getDocumentTheme} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/theme.js'; * * const theme = getDocumentTheme(); * console.log(theme.getName()); @@ -42,7 +33,7 @@ import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.js"; * @memberOf Monster.DOM * @summary A theme class */ -class Theme extends Base { +export class Theme extends Base { /** * @@ -81,7 +72,7 @@ class Theme extends Base { * @memberOf Monster.DOM * @since 1.7.0 */ -function getDocumentTheme() { +export function getDocumentTheme() { let document = getGlobalObject('document'); let name = DEFAULT_THEME; @@ -96,6 +87,3 @@ function getDocumentTheme() { return new Theme(name); } - -assignToNamespace('Monster.DOM', Theme, getDocumentTheme); -export {Monster, Theme, getDocumentTheme} diff --git a/application/source/dom/updater.js b/application/source/dom/updater.js index 93b19ecf068452f5a49af1ad41d2b045681639dd..1530cf97dca08ca79154ab5209032ccbfe0b5908 100644 --- a/application/source/dom/updater.js +++ b/application/source/dom/updater.js @@ -18,7 +18,7 @@ import { ATTRIBUTE_UPDATER_REPLACE, ATTRIBUTE_UPDATER_SELECT_THIS } from "../dom/constants.js"; -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from "../types/base.js"; import {isArray, isInstance, isIterable} from "../types/is.js"; import {Observer} from "../types/observer.js"; @@ -40,27 +40,16 @@ import {getDocument} from "./util.js"; * Changes to attributes are made only when the direct values are changed. If you want to assign changes to other values * as well, you have to insert the attribute `data-monster-select-this`. This should be done with care, as it can reduce performance. * - * You can create an object of this class using the monster namespace `new Monster.DOM.Updater()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.DOM.Updater() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/updater.js'; + * import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/updater.js'; * new Updater() * </script> * ``` * * @example * - * import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/updater.js'; + * import {Updater} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/updater.js'; * * // First we prepare the html document. * // This is done here via script, but can also be inserted into the document as pure html. @@ -95,7 +84,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 */ -class Updater extends Base { +export class Updater extends Base { /** * @since 1.8.0 @@ -900,6 +889,3 @@ function handleInputControlAttributeUpdate(element, name, value) { } } - -assignToNamespace('Monster.DOM', Updater); -export {Monster, Updater} diff --git a/application/source/dom/util.js b/application/source/dom/util.js index b9937e7b37a81c726de99bf456b9fd82ccaa38b3..6e6fb7b350c1872daf413aa7d8fe5452866491aa 100644 --- a/application/source/dom/util.js +++ b/application/source/dom/util.js @@ -3,26 +3,16 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {getGlobal} from "../types/global.js"; import {validateString} from "../types/validate.js"; - /** * this method fetches the document object * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.DOM.getDocument()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {getDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/util.js'; + * import {getDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/util.js'; * console.log(getDocument()) * </script> * ``` @@ -60,7 +50,7 @@ import {validateString} from "../types/validate.js"; * @memberOf Monster.DOM * @throws {Error} not supported environment */ -function getDocument() { +export function getDocument() { let document = getGlobal()?.['document']; if (typeof document !== 'object') { throw new Error("not supported environment") @@ -74,16 +64,7 @@ function getDocument() { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.DOM.getWindow()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/util.js'; + * import {getWindow} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/util.js'; * console.log(getWindow(null)) * </script> * ``` @@ -123,7 +104,7 @@ function getDocument() { * @memberOf Monster.DOM * @throws {Error} not supported environment */ -function getWindow() { +export function getWindow() { let window = getGlobal()?.['window']; if (typeof window !== 'object') { throw new Error("not supported environment") @@ -134,22 +115,11 @@ function getWindow() { /** - * - * * this method fetches the document object * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.DOM.getDocumentFragmentFromString()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/util.js'; + * import {getDocumentFragmentFromString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/util.js'; * console.log(getDocumentFragmentFromString('<div></div>')) * </script> * ``` @@ -188,7 +158,7 @@ function getWindow() { * @throws {Error} not supported environment * @throws {TypeError} value is not a string */ -function getDocumentFragmentFromString(html) { +export function getDocumentFragmentFromString(html) { validateString(html); const document = getDocument(); @@ -197,7 +167,3 @@ function getDocumentFragmentFromString(html) { return template.content; } - - -assignToNamespace('Monster.DOM', getWindow, getDocument, getDocumentFragmentFromString); -export {Monster, getWindow, getDocument, getDocumentFragmentFromString} diff --git a/application/source/dom/worker/factory.js b/application/source/dom/worker/factory.js index 4a88d16fc6c2bb223a45b54f0f4a39aa20fc8df7..28226d02d2ae69bd601bb740b6e8d80a4007056b 100644 --- a/application/source/dom/worker/factory.js +++ b/application/source/dom/worker/factory.js @@ -13,23 +13,12 @@ import {getGlobal, getGlobalFunction} from "../../types/global.js"; import {isFunction} from "../../types/is.js"; import {validateInstance, validateString} from "../../types/validate.js"; - - /** - * You can call the function via the monster namespace `new Monster.DOM.Worker.getLocaleOfDocument()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.DOM.Worker.Factory()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * + * A factory for creating worker instances. + * * ``` * <script type="module"> - * import {Factory} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/dom/worker/factory.js'; + * import {Factory} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/worker/factory.js'; * console.log(new Factory()) * </script> * ``` @@ -39,7 +28,7 @@ import {validateInstance, validateString} from "../../types/validate.js"; * @memberOf Monster.DOM.Worker * @summary A small factory to create worker */ -class Factory extends Base { +export class Factory extends Base { /** @@ -129,6 +118,3 @@ class Factory extends Base { } - -assignToNamespace('Monster.DOM.Worker', Factory); -export {Monster, Factory} diff --git a/application/source/i18n/formatter.js b/application/source/i18n/formatter.js index 7e5c24f9918156f7fd414fd7ae38530f7200c055..ab65ed7bee49498482c50ba7267ac02d8c374175 100644 --- a/application/source/i18n/formatter.js +++ b/application/source/i18n/formatter.js @@ -7,7 +7,7 @@ import {internalSymbol} from "../constants.js"; import {extend} from "../data/extend.js"; -import {assignToNamespace, Monster} from '../namespace.js'; + import {Formatter as TextFormatter} from "../text/formatter.js"; import {validateInstance, validateString} from "../types/validate.js"; import {Translations} from "./translations.js"; @@ -21,28 +21,17 @@ const internalTranslationSymbol = Symbol('internalTranslation') /** * The Formatter extends the Text.Formatter with the possibility to replace the key by a translation. * - * You can create an instance via the monster namespace `new Monster.I18n.Formatter()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.I18n.Formatter() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/formatter.js'; + * import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/formatter.js'; * new Formatter() * </script> * ``` * * @example * - * import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/formatter.js'; - * import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/translations.js'; + * import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/formatter.js'; + * import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/translations.js'; * * const translations = new Translations('en') * .assignTranslations({ @@ -56,7 +45,7 @@ const internalTranslationSymbol = Symbol('internalTranslation') * @copyright schukai GmbH * @memberOf Monster.I18n */ -class Formatter extends TextFormatter { +export class Formatter extends TextFormatter { /** * Default values for the markers are `${` and `}` @@ -135,6 +124,3 @@ class Formatter extends TextFormatter { } - -assignToNamespace('Monster.I18n', Formatter); -export {Monster, Formatter} diff --git a/application/source/i18n/locale.js b/application/source/i18n/locale.js index 68ba869f374b865cf241e0a2a14296b07188dcd5..ad36f18b00f7d0d7e1ba105f082230aeb3626381 100644 --- a/application/source/i18n/locale.js +++ b/application/source/i18n/locale.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from "../types/base.js"; import {validateString} from "../types/validate.js"; import {clone} from "../util/clone.js"; @@ -21,20 +21,11 @@ const propertiesSymbol = Symbol('properties'); const localeStringSymbol = Symbol('localeString'); /** - * You can create an instance via the monster namespace `new Monster.I18n.Locale()`. - * + * The Locale class is a base class for the language classes. + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.I18n.Locale() - * </script> - * ``` - * - * Alternatively, you can also integrate this class individually. - * - * ``` - * <script type="module"> - * import {Locale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/locale.js'; + * import {Locale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/locale.js'; * new Locale() * </script> * ``` @@ -75,7 +66,7 @@ const localeStringSymbol = Symbol('localeString'); * @memberOf Monster.I18n * @see https://datatracker.ietf.org/doc/html/rfc3066 */ -class Locale extends Base { +export class Locale extends Base { /** * @param {string} language @@ -212,7 +203,7 @@ class Locale extends Base { * * ``` * <script type="module"> - * import {createLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/locale.js'; + * import {createLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/locale.js'; * createLocale() * </script> * ``` @@ -273,7 +264,7 @@ class Locale extends Base { * @throws {TypeError} value is not a string * @throws {Error} unsupported locale */ -function parseLocale(locale) { +export function parseLocale(locale) { locale = validateString(locale).replace(/_/g, "-"); @@ -330,7 +321,3 @@ function parseLocale(locale) { return new Locale(language, region, script, variants, extlang); } - - -assignToNamespace('Monster.I18n', Locale, parseLocale); -export {Monster, Locale, parseLocale} diff --git a/application/source/i18n/namespace.js b/application/source/i18n/namespace.js deleted file mode 100644 index fb55e2545f3801d3718936fb148d4793ea163753..0000000000000000000000000000000000000000 --- a/application/source/i18n/namespace.js +++ /dev/null @@ -1,16 +0,0 @@ -'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 - */ - - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.I18n"; \ No newline at end of file diff --git a/application/source/i18n/provider.js b/application/source/i18n/provider.js index d7b6bc2d4c08923af6be3f017714a791d6f7315e..7316dd185e6b04670c99502067088c9b4310b5ad 100644 --- a/application/source/i18n/provider.js +++ b/application/source/i18n/provider.js @@ -3,28 +3,17 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {BaseWithOptions} from "../types/basewithoptions.js"; import {Locale} from "./locale.js" import {Translations} from "./translations.js" /** * A provider makes a translation object available. - * - * You can call the method via the monster namespace `new Monster.I18n.Provider()`. - * + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.I18n.Provider() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Provider} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/provider.js'; + * import {Provider} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/provider.js'; * new Provider() * </script> * ``` @@ -34,7 +23,7 @@ import {Translations} from "./translations.js" * @memberOf Monster.I18n * @see {@link https://datatracker.ietf.org/doc/html/rfc3066} */ -class Provider extends BaseWithOptions { +export class Provider extends BaseWithOptions { /** * @param {Locale|string} locale @@ -52,7 +41,3 @@ class Provider extends BaseWithOptions { } } - - -assignToNamespace('Monster.I18n', Provider); -export {Monster, Provider} diff --git a/application/source/i18n/providers/fetch.js b/application/source/i18n/providers/fetch.js index 5506b2e721d3a02ae28a5715bb86148ed2b449e3..ec4647857bc6bf86e854fd78fbc567d59378cdc3 100644 --- a/application/source/i18n/providers/fetch.js +++ b/application/source/i18n/providers/fetch.js @@ -17,28 +17,17 @@ import {Translations} from "../translations.js"; /** * The fetch provider retrieves a JSON file from the given URL and returns a translation object. - * - * You can create the object via the monster namespace `new Monster.I18n.Provider.Fetch()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.I18n.Providers.Fetch() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * + * * ``` * <script type="module"> - * import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/providers/fetch.js'; + * import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/providers/fetch.js'; * new Fetch() * </script> * ``` * * @example <caption>das ist ein test</caption> * - * import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/providers/fetch.js'; + * import {Fetch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/providers/fetch.js'; * * // fetch from API * const translation = new Fetch('https://example.com/${language}.json').getTranslation('en-GB'); @@ -50,7 +39,7 @@ import {Translations} from "../translations.js"; * @see {@link https://datatracker.ietf.org/doc/html/rfc3066} * @tutorial i18n-locale-and-formatter */ -class Fetch extends Provider { +export class Fetch extends Provider { /** * As options the key `fetch` can be passed. This config object is passed to the fetch method as init. @@ -142,6 +131,3 @@ class Fetch extends Provider { } - -assignToNamespace('Monster.I18n.Providers', Fetch); -export {Monster, Fetch} diff --git a/application/source/i18n/providers/namespace.js b/application/source/i18n/providers/namespace.js deleted file mode 100644 index 4e01e737d6520a4f983c3af24f4c84e3f10ebe94..0000000000000000000000000000000000000000 --- a/application/source/i18n/providers/namespace.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** - * Namespace for different translation providers. - * - * @namespace Monster.I18n.Providers - * @memberOf Monster.I18n - * @author schukai GmbH - */ - - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.I18n.Providers"; \ No newline at end of file diff --git a/application/source/i18n/translations.js b/application/source/i18n/translations.js index 641b54fa650c076ef09fba7a090e5124682c32ff..1928d5488bd0eb7fa98921eea04bf9cd1e54b515 100644 --- a/application/source/i18n/translations.js +++ b/application/source/i18n/translations.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from "../types/base.js"; import {isObject, isString} from "../types/is.js"; import {validateInstance, validateInteger, validateObject, validateString} from "../types/validate.js"; @@ -13,28 +13,17 @@ import {Locale, parseLocale} from "./locale.js"; /** * With this class you can manage translations and access the keys. * - * You can call the method via the monster namespace `new Monster.I18n.Translations()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.I18n.Translations() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/translations.js'; + * import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/translations.js'; * new Translations() * </script> * ``` * * @example * - * import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/translations.js'; - * import {parseLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/i18n/locale.js'; + * import {Translations} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/translations.js'; + * import {parseLocale} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/i18n/locale.js'; * * const translation = new Translations(parseLocale('en-GB')); * @@ -59,7 +48,7 @@ import {Locale, parseLocale} from "./locale.js"; * @memberOf Monster.I18n * @see https://datatracker.ietf.org/doc/html/rfc3066 */ -class Translations extends Base { +export class Translations extends Base { /** * @@ -214,6 +203,3 @@ class Translations extends Base { } } - -assignToNamespace('Monster.I18n', Translations); -export {Monster, Translations} diff --git a/application/source/logging/handler.js b/application/source/logging/handler.js index 674fe3ea6fc3f3677dbd10b6d0414c5fd206db95..5eb221b71a7373092619f7eb1c0ae339d3abca6e 100644 --- a/application/source/logging/handler.js +++ b/application/source/logging/handler.js @@ -4,27 +4,18 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from '../types/base.js'; import {validateInstance, validateInteger} from "../types/validate.js"; import {LogEntry} from "./logentry.js"; import {ALL, DEBUG, ERROR, FATAL, INFO, OFF, TRACE, WARN} from "./logger.js"; /** - * you can call the method via the monster namespace `new Monster.Logging.Handler()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.Logging.Handler()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * + * The log handler is the interface between the log entries and the log listeners. + * * ``` * <script type="module"> - * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/logging/handler.js'; + * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/logging/handler.js'; * console.log(new Handler()) * </script> * ``` @@ -33,7 +24,7 @@ import {ALL, DEBUG, ERROR, FATAL, INFO, OFF, TRACE, WARN} from "./logger.js"; * @copyright schukai GmbH * @memberOf Monster.Logging */ -class Handler extends Base { +export class Handler extends Base { constructor() { super(); @@ -178,7 +169,3 @@ class Handler extends Base { } - - -assignToNamespace('Monster.Logging', Handler); -export {Monster, Handler}; diff --git a/application/source/logging/handler/console.js b/application/source/logging/handler/console.js index 5bd470630a75fa0593d0cdf0274c0c360d2230b5..9f74a9e0373f46299ed58524b7624813dbb27991 100644 --- a/application/source/logging/handler/console.js +++ b/application/source/logging/handler/console.js @@ -12,19 +12,10 @@ import {LogEntry} from "../logentry.js"; /** * You can create an object of the class simply by using the namespace `new Monster.Logging.Handler.ConsoleHandler()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.Logging.Handler.ConsoleHandler()) - * </script> - * ``` - * - * Alternatively, you can also integrate this class individually. - * + * * ``` * <script type="module"> - * import {ConsoleHandler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/logging/handler/console.js'; + * import {ConsoleHandler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/logging/handler/console.js'; * console.log(new ConsoleHandler()) * </script> * ``` @@ -33,7 +24,7 @@ import {LogEntry} from "../logentry.js"; * @copyright schukai GmbH * @memberOf Monster.Logging.Handler */ -class ConsoleHandler extends Handler { +export class ConsoleHandler extends Handler { constructor() { super(); } @@ -62,5 +53,3 @@ class ConsoleHandler extends Handler { } -assignToNamespace('Monster.Logging.Handler', ConsoleHandler); -export {Monster, ConsoleHandler}; diff --git a/application/source/logging/handler/namespace.js b/application/source/logging/handler/namespace.js deleted file mode 100644 index 6bd37d05db543512a7cfb89a84aae257cca7e553..0000000000000000000000000000000000000000 --- a/application/source/logging/handler/namespace.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -/** - * @namespace Monster.Logging.Handler - * @memberOf Monster.Logging - * @author schukai GmbH - */ - - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.Logging.Handler"; \ No newline at end of file diff --git a/application/source/logging/logentry.js b/application/source/logging/logentry.js index cca66fb32c7b428a32a77ba3a17addfad5600f98..f137ab2f12088c7e61c97ed66664a23760954eb7 100644 --- a/application/source/logging/logentry.js +++ b/application/source/logging/logentry.js @@ -4,26 +4,17 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from '../types/base.js'; import {validateInteger} from '../types/validate.js'; /** - * you can call the method via the monster namespace `new Monster.Logging.LogEntry()`. - * + * A log entry for the logger + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.Logging.LogEntry()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/logging/logentry.js'; + * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/logging/logentry.js'; * console.log(new LogEntry()) * </script> * ``` @@ -32,7 +23,7 @@ import {validateInteger} from '../types/validate.js'; * @copyright schukai GmbH * @memberOf Monster.Logging */ -class LogEntry extends Base { +export class LogEntry extends Base { /** * * @param {Integer} loglevel @@ -63,6 +54,3 @@ class LogEntry extends Base { } } - -assignToNamespace('Monster.Logging', LogEntry); -export {Monster, LogEntry} diff --git a/application/source/logging/logger.js b/application/source/logging/logger.js index 420c46a617a8e0cb216e925bf23c7fce2b3749a5..ca43dfd4eaeb6260775f86f857bf4774a3030559 100644 --- a/application/source/logging/logger.js +++ b/application/source/logging/logger.js @@ -6,7 +6,7 @@ import {Handler} from '../logging/handler.js'; import {LogEntry} from '../logging/logentry.js'; -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from '../types/base.js'; import {validateInteger, validateObject, validateString} from '../types/validate.js'; @@ -16,65 +16,56 @@ import {validateInteger, validateObject, validateString} from '../types/validate * @type {number} * @memberOf Monster.Logging */ -const ALL = 255; +export const ALL = 255; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -const TRACE = 64; +export const TRACE = 64; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -const DEBUG = 32; +export const DEBUG = 32; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -const INFO = 16; +export const INFO = 16; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -const WARN = 8; +export const WARN = 8; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -const ERROR = 4; +export const ERROR = 4; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -const FATAL = 2; +export const FATAL = 2; /** * ALL > TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF * @type {number} * @memberOf Monster.Logging */ -const OFF = 0; +export const OFF = 0; /** - * You can create an object of the class simply by using the namespace `new Monster.Logging.Logger()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Logging.Logger() - * </script> - * ``` - * - * Alternatively, you can also integrate this class individually. + * The logger is a class that takes care of logging. * * ``` * <script type="module"> - * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/logging/logger.js'; + * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/logging/logger.js'; * new Logger() * </script> * ``` @@ -83,7 +74,7 @@ const OFF = 0; * @copyright schukai GmbH * @memberOf Monster.Logging */ -class Logger extends Base { +export class Logger extends Base { /** * @@ -256,9 +247,6 @@ class Logger extends Base { } -assignToNamespace('Monster.Logging', Logger); -export {Monster, Logger, ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF}; - /** * Log triggern diff --git a/application/source/logging/namespace.js b/application/source/logging/namespace.js deleted file mode 100644 index 325bb0bd22f68cb0a4227fa86a9f4e2fead613d1..0000000000000000000000000000000000000000 --- a/application/source/logging/namespace.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** - * Namespace for logging. - * - * @namespace Monster.Logging - * @memberOf Monster - * @author schukai GmbH - */ - - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.Logging"; \ No newline at end of file diff --git a/application/source/math/namespace.js b/application/source/math/namespace.js deleted file mode 100644 index 93c2e40e0c2a71fd92ce4fb6eaf573eb9ce8a477..0000000000000000000000000000000000000000 --- a/application/source/math/namespace.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** - * Namespace for math. - * - * @namespace Monster.Math - * @memberOf Monster - * @author schukai GmbH - */ - - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.Math"; \ No newline at end of file diff --git a/application/source/math/random.js b/application/source/math/random.js index 2b41fa9143ccaf87aaba3a083f1ec1e96ae1388f..3a8efed111a7e60df2ebf063e88c88f5af6e88da 100644 --- a/application/source/math/random.js +++ b/application/source/math/random.js @@ -4,28 +4,16 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {getGlobal} from '../types/global.js'; /** * this function uses crypt and returns a random number. * - * you can call the method via the monster namespace `Monster.Math.random()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Math.random(1,10) - * // ↦ 5 - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/math/random.js'; + * import {random} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/math/random.js'; * random(1,10) * // ↦ 5 * </script> @@ -42,7 +30,7 @@ import {getGlobal} from '../types/global.js'; * @since 1.0.0 * @copyright schukai GmbH */ -function random(min, max) { +export function random(min, max) { if (min === undefined) { min = 0; @@ -125,10 +113,3 @@ function create(min, max) { return rval; } - -assignToNamespace('Monster.Math', random); -export {Monster, random} - - - - diff --git a/application/source/text/formatter.js b/application/source/text/formatter.js index bcb536fd61dd4c3290c78b4bf10a233147538b9a..2c004426c0bf494e9909addd095b586326d895d1 100644 --- a/application/source/text/formatter.js +++ b/application/source/text/formatter.js @@ -7,10 +7,11 @@ import {internalSymbol} from "../constants.js"; import {extend} from "../data/extend.js"; import {Pipe} from "../data/pipe.js"; -import {assignToNamespace, Monster} from '../namespace.js'; + import {BaseWithOptions} from "../types/basewithoptions.js"; import {isObject, isString} from "../types/is.js"; import {validateArray, validateString} from "../types/validate.js"; +import {getMonsterVersion} from "../types/version.js"; /** @@ -49,20 +50,9 @@ const workingDataSymbol = Symbol('workingData'); * * Look at the example below. The placeholders use the logic of Pipe. * - * You can create an instance via the monster namespace `new Monster.Text.Formatter()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Text.Formatter() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/text/formatter.js'; + * import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/text/formatter.js'; * new Formatter() * </script> * ``` @@ -107,7 +97,7 @@ const workingDataSymbol = Symbol('workingData'); * * @example * - * import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/text/formatter.js'; + * import {Formatter} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/text/formatter.js'; * * new Formatter({ * a: { @@ -124,7 +114,7 @@ const workingDataSymbol = Symbol('workingData'); * @copyright schukai GmbH * @memberOf Monster.Text */ -class Formatter extends BaseWithOptions { +export class Formatter extends BaseWithOptions { /** * Default values for the markers are `${` and `}` @@ -362,6 +352,3 @@ function tokenize(text, openMarker, closeMarker) { return formatted.join(''); } - -assignToNamespace('Monster.Text', Formatter); -export {Monster, Formatter} diff --git a/application/source/text/namespace.js b/application/source/text/namespace.js deleted file mode 100644 index 2bd5ddd7ec88fe4192638681588effc76d07f99f..0000000000000000000000000000000000000000 --- a/application/source/text/namespace.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** - * Namespace for texts. - * - * @namespace Monster.Text - * @memberOf Monster - * @author schukai GmbH - */ - - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.Text"; \ No newline at end of file diff --git a/application/source/types/base.js b/application/source/types/base.js index 74c6f1efc339d892b2fc8b688d7925121fe0070b..79b10056440a13ddcbf58649daab5a7be9b8fc6c 100644 --- a/application/source/types/base.js +++ b/application/source/types/base.js @@ -4,25 +4,14 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + /** * This is the base class from which all monster classes are derived. * - * You can call the method via the monster namespace `new Monster.Types.Base()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.Base() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Base} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/base.js'; + * import {Base} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/base.js'; * new Base() * </script> * ``` @@ -33,7 +22,7 @@ import {assignToNamespace, Monster} from '../namespace.js'; * @copyright schukai GmbH * @memberOf Monster.Types */ -class Base extends Object { +export class Base extends Object { /** * @@ -45,6 +34,3 @@ class Base extends Object { } - -assignToNamespace('Monster.Types', Base); -export {Monster, Base} diff --git a/application/source/types/basewithoptions.js b/application/source/types/basewithoptions.js index f100f37e6932b85b10ecabf3eada4db7dbda8441..a98e92a4c735b88299b5c235571982837ba3d7bf 100644 --- a/application/source/types/basewithoptions.js +++ b/application/source/types/basewithoptions.js @@ -7,7 +7,7 @@ import {internalSymbol} from "../constants.js"; import {extend} from "../data/extend.js"; import {Pathfinder} from "../data/pathfinder.js"; -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from "./base.js"; import {validateObject} from "./validate.js"; @@ -16,20 +16,9 @@ import {validateObject} from "./validate.js"; * * This class is actually only used as a base class. * - * However, you can also create an instance directly via the monster namespace `new Monster.Types.BaseWithOptions()`. - * * ```html * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.BaseWithOptions() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ```html - * <script type="module"> - * import {BaseWithOptions} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/basewithoptions.js'; + * import {BaseWithOptions} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/basewithoptions.js'; * new BaseWithOptions() * </script> * ``` @@ -53,7 +42,7 @@ import {validateObject} from "./validate.js"; * @copyright schukai GmbH * @memberOf Monster.Types */ -class BaseWithOptions extends Base { +export class BaseWithOptions extends Base { /** * @@ -113,6 +102,3 @@ class BaseWithOptions extends Base { } - -assignToNamespace('Monster.Types', BaseWithOptions); -export {Monster, BaseWithOptions} diff --git a/application/source/types/binary.js b/application/source/types/binary.js index 939b3452a3723af19b5cdd5f04c55ae31ff1d693..19e0eae7fadbda51f523663b73ef16308d4c73d5 100644 --- a/application/source/types/binary.js +++ b/application/source/types/binary.js @@ -13,16 +13,7 @@ import {Monster, validateString} from "./validate.js"; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.toBinary() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {toBinary} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/binary.js'; + * import {toBinary} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/binary.js'; * toBinary() * </script> * ``` @@ -33,7 +24,7 @@ import {Monster, validateString} from "./validate.js"; * @memberOf Monster.Types * @since 1.18.0 */ -function toBinary(string) { +export function toBinary(string) { const codeUnits = new Uint16Array(validateString(string).length); for (let i = 0; i < codeUnits.length; i++) { codeUnits[i] = string.charCodeAt(i); @@ -54,16 +45,7 @@ function toBinary(string) { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.fromBinary() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {fromBinary} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/binary.js'; + * import {fromBinary} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/binary.js'; * fromBinary() * </script> * ``` @@ -74,7 +56,7 @@ function toBinary(string) { * @memberOf Monster.Types * @since 1.18.0 */ -function fromBinary(binary) { +export function fromBinary(binary) { const bytes = new Uint8Array(validateString(binary).length); for (let i = 0; i < bytes.length; i++) { bytes[i] = binary.charCodeAt(i); @@ -87,6 +69,3 @@ function fromBinary(binary) { return result; } - -assignToNamespace('Monster.Types', toBinary, fromBinary); -export {Monster, toBinary, fromBinary}; diff --git a/application/source/types/dataurl.js b/application/source/types/dataurl.js index 4049ef55908f4c5ee47eded7d327c8999286dd5c..790b08761736c96752fbda3b8285ac9ec0be9dac 100644 --- a/application/source/types/dataurl.js +++ b/application/source/types/dataurl.js @@ -20,16 +20,7 @@ const internal = Symbol('internal'); * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.DataUrl() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {DataUrl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/dataurl.js'; + * import {DataUrl} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/dataurl.js'; * new DataUrl() * </script> * ``` @@ -40,7 +31,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 */ -class DataUrl extends Base { +export class DataUrl extends Base { /** * @@ -98,17 +89,8 @@ class DataUrl extends Base { * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.parseDataURL()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {parseDataURL} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/dataurl.js'; - * console.log(parseDataURL()) + * import {parseDataURL} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/dataurl.js'; + * parseDataURL(...) * </script> * ``` * @@ -129,7 +111,7 @@ class DataUrl extends Base { * @throws {TypeError} malformed data url * @memberOf Monster.Types */ -function parseDataURL(dataurl) { +export function parseDataURL(dataurl) { validateString(dataurl); @@ -170,7 +152,3 @@ function parseDataURL(dataurl) { } - - -assignToNamespace('Monster.Types', parseDataURL, DataUrl); -export {Monster, parseDataURL, DataUrl}; diff --git a/application/source/types/id.js b/application/source/types/id.js index 2f0f45e68656bd109e5f5c2828a2f625581bb0ce..24f40ab817c1d5884ab39d26e380d3f9e185d823 100644 --- a/application/source/types/id.js +++ b/application/source/types/id.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from './base.js'; import {validateString} from "./validate.js"; @@ -20,20 +20,9 @@ let internalCounter = new Map; * * So the ids can also be used for navigation. you just have to take care that the order stays the same. * - * You can call the method via the monster namespace `new Monster.Types.ID()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.Types.ID()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/id.js'; + * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/id.js'; * console.log(new ID()) * </script> * ``` @@ -45,7 +34,7 @@ let internalCounter = new Map; * @memberOf Monster.Types * @summary Automatic generation of ids */ -class ID extends Base { +export class ID extends Base { /** * create new id with prefix @@ -79,6 +68,3 @@ class ID extends Base { } } - -assignToNamespace('Monster.Types', ID); -export {Monster, ID} diff --git a/application/source/types/is.js b/application/source/types/is.js index 533773ba88c5dd436c7e1472a57ef3ebbbca0edd..4990aa3016085b4e7ba5805035d1175987e0be56 100644 --- a/application/source/types/is.js +++ b/application/source/types/is.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + /** * With this function you can check if a value is iterable. @@ -15,18 +15,7 @@ import {assignToNamespace, Monster} from '../namespace.js'; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.isIterable(null) // ↦ false - * Monster.Types.isIterable('hello') // ↦ true - * Monster.Types.isIterable([]) // ↦ true - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js'; + * import {isIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js'; * isIterable(null) // ↦ false * isIterable('hello') // ↦ true * isIterable([]) // ↦ true @@ -39,7 +28,7 @@ import {assignToNamespace, Monster} from '../namespace.js'; * @copyright schukai GmbH * @memberOf Monster.Types */ -function isIterable(value) { +export function isIterable(value) { if (value === undefined) return false; if (value === null) return false; return typeof value?.[Symbol.iterator] === 'function'; @@ -51,21 +40,9 @@ function isIterable(value) { * * This method is used in the library to have consistent names. * - * You can call the method via the monster namespace `Monster.Types.isPrimitive()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.isPrimitive('2') // ↦ false - * Monster.Types.isPrimitive([]) // ↦ true - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js'; + * import {isPrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js'; * isPrimitive('2')) // ↦ true * isPrimitive([])) // ↦ false * </script> @@ -77,7 +54,7 @@ function isIterable(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -function isPrimitive(value) { +export function isPrimitive(value) { var type; if (value === undefined || value === null) { @@ -98,21 +75,9 @@ function isPrimitive(value) { * * This method is used in the library to have consistent names. * - * You can call the method via the monster namespace `Monster.Types.isSymbol()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.isSymbol('2') // ↦ false - * Monster.Types.isSymbol(Symbol('test') // ↦ true - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js'; + * import {isSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js'; * isSymbol(Symbol('a'))) // ↦ true * isSymbol([]) // ↦ false * </script> @@ -124,7 +89,7 @@ function isPrimitive(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -function isSymbol(value) { +export function isSymbol(value) { return ('symbol' === typeof value) ? true : false; } @@ -133,22 +98,9 @@ function isSymbol(value) { * * This method is used in the library to have consistent names. * - * You can call the method via the monster namespace `Monster.Types.isBoolean()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.isBoolean('2') // ↦ false - * Monster.Types.isBoolean([]) // ↦ false - * Monster.Types.isBoolean(true) // ↦ true - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js'; + * import {isBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js'; * isBoolean('2')) // ↦ false * isBoolean([])) // ↦ false * isBoolean(2>4)) // ↦ true @@ -161,7 +113,7 @@ function isSymbol(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -function isBoolean(value) { +export function isBoolean(value) { if (value === true || value === false) { return true; @@ -175,21 +127,9 @@ function isBoolean(value) { * * This method is used in the library to have consistent names. * - * You can call the method via the monster namespace `Monster.Types.isString()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.isString('2') // ↦ true - * Monster.Types.isString([]) // ↦ false - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js'; + * import {isString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js'; * isString('2')) // ↦ true * isString([])) // ↦ false * </script> @@ -201,7 +141,7 @@ function isBoolean(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -function isString(value) { +export function isString(value) { if (value === undefined || typeof value !== 'string') { return false; } @@ -213,22 +153,9 @@ function isString(value) { * * This method is used in the library to have consistent names. * - * You can call the method via the monster namespace `Monster.Types.isObject()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.isObject('2') // ↦ false - * Monster.Types.isObject([]) // ↦ false - * Monster.Types.isObject({}) // ↦ true - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js'; + * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js'; * isObject('2')) // ↦ false * isObject([])) // ↦ false * </script> @@ -240,7 +167,7 @@ function isString(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -function isObject(value) { +export function isObject(value) { if (isArray(value)) return false; if (isPrimitive(value)) return false; @@ -257,22 +184,9 @@ function isObject(value) { * * This method is used in the library to have consistent names. * - * you can call the method via the monster namespace `Monster.Types.isInstance()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.isInstance('2') // ↦ false - * Monster.Types.isInstance([]) // ↦ false - * Monster.Types.isInstance({}) // ↦ true - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js'; + * import {isInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js'; * isInstance('2')) // ↦ false * isInstance([])) // ↦ false * </script> @@ -285,7 +199,7 @@ function isObject(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -function isInstance(value, instance) { +export function isInstance(value, instance) { if (!isObject(value)) return false; if (!isFunction(instance)) return false; @@ -299,21 +213,9 @@ function isInstance(value, instance) { * * This method is used in the library to have consistent names. * - * you can call the method via the monster namespace `Monster.Types.isArray()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.isArray('2') // ↦ false - * Monster.Types.isArray([]) // ↦ true - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js'; + * import {isArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js'; * isArray('2')) // ↦ false * isArray([])) // ↦ true * </script> @@ -326,7 +228,7 @@ function isInstance(value, instance) { * @memberOf Monster.Types * @see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray */ -function isArray(value) { +export function isArray(value) { return Array.isArray(value); } @@ -335,22 +237,9 @@ function isArray(value) { * * This method is used in the library to have consistent names. * - * you can call the method via the monster namespace `Monster.Types.isFunction()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.isFunction(()=>{}) // ↦ true - * Monster.Types.isFunction('2') // ↦ false - * Monster.Types.isFunction([]) // ↦ false - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js'; + * import {isFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js'; * isFunction(()=>{}) // ↦ true * isFunction('2')) // ↦ false * isFunction([])) // ↦ false @@ -363,7 +252,7 @@ function isArray(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -function isFunction(value) { +export function isFunction(value) { if (isArray(value)) return false; if (isPrimitive(value)) return false; @@ -380,22 +269,9 @@ function isFunction(value) { * * This method is used in the library to have consistent names. * - * You can call the method via the monster namespace `Monster.Types.isFunction()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.isInteger(()=>{}) // ↦ true - * Monster.Types.isInteger('2') // ↦ false - * Monster.Types.isInteger(2) // ↦ true - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js'; + * import {isInteger} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js'; * isInteger(()=>{}) // ↦ true * isInteger('2')) // ↦ false * isInteger(2)) // ↦ true @@ -408,22 +284,7 @@ function isFunction(value) { * @copyright schukai GmbH * @memberOf Monster.Types */ -function isInteger(value) { +export function isInteger(value) { return Number.isInteger(value); } - -assignToNamespace('Monster.Types', isPrimitive, isBoolean, isString, isObject, isArray, isFunction, isIterable, isInteger, isSymbol); -export { - Monster, - isPrimitive, - isBoolean, - isString, - isObject, - isInstance, - isArray, - isFunction, - isIterable, - isInteger, - isSymbol -} diff --git a/application/source/types/mediatype.js b/application/source/types/mediatype.js index 6b63573e955dfcc68d2a33894c088d3fcfdb0462..fd9bfb1a51baf67aa85e8ecd27c9c6b8a3306da0 100644 --- a/application/source/types/mediatype.js +++ b/application/source/types/mediatype.js @@ -28,16 +28,7 @@ const internal = Symbol('internal'); * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.Types.MediaType()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {MediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/mediatype.js'; + * import {MediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/mediatype.js'; * console.log(new MediaType()) * </script> * ``` @@ -46,7 +37,7 @@ const internal = Symbol('internal'); * @copyright schukai GmbH * @memberOf Monster.Types */ -class MediaType extends Base { +export class MediaType extends Base { /** * @@ -146,7 +137,7 @@ class MediaType extends Base { * * ``` * <script type="module"> - * import {parseMediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/dataurl.js'; + * import {parseMediaType} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/dataurl.js'; * console.log(parseMediaType()) * </script> * ``` @@ -168,7 +159,7 @@ class MediaType extends Base { * @throws {TypeError} malformed data url * @memberOf Monster.Types */ -function parseMediaType(mediatype) { +export 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)); @@ -230,7 +221,3 @@ function parseParameter(parameter) { return result; } - - -assignToNamespace('Monster.Types', parseMediaType, MediaType); -export {Monster, parseMediaType, MediaType}; diff --git a/application/source/types/namespace.js b/application/source/types/namespace.js deleted file mode 100644 index d379ec3ed5b505dad2dacb7929c12917f77ceec5..0000000000000000000000000000000000000000 --- a/application/source/types/namespace.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** - * Namespace for types. - * - * @namespace Monster.Types - * @memberOf Monster - * @author schukai GmbH - */ - - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.Types"; \ No newline at end of file diff --git a/application/source/types/node.js b/application/source/types/node.js index ad4093ab2697b9aa113edff6448734019cef651c..0c06d69b532eb8990e77e0b3b371d1e9c96e646c 100644 --- a/application/source/types/node.js +++ b/application/source/types/node.js @@ -5,7 +5,7 @@ */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from './base.js'; import {isPrimitive} from "./is.js"; import {NodeList} from './nodelist.js'; @@ -29,16 +29,7 @@ const treeStructureSymbol = Symbol('treeStructure'); * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.Node() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Node} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/node.js'; + * import {Node} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/node.js'; * new Node() * </script> * ``` @@ -49,7 +40,7 @@ const treeStructureSymbol = Symbol('treeStructure'); * @summary A Node Class * @see https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Iteration_protocols */ -class Node extends Base { +export class Node extends Base { /** * @param {*} [value] @@ -205,6 +196,3 @@ function setChildLevelAndParent(node, operand) { }); return this; } - -assignToNamespace('Monster.Types', Node); -export {Monster, Node} diff --git a/application/source/types/nodelist.js b/application/source/types/nodelist.js index 49437d21a60e1b1bd201b2e6407a2db2730c2bed..24532a3c11496c52b2ef4e9d0c14b8b203eede56 100644 --- a/application/source/types/nodelist.js +++ b/application/source/types/nodelist.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {isArray, isInstance} from "./is.js"; import {Node} from "./node.js"; import {validateInstance} from "./validate.js"; @@ -13,16 +13,7 @@ import {validateInstance} from "./validate.js"; * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.NodeList() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {NodeList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/nodelist.js'; + * import {NodeList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/nodelist.js'; * new NodeList() * </script> * ``` @@ -32,7 +23,7 @@ import {validateInstance} from "./validate.js"; * @memberOf Monster.Types * @summary A NodeList class */ -class NodeList extends Set { +export class NodeList extends Set { /** * @throws {Error} invalid value type @@ -124,6 +115,3 @@ class NodeList extends Set { } } - -assignToNamespace('Monster.Types', NodeList); -export {Monster, NodeList} diff --git a/application/source/types/noderecursiveiterator.js b/application/source/types/noderecursiveiterator.js index 4fe8f6d2b32cf14ece033a388bb34e650d8f111c..411e73dac9379a69efb72faa69561572481407b2 100644 --- a/application/source/types/noderecursiveiterator.js +++ b/application/source/types/noderecursiveiterator.js @@ -6,7 +6,7 @@ import {internalSymbol} from "../constants.js"; -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from './base.js'; import {isInstance} from "./is.js"; import {Node} from "./node.js"; @@ -25,23 +25,14 @@ const isNodeListSymbol = Symbol('isNodeList'); * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.NodeRecursiveIterator() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {NodeRecursiveIterator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/noderecursiveiterator.js'; + * import {NodeRecursiveIterator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/noderecursiveiterator.js'; * new NodeRecursiveIterator() * </script> * ``` * * @example - * import {Node} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/node.js'; - * import {NodeRecursiveIterator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/noderecursiveiterator.js'; + * import {Node} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/node.js'; + * import {NodeRecursiveIterator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/noderecursiveiterator.js'; * * const node =new Node('1') * @@ -78,7 +69,7 @@ const isNodeListSymbol = Symbol('isNodeList'); * @memberOf Monster.Types * @summary An iterator to run recursively through a tree of nodes */ -class NodeRecursiveIterator extends Base { +export class NodeRecursiveIterator extends Base { /** * @param {Node} [data] @@ -142,7 +133,3 @@ class NodeRecursiveIterator extends Base { } } - - -assignToNamespace('Monster.Types', NodeRecursiveIterator); -export {Monster, NodeRecursiveIterator} diff --git a/application/source/types/observer.js b/application/source/types/observer.js index 4c65e9f2a458bef4eddbb82fb784631f7a0f4066..f6d5d317b286b188f0baad3019a2139bb01f6c1b 100644 --- a/application/source/types/observer.js +++ b/application/source/types/observer.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from './base.js'; import {isObject} from './is.js'; import {TokenList} from './tokenlist.js'; @@ -13,17 +13,8 @@ import {UniqueQueue} from './uniquequeue.js'; /** * An observer manages a callback function * - * You can call the method via the monster namespace `new Monster.Types.Observer()`. - * - * ``` - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.Observer() - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` - * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/observer.js'; + * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/observer.js'; * new Observer() * ``` * @@ -52,7 +43,7 @@ import {UniqueQueue} from './uniquequeue.js'; * * @example * - * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/observer.js'; + * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/observer.js'; * * const observer = new Observer(function(a, b, c) { * console.log(this, a, b, c); // ↦ "a", 2, true @@ -65,7 +56,7 @@ import {UniqueQueue} from './uniquequeue.js'; * @copyright schukai GmbH * @memberOf Monster.Types */ -class Observer extends Base { +export class Observer extends Base { /** * @@ -168,9 +159,3 @@ class Observer extends Base { }; } - -assignToNamespace('Monster.Types', Observer); -export {Monster, Observer} - - - diff --git a/application/source/types/observerlist.js b/application/source/types/observerlist.js index 8b667bda2bf7f2e69a0718539d6b3057da2e147e..79cc16602d1faf8c414bb8c27b4db0fb677640c8 100644 --- a/application/source/types/observerlist.js +++ b/application/source/types/observerlist.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from './base.js'; import {Observer} from "./observer.js"; import {validateInstance} from "./validate.js"; @@ -12,21 +12,9 @@ import {validateInstance} from "./validate.js"; /** * With the help of the ObserverList class, observer can be managed. * - * You can call the method via the monster namespace `new Monster.Types.ObserverList()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.Types.ObserverList()) - * console.log(new Monster.Types.ObserverList()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/observerlist.js'; + * import {ObserverList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/observerlist.js'; * console.log(ObserverList()) * console.log(ObserverList()) * </script> @@ -36,7 +24,7 @@ import {validateInstance} from "./validate.js"; * @copyright schukai GmbH * @memberOf Monster.Types */ -class ObserverList extends Base { +export class ObserverList extends Base { /** * @@ -113,6 +101,3 @@ class ObserverList extends Base { }; } - -assignToNamespace('Monster.Types', ObserverList); -export {Monster, ObserverList} diff --git a/application/source/types/package.d.ts b/application/source/types/package.d.ts deleted file mode 100644 index 2202f177583ba752d92030c12cf2e66e014de840..0000000000000000000000000000000000000000 --- a/application/source/types/package.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare let Monster: Object; \ No newline at end of file diff --git a/application/source/types/proxyobserver.js b/application/source/types/proxyobserver.js index d2d388bca1af70847d7f07334c128d107a0a9c3e..a2fe765dc4dbfcd8b0af8208272a5cf177ef9177 100644 --- a/application/source/types/proxyobserver.js +++ b/application/source/types/proxyobserver.js @@ -3,7 +3,7 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from './base.js'; import {isArray, isObject, isPrimitive} from "./is.js"; import {Observer} from "./observer.js"; @@ -14,33 +14,22 @@ import {extend} from "../data/extend.js"; /** * An observer manages a callback function * - * You can call create the class via the monster namespace `new Monster.Types.ProxyObserver()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.ProxyObserver() - * </script> - * ``` - * - * Alternatively, you can also integrate this class individually. - * - * ``` - * <script type="module"> - * import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/proxyobserver.js'; + * import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/proxyobserver.js'; * new ProxyObserver() * </script> * ``` * - * with the ProxyObserver you can attach observer for observation. with each change at the object to be observed an update takes place. + * With the ProxyObserver you can attach observer for observation. with each change at the object to be observed an update takes place. * * this also applies to nested objects. * * @example * - * import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/proxyobserver.js'; - * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/observer.js'; - * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/is.js'; + * import {ProxyObserver} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/proxyobserver.js'; + * import {Observer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/observer.js'; + * import {isObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/is.js'; * * const o = new Observer(function () { * if (isObject(this) && this instanceof ProxyObserver) { @@ -68,7 +57,7 @@ import {extend} from "../data/extend.js"; * @copyright schukai GmbH * @memberOf Monster.Types */ -class ProxyObserver extends Base { +export class ProxyObserver extends Base { /** * @@ -167,9 +156,6 @@ class ProxyObserver extends Base { } -assignToNamespace('Monster.Types', ProxyObserver); -export {Monster, ProxyObserver} - /** * * @returns {{defineProperty: (function(*=, *=, *=): *), setPrototypeOf: (function(*, *=): boolean), set: (function(*, *, *, *): boolean), get: ((function(*=, *=, *=): (undefined))|*), deleteProperty: ((function(*, *): (boolean))|*)}} diff --git a/application/source/types/queue.js b/application/source/types/queue.js index 898304a91b0ef709afd8b382ebc517f4c743b7f0..f6505c3fddf976e9d094908f3cb1dd6529c67fc2 100644 --- a/application/source/types/queue.js +++ b/application/source/types/queue.js @@ -3,31 +3,22 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from './base.js'; /** * You can create the instance via the monster namespace `new Monster.Types.Queue()`. - * + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.Queue() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/queue.js'; + * import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/queue.js'; * new Queue() * </script> * ``` * * @example * - * import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/queue.js'; + * import {Queue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/queue.js'; * * const queue = new Queue; * @@ -53,7 +44,7 @@ import {Base} from './base.js'; * @memberOf Monster.Types * @summary A Queue (Fifo) */ -class Queue extends Base { +export class Queue extends Base { /** * @@ -120,6 +111,3 @@ class Queue extends Base { } - -assignToNamespace('Monster.Types', Queue); -export {Monster, Queue} diff --git a/application/source/types/randomid.js b/application/source/types/randomid.js index f7333f8822abab3ee7da85a533a68161bd4d0f27..c592e5d14f06f834be6804bc5c131fdcd3f5bee7 100644 --- a/application/source/types/randomid.js +++ b/application/source/types/randomid.js @@ -4,7 +4,7 @@ import {random} from "../math/random.js"; /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {getGlobal} from "./global.js"; import {ID} from "./id.js"; @@ -15,20 +15,11 @@ import {ID} from "./id.js"; let internalCounter = 0; /** - * You can call the method via the monster namespace `new Monster.Types.RandomID()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.Types.RandomID()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. + * The `RandomID` class provides a unique ID for an item. * * ``` * <script type="module"> - * import {RandomID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/randomid.js'; + * import {RandomID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/randomid.js'; * console.log(new RandomID()) * </script> * ``` @@ -38,7 +29,7 @@ let internalCounter = 0; * @memberOf Monster.Types * @summary class to generate random numbers */ -class RandomID extends ID { +export class RandomID extends ID { /** * create new object @@ -55,6 +46,3 @@ class RandomID extends ID { } } - -assignToNamespace('Monster.Types', RandomID); -export {Monster, RandomID} diff --git a/application/source/types/regex.js b/application/source/types/regex.js index 14aefb3278d5ac608fb49c612f84592615f4fcb4..b9cd220422f515ddaa6c2fda015805fd419a8bf3 100644 --- a/application/source/types/regex.js +++ b/application/source/types/regex.js @@ -11,20 +11,9 @@ import {validateString} from "./validate.js"; /** * This function prefixes all special characters that may appear in a regex with a slash. * - * You can call the method via the monster namespace `Monster.Types.escapeString()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Types.escapeString() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {escapeString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/validate.js'; + * import {escapeString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; * escapeString() * </script> * ``` @@ -36,14 +25,8 @@ import {validateString} from "./validate.js"; * @memberOf Monster.Types * @throws {TypeError} value is not a string */ -function escapeString(value) { +export function escapeString(value) { return validateString(value) .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&') .replace(/-/g, '\\x2d'); } - -assignToNamespace('Monster.Types', escapeString); -export { - Monster, - escapeString -} diff --git a/application/source/types/stack.js b/application/source/types/stack.js index 73807939c1dc0c56055d8ac0e1b17faad56e3741..983196c7bb922a806a63c6a078c5ae0069727383 100644 --- a/application/source/types/stack.js +++ b/application/source/types/stack.js @@ -4,24 +4,15 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from './base.js'; /** * You can call the method via the monster namespace `new Monster.Types.Queue()`. - * + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.Types.Stack()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/stack.js'; + * import {ID} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/stack.js'; * console.log(new Stack()) * </script> * ``` @@ -30,7 +21,7 @@ import {Base} from './base.js'; * @copyright schukai GmbH * @memberOf Monster.Types */ -class Stack extends Base { +export class Stack extends Base { /** * @@ -98,6 +89,3 @@ class Stack extends Base { } - -assignToNamespace('Monster.Types', Stack); -export {Monster, Stack} diff --git a/application/source/types/tokenlist.js b/application/source/types/tokenlist.js index d82f92b33354f43c4b71239ae2ff262caeb326ae..b94567ea660abd87977c6dc784bf45d770ecf15d 100644 --- a/application/source/types/tokenlist.js +++ b/application/source/types/tokenlist.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {isIterable, isString} from '../types/is.js'; import {validateFunction, validateString} from '../types/validate.js'; import {Base} from './base.js'; @@ -14,20 +14,9 @@ import {Base} from './base.js'; * * The tokenlist offers various functions to manipulate values. For example, you can add, remove or replace a class in a CSS list. * - * You can call the method via the monster namespace `new Monster.Types.TokenList()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.TokenList("myclass row") - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/tokenlist.js'; + * import {TokenList} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/tokenlist.js'; * new TokenList("myclass row") * </script> * ``` @@ -43,7 +32,7 @@ import {Base} from './base.js'; * @copyright schukai GmbH * @memberOf Monster.Types */ -class TokenList extends Base { +export class TokenList extends Base { /** * @@ -309,6 +298,3 @@ function toggleValue(token) { this.add(token); return this; } - -assignToNamespace('Monster.Types', TokenList); -export {Monster, TokenList} diff --git a/application/source/types/typeof.js b/application/source/types/typeof.js index f3d8fda32b004ba90efccb7fbfcbae9c95fe4102..c1eb8b3a2faa2501263d71bb88ae85d835fc1c19 100644 --- a/application/source/types/typeof.js +++ b/application/source/types/typeof.js @@ -5,32 +5,21 @@ */ -import {assignToNamespace, Monster} from '../namespace.js'; + /** * The built-in typeof method is known to have some historical weaknesses. This function tries to provide a better and more accurate result. * - * You can call the method via the monster namespace `Monster.Types.typeOf()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.typeOf()) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/typeof.js'; + * import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/typeof.js'; * console.log(typeOf()) * </script> * ``` * * @example * - * import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/typeof.js'; + * import {typeOf} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/typeof.js'; * * console.log(typeOf(undefined)); // ↦ undefined * console.log(typeOf("")); // ↦ string @@ -56,8 +45,3 @@ function typeOf(value) { return type.toLowerCase(); } -assignToNamespace('Monster.Types', typeOf); -export { - Monster, - typeOf -} diff --git a/application/source/types/uniquequeue.js b/application/source/types/uniquequeue.js index 6dbfd1d93447dd93bc318bfc471348b643f819b8..a61b4c83a14d61b497497b4737b82d9e3b467d89 100644 --- a/application/source/types/uniquequeue.js +++ b/application/source/types/uniquequeue.js @@ -4,25 +4,16 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Queue} from "./queue.js"; import {validateObject} from "./validate.js"; /** - * You can call the method via the monster namespace `new Monster.Types.Queue()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.UniqueQueue() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. + * A UniqueQueue is a queue that contains items only once. * * ``` * <script type="module"> - * import {UniqueQueue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/uniquequeue.js'; + * import {UniqueQueue} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/uniquequeue.js'; * new UniqueQueue() * </script> * ``` @@ -32,7 +23,7 @@ import {validateObject} from "./validate.js"; * @memberOf Monster.Types * @summary A queue for unique values */ -class UniqueQueue extends Queue { +export class UniqueQueue extends Queue { /** * @@ -90,6 +81,3 @@ class UniqueQueue extends Queue { } - -assignToNamespace('Monster.Types', UniqueQueue); -export {Monster, UniqueQueue} diff --git a/application/source/types/uuid.js b/application/source/types/uuid.js index e11b07f3a48e513a9383747d981fb15376833efa..f709b5e73722e87e174d484f42d62cdf922cdc38 100644 --- a/application/source/types/uuid.js +++ b/application/source/types/uuid.js @@ -12,22 +12,11 @@ import {Base} from "./base.js"; import {getGlobalObject} from "./global.js"; /** - * This is the base class from which all monster classes are derived. - * - * You can create an object using the namespace: - * + * The UUID class makes it possible to get a unique UUID for an object. + * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Types.UUID() - * </script> - * ``` - * - * Or directly via the class: - * - * ``` - * <script type="module"> - * import {Base} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/uuid.js'; + * import {Base} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/uuid.js'; * new UUID() * </script> * ``` @@ -37,7 +26,7 @@ import {getGlobalObject} from "./global.js"; * @memberOf Monster.Types * @throws {Error} unsupported */ -class UUID extends Base { +export class UUID extends Base { /** * @@ -97,6 +86,3 @@ function createWithCrypto() { return crypt.randomUUID(); } - -assignToNamespace('Monster.Types', UUID); -export {Monster, UUID} diff --git a/application/source/types/validate.js b/application/source/types/validate.js index fecd561d424e6c2eca9e62de54e703bafe9c0c20..1bc7e6259c5227cc29c288e572068849177e8c27 100644 --- a/application/source/types/validate.js +++ b/application/source/types/validate.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import { isArray, isBoolean, @@ -21,21 +21,9 @@ import { /** * This method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown. * - * You can call the method via the monster namespace `Monster.Types.validatePrimitive()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.validateIterable('2')) // ↦ TypeError - * console.log(Monster.Types.validateIterable([])) // ↦ value - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/validate.js'; + * import {validateIterable} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; * console.log(validateIterable('2')) // ↦ TypeError * console.log(validateIterable([])) // ↦ value * </script> @@ -51,7 +39,7 @@ import { * @see {@link Monster.Types.isPrimitive} * @see {@link Monster.Types#isPrimitive} */ -function validateIterable(value) { +export function validateIterable(value) { if (!isIterable(value)) { throw new TypeError('value is not iterable') } @@ -61,21 +49,9 @@ function validateIterable(value) { /** * This method checks if the type matches the primitive type. this function is identical to isPrimitive() except that a TypeError is thrown. * - * You can call the method via the monster namespace `Monster.Types.validatePrimitive()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.validatePrimitive('2')) // ↦ value - * console.log(Monster.Types.validatePrimitive([])) // ↦ TypeError - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/validate.js'; + * import {validatePrimitive} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; * console.log(validatePrimitive('2')) // ↦ value * console.log(validatePrimitive([])) // ↦ TypeError * </script> @@ -91,7 +67,7 @@ function validateIterable(value) { * @see {@link Monster.Types.isPrimitive} * @see {@link Monster.Types#isPrimitive} */ -function validatePrimitive(value) { +export function validatePrimitive(value) { if (!isPrimitive(value)) { throw new TypeError('value is not a primitive') } @@ -101,22 +77,9 @@ function validatePrimitive(value) { /** * This method checks if the type matches the boolean type. this function is identical to isBoolean() except that a TypeError is thrown. * - * You can call the method via the monster namespace `Monster.Types.validateBoolean()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.validateBoolean(true)) // ↦ value - * console.log(Monster.Types.validateBoolean('2')) // ↦ TypeError - * console.log(Monster.Types.validateBoolean([])) // ↦ TypeError - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/validate.js'; + * import {validateBoolean} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; * console.log(validateBoolean(false)) // ↦ value * console.log(validateBoolean('2')) // ↦ TypeError * console.log(validateBoolean([])) // ↦ TypeError @@ -131,7 +94,7 @@ function validatePrimitive(value) { * @throws {TypeError} value is not primitive */ -function validateBoolean(value) { +export function validateBoolean(value) { if (!isBoolean(value)) { throw new TypeError('value is not a boolean') } @@ -141,21 +104,9 @@ function validateBoolean(value) { /** * This method checks if the type matches the string type. this function is identical to isString() except that a TypeError is thrown. * - * You can call the method via the monster namespace `Monster.Types.validateString()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.validateString('2')) // ↦ value - * console.log(Monster.Types.validateString([])) // ↦ TypeError - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/validate.js'; + * import {validateString} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; * console.log(validateString('2')) // ↦ value * console.log(validateString([])) // ↦ TypeError * </script> @@ -168,7 +119,7 @@ function validateBoolean(value) { * @memberOf Monster.Types * @throws {TypeError} value is not a string */ -function validateString(value) { +export function validateString(value) { if (!isString(value)) { throw new TypeError('value is not a string') } @@ -179,22 +130,9 @@ function validateString(value) { /** * This method checks if the type matches the object type. this function is identical to isObject() except that a TypeError is thrown. * - * You can call the method via the monster namespace `Monster.Types.validateObject()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.validateObject({})) // ↦ value - * console.log(Monster.Types.validateObject('2')) // ↦ TypeError - * console.log(Monster.Types.validateObject([])) // ↦ TypeError - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/validate.js'; + * import {validateObject} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; * console.log(validateObject({})) // ↦ value * console.log(validateObject('2')) // ↦ TypeError * console.log(validateObject([])) // ↦ TypeError @@ -208,7 +146,7 @@ function validateString(value) { * @memberOf Monster.Types * @throws {TypeError} value is not a object */ -function validateObject(value) { +export function validateObject(value) { if (!isObject(value)) { throw new TypeError('value is not a object') } @@ -218,22 +156,9 @@ function validateObject(value) { /** * This method checks if the type matches the object instance. * - * You can call the method via the monster namespace `Monster.Types.validateInstance()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.validateInstance({}, Object)) // ↦ value - * console.log(Monster.Types.validateInstance('2', Object)) // ↦ TypeError - * console.log(Monster.Types.validateInstance([], Object)) // ↦ TypeError - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {validateInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/validate.js'; + * import {validateInstance} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; * console.log(validateInstance({}, Object)) // ↦ value * console.log(validateInstance('2', Object)) // ↦ TypeError * console.log(validateInstance([], Object)) // ↦ TypeError @@ -247,7 +172,7 @@ function validateObject(value) { * @memberOf Monster.Types * @throws {TypeError} value is not an instance of */ -function validateInstance(value, instance) { +export function validateInstance(value, instance) { if (!isInstance(value, instance)) { let n = ""; if (isObject(instance) || isFunction(instance)) { @@ -266,21 +191,9 @@ function validateInstance(value, instance) { /** * This method checks if the type matches the array type. this function is identical to isArray() except that a TypeError is thrown. * - * You can call the method via the monster namespace `Monster.Types.validateArray()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.validateArray('2')) // ↦ TypeError - * console.log(Monster.Types.validateArray([])) // ↦ value - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/validate.js'; + * import {validateArray} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; * console.log(validateArray('2')) // ↦ TypeError * console.log(validateArray([])) // ↦ value * </script> @@ -293,7 +206,7 @@ function validateInstance(value, instance) { * @memberOf Monster.Types * @throws {TypeError} value is not an array */ -function validateArray(value) { +export function validateArray(value) { if (!isArray(value)) { throw new TypeError('value is not an array') } @@ -303,21 +216,9 @@ function validateArray(value) { /** * This method checks if the type matches the symbol type. this function is identical to isSymbol() except that a TypeError is thrown. * - * You can call the method via the monster namespace `Monster.Types.validateSymbol()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.validateSymbol('2')) // ↦ TypeError - * console.log(Monster.Types.validateSymbol([])) // ↦ value - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {validateSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/validate.js'; + * import {validateSymbol} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; * console.log(validateSymbol('2')) // ↦ TypeError * console.log(validateSymbol()) // ↦ value * </script> @@ -330,7 +231,7 @@ function validateArray(value) { * @memberOf Monster.Types * @throws {TypeError} value is not an symbol */ -function validateSymbol(value) { +export function validateSymbol(value) { if (!isSymbol(value)) { throw new TypeError('value is not an symbol') } @@ -340,22 +241,9 @@ function validateSymbol(value) { /** * This method checks if the type matches the function type. this function is identical to isFunction() except that a TypeError is thrown. * - * You can call the method via the monster namespace `Monster.Types.validateFunction()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.validateFunction(()=>{})) // ↦ value - * console.log(Monster.Types.validateFunction('2')) // ↦ TypeError - * console.log(Monster.Types.validateFunction([])) // ↦ TypeError - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * * ``` * <script type="module"> - * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/validate.js'; + * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; * console.log(validateFunction(()=>{})) // ↦ value * console.log(validateFunction('2')) // ↦ TypeError * console.log(validateFunction([])) // ↦ TypeError @@ -369,7 +257,7 @@ function validateSymbol(value) { * @memberOf Monster.Types * @throws {TypeError} value is not a function */ -function validateFunction(value) { +export function validateFunction(value) { if (!isFunction(value)) { throw new TypeError('value is not a function') } @@ -379,22 +267,9 @@ function validateFunction(value) { /** * This method checks if the type is an integer. this function is identical to isInteger() except that a TypeError is thrown. * - * You can call the method via the monster namespace `Monster.Types.validateInteger()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(Monster.Types.validateInteger(true)) // ↦ TypeError - * console.log(Monster.Types.validateInteger('2')) // ↦ TypeError - * console.log(Monster.Types.validateInteger(2)) // ↦ value - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/validate.js'; + * import {validateFunction} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/validate.js'; * console.log(validateInteger(true)) // ↦ TypeError * console.log(validateInteger('2')) // ↦ TypeError * console.log(validateInteger(2)) // ↦ value @@ -408,24 +283,9 @@ function validateFunction(value) { * @memberOf Monster.Types * @throws {TypeError} value is not an integer */ -function validateInteger(value) { +export function validateInteger(value) { if (!isInteger(value)) { throw new TypeError('value is not an integer') } return value } - -assignToNamespace('Monster.Types', validatePrimitive, validateBoolean, validateString, validateObject, validateArray, validateFunction, validateIterable, validateInteger); -export { - Monster, - validatePrimitive, - validateBoolean, - validateString, - validateObject, - validateInstance, - validateArray, - validateFunction, - validateIterable, - validateInteger, - validateSymbol -} diff --git a/application/source/types/version.js b/application/source/types/version.js index db52ec50635b2e21a407c4d846f92c053ee75c57..5c635227b1326c68ba3e863ce45dc5ca23059588 100644 --- a/application/source/types/version.js +++ b/application/source/types/version.js @@ -1,26 +1,14 @@ 'use strict'; -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from './base.js'; /** * The version object contains a sematic version number * - * You can create the object via the monster namespace `new Monster.Types.Version()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * console.log(new Monster.Types.Version('1.2.3')) // ↦ 1.2.3 - * console.log(new Monster.Types.Version('1')) // ↦ 1.0.0 - * </script> - * ``` - * - * Alternatively, you can also integrate this class individually. - * * ``` * <script type="module"> - * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/version.js'; + * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/version.js'; * console.log(new Version('1.2.3')) // ↦ 1.2.3 * console.log(new Version('1')) // ↦ 1.0.0 * </script> @@ -28,7 +16,7 @@ import {Base} from './base.js'; * * @example * - * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/version.js'; + * import {Version} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/version.js'; * * new Version('1.0.0') // ↦ 1.0.0 * new Version(1) // ↦ 1.0.0 @@ -41,7 +29,7 @@ import {Base} from './base.js'; * @memberOf Monster.Types * @summary The version object contains a sematic version number */ -class Version extends Base { +export class Version extends Base { /** * @@ -139,9 +127,6 @@ class Version extends Base { } -assignToNamespace('Monster.Types', Version); - - let monsterVersion; /** @@ -160,8 +145,8 @@ let monsterVersion; * * ``` * <script type="module"> - * import {getVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/types/version.js'; - * console.log(getVersion()) + * import {getMonsterVersion} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/types/version.js'; + * console.log(getMonsterVersion()) * </script> * ``` * @@ -171,7 +156,7 @@ let monsterVersion; * @author schukai GmbH * @memberOf Monster */ -function getVersion() { +export function getMonsterVersion() { if (monsterVersion instanceof Version) { return monsterVersion; } @@ -182,6 +167,3 @@ function getVersion() { return monsterVersion; } - -assignToNamespace('Monster', getVersion); -export {Monster, Version, getVersion} diff --git a/application/source/util/clone.js b/application/source/util/clone.js index d8b1a769f1a9d5820fc8b1660f54450112282a6b..a48f2d578e6152aabe6ab4ad4dc2b27b12427e7e 100644 --- a/application/source/util/clone.js +++ b/application/source/util/clone.js @@ -4,7 +4,7 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {getGlobal} from '../types/global.js'; import {isArray, isFunction, isObject, isPrimitive} from '../types/is.js'; import {typeOf} from "../types/typeof.js"; @@ -20,20 +20,9 @@ import {validateObject} from "../types/validate.js"; * * If an object has a method `getClone()`, this method is used to create the clone. * - * You can call the method via the monster namespace `Monster.Util.clone()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Util.clone({}) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/util/clone.js'; + * import {clone} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/util/clone.js'; * clone({}) * </script> * ``` @@ -45,7 +34,7 @@ import {validateObject} from "../types/validate.js"; * @copyright schukai GmbH * @throws {Error} unable to clone obj! its type isn't supported. */ -function clone(obj) { +export function clone(obj) { // typeof null results in 'object'. https://2ality.com/2013/10/typeof-null.html if (null === obj) { @@ -155,6 +144,3 @@ function cloneObject(obj) { return copy; } - -assignToNamespace('Monster.Util', clone); -export {Monster, clone} diff --git a/application/source/util/comparator.js b/application/source/util/comparator.js index 81606729a7492b510943f5ff3cc2e0e5e9033fd9..1939bdf65d9b080d199205f0e0a60a9d55acc90b 100644 --- a/application/source/util/comparator.js +++ b/application/source/util/comparator.js @@ -3,25 +3,16 @@ /** * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from '../types/base.js'; import {isFunction} from '../types/is.js'; /** * The comparator allows a comparison function to be abstracted. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Util.Comparator() - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * + * * ``` * <script type="module"> - * import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/util/comparator.js'; + * import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/util/comparator.js'; * console.log(new Comparator()) * </script> * ``` @@ -46,7 +37,7 @@ import {isFunction} from '../types/is.js'; * * @example * - * import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/util/comparator.js'; + * import {Comparator} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/util/comparator.js'; * * console.log(new Comparator().lessThanOrEqual(2, 5)) * // ↦ true @@ -60,7 +51,7 @@ import {isFunction} from '../types/is.js'; * @since 1.3.0 * @memberOf Monster.Util */ -class Comparator extends Base { +export class Comparator extends Base { /** * create new comparator @@ -194,9 +185,3 @@ class Comparator extends Base { * @see Monster.Util.Comparator */ - -/** - * - */ -assignToNamespace('Monster.Util', Comparator); -export {Monster, Comparator} diff --git a/application/source/util/deadmansswitch.js b/application/source/util/deadmansswitch.js index 63dbfb0e1a9a223618c8e3000c8bca413cbaf398..b6bb6d8a3753f460bfd5a9fe668cbded53a40b75 100644 --- a/application/source/util/deadmansswitch.js +++ b/application/source/util/deadmansswitch.js @@ -6,7 +6,7 @@ import {internalSymbol} from "../constants.js"; -import {assignToNamespace, Monster} from '../namespace.js'; + import {Base} from "../types/base.js"; import {isInteger} from "../types/is.js"; import {validateFunction, validateInteger} from "../types/validate.js"; @@ -14,26 +14,15 @@ import {validateFunction, validateInteger} from "../types/validate.js"; /** * The dead man's switch allows to set a timer which can be reset again and again within a defined period of time. * - * You can create an instance via the monster namespace `Monster.Util.DeadMansSwitch()`. - * - * ``` - * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Util.DeadMansSwitch() - * </script> - * ``` - * - * Alternatively, you can also integrate this class individually. - * * ``` * <script type="module"> - * import {DeadMansSwitch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/util/deadmansswitch.js'; + * import {DeadMansSwitch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/util/deadmansswitch.js'; * new DeadMansSwitch(); * </script> * ``` * * @example - * import {DeadMansSwitch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/util/deadmansswitch.js'; + * import {DeadMansSwitch} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/util/deadmansswitch.js'; * * const deadmansswitch = new DeadMansSwitch(100, ()=>{ * console.log('yeah!') @@ -48,7 +37,7 @@ import {validateFunction, validateInteger} from "../types/validate.js"; * @memberOf Monster.Util * @summary Class to be able to execute function chains */ -class DeadMansSwitch extends Base { +export class DeadMansSwitch extends Base { /** * Create new dead man's switch @@ -120,5 +109,5 @@ function init(delay, callback) { } -assignToNamespace('Monster.Util', DeadMansSwitch); -export {Monster, DeadMansSwitch} + + diff --git a/application/source/util/freeze.js b/application/source/util/freeze.js index daa49a34ef8de591c20c7041d1b95280ac6e9991..a0c0619ce400ac2ff3e1629e56d7b18a90e8c9a4 100644 --- a/application/source/util/freeze.js +++ b/application/source/util/freeze.js @@ -4,26 +4,15 @@ * @author schukai GmbH */ -import {assignToNamespace, Monster} from '../namespace.js'; + import {validateObject} from '../types/validate.js'; /** * Deep freeze a object * - * You can call the method via the monster namespace `Monster.Util.deepFreeze()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * Monster.Util.deepFreeze({}) - * </script> - * ``` - * - * Alternatively, you can also integrate this function individually. - * - * ``` - * <script type="module"> - * import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/util/freeze.js'; + * import {deepFreeze} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/util/freeze.js'; * deepFreeze({}) * </script> * ``` @@ -35,7 +24,7 @@ import {validateObject} from '../types/validate.js'; * @copyright schukai GmbH * @throws {TypeError} value is not a object */ -function deepFreeze(object) { +export function deepFreeze(object) { validateObject(object) @@ -52,6 +41,3 @@ function deepFreeze(object) { return Object.freeze(object); } - -assignToNamespace('Monster.Util', deepFreeze); -export {Monster, deepFreeze} diff --git a/application/source/util/namespace.js b/application/source/util/namespace.js deleted file mode 100644 index f304ecc7d377191d60aa3307b8cab11abf451e31..0000000000000000000000000000000000000000 --- a/application/source/util/namespace.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -/** - * Namespace for utilities. - * - * @namespace Monster.Util - * @memberOf Monster - * @author schukai GmbH - */ - - -/** - * @private - * @type {string} - */ -export const namespace = "Monster.Util"; \ No newline at end of file diff --git a/application/source/util/processing.js b/application/source/util/processing.js index 9e8d77b5df0afcf7d8ca9e2bedb438874932ca25..5019656ba6418986c3329af9b3f2226a3c653ab8 100644 --- a/application/source/util/processing.js +++ b/application/source/util/processing.js @@ -6,14 +6,12 @@ import {internalSymbol} from "../constants.js"; -import {assignToNamespace, Monster} from '../namespace.js'; import {Base} from "../types/base.js"; import {getGlobalFunction} from "../types/global.js"; import {isFunction, isInteger} from "../types/is.js"; import {Queue} from "../types/queue.js"; import {validateFunction, validateInteger} from "../types/validate.js"; - /** * @private */ @@ -73,26 +71,15 @@ class Callback { * * The result of `run()` is a promise. * - * You can create an instance via the monster namespace `Monster.Util.Processing()`. - * * ``` * <script type="module"> - * import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; - * new Monster.Util.Processing() - * </script> - * ``` - * - * Alternatively, you can also integrate this class individually. - * - * ``` - * <script type="module"> - * import {Processing} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/util/processing.js'; + * import {Processing} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/util/processing.js'; * new Processing(); * </script> * ``` * * @example - * import {Processing} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/modules/util/processing.js'; + * import {Processing} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/util/processing.js'; * * let startTime = +new Date(); * @@ -115,7 +102,7 @@ class Callback { * @memberOf Monster.Util * @summary Class to be able to execute function chains */ -class Processing extends Base { +export class Processing extends Base { /** * Create new Processing @@ -189,6 +176,3 @@ class Processing extends Base { } } - -assignToNamespace('Monster.Util', Processing); -export {Monster, Processing} diff --git a/application/source/util/trimspaces.js b/application/source/util/trimspaces.js index 7ae3771c150ff67a3b760a490f742a5727094c6f..6a4ef3d3deaa86f5cf37d6f37266d645db74a788 100644 --- a/application/source/util/trimspaces.js +++ b/application/source/util/trimspaces.js @@ -32,7 +32,7 @@ import {validateString} from "../types/validate.js"; * @return {string} * @throws {TypeError} value is not a string */ -function trimSpaces(value) { +export function trimSpaces(value) { validateString(value);