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

chore: commit save point

parent ccb2cba1
No related branches found
No related tags found
No related merge requests found
Showing
with 145 additions and 598 deletions
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {isArray, isObject} from "../types/is.js"; import {isArray, isObject} from "../types/is.js";
import {typeOf} from "../types/typeof.js"; import {typeOf} from "../types/typeof.js";
...@@ -11,20 +11,9 @@ 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 * Extend copies all enumerable own properties from one or
* more source objects to a target object. It returns the modified target object. * 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"> * <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) * extend(a, b)
* </script> * </script>
* ``` * ```
...@@ -38,7 +27,7 @@ import {typeOf} from "../types/typeof.js"; ...@@ -38,7 +27,7 @@ import {typeOf} from "../types/typeof.js";
* @throws {Error} unsupported argument * @throws {Error} unsupported argument
* @throws {Error} type mismatch * @throws {Error} type mismatch
*/ */
function extend() { export function extend() {
let o, i; let o, i;
for (i = 0; i < arguments.length; i++) { for (i = 0; i < arguments.length; i++) {
...@@ -86,7 +75,3 @@ function extend() { ...@@ -86,7 +75,3 @@ function extend() {
return o; return o;
} }
assignToNamespace('Monster.Data', extend);
export {Monster, extend}
'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
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js'; import {Base} from '../types/base.js';
import {isArray, isInteger, isObject, isPrimitive} from '../types/is.js'; import {isArray, isInteger, isObject, isPrimitive} from '../types/is.js';
import {Stack} from "../types/stack.js"; import {Stack} from "../types/stack.js";
...@@ -24,20 +24,11 @@ export const DELIMITER = '.'; ...@@ -24,20 +24,11 @@ export const DELIMITER = '.';
export const WILDCARD = '*'; export const WILDCARD = '*';
/** /**
* You can call the method via the monster namespace `new Monster.Data.Pathfinder()`. * Pathfinder is a class to find a path to an object.
*
* ```
* <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.
* *
* ``` * ```
* <script type="module"> * <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()) * console.log(new Pathfinder())
* </script> * </script>
* ``` * ```
...@@ -79,7 +70,7 @@ export const WILDCARD = '*'; ...@@ -79,7 +70,7 @@ export const WILDCARD = '*';
* *
* @example * @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({ * let value = new Pathfinder({
* a: { * a: {
...@@ -105,7 +96,7 @@ export const WILDCARD = '*'; ...@@ -105,7 +96,7 @@ export const WILDCARD = '*';
* *
* @example * @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({ * let p = new Pathfinder({
* a: { * a: {
...@@ -129,7 +120,7 @@ export const WILDCARD = '*'; ...@@ -129,7 +120,7 @@ export const WILDCARD = '*';
* @copyright schukai GmbH * @copyright schukai GmbH
* @memberOf Monster.Data * @memberOf Monster.Data
*/ */
class Pathfinder extends Base { export class Pathfinder extends Base {
/** /**
* @param {array|object|Map|Set} value * @param {array|object|Map|Set} value
...@@ -232,8 +223,6 @@ class Pathfinder extends Base { ...@@ -232,8 +223,6 @@ class Pathfinder extends Base {
} }
assignToNamespace('Monster.Data', Pathfinder);
export {Monster, Pathfinder}
/** /**
* *
......
...@@ -4,31 +4,20 @@ ...@@ -4,31 +4,20 @@
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js'; import {Base} from '../types/base.js';
import {validateString} from '../types/validate.js'; import {validateString} from '../types/validate.js';
import {Transformer} from './transformer.js'; import {Transformer} from './transformer.js';
const DELIMITER = '|'; export const DELIMITER = '|';
/** /**
* The pipe class makes it possible to combine several processing steps. * 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"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {Pipe} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/pipe.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';
* new Pipe() * new Pipe()
* </script> * </script>
* ``` * ```
...@@ -39,7 +28,7 @@ const DELIMITER = '|'; ...@@ -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. * the word is then converted to uppercase letters and a prefix Hello is added. the two backslash safe the space char.
* *
* @example * @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 = { * let obj = {
* a: { * a: {
...@@ -58,7 +47,7 @@ const DELIMITER = '|'; ...@@ -58,7 +47,7 @@ const DELIMITER = '|';
* @copyright schukai GmbH * @copyright schukai GmbH
* @memberOf Monster.Data * @memberOf Monster.Data
*/ */
class Pipe extends Base { export class Pipe extends Base {
/** /**
* *
...@@ -106,6 +95,3 @@ class Pipe extends Base { ...@@ -106,6 +95,3 @@ class Pipe extends Base {
}, value); }, value);
} }
} }
assignToNamespace('Monster.Data', Pipe);
export {Monster, Pipe}
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js'; import {Base} from '../types/base.js';
import {getGlobal, getGlobalObject} from "../types/global.js"; import {getGlobal, getGlobalObject} from "../types/global.js";
import {ID} from '../types/id.js'; import {ID} from '../types/id.js';
...@@ -21,20 +21,9 @@ import {Pathfinder} from "./pathfinder.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. * 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"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {Transformer} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/data/transformer.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';
* new Transformer() * new Transformer()
* </script> * </script>
* ``` * ```
...@@ -120,7 +109,7 @@ import {Pathfinder} from "./pathfinder.js"; ...@@ -120,7 +109,7 @@ import {Pathfinder} from "./pathfinder.js";
* *
* @example * @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") * const transformer = new Transformer("tolower")
* *
...@@ -134,7 +123,7 @@ import {Pathfinder} from "./pathfinder.js"; ...@@ -134,7 +123,7 @@ import {Pathfinder} from "./pathfinder.js";
* @copyright schukai GmbH * @copyright schukai GmbH
* @memberOf Monster.Data * @memberOf Monster.Data
*/ */
class Transformer extends Base { export class Transformer extends Base {
/** /**
* *
* @param {string} definition * @param {string} definition
...@@ -185,9 +174,6 @@ class Transformer extends Base { ...@@ -185,9 +174,6 @@ class Transformer extends Base {
} }
} }
assignToNamespace('Monster.Data', Transformer);
export {Monster, Transformer}
/** /**
* *
* @param {string} command * @param {string} command
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {Base} from '../types/base.js'; import {Base} from '../types/base.js';
import {getGlobalFunction} from "../types/global.js"; import {getGlobalFunction} from "../types/global.js";
import {ProxyObserver} from "../types/proxyobserver.js"; import {ProxyObserver} from "../types/proxyobserver.js";
...@@ -16,7 +16,7 @@ import {validateInstance, validateString} from "../types/validate.js"; ...@@ -16,7 +16,7 @@ import {validateInstance, validateString} from "../types/validate.js";
* @type {string} * @type {string}
* @memberOf Monster.DOM * @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()`. * you can call the method via the monster namespace `new Monster.DOM.Assembler()`.
...@@ -32,7 +32,7 @@ const ATTRIBUTEPREFIX = "data-monster-"; ...@@ -32,7 +32,7 @@ const ATTRIBUTEPREFIX = "data-monster-";
* *
* ``` * ```
* <script type="module"> * <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()) * console.log(new Assembler())
* </script> * </script>
* ``` * ```
...@@ -42,7 +42,7 @@ const ATTRIBUTEPREFIX = "data-monster-"; ...@@ -42,7 +42,7 @@ const ATTRIBUTEPREFIX = "data-monster-";
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @summary Allows you to build an html fragment * @summary Allows you to build an html fragment
*/ */
class Assembler extends Base { export class Assembler extends Base {
/** /**
* @param {DocumentFragment} fragment * @param {DocumentFragment} fragment
...@@ -95,6 +95,3 @@ class Assembler extends Base { ...@@ -95,6 +95,3 @@ class Assembler extends Base {
} }
} }
assignToNamespace('Monster.DOM', Assembler);
export {Monster, ATTRIBUTEPREFIX, Assembler}
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {getGlobalFunction} from "../types/global.js"; import {getGlobalFunction} from "../types/global.js";
import {TokenList} from "../types/tokenlist.js"; import {TokenList} from "../types/tokenlist.js";
import {validateInstance, validateString, validateSymbol} from "../types/validate.js"; import {validateInstance, validateString, validateSymbol} from "../types/validate.js";
...@@ -16,20 +16,9 @@ import {ATTRIBUTE_OBJECTLINK} from "./constants.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 * 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. * 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"> * <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()) * console.log(findClosestObjectLink())
* </script> * </script>
* ``` * ```
...@@ -41,25 +30,16 @@ import {ATTRIBUTE_OBJECTLINK} from "./constants.js"; ...@@ -41,25 +30,16 @@ import {ATTRIBUTE_OBJECTLINK} from "./constants.js";
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @throws {TypeError} value is not an instance of HTMLElement * @throws {TypeError} value is not an instance of HTMLElement
*/ */
function findClosestObjectLink(element) { export function findClosestObjectLink(element) {
return findClosestByAttribute(element, ATTRIBUTE_OBJECTLINK); 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"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {addToObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.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';
* addToObjectLink(); * addToObjectLink();
* </script> * </script>
* ``` * ```
...@@ -72,7 +52,7 @@ function findClosestObjectLink(element) { ...@@ -72,7 +52,7 @@ function findClosestObjectLink(element) {
* @param {Object} object * @param {Object} object
* @return {boolean} * @return {boolean}
*/ */
function addToObjectLink(element, symbol, object) { export function addToObjectLink(element, symbol, object) {
validateInstance(element, HTMLElement); validateInstance(element, HTMLElement);
validateSymbol(symbol) validateSymbol(symbol)
...@@ -88,20 +68,11 @@ function addToObjectLink(element, symbol, object) { ...@@ -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"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {removeObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.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';
* removeObjectLink(); * removeObjectLink();
* </script> * </script>
* ``` * ```
...@@ -113,7 +84,7 @@ function addToObjectLink(element, symbol, object) { ...@@ -113,7 +84,7 @@ function addToObjectLink(element, symbol, object) {
* @param {Symbol} symbol * @param {Symbol} symbol
* @return {boolean} * @return {boolean}
*/ */
function removeObjectLink(element, symbol) { export function removeObjectLink(element, symbol) {
validateInstance(element, HTMLElement); validateInstance(element, HTMLElement);
validateSymbol(symbol) validateSymbol(symbol)
...@@ -130,20 +101,11 @@ function removeObjectLink(element, symbol) { ...@@ -130,20 +101,11 @@ function removeObjectLink(element, symbol) {
/** /**
* You can call the method via the monster namespace `new Monster.DOM.hasObjectLink()`. * Checks if an element has an object link
*
* ```
* <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.
* *
* ``` * ```
* <script type="module"> * <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(); * hasObjectLink();
* </script> * </script>
* ``` * ```
...@@ -155,7 +117,7 @@ function removeObjectLink(element, symbol) { ...@@ -155,7 +117,7 @@ function removeObjectLink(element, symbol) {
* @param {Symbol} symbol * @param {Symbol} symbol
* @return {boolean} * @return {boolean}
*/ */
function hasObjectLink(element, symbol) { export function hasObjectLink(element, symbol) {
validateInstance(element, HTMLElement); validateInstance(element, HTMLElement);
validateSymbol(symbol) validateSymbol(symbol)
...@@ -176,20 +138,9 @@ function hasObjectLink(element, symbol) { ...@@ -176,20 +138,9 @@ function hasObjectLink(element, symbol) {
* *
* With the method {@see {@link addToObjectLink}} the objects can be added. * 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"> * <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(); * getLinkedObjects();
* </script> * </script>
* ``` * ```
...@@ -202,7 +153,7 @@ function hasObjectLink(element, symbol) { ...@@ -202,7 +153,7 @@ function hasObjectLink(element, symbol) {
* @return {Iterator} * @return {Iterator}
* @throws {Error} there is no object link for symbol * @throws {Error} there is no object link for symbol
*/ */
function getLinkedObjects(element, symbol) { export function getLinkedObjects(element, symbol) {
validateInstance(element, HTMLElement); validateInstance(element, HTMLElement);
validateSymbol(symbol) validateSymbol(symbol)
...@@ -221,20 +172,9 @@ function getLinkedObjects(element, symbol) { ...@@ -221,20 +172,9 @@ function getLinkedObjects(element, symbol) {
* *
* Tokens are always separated by a space. * Tokens are always separated by a space.
* *
* You can call the method via the monster namespace `new Monster.DOM.toggleAttributeToken()`.
*
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {toggleAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.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';
* toggleAttributeToken(); * toggleAttributeToken();
* </script> * </script>
* ``` * ```
...@@ -247,7 +187,7 @@ function getLinkedObjects(element, symbol) { ...@@ -247,7 +187,7 @@ function getLinkedObjects(element, symbol) {
* @param {string} token * @param {string} token
* @return {HTMLElement} * @return {HTMLElement}
*/ */
function toggleAttributeToken(element, key, token) { export function toggleAttributeToken(element, key, token) {
validateInstance(element, HTMLElement); validateInstance(element, HTMLElement);
validateString(token) validateString(token)
validateString(key) validateString(key)
...@@ -265,20 +205,9 @@ function toggleAttributeToken(element, key, token) { ...@@ -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. * 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"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {addAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.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';
* addAttributeToken(); * addAttributeToken();
* </script> * </script>
* ``` * ```
...@@ -291,7 +220,7 @@ function toggleAttributeToken(element, key, token) { ...@@ -291,7 +220,7 @@ function toggleAttributeToken(element, key, token) {
* @param {string} token * @param {string} token
* @return {HTMLElement} * @return {HTMLElement}
*/ */
function addAttributeToken(element, key, token) { export function addAttributeToken(element, key, token) {
validateInstance(element, HTMLElement); validateInstance(element, HTMLElement);
validateString(token) validateString(token)
validateString(key) validateString(key)
...@@ -311,20 +240,9 @@ function addAttributeToken(element, key, token) { ...@@ -311,20 +240,9 @@ function addAttributeToken(element, key, token) {
* *
* Tokens are always separated by a space. * 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"> * <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(); * removeAttributeToken();
* </script> * </script>
* ``` * ```
...@@ -337,7 +255,7 @@ function addAttributeToken(element, key, token) { ...@@ -337,7 +255,7 @@ function addAttributeToken(element, key, token) {
* @param {string} token * @param {string} token
* @return {HTMLElement} * @return {HTMLElement}
*/ */
function removeAttributeToken(element, key, token) { export function removeAttributeToken(element, key, token) {
validateInstance(element, HTMLElement); validateInstance(element, HTMLElement);
validateString(token) validateString(token)
validateString(key) validateString(key)
...@@ -356,20 +274,9 @@ function removeAttributeToken(element, key, token) { ...@@ -356,20 +274,9 @@ function removeAttributeToken(element, key, token) {
* *
* Tokens are always separated by a space. * Tokens are always separated by a space.
* *
* You can call the method via the monster namespace `new Monster.DOM.containsAttributeToken()`.
*
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {containsAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.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';
* containsAttributeToken(); * containsAttributeToken();
* </script> * </script>
* ``` * ```
...@@ -382,7 +289,7 @@ function removeAttributeToken(element, key, token) { ...@@ -382,7 +289,7 @@ function removeAttributeToken(element, key, token) {
* @param {string} token * @param {string} token
* @return {boolean} * @return {boolean}
*/ */
function containsAttributeToken(element, key, token) { export function containsAttributeToken(element, key, token) {
validateInstance(element, HTMLElement); validateInstance(element, HTMLElement);
validateString(token) validateString(token)
validateString(key) validateString(key)
...@@ -398,20 +305,9 @@ function containsAttributeToken(element, key, token) { ...@@ -398,20 +305,9 @@ function containsAttributeToken(element, key, token) {
/** /**
* Tokens are always separated by a space. * Tokens are always separated by a space.
* *
* You can call the method via the monster namespace `new Monster.DOM.replaceAttributeToken()`.
*
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {replaceAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.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';
* replaceAttributeToken(); * replaceAttributeToken();
* </script> * </script>
* ``` * ```
...@@ -425,7 +321,7 @@ function containsAttributeToken(element, key, token) { ...@@ -425,7 +321,7 @@ function containsAttributeToken(element, key, token) {
* @param {string} to * @param {string} to
* @return {HTMLElement} * @return {HTMLElement}
*/ */
function replaceAttributeToken(element, key, from, to) { export function replaceAttributeToken(element, key, from, to) {
validateInstance(element, HTMLElement); validateInstance(element, HTMLElement);
validateString(from) validateString(from)
validateString(to) validateString(to)
...@@ -443,20 +339,9 @@ function replaceAttributeToken(element, key, from, to) { ...@@ -443,20 +339,9 @@ function replaceAttributeToken(element, key, from, to) {
/** /**
* Tokens are always separated by a space. * Tokens are always separated by a space.
* *
* You can call the method via the monster namespace `new Monster.DOM.clearAttributeTokens()`.
*
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.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';
* clearAttributeTokens(); * clearAttributeTokens();
* </script> * </script>
* ``` * ```
...@@ -468,7 +353,7 @@ function replaceAttributeToken(element, key, from, to) { ...@@ -468,7 +353,7 @@ function replaceAttributeToken(element, key, from, to) {
* @param {string} key * @param {string} key
* @return {HTMLElement} * @return {HTMLElement}
*/ */
function clearAttributeTokens(element, key) { export function clearAttributeTokens(element, key) {
validateInstance(element, HTMLElement); validateInstance(element, HTMLElement);
validateString(key) validateString(key)
...@@ -500,20 +385,9 @@ function clearAttributeTokens(element, key) { ...@@ -500,20 +385,9 @@ function clearAttributeTokens(element, key) {
* findClosestByAttribute(document.getElementById('1'),'data-my-attribute', '2'); // ↦ node with id 2 * 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"> * <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(); * findClosestByAttribute();
* </script> * </script>
* ``` * ```
...@@ -527,7 +401,7 @@ function clearAttributeTokens(element, key) { ...@@ -527,7 +401,7 @@ function clearAttributeTokens(element, key) {
* @return {HTMLElement|undefined} * @return {HTMLElement|undefined}
* @summary find closest node * @summary find closest node
*/ */
function findClosestByAttribute(element, key, value) { export function findClosestByAttribute(element, key, value) {
validateInstance(element, getGlobalFunction('HTMLElement')); validateInstance(element, getGlobalFunction('HTMLElement'));
if (element.hasAttribute(key)) { if (element.hasAttribute(key)) {
...@@ -565,20 +439,9 @@ function findClosestByAttribute(element, key, value) { ...@@ -565,20 +439,9 @@ function findClosestByAttribute(element, key, value) {
* findClosestByClass(document.getElementById('2'),'myclass'); // ↦ node with id 2 * 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"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {findClosestByClass} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/attributes.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';
* findClosestByClass(); * findClosestByClass();
* </script> * </script>
* ``` * ```
...@@ -591,7 +454,7 @@ function findClosestByAttribute(element, key, value) { ...@@ -591,7 +454,7 @@ function findClosestByAttribute(element, key, value) {
* @return {HTMLElement|undefined} * @return {HTMLElement|undefined}
* @summary find closest node * @summary find closest node
*/ */
function findClosestByClass(element, className) { export function findClosestByClass(element, className) {
validateInstance(element, getGlobalFunction('HTMLElement')); validateInstance(element, getGlobalFunction('HTMLElement'));
if (element?.classList?.contains(validateString(className))) { if (element?.classList?.contains(validateString(className))) {
...@@ -605,22 +468,3 @@ function findClosestByClass(element, className) { ...@@ -605,22 +468,3 @@ function findClosestByClass(element, className) {
return undefined; 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
}
...@@ -11,14 +11,14 @@ import {Monster} from '../namespace.js'; ...@@ -11,14 +11,14 @@ import {Monster} from '../namespace.js';
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
*/ */
const DEFAULT_THEME = 'monster'; export const DEFAULT_THEME = 'monster';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @since 1.8.0 * @since 1.8.0
* @type {string} * @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 * This is the name of the attribute to pass options to a control
...@@ -27,7 +27,7 @@ const ATTRIBUTE_PREFIX = 'data-monster-'; ...@@ -27,7 +27,7 @@ const ATTRIBUTE_PREFIX = 'data-monster-';
* @since 1.8.0 * @since 1.8.0
* @type {string} * @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 * This is the name of the attribute to pass options to a control
...@@ -36,139 +36,139 @@ const ATTRIBUTE_OPTIONS = ATTRIBUTE_PREFIX + 'options'; ...@@ -36,139 +36,139 @@ const ATTRIBUTE_OPTIONS = ATTRIBUTE_PREFIX + 'options';
* @since 1.30.0 * @since 1.30.0
* @type {string} * @type {string}
*/ */
const ATTRIBUTE_OPTIONS_SELECTOR = ATTRIBUTE_PREFIX + 'options-selector'; export const ATTRIBUTE_OPTIONS_SELECTOR = ATTRIBUTE_PREFIX + 'options-selector';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.8.0 * @since 1.8.0
*/ */
const ATTRIBUTE_THEME_PREFIX = ATTRIBUTE_PREFIX + 'theme-'; export const ATTRIBUTE_THEME_PREFIX = ATTRIBUTE_PREFIX + 'theme-';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
*/ */
const ATTRIBUTE_THEME_NAME = ATTRIBUTE_THEME_PREFIX + 'name'; export const ATTRIBUTE_THEME_NAME = ATTRIBUTE_THEME_PREFIX + 'name';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.8.0 * @since 1.8.0
*/ */
const ATTRIBUTE_UPDATER_ATTRIBUTES = ATTRIBUTE_PREFIX + 'attributes'; export const ATTRIBUTE_UPDATER_ATTRIBUTES = ATTRIBUTE_PREFIX + 'attributes';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.27.1 * @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 * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.8.0 * @since 1.8.0
*/ */
const ATTRIBUTE_UPDATER_REPLACE = ATTRIBUTE_PREFIX + 'replace'; export const ATTRIBUTE_UPDATER_REPLACE = ATTRIBUTE_PREFIX + 'replace';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.8.0 * @since 1.8.0
*/ */
const ATTRIBUTE_UPDATER_INSERT = ATTRIBUTE_PREFIX + 'insert'; export const ATTRIBUTE_UPDATER_INSERT = ATTRIBUTE_PREFIX + 'insert';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.8.0 * @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 * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.8.0 * @since 1.8.0
*/ */
const ATTRIBUTE_UPDATER_REMOVE = ATTRIBUTE_PREFIX + 'remove'; export const ATTRIBUTE_UPDATER_REMOVE = ATTRIBUTE_PREFIX + 'remove';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.9.0 * @since 1.9.0
*/ */
const ATTRIBUTE_UPDATER_BIND = ATTRIBUTE_PREFIX + 'bind'; export const ATTRIBUTE_UPDATER_BIND = ATTRIBUTE_PREFIX + 'bind';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.27.0 * @since 1.27.0
*/ */
const ATTRIBUTE_TEMPLATE_PREFIX = ATTRIBUTE_PREFIX + 'template-prefix'; export const ATTRIBUTE_TEMPLATE_PREFIX = ATTRIBUTE_PREFIX + 'template-prefix';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.14.0 * @since 1.14.0
*/ */
const ATTRIBUTE_ROLE = ATTRIBUTE_PREFIX + 'role'; export const ATTRIBUTE_ROLE = ATTRIBUTE_PREFIX + 'role';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.24.0 * @since 1.24.0
*/ */
const ATTRIBUTE_DISABLED = 'disabled'; export const ATTRIBUTE_DISABLED = 'disabled';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.24.0 * @since 1.24.0
*/ */
const ATTRIBUTE_VALUE = 'value'; export const ATTRIBUTE_VALUE = 'value';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.9.0 * @since 1.9.0
*/ */
const ATTRIBUTE_OBJECTLINK = ATTRIBUTE_PREFIX + 'objectlink'; export const ATTRIBUTE_OBJECTLINK = ATTRIBUTE_PREFIX + 'objectlink';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.24.0 * @since 1.24.0
*/ */
const ATTRIBUTE_ERRORMESSAGE = ATTRIBUTE_PREFIX + 'error'; export const ATTRIBUTE_ERRORMESSAGE = ATTRIBUTE_PREFIX + 'error';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {symbol} * @type {symbol}
* @since 1.24.0 * @since 1.24.0
*/ */
const objectUpdaterLinkSymbol = Symbol('monsterUpdater'); export const objectUpdaterLinkSymbol = Symbol('monsterUpdater');
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const TAG_SCRIPT = 'script'; export const TAG_SCRIPT = 'script';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const TAG_STYLE = 'style'; export const TAG_STYLE = 'style';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const TAG_LINK = 'link'; export const TAG_LINK = 'link';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
...@@ -176,7 +176,7 @@ const TAG_LINK = 'link'; ...@@ -176,7 +176,7 @@ const TAG_LINK = 'link';
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_ID = 'id'; export const ATTRIBUTE_ID = 'id';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
...@@ -184,48 +184,48 @@ const ATTRIBUTE_ID = 'id'; ...@@ -184,48 +184,48 @@ const ATTRIBUTE_ID = 'id';
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_CLASS = 'class'; export const ATTRIBUTE_CLASS = 'class';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_TITLE = 'title'; export const ATTRIBUTE_TITLE = 'title';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_SRC = 'src'; export const ATTRIBUTE_SRC = 'src';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_HREF = 'href'; export const ATTRIBUTE_HREF = 'href';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_TYPE = 'type'; export const ATTRIBUTE_TYPE = 'type';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_NONCE = 'nonce'; export const ATTRIBUTE_NONCE = 'nonce';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_TRANSLATE = 'translate'; export const ATTRIBUTE_TRANSLATE = 'translate';
/** /**
...@@ -233,7 +233,7 @@ const ATTRIBUTE_TRANSLATE = 'translate'; ...@@ -233,7 +233,7 @@ const ATTRIBUTE_TRANSLATE = 'translate';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_TABINDEX = 'tabindex'; export const ATTRIBUTE_TABINDEX = 'tabindex';
/** /**
...@@ -241,7 +241,7 @@ const ATTRIBUTE_TABINDEX = 'tabindex'; ...@@ -241,7 +241,7 @@ const ATTRIBUTE_TABINDEX = 'tabindex';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_SPELLCHECK = 'spellcheck'; export const ATTRIBUTE_SPELLCHECK = 'spellcheck';
/** /**
...@@ -249,7 +249,7 @@ const ATTRIBUTE_SPELLCHECK = 'spellcheck'; ...@@ -249,7 +249,7 @@ const ATTRIBUTE_SPELLCHECK = 'spellcheck';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_SLOT = 'slot'; export const ATTRIBUTE_SLOT = 'slot';
/** /**
...@@ -257,7 +257,7 @@ const ATTRIBUTE_SLOT = 'slot'; ...@@ -257,7 +257,7 @@ const ATTRIBUTE_SLOT = 'slot';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_PART = 'part'; export const ATTRIBUTE_PART = 'part';
/** /**
...@@ -265,7 +265,7 @@ const ATTRIBUTE_PART = 'part'; ...@@ -265,7 +265,7 @@ const ATTRIBUTE_PART = 'part';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_LANG = 'lang'; export const ATTRIBUTE_LANG = 'lang';
/** /**
...@@ -273,7 +273,7 @@ const ATTRIBUTE_LANG = 'lang'; ...@@ -273,7 +273,7 @@ const ATTRIBUTE_LANG = 'lang';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_ITEMTYPE = 'itemtype'; export const ATTRIBUTE_ITEMTYPE = 'itemtype';
/** /**
...@@ -281,7 +281,7 @@ const ATTRIBUTE_ITEMTYPE = 'itemtype'; ...@@ -281,7 +281,7 @@ const ATTRIBUTE_ITEMTYPE = 'itemtype';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_ITEMSCOPE = 'itemscope'; export const ATTRIBUTE_ITEMSCOPE = 'itemscope';
/** /**
...@@ -289,7 +289,7 @@ const ATTRIBUTE_ITEMSCOPE = 'itemscope'; ...@@ -289,7 +289,7 @@ const ATTRIBUTE_ITEMSCOPE = 'itemscope';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_ITEMREF = 'itemref'; export const ATTRIBUTE_ITEMREF = 'itemref';
/** /**
...@@ -297,7 +297,7 @@ const ATTRIBUTE_ITEMREF = 'itemref'; ...@@ -297,7 +297,7 @@ const ATTRIBUTE_ITEMREF = 'itemref';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_ITEMID = 'itemid'; export const ATTRIBUTE_ITEMID = 'itemid';
/** /**
...@@ -305,7 +305,7 @@ const ATTRIBUTE_ITEMID = 'itemid'; ...@@ -305,7 +305,7 @@ const ATTRIBUTE_ITEMID = 'itemid';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_ITEMPROP = 'itemprop'; export const ATTRIBUTE_ITEMPROP = 'itemprop';
/** /**
...@@ -313,7 +313,7 @@ const ATTRIBUTE_ITEMPROP = 'itemprop'; ...@@ -313,7 +313,7 @@ const ATTRIBUTE_ITEMPROP = 'itemprop';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_IS = 'is'; export const ATTRIBUTE_IS = 'is';
/** /**
...@@ -321,7 +321,7 @@ const ATTRIBUTE_IS = 'is'; ...@@ -321,7 +321,7 @@ const ATTRIBUTE_IS = 'is';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_INPUTMODE = 'inputmode'; export const ATTRIBUTE_INPUTMODE = 'inputmode';
/** /**
...@@ -329,42 +329,42 @@ const ATTRIBUTE_INPUTMODE = 'inputmode'; ...@@ -329,42 +329,42 @@ const ATTRIBUTE_INPUTMODE = 'inputmode';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_ACCESSKEY = 'accesskey'; export const ATTRIBUTE_ACCESSKEY = 'accesskey';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_AUTOCAPITALIZE = 'autocapitalize'; export const ATTRIBUTE_AUTOCAPITALIZE = 'autocapitalize';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_AUTOFOCUS = 'autofocus'; export const ATTRIBUTE_AUTOFOCUS = 'autofocus';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_CONTENTEDITABLE = 'contenteditable'; export const ATTRIBUTE_CONTENTEDITABLE = 'contenteditable';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_DIR = 'dir'; export const ATTRIBUTE_DIR = 'dir';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_DRAGGABLE = 'draggable'; export const ATTRIBUTE_DRAGGABLE = 'draggable';
/** /**
...@@ -372,73 +372,16 @@ const ATTRIBUTE_DRAGGABLE = 'draggable'; ...@@ -372,73 +372,16 @@ const ATTRIBUTE_DRAGGABLE = 'draggable';
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_ENTERKEYHINT = 'enterkeyhint'; export const ATTRIBUTE_ENTERKEYHINT = 'enterkeyhint';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_EXPORTPARTS = 'exportparts'; export const ATTRIBUTE_EXPORTPARTS = 'exportparts';
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {string} * @type {string}
* @since 1.25.0 * @since 1.25.0
*/ */
const ATTRIBUTE_HIDDEN = 'hidden'; export 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
...@@ -4,7 +4,7 @@ import {extend} from "../data/extend.js"; ...@@ -4,7 +4,7 @@ import {extend} from "../data/extend.js";
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {ATTRIBUTE_VALUE} from "./constants.js"; import {ATTRIBUTE_VALUE} from "./constants.js";
import {CustomElement, attributeObserverSymbol} from "./customelement.js"; import {CustomElement, attributeObserverSymbol} from "./customelement.js";
...@@ -50,7 +50,7 @@ const attachedInternalSymbol = Symbol('attachedInternal'); ...@@ -50,7 +50,7 @@ const attachedInternalSymbol = Symbol('attachedInternal');
* @copyright schukai GmbH * @copyright schukai GmbH
* @memberOf Monster.DOM * @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>. * 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() { ...@@ -328,6 +328,3 @@ function initObserver() {
} }
} }
assignToNamespace('Monster.DOM', CustomControl);
export {Monster, CustomControl}
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
import {internalSymbol} from "../constants.js"; import {internalSymbol} from "../constants.js";
import {extend} from "../data/extend.js"; import {extend} from "../data/extend.js";
import {Pathfinder} from "../data/pathfinder.js"; import {Pathfinder} from "../data/pathfinder.js";
import {assignToNamespace, Monster} from '../namespace.js';
import {parseDataURL} from "../types/dataurl.js"; import {parseDataURL} from "../types/dataurl.js";
import {getGlobalObject} from "../types/global.js"; import {getGlobalObject} from "../types/global.js";
import {isArray, isFunction, isObject, isString} from "../types/is.js"; import {isArray, isFunction, isObject, isString} from "../types/is.js";
...@@ -31,20 +31,20 @@ import {Updater} from "./updater.js"; ...@@ -31,20 +31,20 @@ import {Updater} from "./updater.js";
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {symbol} * @type {symbol}
*/ */
const initMethodSymbol = Symbol('initMethodSymbol'); export const initMethodSymbol = Symbol('initMethodSymbol');
/** /**
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {symbol} * @type {symbol}
*/ */
const assembleMethodSymbol = Symbol('assembleMethodSymbol'); export const assembleMethodSymbol = Symbol('assembleMethodSymbol');
/** /**
* this symbol holds the attribute observer callbacks. The key is the attribute name. * this symbol holds the attribute observer callbacks. The key is the attribute name.
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @type {symbol} * @type {symbol}
*/ */
const attributeObserverSymbol = Symbol('attributeObserver'); export const attributeObserverSymbol = Symbol('attributeObserver');
/** /**
...@@ -196,7 +196,7 @@ const attributeObserverSymbol = Symbol('attributeObserver'); ...@@ -196,7 +196,7 @@ const attributeObserverSymbol = Symbol('attributeObserver');
* @extends external:HTMLElement * @extends external:HTMLElement
* @summary A base class for HTML5 customcontrols * @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 * A new object is created. First the `initOptions` method is called. Here the
...@@ -560,7 +560,7 @@ class CustomElement extends HTMLElement { ...@@ -560,7 +560,7 @@ class CustomElement extends HTMLElement {
* @since 1.23.0 * @since 1.23.0
* @throws {Error} query must be a string * @throws {Error} query must be a string
*/ */
function getSlottedElements(query, name) { export function getSlottedElements(query, name) {
const self = this; const self = this;
const result = new Set; const result = new Set;
...@@ -932,7 +932,7 @@ function initShadowRoot() { ...@@ -932,7 +932,7 @@ function initShadowRoot() {
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @throws {DOMException} Failed to execute 'define' on 'CustomElementRegistry': is not a valid custom element name * @throws {DOMException} Failed to execute 'define' on 'CustomElementRegistry': is not a valid custom element name
*/ */
function registerCustomElement(element) { export function registerCustomElement(element) {
validateFunction(element); validateFunction(element);
getGlobalObject('customElements').define(element.getTag(), element); getGlobalObject('customElements').define(element.getTag(), element);
} }
...@@ -946,7 +946,7 @@ function registerCustomElement(element) { ...@@ -946,7 +946,7 @@ function registerCustomElement(element) {
* @since 1.23.0 * @since 1.23.0
* @memberOf Monster.DOM * @memberOf Monster.DOM
*/ */
function assignUpdaterToElement(elements, object) { export function assignUpdaterToElement(elements, object) {
const updaters = new Set; const updaters = new Set;
...@@ -977,15 +977,3 @@ function assignUpdaterToElement(elements, object) { ...@@ -977,15 +977,3 @@ function assignUpdaterToElement(elements, object) {
return result; return result;
} }
assignToNamespace('Monster.DOM', CustomElement, registerCustomElement, assignUpdaterToElement);
export {
Monster,
registerCustomElement,
CustomElement,
initMethodSymbol,
assembleMethodSymbol,
assignUpdaterToElement,
attributeObserverSymbol,
getSlottedElements
}
...@@ -4,26 +4,17 @@ ...@@ -4,26 +4,17 @@
/** /**
* @author schukai GmbH * @author schukai GmbH
*/ */
import {assignToNamespace, Monster} from '../namespace.js';
import {isArray,isObject} from "../types/is.js"; import {isArray,isObject} from "../types/is.js";
import {validateInstance, validateString} from "../types/validate.js"; import {validateInstance, validateString} from "../types/validate.js";
import {getDocument} from "./util.js"; import {getDocument} from "./util.js";
/** /**
* You can call the function via the monster namespace `new Monster.DOM.fireEvent()`. * The function sends an event
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/events.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.31.0/dist/modules/dom/events.js';
* fireEvent() * fireEvent()
* </script> * </script>
* ``` * ```
...@@ -37,7 +28,7 @@ import {getDocument} from "./util.js"; ...@@ -37,7 +28,7 @@ import {getDocument} from "./util.js";
* @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection * @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection
* @summary Construct and send and event * @summary Construct and send and event
*/ */
function fireEvent(element, type) { export function fireEvent(element, type) {
const document = getDocument(); const document = getDocument();
...@@ -70,16 +61,7 @@ function fireEvent(element, type) { ...@@ -70,16 +61,7 @@ function fireEvent(element, type) {
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {fireCustomEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/events.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';
* fireCustomEvent() * fireCustomEvent()
* </script> * </script>
* ``` * ```
...@@ -93,7 +75,7 @@ function fireEvent(element, type) { ...@@ -93,7 +75,7 @@ function fireEvent(element, type) {
* @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection * @throws {TypeError} value is not an instance of HTMLElement or HTMLCollection
* @summary Construct and send and event * @summary Construct and send and event
*/ */
function fireCustomEvent(element, type, detail) { export function fireCustomEvent(element, type, detail) {
const document = getDocument(); const document = getDocument();
...@@ -126,20 +108,9 @@ function fireCustomEvent(element, type, detail) { ...@@ -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, * 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. * is specified, only the attribute is searched.
* *
* You can call the function via the monster namespace `new Monster.DOM.findTargetElementFromEvent()`.
*
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {findTargetElementFromEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/events.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';
* findTargetElementFromEvent() * findTargetElementFromEvent()
* </script> * </script>
* ``` * ```
...@@ -154,7 +125,7 @@ function fireCustomEvent(element, type, detail) { ...@@ -154,7 +125,7 @@ function fireCustomEvent(element, type, detail) {
* @throws {TypeError} value is not an instance of HTMLElement * @throws {TypeError} value is not an instance of HTMLElement
* @summary Help function to find the appropriate control * @summary Help function to find the appropriate control
*/ */
function findTargetElementFromEvent(event, attributeName, attributeValue) { export function findTargetElementFromEvent(event, attributeName, attributeValue) {
validateInstance(event, Event); validateInstance(event, Event);
if (typeof event.composedPath !== 'function') { if (typeof event.composedPath !== 'function') {
...@@ -179,7 +150,3 @@ function findTargetElementFromEvent(event, attributeName, attributeValue) { ...@@ -179,7 +150,3 @@ function findTargetElementFromEvent(event, attributeName, attributeValue) {
return undefined; return undefined;
} }
assignToNamespace('Monster.DOM', findTargetElementFromEvent, fireEvent, fireCustomEvent);
export {Monster, findTargetElementFromEvent, fireEvent, fireCustomEvent}
...@@ -37,20 +37,9 @@ const stackSymbol = Symbol('stack'); ...@@ -37,20 +37,9 @@ const stackSymbol = Symbol('stack');
/** /**
* With the focusmanager the focus can be stored in a document, recalled and moved. * 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"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {FocusManager} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/focusmanager.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';
* new FocusManager() * new FocusManager()
* </script> * </script>
* ``` * ```
...@@ -61,7 +50,7 @@ const stackSymbol = Symbol('stack'); ...@@ -61,7 +50,7 @@ const stackSymbol = Symbol('stack');
* @throws {Error} unsupported locale * @throws {Error} unsupported locale
* @summary Handle the focus * @summary Handle the focus
*/ */
class FocusManager extends BaseWithOptions { export class FocusManager extends BaseWithOptions {
/** /**
* *
...@@ -239,10 +228,6 @@ class FocusManager extends BaseWithOptions { ...@@ -239,10 +228,6 @@ class FocusManager extends BaseWithOptions {
} }
assignToNamespace('Monster.DOM', FocusManager);
export {FocusManager}
......
...@@ -5,14 +5,14 @@ ...@@ -5,14 +5,14 @@
*/ */
import {parseLocale} from "../i18n/locale.js"; import {parseLocale} from "../i18n/locale.js";
import {assignToNamespace, Monster} from '../namespace.js';
import {getDocument} from "./util.js"; import {getDocument} from "./util.js";
/** /**
* @private * @private
* @type {string} * @type {string}
*/ */
const DEFAULT_LANGUAGE = 'en'; export const DEFAULT_LANGUAGE = 'en';
/** /**
* With this function you can read the language version set by the document. * With this function you can read the language version set by the document.
...@@ -26,16 +26,7 @@ const DEFAULT_LANGUAGE = 'en'; ...@@ -26,16 +26,7 @@ const DEFAULT_LANGUAGE = 'en';
* *
* ``` * ```
* <script type="module"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/locale.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';
* new getLocaleOfDocument() * new getLocaleOfDocument()
* </script> * </script>
* ``` * ```
...@@ -47,7 +38,7 @@ const DEFAULT_LANGUAGE = 'en'; ...@@ -47,7 +38,7 @@ const DEFAULT_LANGUAGE = 'en';
* @throws {Error} unsupported locale * @throws {Error} unsupported locale
* @summary Tries to determine the locale used * @summary Tries to determine the locale used
*/ */
function getLocaleOfDocument() { export function getLocaleOfDocument() {
const document = getDocument(); const document = getDocument();
...@@ -61,6 +52,3 @@ function getLocaleOfDocument() { ...@@ -61,6 +52,3 @@ function getLocaleOfDocument() {
return parseLocale(DEFAULT_LANGUAGE); return parseLocale(DEFAULT_LANGUAGE);
} }
assignToNamespace('Monster.DOM', getLocaleOfDocument);
export {Monster, getLocaleOfDocument}
'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
...@@ -17,7 +17,7 @@ import {getDocument, getWindow} from "./util.js"; ...@@ -17,7 +17,7 @@ import {getDocument, getWindow} from "./util.js";
* *
* ``` * ```
* <script type="module"> * <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(()=>{ * domReady().then(()=>{
* // ... * // ...
* }) * })
...@@ -31,7 +31,7 @@ import {getDocument, getWindow} from "./util.js"; ...@@ -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/DOMContentLoaded_event
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState * @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(); const document = getDocument();
...@@ -52,7 +52,7 @@ const domReady = new Promise(resolve => { ...@@ -52,7 +52,7 @@ const domReady = new Promise(resolve => {
* *
* ``` * ```
* <script type="module"> * <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(()=>{ * windowReady().then(()=>{
* // ... * // ...
* }) * })
...@@ -66,7 +66,7 @@ const domReady = new Promise(resolve => { ...@@ -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/Window/load_event
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState * @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 document = getDocument();
const window = getWindow(); const window = getWindow();
...@@ -77,5 +77,3 @@ const windowReady = new Promise(resolve => { ...@@ -77,5 +77,3 @@ const windowReady = new Promise(resolve => {
window.addEventListener('load', resolve); window.addEventListener('load', resolve);
} }
}); });
export {Monster, windowReady, domReady}
...@@ -43,20 +43,9 @@ export const referenceSymbol = Symbol('reference'); ...@@ -43,20 +43,9 @@ export const referenceSymbol = Symbol('reference');
/** /**
* This class is the base class for all resources to be loaded. * 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"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {Resource} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/resource.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';
* new Resource() * new Resource()
* </script> * </script>
* ``` * ```
...@@ -66,7 +55,7 @@ export const referenceSymbol = Symbol('reference'); ...@@ -66,7 +55,7 @@ export const referenceSymbol = Symbol('reference');
* @memberOf Monster.DOM * @memberOf Monster.DOM
* @summary A Resource class * @summary A Resource class
*/ */
class Resource extends BaseWithOptions { export class Resource extends BaseWithOptions {
/** /**
* *
...@@ -262,7 +251,3 @@ function addEvents() { ...@@ -262,7 +251,3 @@ function addEvents() {
return self; return self;
} }
assignToNamespace('Monster.DOM', Resource);
export {Monster, Resource}
...@@ -19,24 +19,12 @@ import { ...@@ -19,24 +19,12 @@ import {
} from "../constants.js"; } from "../constants.js";
import {KEY_DOCUMENT, KEY_QUERY, referenceSymbol, Resource} from "../resource.js"; import {KEY_DOCUMENT, KEY_QUERY, referenceSymbol, Resource} from "../resource.js";
/** /**
* This class is used by the resource manager to embed data. * 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"> * <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() * new Data()
* </script> * </script>
* ``` * ```
...@@ -46,7 +34,7 @@ import {KEY_DOCUMENT, KEY_QUERY, referenceSymbol, Resource} from "../resource.js ...@@ -46,7 +34,7 @@ import {KEY_DOCUMENT, KEY_QUERY, referenceSymbol, Resource} from "../resource.js
* @memberOf Monster.DOM.Resource * @memberOf Monster.DOM.Resource
* @summary A Data Resource class * @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 * @property {string} mode=cors https://developer.mozilla.org/en-US/docs/Web/API/fetch
...@@ -164,7 +152,3 @@ function appendToDocument() { ...@@ -164,7 +152,3 @@ function appendToDocument() {
return self; return self;
} }
assignToNamespace('Monster.DOM.Resource', Data);
export {Monster, Data}
...@@ -20,20 +20,9 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.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. * 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"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {Link} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/resource/link.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';
* new Link() * new Link()
* </script> * </script>
* ``` * ```
...@@ -44,7 +33,7 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js"; ...@@ -44,7 +33,7 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js";
* @summary A Resource class * @summary A Resource class
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link * @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} * @property {string} as {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-as}
...@@ -119,7 +108,3 @@ function createElement() { ...@@ -119,7 +108,3 @@ function createElement() {
return self; return self;
} }
assignToNamespace('Monster.DOM.Resource', Link);
export {Monster, Link}
...@@ -12,20 +12,9 @@ import {Link} from "../link.js"; ...@@ -12,20 +12,9 @@ import {Link} from "../link.js";
/** /**
* This class is used by the resource manager to embed external resources. * 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"> * <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() * new Stylesheet()
* </script> * </script>
* ``` * ```
...@@ -36,7 +25,7 @@ import {Link} from "../link.js"; ...@@ -36,7 +25,7 @@ import {Link} from "../link.js";
* @summary A Resource class * @summary A Resource class
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link * @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} * @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 { ...@@ -49,6 +38,3 @@ class Stylesheet extends Link {
} }
assignToNamespace('Monster.DOM.Resource.Link', Stylesheet);
export {Monster, Stylesheet}
...@@ -21,20 +21,9 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js"; ...@@ -21,20 +21,9 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js";
/** /**
* This class is used by the resource manager to embed scripts. * 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"> * <script type="module">
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.31.0/dist/monster.js'; * import {Script} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@latest/source/dom/resource/script.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';
* new Script() * new Script()
* </script> * </script>
* ``` * ```
...@@ -44,7 +33,7 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js"; ...@@ -44,7 +33,7 @@ import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.js";
* @memberOf Monster.DOM.Resource * @memberOf Monster.DOM.Resource
* @summary A Resource class * @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} * @property {boolean} async=true {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script#attr-async}
...@@ -106,7 +95,3 @@ function createElement() { ...@@ -106,7 +95,3 @@ function createElement() {
return self; return self;
} }
assignToNamespace('Monster.DOM.Resource', Script);
export {Monster, Script}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment