Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 1.31
  • master
  • 1.10.0
  • 1.30.1
  • 1.31.0
  • 1.8.0
  • 1.9.0
  • 3.100.0
  • 3.100.1
  • 3.100.10
  • 3.100.11
  • 3.100.12
  • 3.100.13
  • 3.100.14
  • 3.100.15
  • 3.100.16
  • 3.100.17
  • 3.100.18
  • 3.100.19
  • 3.100.2
  • 3.100.20
  • 3.100.3
  • 3.100.4
  • 3.100.5
  • 3.100.6
  • 3.100.7
  • 3.100.8
  • 3.100.9
  • 3.101.0
  • 3.101.1
  • 3.101.2
  • 3.101.3
  • 3.102.0
  • 3.102.1
  • 3.102.2
  • 3.102.3
  • 3.102.4
  • 3.102.5
  • 3.102.6
  • 3.103.0
  • 3.103.1
  • 3.104.0
  • 3.104.1
  • 3.105.0
  • 3.105.1
  • 3.105.2
  • 3.106.0
  • 3.106.1
  • 3.107.0
  • 3.108.0
  • 3.108.1
  • 3.108.2
  • 3.108.3
  • 3.108.4
  • 3.108.5
  • 3.109.0
  • 3.110.0
  • 3.110.1
  • 3.110.2
  • 3.110.3
  • 3.110.4
  • 3.111.0
  • 3.112.0
  • 3.112.1
  • 3.112.2
  • 3.112.3
  • 3.112.4
  • 3.113.0
  • 3.114.0
  • 3.114.1
  • 3.114.2
  • 3.114.3
  • 3.114.4
  • 3.114.5
  • 3.114.6
  • 3.114.7
  • 3.115.0
  • 3.115.1
  • 3.115.2
  • 3.115.3
  • 3.115.4
  • 3.116.0
  • 3.116.1
  • 3.117.0
  • 3.117.1
  • 3.117.2
  • 3.117.3
  • 3.118.0
  • 3.118.1
  • 3.119.0
  • 3.120.0
  • 3.121.0
  • 3.51.5
  • 3.52.0
  • 3.52.1
  • 3.53.0
  • 3.54.0
  • 3.55.0
  • 3.55.1
  • 3.55.2
  • 3.55.3
  • 3.55.4
102 results

Target

Select target project
  • oss/libraries/javascript/monster
1 result
Select Git revision
  • 1.31
  • master
  • 1.10.0
  • 1.30.1
  • 1.31.0
  • 1.8.0
  • 1.9.0
  • 3.100.0
  • 3.100.1
  • 3.100.10
  • 3.100.11
  • 3.100.12
  • 3.100.13
  • 3.100.14
  • 3.100.15
  • 3.100.16
  • 3.100.17
  • 3.100.18
  • 3.100.19
  • 3.100.2
  • 3.100.20
  • 3.100.3
  • 3.100.4
  • 3.100.5
  • 3.100.6
  • 3.100.7
  • 3.100.8
  • 3.100.9
  • 3.101.0
  • 3.101.1
  • 3.101.2
  • 3.101.3
  • 3.102.0
  • 3.102.1
  • 3.102.2
  • 3.102.3
  • 3.102.4
  • 3.102.5
  • 3.102.6
  • 3.103.0
  • 3.103.1
  • 3.104.0
  • 3.104.1
  • 3.105.0
  • 3.105.1
  • 3.105.2
  • 3.106.0
  • 3.106.1
  • 3.107.0
  • 3.108.0
  • 3.108.1
  • 3.108.2
  • 3.108.3
  • 3.108.4
  • 3.108.5
  • 3.109.0
  • 3.110.0
  • 3.110.1
  • 3.110.2
  • 3.110.3
  • 3.110.4
  • 3.111.0
  • 3.112.0
  • 3.112.1
  • 3.112.2
  • 3.112.3
  • 3.112.4
  • 3.113.0
  • 3.114.0
  • 3.114.1
  • 3.114.2
  • 3.114.3
  • 3.114.4
  • 3.114.5
  • 3.114.6
  • 3.114.7
  • 3.115.0
  • 3.115.1
  • 3.115.2
  • 3.115.3
  • 3.115.4
  • 3.116.0
  • 3.116.1
  • 3.117.0
  • 3.117.1
  • 3.117.2
  • 3.117.3
  • 3.118.0
  • 3.118.1
  • 3.119.0
  • 3.120.0
  • 3.121.0
  • 3.51.5
  • 3.52.0
  • 3.52.1
  • 3.53.0
  • 3.54.0
  • 3.55.0
  • 3.55.1
  • 3.55.2
  • 3.55.3
  • 3.55.4
102 results
Show changes
Showing
with 473 additions and 865 deletions
/**
* Copyright 2022 schukai GmbH
* SPDX-License-Identifier: AGPL-3.0
*/
/**
* Namespace for storages
*
* @namespace Monster.Data.Datasource.RestAPI
* @memberOf Monster.Data.Datasource
* @author schukai GmbH
*/
const ns = {};
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {internalSymbol} from "../../../constants.js";
import {assignToNamespace, Monster} from '../../../namespace.js';
import {internalSymbol} from "../../../constants.mjs";
export {WriteError}
/**
* Error message for API requests with extension of request and validation.
*
* @license AGPLv3
* @since 1.24.0
* @copyright schukai GmbH
* @memberOf Monster.Data.Datasource.RestAPI
......@@ -43,7 +46,3 @@ class WriteError extends Error {
return this[internalSymbol]['validation']
}
}
assignToNamespace('Monster.Data.Datasource.RestAPI', WriteError);
export {Monster, WriteError}
\ No newline at end of file
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {internalSymbol} from "../../constants.js";
import {assignToNamespace, Monster} from '../../namespace.js';
import {validateString} from "../../types/validate.js";
import {Datasource} from "../datasource.js";
import {internalSymbol} from "../../constants.mjs";
import {validateString} from "../../types/validate.mjs";
import {Datasource} from "../datasource.mjs";
export {Storage, storageObjectSymbol}
/**
* @private
......@@ -16,30 +18,9 @@ import {Datasource} from "../datasource.js";
const storageObjectSymbol = Symbol('storageObject');
/**
* You can create an object of this class using the monster namespace `Monster.Data.Datasource.Storage()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.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.30.0/dist/modules/data/datasource/storage.js';
* new Storage()
* </script>
* ```
*
* @example
*
* import {Storage} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/datasource/storage.js';
*
* new Datasource();
* The class represents a record.
*
* @license AGPLv3
* @since 1.22.0
* @copyright schukai GmbH
* @memberOf Monster.Data.Datasource
......@@ -125,7 +106,3 @@ class Storage extends Datasource {
}
}
assignToNamespace('Monster.Data.Datasource', Storage);
export {Monster, Storage, storageObjectSymbol}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {internalSymbol} from "../../../constants.js";
import {assignToNamespace, Monster} from '../../../namespace.js';
import {getGlobalObject} from "../../../types/global.js";
import {Datasource} from "../../datasource.js";
import {Storage, storageObjectSymbol} from "../storage.js";
import {internalSymbol} from "../../../constants.mjs";
import {getGlobalObject} from "../../../types/global.mjs";
import {Datasource} from "../../datasource.mjs";
import {Storage, storageObjectSymbol} from "../storage.mjs";
export {LocalStorage}
/**
* 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.30.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.30.0/dist/modules/data/datasource/storage/localstorage.js';
* new LocalStorage()
* </script>
* ```
*
* @license AGPLv3
* @since 1.22.0
* @copyright schukai GmbH
* @memberOf Monster.Data.Datasource.Storage
......@@ -59,6 +43,3 @@ class LocalStorage extends Storage {
}
assignToNamespace('Monster.Data.Datasource.Storage', LocalStorage);
export {Monster, LocalStorage}
'use strict';
/**
* Copyright 2022 schukai GmbH
* SPDX-License-Identifier: AGPL-3.0
*/
/**
* Namespace for storages
......@@ -7,10 +10,4 @@
* @memberOf Monster.Data.Datasource
* @author schukai GmbH
*/
/**
* @private
* @type {string}
*/
export const namespace = "Monster.Data.Datasource.Storage";
\ No newline at end of file
const ns = {};
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {internalSymbol} from "../../../constants.js";
import {assignToNamespace, Monster} from '../../../namespace.js';
import {getGlobalObject} from "../../../types/global.js";
import {Datasource} from "../../datasource.js";
import {Storage, storageObjectSymbol} from "../storage.js";
import {internalSymbol} from "../../../constants.mjs";
import {getGlobalObject} from "../../../types/global.mjs";
import {Datasource} from "../../datasource.mjs";
import {Storage, storageObjectSymbol} from "../storage.mjs";
export {SessionStorage}
/**
* 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.30.0/dist/monster.js';
* Monster.Data.Datasource.Storage.SessionStorage()
* </script>
* ```
*
* Alternatively you can import the class directly
*
* ```
* <script type="module">
* import {SessionStorage} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/datasource/storage/sessionstorage.js';
* new SessionStorage()
* </script>
* ```
* The SessionStorage class provides a data source that uses the SessionStorage API on the client.
*
* @license AGPLv3
* @since 1.22.0
* @copyright schukai GmbH
* @memberOf Monster.Data.Datasource.Storage
......@@ -56,6 +43,3 @@ class SessionStorage extends Storage {
}
}
assignToNamespace('Monster.Data.Datasource.Storage', SessionStorage);
export {Monster, SessionStorage}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {isArray, isObject} from "../types/is.js";
import {typeOf} from "../types/typeof.js";
import {isArray, isObject} from "../types/is.mjs";
import {typeOf} from "../types/typeof.mjs";
export {diff}
/**
* With the diff function you can perform the change of one object to another. The result shows the changes of the second object to the first object.
*
* 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.30.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.30.0/dist/modules/data/diff.js';
* Diff(a, b)
* </script>
* ```
*
* @example
*
* import {Diff} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/diff.js';
*
* // given are two objects x and y.
*
* let x = {
* a: 1,
* b: "Hello!"
* }
*
* let y = {
* a: 2,
* c: true
* }
*
* // These two objects can be compared with each other.
*
* console.log(Diff(x, y));
*
* // the result is then the following
*
* //
* // [
* // {
* // operator: 'update',
* // path: [ 'a' ],
* // first: { value: 1, type: 'number' },
* // second: { value: 2, type: 'number' }
* // },
* // {
* // operator: 'delete',
* // path: [ 'b' ],
* // first: { value: 'Hello!', type: 'string' }
* // },
* // {
* // operator: 'add',
* // path: [ 'c' ],
* // second: { value: true, type: 'boolean' }
* // }
* // ]
*
* @externalExample ../../example/data/diff.mjs
* @param {*} first
* @param {*} second
* @return {array}
* @license AGPLv3
* @since 1.6.0
* @copyright schukai GmbH
* @memberOf Monster.Data
......@@ -244,6 +188,3 @@ function getOperator(a, b) {
return operator;
}
assignToNamespace('Monster.Data', diff);
export {Monster, diff}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {isArray, isObject} from "../types/is.js";
import {typeOf} from "../types/typeof.js";
import {isArray, isObject} from "../types/is.mjs";
import {typeOf} from "../types/typeof.mjs";
export {extend}
/**
* 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.30.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.30.0/dist/modules/data/extend.js';
* extend(a, b)
* </script>
* ```
*
* @param {object} target
* @param {object}
* @return {object}
* @license AGPLv3
* @since 1.10.0
* @copyright schukai GmbH
* @memberOf Monster.Data
......@@ -86,7 +72,3 @@ function extend() {
return o;
}
assignToNamespace('Monster.Data', extend);
export {Monster, extend}
'use strict';
/**
* Copyright 2022 schukai GmbH
* SPDX-License-Identifier: AGPL-3.0
*/
/**
* In this namespace you will find classes and methods for handling data.
......@@ -7,10 +12,4 @@
* @memberOf Monster
* @author schukai GmbH
*/
/**
* @private
* @type {string}
*/
export const namespace = "Monster.Data";
\ No newline at end of file
const ns = {};
\ No newline at end of file
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
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";
import {validateInteger, validateString} from '../types/validate.js';
import {Base} from '../types/base.mjs';
import {isArray, isInteger, isObject, isPrimitive} from '../types/is.mjs';
import {Stack} from "../types/stack.mjs";
import {validateInteger, validateString} from '../types/validate.mjs';
export {Pathfinder, DELIMITER, WILDCARD}
/**
* path separator
......@@ -15,32 +18,16 @@ import {validateInteger, validateString} from '../types/validate.js';
* @private
* @type {string}
*/
export const DELIMITER = '.';
const DELIMITER = '.';
/**
* @private
* @type {string}
*/
export const WILDCARD = '*';
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.30.0/dist/monster.js';
* console.log(new Monster.Data.Pathfinder())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/pathfinder.js';
* console.log(new Pathfinder())
* </script>
* ```
* Pathfinder is a class to find a path to an object.
*
* With the help of the pathfinder, values can be read and written from an object construct.
*
......@@ -77,54 +64,9 @@ export const WILDCARD = '*';
* new Pathfinder(obj).setVia('a.b.0.c', true); // ↦ {a:{b:[{c:true}]}}
* ```
*
* @example
*
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/pathfinder.js';
*
* let value = new Pathfinder({
* a: {
* b: {
* f: [
* {
* g: false,
* }
* ],
* }
* }
* }).getVia("a.b.f.0.g");
*
* console.log(value);
* // ↦ false
*
* try {
* new Pathfinder({}).getVia("a.b.f.0.g");
* } catch(e) {
* console.log(e.toString());
* // ↦ Error: the journey is not at its end (b.f.0.g)
* }
*
* @example
*
* import {Pathfinder} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/pathfinder.js';
*
* let p = new Pathfinder({
* a: {
* x: [
* {c: 1}, {c: 2}
* ],
* y: true
* },
* b: {
* x: [
* {c: 1, d: false}, {c: 2}
* ],
* y: true
* },
* });
*
* let r = p.getVia("*.x.*.c");
* console.log(r);
*
* @externalExample ../../example/data/pathfinder-1.mjs
* @externalExample ../../example/data/pathfinder-2.mjs
* @license AGPLv3
* @since 1.4.0
* @copyright schukai GmbH
* @memberOf Monster.Data
......@@ -232,8 +174,6 @@ class Pathfinder extends Base {
}
assignToNamespace('Monster.Data', Pathfinder);
export {Monster, Pathfinder}
/**
*
......@@ -444,6 +384,7 @@ function assignProperty(object, key, value) {
* @throws {TypeError} unsupported type
* @throws {Error} the journey is not at its end
* @throws {Error} unsupported action for this data type
* @license AGPLv3
* @since 1.6.0
* @private
*/
......
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js';
import {validateString} from '../types/validate.js';
import {Transformer} from './transformer.js';
import {Base} from '../types/base.mjs';
import {validateString} from '../types/validate.mjs';
import {Transformer} from './transformer.mjs';
export {Pipe}
/**
* @private
* @type {string}
*/
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.30.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.30.0/dist/modules/data/pipe.js';
* new Pipe()
* </script>
* ```
*
* A pipe consists of commands whose input and output are connected with the pipe symbol `|`.
*
* With the Pipe, processing steps can be combined. Here, the value of an object is accessed via the pathfinder (path command).
* 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.30.0/dist/modules/data/pipe.js';
*
* let obj = {
* a: {
* b: {
* c: {
* d: "world"
* }
* }
* }
* }
*
* console.log(new Pipe('path:a.b.c.d | toupper | prefix:Hello\\ ').run(obj));
* // ↦ Hello WORLD
*
* @externalExample ../../example/data/pipe.mjs
* @license AGPLv3
* @since 1.5.0
* @copyright schukai GmbH
* @memberOf Monster.Data
......@@ -61,7 +34,6 @@ const DELIMITER = '|';
class Pipe extends Base {
/**
*
* @param {string} pipe a pipe consists of commands whose input and output are connected with the pipe symbol `|`.
* @throws {TypeError}
*/
......@@ -77,7 +49,6 @@ class Pipe extends Base {
}
/**
*
* @param {string} name
* @param {function} callback
* @param {object} context
......@@ -106,6 +77,3 @@ class Pipe extends Base {
}, value);
}
}
assignToNamespace('Monster.Data', Pipe);
export {Monster, Pipe}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
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';
import {isArray, isObject, isString} from '../types/is.js';
import {Base} from '../types/base.mjs';
import {getGlobal, getGlobalObject} from "../types/global.mjs";
import {ID} from '../types/id.mjs';
import {isArray, isObject, isString} from '../types/is.mjs';
import {
validateFunction,
validateInteger,
validateObject,
validatePrimitive,
validateString
} from '../types/validate.js';
import {clone} from "../util/clone.js";
import {Pathfinder} from "./pathfinder.js";
} from '../types/validate.mjs';
import {clone} from "../util/clone.mjs";
import {Pathfinder} from "./pathfinder.mjs";
export {Transformer}
/**
* The transformer class is a swiss army knife for manipulating values. especially in combination with the pipe, processing chains can be built up.
*
* 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.30.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.30.0/dist/modules/data/transformer.js';
* new Transformer()
* </script>
* ```
*
* A simple example is the conversion of all characters to lowercase. for this purpose the command `tolower` must be used.
*
* ```
......@@ -118,18 +106,8 @@ import {Pathfinder} from "./pathfinder.js";
* global['crypto'] = new Crypto.Crypto();
* ```
*
* @example
*
* import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/data/transformer.js';
*
* const transformer = new Transformer("tolower")
*
* console.log(transformer.run("HELLO"))
* // ↦ hello
*
* console.log(transformer.run("WORLD"))
* // ↦ world
*
* @externalExample ../../example/data/transformer.mjs
* @license AGPLv3
* @since 1.5.0
* @copyright schukai GmbH
* @memberOf Monster.Data
......@@ -185,9 +163,6 @@ class Transformer extends Base {
}
}
assignToNamespace('Monster.Data', Transformer);
export {Monster, Transformer}
/**
*
* @param {string} command
......
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js';
import {getGlobalFunction} from "../types/global.js";
import {ProxyObserver} from "../types/proxyobserver.js";
import {validateInstance, validateString} from "../types/validate.js";
import {Base} from '../types/base.mjs';
import {getGlobalFunction} from "../types/global.mjs";
import {ProxyObserver} from "../types/proxyobserver.mjs";
import {validateInstance, validateString} from "../types/validate.mjs";
export {ATTRIBUTEPREFIX,Assembler}
/**
* attribute prefix
......@@ -19,24 +21,9 @@ import {validateInstance, validateString} from "../types/validate.js";
const ATTRIBUTEPREFIX = "data-monster-";
/**
* you can call the method via the monster namespace `new Monster.DOM.Assembler()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
* console.log(new Monster.DOM.Assembler())
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {Assembler} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/assembler.js';
* console.log(new Assembler())
* </script>
* ```
* Assembler class
*
* @license AGPLv3
* @since 1.6.0
* @copyright schukai GmbH
* @memberOf Monster.DOM
......@@ -95,6 +82,3 @@ class Assembler extends Base {
}
}
assignToNamespace('Monster.DOM', Assembler);
export {Monster, ATTRIBUTEPREFIX, Assembler}
'use strict';
import {extend} from "../data/extend.js";
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
import {assignToNamespace, Monster} from '../namespace.js';
import {ATTRIBUTE_VALUE} from "./constants.js";
import {CustomElement, attributeObserverSymbol} from "./customelement.js";
import {extend} from "../data/extend.mjs";
import {ATTRIBUTE_VALUE} from "./constants.mjs";
import {CustomElement, attributeObserverSymbol} from "./customelement.mjs";
export {CustomControl}
/**
* @private
......@@ -28,13 +30,6 @@ const attachedInternalSymbol = Symbol('attachedInternal');
*
* You can create the object via the function `document.createElement()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
* document.createElement('monster-')
* </script>
* ```
*
* @startuml customcontrol-class.png
* skinparam monochrome true
* skinparam shadowing false
......@@ -46,6 +41,7 @@ const attachedInternalSymbol = Symbol('attachedInternal');
* @see {@link https://www.npmjs.com/package/element-internals-polyfill}
* @see {@link https://github.com/WICG/webcomponents}
* @see {@link https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements}
* @license AGPLv3
* @since 1.14.0
* @copyright schukai GmbH
* @memberOf Monster.DOM
......@@ -328,6 +324,3 @@ function initObserver() {
}
}
assignToNamespace('Monster.DOM', CustomControl);
export {Monster, CustomControl}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
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";
import {Observer} from "../types/observer.js";
import {ProxyObserver} from "../types/proxyobserver.js";
import {validateFunction, validateInstance, validateObject, validateString} from "../types/validate.js";
import {clone} from "../util/clone.js";
import {addAttributeToken, addToObjectLink, getLinkedObjects, hasObjectLink} from "./attributes.js";
import {internalSymbol} from "../constants.mjs";
import {extend} from "../data/extend.mjs";
import {Pathfinder} from "../data/pathfinder.mjs";
import {parseDataURL} from "../types/dataurl.mjs";
import {getGlobalObject} from "../types/global.mjs";
import {isArray, isFunction, isObject, isString} from "../types/is.mjs";
import {Observer} from "../types/observer.mjs";
import {ProxyObserver} from "../types/proxyobserver.mjs";
import {validateFunction, validateInstance, validateObject, validateString} from "../types/validate.mjs";
import {clone} from "../util/clone.mjs";
import {addAttributeToken, addToObjectLink, getLinkedObjects, hasObjectLink} from "./attributes.mjs";
import {
ATTRIBUTE_DISABLED,
ATTRIBUTE_ERRORMESSAGE,
ATTRIBUTE_OPTIONS,
ATTRIBUTE_OPTIONS_SELECTOR,
objectUpdaterLinkSymbol
} from "./constants.js";
import {findDocumentTemplate, Template} from "./template.js";
import {Updater} from "./updater.js";
} from "./constants.mjs";
import {findDocumentTemplate, Template} from "./template.mjs";
import {Updater} from "./updater.mjs";
export {CustomElement, initMethodSymbol, assembleMethodSymbol, attributeObserverSymbol, registerCustomElement, assignUpdaterToElement, getSlottedElements}
/**
* @memberOf Monster.DOM
......@@ -101,12 +103,6 @@ const attributeObserverSymbol = Symbol('attributeObserver');
*
* You can create the object via the function `document.createElement()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
* document.createElement('monster-')
* </script>
* ```
*
* ## Interaction
*
......@@ -172,24 +168,10 @@ const attributeObserverSymbol = Symbol('attributeObserver');
* }
* ```
*
* @example
*
* // In the example the the user can use his own template by creating a template in the DOM with the ID `my-custom-element`.
* // You can also specify a theme (for example `mytheme`), then it will search for the ID `my-custom-element-mytheme` and
* // if not available for the ID `my-custom-element`.
*
* class MyCustomElement extends CustomElement {
*
* static getTag() {
* return "my-custom-element"
* }
*
* }
*
* // ↦ <my-custom-element></my-custom-element>
*
* @externalExample ../../example/dom/theme.mjs
* @see https://github.com/WICG/webcomponents
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements
* @license AGPLv3
* @since 1.7.0
* @copyright schukai GmbH
* @memberOf Monster.DOM
......@@ -207,7 +189,7 @@ class CustomElement extends HTMLElement {
*/
constructor() {
super();
this[internalSymbol] = new ProxyObserver({'options': extend({}, this.defaults, getOptionsFromAttributes.call(this), getOptionsFromScriptTag.call(this))});
this[internalSymbol] = new ProxyObserver({'options': extend({}, this.defaults)});
this[attributeObserverSymbol] = {};
initOptionObserver.call(this);
this[initMethodSymbol]();
......@@ -234,7 +216,7 @@ class CustomElement extends HTMLElement {
* }
* ```
*
* to set the options via the html tag the attribute data-monster-options must be set.
* To set the options via the html tag the attribute data-monster-options must be set.
* As value a JSON object with the desired values must be defined.
*
* Since 1.18.0 the JSON can be specified as a DataURI.
......@@ -261,6 +243,7 @@ class CustomElement extends HTMLElement {
* </script>
* ```
*
* The individual configuration values can be found in the table.
*
* @property {boolean} disabled=false Object The Boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with the form.
* @property {string} shadowMode=open `open` Elements of the shadow root are accessible from JavaScript outside the root, for example using. `close` Denies access to the node(s) of a closed shadow root from JavaScript outside it
......@@ -423,6 +406,17 @@ class CustomElement extends HTMLElement {
const self = this;
let elements, nodeList;
const AttributeOptions = getOptionsFromAttributes.call(self);
if (isObject(AttributeOptions) && Object.keys(AttributeOptions).length > 0) {
self.setOptions(AttributeOptions);
}
const ScriptOptions = getOptionsFromScriptTag.call(self);
if (isObject(ScriptOptions) && Object.keys(ScriptOptions).length > 0) {
self.setOptions(ScriptOptions);
}
if (self.getOption('shadowMode', false) !== false) {
try {
initShadowRoot.call(self);
......@@ -545,6 +539,7 @@ class CustomElement extends HTMLElement {
* @param {String|undefined|null} name name of the slot (if the parameter is undefined, all slots are searched, if the parameter has the value null, all slots without a name are searched. if a string is specified, the slots with this name are searched.)
* @return {*}
* @this CustomElement
* @license AGPLv3
* @since 1.23.0
* @throws {Error} query must be a string
*/
......@@ -619,6 +614,7 @@ function containChildNode(node) {
}
/**
* @license AGPLv3
* @since 1.15.0
* @private
* @this CustomElement
......@@ -693,7 +689,15 @@ function initOptionObserver() {
// data-monster-options
self[attributeObserverSymbol][ATTRIBUTE_OPTIONS] = () => {
const options = getOptionsFromAttributes.call(self);
if (isObject(options)) {
if (isObject(options) && Object.keys(options).length > 0) {
self.setOptions(options);
}
}
// data-monster-options-selector
self[attributeObserverSymbol][ATTRIBUTE_OPTIONS_SELECTOR] = () => {
const options = getOptionsFromScriptTag.call(self);
if (isObject(options) && Object.keys(options).length > 0) {
self.setOptions(options);
}
}
......@@ -808,6 +812,7 @@ function initHtmlContent() {
* @return {CustomElement}
* @memberOf Monster.DOM
* @this CustomElement
* @license AGPLv3
* @since 1.16.0
* @throws {TypeError} value is not an instance of
*/
......@@ -871,6 +876,7 @@ function initCSSStylesheet() {
* @throws {Error} html is not set.
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow
* @memberOf Monster.DOM
* @license AGPLv3
* @since 1.8.0
*/
function initShadowRoot() {
......@@ -907,6 +913,7 @@ function initShadowRoot() {
*
* @param {CustomElement} element
* @return {void}
* @license AGPLv3
* @since 1.7.0
* @copyright schukai GmbH
* @memberOf Monster.DOM
......@@ -923,6 +930,7 @@ function registerCustomElement(element) {
* @param element
* @param object
* @return {Promise[]}
* @license AGPLv3
* @since 1.23.0
* @memberOf Monster.DOM
*/
......@@ -957,15 +965,3 @@ function assignUpdaterToElement(elements, object) {
return result;
}
assignToNamespace('Monster.DOM', CustomElement, registerCustomElement, assignUpdaterToElement);
export {
Monster,
registerCustomElement,
CustomElement,
initMethodSymbol,
assembleMethodSymbol,
assignUpdaterToElement,
attributeObserverSymbol,
getSlottedElements
}
'use strict';
/**
* @author schukai GmbH
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
* Node module: @schukai/monster
* This file is licensed under the AGPLv3 License.
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
*/
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";
import {isArray, isObject} from "../types/is.mjs";
import {validateInstance, validateString} from "../types/validate.mjs";
import {getDocument} from "./util.mjs";
export {fireEvent, fireCustomEvent, findTargetElementFromEvent}
/**
* 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.30.0/dist/monster.js';
* new Monster.DOM.fireEvent()
* </script>
* ```
*
* Alternatively, you can also integrate this function individually.
*
* ```
* <script type="module">
* import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/events.js';
* fireEvent()
* </script>
* ```
* The function sends an event
*
* @param {HTMLElement|HTMLCollection|NodeList} element
* @param {string} type
* @return {void}
* @license AGPLv3
* @since 1.10.0
* @copyright schukai GmbH
* @memberOf Monster.DOM
......@@ -68,25 +55,10 @@ function fireEvent(element, type) {
/**
* You can call the function via the monster namespace `new Monster.DOM.fireCustomEvent()`.
*
* ```
* <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.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.30.0/dist/modules/dom/events.js';
* fireCustomEvent()
* </script>
* ```
*
* @param {HTMLElement|HTMLCollection|NodeList} element
* @param {string} type
* @return {void}
* @license AGPLv3
* @since 1.29.0
* @copyright schukai GmbH
* @memberOf Monster.DOM
......@@ -126,24 +98,7 @@ 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.30.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.30.0/dist/modules/dom/events.js';
* findTargetElementFromEvent()
* </script>
* ```
*
* @license AGPLv3
* @since 1.14.0
* @param {Event} event
* @param {string} attributeName
......@@ -179,7 +134,3 @@ function findTargetElementFromEvent(event, attributeName, attributeValue) {
return undefined;
}
assignToNamespace('Monster.DOM', findTargetElementFromEvent, fireEvent, fireCustomEvent);
export {Monster, findTargetElementFromEvent, fireEvent, fireCustomEvent}