@schukai/monster 1.30.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG +17 -1
- package/README.md +55 -58
- package/example/constraints/andoperator.mjs +17 -0
- package/example/constraints/invalid.mjs +6 -0
- package/example/constraints/isarray.mjs +11 -0
- package/example/constraints/isobject.mjs +12 -0
- package/example/constraints/oroperator.mjs +15 -0
- package/example/constraints/valid.mjs +6 -0
- package/example/data/buildmap.mjs +67 -0
- package/example/data/datasource.mjs +7 -0
- package/example/data/diff.mjs +39 -0
- package/example/data/pathfinder-1.mjs +23 -0
- package/example/data/pathfinder-2.mjs +19 -0
- package/example/data/pipe.mjs +14 -0
- package/example/data/storage/restapi.mjs +11 -0
- package/example/data/transformer.mjs +9 -0
- package/example/dom/customelement.mjs +13 -0
- package/example/dom/theme.mjs +5 -0
- package/example/dom/updater.mjs +23 -0
- package/example/i18n/formatter.mjs +10 -0
- package/example/i18n/providers/fetch.mjs +5 -0
- package/example/i18n/translations.mjs +20 -0
- package/example/types/basewithoptions.mjs +10 -0
- package/example/types/is-1.mjs +5 -0
- package/example/types/is-10.mjs +6 -0
- package/example/types/is-2.mjs +4 -0
- package/example/types/is-3.mjs +4 -0
- package/example/types/is-4.mjs +5 -0
- package/example/types/is-5.mjs +4 -0
- package/example/types/is-6.mjs +4 -0
- package/example/types/is-7.mjs +4 -0
- package/example/types/is-8.mjs +4 -0
- package/example/types/is-9.mjs +6 -0
- package/example/types/noderecursiveiterator.mjs +32 -0
- package/example/types/observer.mjs +9 -0
- package/example/types/proxyobserver.mjs +25 -0
- package/example/types/queue.mjs +20 -0
- package/example/types/tokenlist-1.mjs +4 -0
- package/example/types/tokenlist-2.mjs +7 -0
- package/example/types/tokenlist-3.mjs +5 -0
- package/example/types/tokenlist-4.mjs +5 -0
- package/example/types/tokenlist-5.mjs +5 -0
- package/example/types/typeof.mjs +9 -0
- package/example/types/version-1.mjs +6 -0
- package/example/types/version-2.mjs +3 -0
- package/example/util/comparator.mjs +10 -0
- package/example/util/deadmansswitch.mjs +9 -0
- package/example/util/processing.mjs +17 -0
- package/package.json +5 -59
- package/source/{constants.js → constants.mjs} +7 -10
- package/source/constraints/{abstract.js → abstract.mjs} +8 -9
- package/source/constraints/{abstractoperator.js → abstractoperator.mjs} +11 -8
- package/source/constraints/andoperator.mjs +38 -0
- package/source/constraints/invalid.mjs +38 -0
- package/source/constraints/isarray.mjs +41 -0
- package/source/constraints/isobject.mjs +41 -0
- package/source/constraints/{namespace.js → namespace.mjs} +3 -8
- package/source/constraints/{oroperator.js → oroperator.mjs} +10 -42
- package/source/constraints/valid.mjs +38 -0
- package/source/data/{buildmap.js → buildmap.mjs} +18 -104
- package/source/data/{buildtree.js → buildtree.mjs} +11 -31
- package/source/data/datasource/{namespace.js → namespace.mjs} +1 -9
- package/source/data/datasource/restapi/namespace.mjs +8 -0
- package/source/data/datasource/restapi/{writeerror.js → writeerror.mjs} +8 -9
- package/source/data/datasource/{restapi.js → restapi.mjs} +15 -45
- package/source/data/datasource/storage/localstorage.mjs +45 -0
- package/source/data/datasource/storage/{namespace.js → namespace.mjs} +1 -9
- package/source/data/datasource/storage/sessionstorage.mjs +45 -0
- package/source/data/datasource/{storage.js → storage.mjs} +12 -35
- package/source/data/{datasource.js → datasource.mjs} +17 -45
- package/source/data/{diff.js → diff.mjs} +10 -69
- package/source/data/{extend.js → extend.mjs} +10 -28
- package/source/data/{namespace.js → namespace.mjs} +2 -8
- package/source/data/{pathfinder.js → pathfinder.mjs} +18 -77
- package/source/data/{pipe.js → pipe.mjs} +14 -46
- package/source/data/{transformer.js → transformer.mjs} +18 -43
- package/source/dom/{assembler.js → assembler.mjs} +12 -28
- package/source/dom/{attributes.js → attributes.mjs} +42 -253
- package/source/dom/{constants.js → constants.mjs} +110 -61
- package/source/dom/{customcontrol.js → customcontrol.mjs} +10 -17
- package/source/dom/{customelement.js → customelement.mjs} +55 -59
- package/source/dom/{events.js → events.mjs} +15 -64
- package/source/dom/{focusmanager.js → focusmanager.mjs} +13 -34
- package/source/dom/{locale.js → locale.mjs} +11 -26
- package/source/dom/{namespace.js → namespace.mjs} +1 -8
- package/source/dom/ready.mjs +63 -0
- package/source/dom/resource/{data.js → data.mjs} +11 -31
- package/source/dom/resource/link/namespace.mjs +10 -0
- package/source/dom/resource/link/stylesheet.mjs +35 -0
- package/source/dom/resource/{link.js → link.mjs} +9 -29
- package/source/dom/resource/namespace.mjs +8 -0
- package/source/dom/resource/{script.js → script.mjs} +9 -29
- package/source/dom/{resource.js → resource.mjs} +19 -39
- package/source/dom/{resourcemanager.js → resourcemanager.mjs} +17 -35
- package/source/dom/{template.js → template.mjs} +18 -43
- package/source/dom/{theme.js → theme.mjs} +14 -36
- package/source/dom/{updater.js → updater.mjs} +34 -68
- package/source/dom/{util.js → util.mjs} +17 -66
- package/source/dom/worker/{factory.js → factory.mjs} +13 -34
- package/source/dom/worker/namespace.mjs +8 -0
- package/source/i18n/{formatter.js → formatter.mjs} +14 -45
- package/source/i18n/{locale.js → locale.mjs} +15 -30
- package/source/i18n/{namespace.js → namespace.mjs} +1 -9
- package/source/i18n/provider.mjs +40 -0
- package/source/i18n/providers/{fetch.js → fetch.mjs} +18 -43
- package/source/i18n/providers/namespace.mjs +8 -0
- package/source/i18n/{translations.js → translations.mjs} +12 -52
- package/source/logging/handler/console.mjs +50 -0
- package/source/logging/handler/namespace.mjs +6 -0
- package/source/logging/{handler.js → handler.mjs} +13 -30
- package/source/logging/logentry.mjs +51 -0
- package/source/logging/{logger.js → logger.mjs} +12 -28
- package/source/logging/{namespace.js → namespace.mjs} +1 -9
- package/source/math/{namespace.js → namespace.mjs} +1 -9
- package/source/math/{random.js → random.mjs} +8 -34
- package/source/monster.mjs +114 -0
- package/source/text/{formatter.js → formatter.mjs} +17 -33
- package/source/text/{namespace.js → namespace.mjs} +1 -9
- package/source/types/base.mjs +31 -0
- package/source/types/{basewithoptions.js → basewithoptions.mjs} +17 -46
- package/source/types/{binary.js → binary.mjs} +10 -42
- package/source/types/{dataurl.js → dataurl.mjs} +12 -46
- package/source/types/{global.js → global.mjs} +20 -12
- package/source/types/{id.js → id.mjs} +10 -27
- package/source/types/is.mjs +225 -0
- package/source/types/{mediatype.js → mediatype.mjs} +13 -29
- package/source/types/{namespace.js → namespace.mjs} +1 -8
- package/source/types/{node.js → node.mjs} +11 -28
- package/source/types/{nodelist.js → nodelist.mjs} +17 -32
- package/source/types/{noderecursiveiterator.js → noderecursiveiterator.mjs} +14 -65
- package/source/types/{observer.js → observer.mjs} +15 -42
- package/source/types/{observerlist.js → observerlist.mjs} +12 -29
- package/source/types/{proxyobserver.js → proxyobserver.mjs} +19 -62
- package/source/types/{queue.js → queue.mjs} +10 -47
- package/source/types/randomid.mjs +45 -0
- package/source/types/regex.mjs +27 -0
- package/source/types/{stack.js → stack.mjs} +8 -24
- package/source/types/{tokenlist.js → tokenlist.mjs} +20 -64
- package/source/types/typeof.mjs +37 -0
- package/source/types/{uniquequeue.js → uniquequeue.mjs} +11 -27
- package/source/types/{uuid.js → uuid.mjs} +15 -33
- package/source/types/{validate.js → validate.mjs} +38 -155
- package/source/types/{version.js → version.mjs} +19 -62
- package/source/util/{clone.js → clone.mjs} +10 -28
- package/source/util/{comparator.js → comparator.mjs} +13 -43
- package/source/util/{deadmansswitch.js → deadmansswitch.mjs} +15 -40
- package/source/util/freeze.mjs +39 -0
- package/source/util/{namespace.js → namespace.mjs} +1 -9
- package/source/util/{processing.js → processing.mjs} +13 -51
- package/source/util/{trimspaces.js → trimspaces.mjs} +14 -21
- package/test/cases/constraint/{andoperator.js → andoperator.mjs} +3 -3
- package/test/cases/constraint/{invalid.js → invalid.mjs} +1 -1
- package/test/cases/constraint/{isarray.js → isarray.mjs} +1 -1
- package/test/cases/constraint/{isobject.js → isobject.mjs} +1 -1
- package/test/cases/constraint/{oroperator.js → oroperator.mjs} +3 -3
- package/test/cases/constraint/{valid.js → valid.mjs} +1 -1
- package/test/cases/data/{buildmap.js → buildmap.mjs} +1 -1
- package/test/cases/data/{buildtree.js → buildtree.mjs} +2 -2
- package/test/cases/data/datasource/{restapi.js → restapi.mjs} +5 -5
- package/test/cases/data/datasource/storage/{localstorage.js → localstorage.mjs} +5 -5
- package/test/cases/data/datasource/storage/{sessionstorage.js → sessionstorage.mjs} +5 -5
- package/test/cases/data/{datasource.js → datasource.mjs} +1 -1
- package/test/cases/data/{diff.js → diff.mjs} +2 -2
- package/test/cases/data/{extend.js → extend.mjs} +1 -1
- package/test/cases/data/{pathfinder.js → pathfinder.mjs} +1 -1
- package/test/cases/data/{pipe.js → pipe.mjs} +19 -5
- package/test/cases/data/{transformer.js → transformer.mjs} +14 -10
- package/test/cases/dom/{assembler.js → assembler.mjs} +2 -2
- package/test/cases/dom/{attributes.js → attributes.mjs} +2 -2
- package/test/cases/dom/{customcontrol.js → customcontrol.mjs} +6 -6
- package/test/cases/dom/{customelement.js → customelement.mjs} +6 -6
- package/test/cases/dom/{events.js → events.mjs} +2 -2
- package/test/cases/dom/{focusmanager.js → focusmanager.mjs} +3 -3
- package/test/cases/dom/{locale.js → locale.mjs} +2 -2
- package/test/cases/dom/ready.mjs +42 -0
- package/test/cases/dom/resource/{data.js → data.mjs} +9 -9
- package/test/cases/dom/resource/link/{stylesheet.js → stylesheet.mjs} +6 -6
- package/test/cases/dom/resource/{link.js → link.mjs} +6 -6
- package/test/cases/dom/resource/{script.js → script.mjs} +6 -6
- package/test/cases/dom/{resourcemanager.js → resourcemanager.mjs} +6 -6
- package/test/cases/dom/{template.js → template.mjs} +3 -3
- package/test/cases/dom/{theme.js → theme.mjs} +3 -3
- package/test/cases/dom/{updater.js → updater.mjs} +6 -6
- package/test/cases/dom/{util.js → util.mjs} +2 -2
- package/test/cases/dom/worker/{factory.js → factory.mjs} +4 -4
- package/test/cases/i18n/{formatter.js → formatter.mjs} +2 -2
- package/test/cases/i18n/{locale.js → locale.mjs} +1 -1
- package/test/cases/i18n/{provider.js → provider.mjs} +1 -1
- package/test/cases/i18n/providers/{fetch.js → fetch.mjs} +3 -3
- package/test/cases/i18n/{translations.js → translations.mjs} +2 -2
- package/test/cases/logging/handler/{console.js → console.mjs} +3 -3
- package/test/cases/logging/{handler.js → handler.mjs} +3 -3
- package/test/cases/logging/{logentry.js → logentry.mjs} +1 -1
- package/test/cases/logging/{logger.js → logger.mjs} +1 -1
- package/test/cases/math/random.mjs +101 -0
- package/test/cases/monster.mjs +20 -0
- package/test/cases/text/{formatter.js → formatter.mjs} +1 -1
- package/test/cases/types/{base.js → base.mjs} +1 -1
- package/test/cases/types/{basewithoptions.js → basewithoptions.mjs} +1 -1
- package/test/cases/types/{binary.js → binary.mjs} +1 -1
- package/test/cases/types/{dataurl.js → dataurl.mjs} +1 -1
- package/test/cases/types/{global.js → global.mjs} +1 -1
- package/test/cases/types/{id.js → id.mjs} +17 -6
- package/test/cases/types/{is.js → is.mjs} +20 -8
- package/test/cases/types/{mediatype.js → mediatype.mjs} +1 -1
- package/test/cases/types/{node.js → node.mjs} +3 -3
- package/test/cases/types/{nodelist.js → nodelist.mjs} +2 -2
- package/test/cases/types/{noderecursiveiterator.js → noderecursiveiterator.mjs} +3 -3
- package/test/cases/types/{observer.js → observer.mjs} +1 -1
- package/test/cases/types/{observerlist.js → observerlist.mjs} +2 -2
- package/test/cases/types/{proxyobserver.js → proxyobserver.mjs} +4 -4
- package/test/cases/types/{queue.js → queue.mjs} +1 -1
- package/test/cases/types/randomid.mjs +39 -0
- package/test/cases/types/regex.mjs +46 -0
- package/test/cases/types/{stack.js → stack.mjs} +1 -1
- package/test/cases/types/{tokenlist.js → tokenlist.mjs} +1 -1
- package/test/cases/types/{typeof.js → typeof.mjs} +3 -4
- package/test/cases/types/{uniquequeue.js → uniquequeue.mjs} +1 -1
- package/test/cases/types/{uuid.js → uuid.mjs} +30 -10
- package/test/cases/types/{validate.js → validate.mjs} +3 -4
- package/test/cases/types/{version.js → version.mjs} +1 -2
- package/test/cases/util/{clone.js → clone.mjs} +1 -1
- package/test/cases/util/{comparator.js → comparator.mjs} +1 -1
- package/test/cases/util/{deadmansswitch.js → deadmansswitch.mjs} +1 -1
- package/test/cases/util/{freeze.js → freeze.mjs} +1 -1
- package/test/cases/util/{processing.js → processing.mjs} +1 -1
- package/test/cases/util/{trimspaces.js → trimspaces.mjs} +1 -1
- package/test/util/{chai-dom.js → chai-dom.mjs} +0 -0
- package/test/util/{cleanupdom.js → cleanupdom.mjs} +0 -0
- package/test/util/{jsdom.js → jsdom.mjs} +2 -2
- package/test/util/{localstorage.js → localstorage.mjs} +0 -0
- package/test/web/import.js +77 -77
- package/test/web/prepare.js +0 -8
- package/test/web/test.html +5 -4
- package/test/web/tests.js +25731 -587
- package/dist/modules/constants.js +0 -2
- package/dist/modules/constraints/abstract.js +0 -2
- package/dist/modules/constraints/abstractoperator.js +0 -2
- package/dist/modules/constraints/andoperator.js +0 -2
- package/dist/modules/constraints/invalid.js +0 -2
- package/dist/modules/constraints/isarray.js +0 -2
- package/dist/modules/constraints/isobject.js +0 -2
- package/dist/modules/constraints/namespace.js +0 -2
- package/dist/modules/constraints/oroperator.js +0 -2
- package/dist/modules/constraints/valid.js +0 -2
- package/dist/modules/data/buildmap.js +0 -2
- package/dist/modules/data/buildtree.js +0 -2
- package/dist/modules/data/datasource/namespace.js +0 -2
- package/dist/modules/data/datasource/restapi/writeerror.js +0 -2
- package/dist/modules/data/datasource/restapi.js +0 -2
- package/dist/modules/data/datasource/storage/localstorage.js +0 -2
- package/dist/modules/data/datasource/storage/namespace.js +0 -2
- package/dist/modules/data/datasource/storage/sessionstorage.js +0 -2
- package/dist/modules/data/datasource/storage.js +0 -2
- package/dist/modules/data/datasource.js +0 -2
- package/dist/modules/data/diff.js +0 -2
- package/dist/modules/data/extend.js +0 -2
- package/dist/modules/data/namespace.js +0 -2
- package/dist/modules/data/pathfinder.js +0 -2
- package/dist/modules/data/pipe.js +0 -2
- package/dist/modules/data/transformer.js +0 -2
- package/dist/modules/dom/assembler.js +0 -2
- package/dist/modules/dom/attributes.js +0 -2
- package/dist/modules/dom/constants.js +0 -2
- package/dist/modules/dom/customcontrol.js +0 -2
- package/dist/modules/dom/customelement.js +0 -2
- package/dist/modules/dom/events.js +0 -2
- package/dist/modules/dom/focusmanager.js +0 -2
- package/dist/modules/dom/locale.js +0 -2
- package/dist/modules/dom/namespace.js +0 -2
- package/dist/modules/dom/resource/data.js +0 -2
- package/dist/modules/dom/resource/link/stylesheet.js +0 -2
- package/dist/modules/dom/resource/link.js +0 -2
- package/dist/modules/dom/resource/script.js +0 -2
- package/dist/modules/dom/resource.js +0 -2
- package/dist/modules/dom/resourcemanager.js +0 -2
- package/dist/modules/dom/template.js +0 -2
- package/dist/modules/dom/theme.js +0 -2
- package/dist/modules/dom/updater.js +0 -2
- package/dist/modules/dom/util.js +0 -2
- package/dist/modules/dom/worker/factory.js +0 -2
- package/dist/modules/i18n/formatter.js +0 -2
- package/dist/modules/i18n/locale.js +0 -2
- package/dist/modules/i18n/namespace.js +0 -2
- package/dist/modules/i18n/provider.js +0 -2
- package/dist/modules/i18n/providers/fetch.js +0 -2
- package/dist/modules/i18n/providers/namespace.js +0 -2
- package/dist/modules/i18n/translations.js +0 -2
- package/dist/modules/logging/handler/console.js +0 -2
- package/dist/modules/logging/handler/namespace.js +0 -2
- package/dist/modules/logging/handler.js +0 -2
- package/dist/modules/logging/logentry.js +0 -2
- package/dist/modules/logging/logger.js +0 -2
- package/dist/modules/logging/namespace.js +0 -2
- package/dist/modules/math/namespace.js +0 -2
- package/dist/modules/math/random.js +0 -2
- package/dist/modules/monster.js +0 -2
- package/dist/modules/namespace.js +0 -2
- package/dist/modules/text/formatter.js +0 -2
- package/dist/modules/text/namespace.js +0 -2
- package/dist/modules/types/base.js +0 -2
- package/dist/modules/types/basewithoptions.js +0 -2
- package/dist/modules/types/binary.js +0 -2
- package/dist/modules/types/dataurl.js +0 -2
- package/dist/modules/types/global.js +0 -2
- package/dist/modules/types/id.js +0 -2
- package/dist/modules/types/is.js +0 -2
- package/dist/modules/types/mediatype.js +0 -2
- package/dist/modules/types/namespace.js +0 -2
- package/dist/modules/types/node.js +0 -2
- package/dist/modules/types/nodelist.js +0 -2
- package/dist/modules/types/noderecursiveiterator.js +0 -2
- package/dist/modules/types/observer.js +0 -2
- package/dist/modules/types/observerlist.js +0 -2
- package/dist/modules/types/proxyobserver.js +0 -2
- package/dist/modules/types/queue.js +0 -2
- package/dist/modules/types/randomid.js +0 -2
- package/dist/modules/types/regex.js +0 -2
- package/dist/modules/types/stack.js +0 -2
- package/dist/modules/types/tokenlist.js +0 -2
- package/dist/modules/types/typeof.js +0 -2
- package/dist/modules/types/uniquequeue.js +0 -2
- package/dist/modules/types/uuid.js +0 -2
- package/dist/modules/types/validate.js +0 -2
- package/dist/modules/types/version.js +0 -2
- package/dist/modules/util/clone.js +0 -2
- package/dist/modules/util/comparator.js +0 -2
- package/dist/modules/util/deadmansswitch.js +0 -2
- package/dist/modules/util/freeze.js +0 -2
- package/dist/modules/util/namespace.js +0 -2
- package/dist/modules/util/processing.js +0 -2
- package/dist/modules/util/trimspaces.js +0 -2
- package/dist/monster.dev.js +0 -15469
- package/dist/monster.dev.js.map +0 -1
- package/dist/monster.js +0 -2
- package/source/constraints/andoperator.js +0 -71
- package/source/constraints/invalid.js +0 -63
- package/source/constraints/isarray.js +0 -71
- package/source/constraints/isobject.js +0 -72
- package/source/constraints/valid.js +0 -63
- package/source/data/datasource/storage/localstorage.js +0 -64
- package/source/data/datasource/storage/sessionstorage.js +0 -61
- package/source/dom/resource/link/stylesheet.js +0 -54
- package/source/i18n/provider.js +0 -58
- package/source/i18n/providers/namespace.js +0 -16
- package/source/logging/handler/console.js +0 -66
- package/source/logging/handler/namespace.js +0 -14
- package/source/logging/logentry.js +0 -68
- package/source/monster.js +0 -80
- package/source/namespace.js +0 -170
- package/source/types/base.js +0 -50
- package/source/types/is.js +0 -429
- package/source/types/package.d.ts +0 -1
- package/source/types/randomid.js +0 -60
- package/source/types/regex.js +0 -49
- package/source/types/typeof.js +0 -63
- package/source/util/freeze.js +0 -57
- package/test/cases/math/random.js +0 -82
- package/test/cases/monster.js +0 -23
- package/test/cases/namespace.js +0 -93
- package/test/cases/types/randomid.js +0 -24
- package/test/cases/types/regex.js +0 -32
- package/test/web/monster-dev.html +0 -22
- package/test/web/monster.html +0 -21
@@ -1,14 +1,30 @@
|
|
1
|
-
'use strict';
|
2
|
-
|
3
1
|
/**
|
4
|
-
*
|
2
|
+
* Copyright schukai GmbH and contributors 2022. All Rights Reserved.
|
3
|
+
* Node module: @schukai/monster
|
4
|
+
* This file is licensed under the AGPLv3 License.
|
5
|
+
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
5
6
|
*/
|
6
7
|
|
7
|
-
import {
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
|
8
|
+
import {getGlobalFunction} from "../types/global.mjs";
|
9
|
+
import {TokenList} from "../types/tokenlist.mjs";
|
10
|
+
import {validateInstance, validateString, validateSymbol} from "../types/validate.mjs";
|
11
|
+
import {ATTRIBUTE_OBJECTLINK} from "./constants.mjs";
|
12
|
+
|
13
|
+
export {
|
14
|
+
findClosestObjectLink,
|
15
|
+
addToObjectLink,
|
16
|
+
removeObjectLink,
|
17
|
+
hasObjectLink,
|
18
|
+
getLinkedObjects,
|
19
|
+
toggleAttributeToken,
|
20
|
+
addAttributeToken,
|
21
|
+
removeAttributeToken,
|
22
|
+
containsAttributeToken,
|
23
|
+
replaceAttributeToken,
|
24
|
+
clearAttributeTokens,
|
25
|
+
findClosestByAttribute,
|
26
|
+
findClosestByClass
|
27
|
+
}
|
12
28
|
|
13
29
|
/**
|
14
30
|
* Get the closest object link of a node
|
@@ -16,26 +32,9 @@ import {ATTRIBUTE_OBJECTLINK} from "./constants.js";
|
|
16
32
|
* if a node is specified without a object link, a recursive search upwards is performed until the corresponding
|
17
33
|
* object link is found, or undefined is returned.
|
18
34
|
*
|
19
|
-
* you can call the method via the monster namespace `Monster.DOM.getUpdaterFromNode()`.
|
20
|
-
*
|
21
|
-
* ```
|
22
|
-
* <script type="module">
|
23
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
24
|
-
* console.log(Monster.DOM.findClosestObjectLink())
|
25
|
-
* </script>
|
26
|
-
* ```
|
27
|
-
*
|
28
|
-
* Alternatively, you can also integrate this function individually.
|
29
|
-
*
|
30
|
-
* ```
|
31
|
-
* <script type="module">
|
32
|
-
* import {getUpdaterFromNode} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/updater.js';
|
33
|
-
* console.log(findClosestObjectLink())
|
34
|
-
* </script>
|
35
|
-
* ```
|
36
|
-
*
|
37
35
|
* @param {HTMLElement} element
|
38
36
|
* @return {HTMLElement|undefined}
|
37
|
+
* @license AGPLv3
|
39
38
|
* @since 1.10.0
|
40
39
|
* @copyright schukai GmbH
|
41
40
|
* @memberOf Monster.DOM
|
@@ -46,24 +45,9 @@ function findClosestObjectLink(element) {
|
|
46
45
|
}
|
47
46
|
|
48
47
|
/**
|
49
|
-
*
|
50
|
-
*
|
51
|
-
* ```
|
52
|
-
* <script type="module">
|
53
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
54
|
-
* Monster.DOM.addToObjectLink();
|
55
|
-
* </script>
|
56
|
-
* ```
|
57
|
-
*
|
58
|
-
* Alternatively, you can also integrate this function individually.
|
59
|
-
*
|
60
|
-
* ```
|
61
|
-
* <script type="module">
|
62
|
-
* import {addToObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
63
|
-
* addToObjectLink();
|
64
|
-
* </script>
|
65
|
-
* ```
|
48
|
+
* Adds a class attribute to an element.
|
66
49
|
*
|
50
|
+
* @license AGPLv3
|
67
51
|
* @since 1.9.0
|
68
52
|
* @copyright schukai GmbH
|
69
53
|
* @memberOf Monster.DOM
|
@@ -88,24 +72,9 @@ function addToObjectLink(element, symbol, object) {
|
|
88
72
|
}
|
89
73
|
|
90
74
|
/**
|
91
|
-
*
|
92
|
-
*
|
93
|
-
* ```
|
94
|
-
* <script type="module">
|
95
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
96
|
-
* Monster.DOM.removeObjectLink();
|
97
|
-
* </script>
|
98
|
-
* ```
|
99
|
-
*
|
100
|
-
* Alternatively, you can also integrate this function individually.
|
101
|
-
*
|
102
|
-
* ```
|
103
|
-
* <script type="module">
|
104
|
-
* import {removeObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
105
|
-
* removeObjectLink();
|
106
|
-
* </script>
|
107
|
-
* ```
|
75
|
+
* Removes an object from an element
|
108
76
|
*
|
77
|
+
* @license AGPLv3
|
109
78
|
* @since 1.9.0
|
110
79
|
* @copyright schukai GmbH
|
111
80
|
* @memberOf Monster.DOM
|
@@ -130,24 +99,9 @@ function removeObjectLink(element, symbol) {
|
|
130
99
|
|
131
100
|
|
132
101
|
/**
|
133
|
-
*
|
134
|
-
*
|
135
|
-
* ```
|
136
|
-
* <script type="module">
|
137
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
138
|
-
* Monster.DOM.hasObjectLink();
|
139
|
-
* </script>
|
140
|
-
* ```
|
141
|
-
*
|
142
|
-
* Alternatively, you can also integrate this function individually.
|
143
|
-
*
|
144
|
-
* ```
|
145
|
-
* <script type="module">
|
146
|
-
* import {hasObjectLink} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
147
|
-
* hasObjectLink();
|
148
|
-
* </script>
|
149
|
-
* ```
|
102
|
+
* Checks if an element has an object link
|
150
103
|
*
|
104
|
+
* @license AGPLv3
|
151
105
|
* @since 1.9.0
|
152
106
|
* @copyright schukai GmbH
|
153
107
|
* @memberOf Monster.DOM
|
@@ -176,24 +130,7 @@ function hasObjectLink(element, symbol) {
|
|
176
130
|
*
|
177
131
|
* With the method {@see {@link addToObjectLink}} the objects can be added.
|
178
132
|
*
|
179
|
-
*
|
180
|
-
*
|
181
|
-
* ```
|
182
|
-
* <script type="module">
|
183
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
184
|
-
* Monster.DOM.getLinkedObjects();
|
185
|
-
* </script>
|
186
|
-
* ```
|
187
|
-
*
|
188
|
-
* Alternatively, you can also integrate this function individually.
|
189
|
-
*
|
190
|
-
* ```
|
191
|
-
* <script type="module">
|
192
|
-
* import {getLinkedObjects} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
193
|
-
* getLinkedObjects();
|
194
|
-
* </script>
|
195
|
-
* ```
|
196
|
-
*
|
133
|
+
* @license AGPLv3
|
197
134
|
* @since 1.9.0
|
198
135
|
* @copyright schukai GmbH
|
199
136
|
* @memberOf Monster.DOM
|
@@ -221,24 +158,7 @@ function getLinkedObjects(element, symbol) {
|
|
221
158
|
*
|
222
159
|
* Tokens are always separated by a space.
|
223
160
|
*
|
224
|
-
*
|
225
|
-
*
|
226
|
-
* ```
|
227
|
-
* <script type="module">
|
228
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
229
|
-
* Monster.DOM.toggleAttributeToken();
|
230
|
-
* </script>
|
231
|
-
* ```
|
232
|
-
*
|
233
|
-
* Alternatively, you can also integrate this function individually.
|
234
|
-
*
|
235
|
-
* ```
|
236
|
-
* <script type="module">
|
237
|
-
* import {toggleAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
238
|
-
* toggleAttributeToken();
|
239
|
-
* </script>
|
240
|
-
* ```
|
241
|
-
*
|
161
|
+
* @license AGPLv3
|
242
162
|
* @since 1.9.0
|
243
163
|
* @copyright schukai GmbH
|
244
164
|
* @memberOf Monster.DOM
|
@@ -265,24 +185,7 @@ function toggleAttributeToken(element, key, token) {
|
|
265
185
|
/**
|
266
186
|
* This method can be used to add a token to an attribute. Tokens are always separated by a space.
|
267
187
|
*
|
268
|
-
*
|
269
|
-
*
|
270
|
-
* ```
|
271
|
-
* <script type="module">
|
272
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
273
|
-
* Monster.DOM.addAttributeToken();
|
274
|
-
* </script>
|
275
|
-
* ```
|
276
|
-
*
|
277
|
-
* Alternatively, you can also integrate this function individually.
|
278
|
-
*
|
279
|
-
* ```
|
280
|
-
* <script type="module">
|
281
|
-
* import {addAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
282
|
-
* addAttributeToken();
|
283
|
-
* </script>
|
284
|
-
* ```
|
285
|
-
*
|
188
|
+
* @license AGPLv3
|
286
189
|
* @since 1.9.0
|
287
190
|
* @copyright schukai GmbH
|
288
191
|
* @memberOf Monster.DOM
|
@@ -311,24 +214,7 @@ function addAttributeToken(element, key, token) {
|
|
311
214
|
*
|
312
215
|
* Tokens are always separated by a space.
|
313
216
|
*
|
314
|
-
*
|
315
|
-
*
|
316
|
-
* ```
|
317
|
-
* <script type="module">
|
318
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
319
|
-
* Monster.DOM.removeAttributeToken();
|
320
|
-
* </script>
|
321
|
-
* ```
|
322
|
-
*
|
323
|
-
* Alternatively, you can also integrate this function individually.
|
324
|
-
*
|
325
|
-
* ```
|
326
|
-
* <script type="module">
|
327
|
-
* import {removeAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
328
|
-
* removeAttributeToken();
|
329
|
-
* </script>
|
330
|
-
* ```
|
331
|
-
*
|
217
|
+
* @license AGPLv3
|
332
218
|
* @since 1.9.0
|
333
219
|
* @copyright schukai GmbH
|
334
220
|
* @memberOf Monster.DOM
|
@@ -356,24 +242,7 @@ function removeAttributeToken(element, key, token) {
|
|
356
242
|
*
|
357
243
|
* Tokens are always separated by a space.
|
358
244
|
*
|
359
|
-
*
|
360
|
-
*
|
361
|
-
* ```
|
362
|
-
* <script type="module">
|
363
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
364
|
-
* Monster.DOM.containsAttributeToken();
|
365
|
-
* </script>
|
366
|
-
* ```
|
367
|
-
*
|
368
|
-
* Alternatively, you can also integrate this function individually.
|
369
|
-
*
|
370
|
-
* ```
|
371
|
-
* <script type="module">
|
372
|
-
* import {containsAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
373
|
-
* containsAttributeToken();
|
374
|
-
* </script>
|
375
|
-
* ```
|
376
|
-
*
|
245
|
+
* @license AGPLv3
|
377
246
|
* @since 1.9.0
|
378
247
|
* @copyright schukai GmbH
|
379
248
|
* @memberOf Monster.DOM
|
@@ -398,24 +267,7 @@ function containsAttributeToken(element, key, token) {
|
|
398
267
|
/**
|
399
268
|
* Tokens are always separated by a space.
|
400
269
|
*
|
401
|
-
*
|
402
|
-
*
|
403
|
-
* ```
|
404
|
-
* <script type="module">
|
405
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
406
|
-
* Monster.DOM.replaceAttributeToken();
|
407
|
-
* </script>
|
408
|
-
* ```
|
409
|
-
*
|
410
|
-
* Alternatively, you can also integrate this function individually.
|
411
|
-
*
|
412
|
-
* ```
|
413
|
-
* <script type="module">
|
414
|
-
* import {replaceAttributeToken} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
415
|
-
* replaceAttributeToken();
|
416
|
-
* </script>
|
417
|
-
* ```
|
418
|
-
*
|
270
|
+
* @license AGPLv3
|
419
271
|
* @since 1.9.0
|
420
272
|
* @copyright schukai GmbH
|
421
273
|
* @memberOf Monster.DOM
|
@@ -443,24 +295,7 @@ function replaceAttributeToken(element, key, from, to) {
|
|
443
295
|
/**
|
444
296
|
* Tokens are always separated by a space.
|
445
297
|
*
|
446
|
-
*
|
447
|
-
*
|
448
|
-
* ```
|
449
|
-
* <script type="module">
|
450
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
451
|
-
* Monster.DOM.clearAttributeTokens();
|
452
|
-
* </script>
|
453
|
-
* ```
|
454
|
-
*
|
455
|
-
* Alternatively, you can also integrate this function individually.
|
456
|
-
*
|
457
|
-
* ```
|
458
|
-
* <script type="module">
|
459
|
-
* import {clearAttributeTokens} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
460
|
-
* clearAttributeTokens();
|
461
|
-
* </script>
|
462
|
-
* ```
|
463
|
-
*
|
298
|
+
* @license AGPLv3
|
464
299
|
* @since 1.9.0
|
465
300
|
* @copyright schukai GmbH
|
466
301
|
* @memberOf Monster.DOM
|
@@ -500,24 +335,7 @@ function clearAttributeTokens(element, key) {
|
|
500
335
|
* findClosestByAttribute(document.getElementById('1'),'data-my-attribute', '2'); // ↦ node with id 2
|
501
336
|
* ```
|
502
337
|
*
|
503
|
-
*
|
504
|
-
*
|
505
|
-
* ```
|
506
|
-
* <script type="module">
|
507
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/monster.js';
|
508
|
-
* Monster.DOM.findClosestByAttribute();
|
509
|
-
* </script>
|
510
|
-
* ```
|
511
|
-
*
|
512
|
-
* Alternatively, you can also integrate this function individually.
|
513
|
-
*
|
514
|
-
* ```
|
515
|
-
* <script type="module">
|
516
|
-
* import {findClosestByAttribute} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
517
|
-
* findClosestByAttribute();
|
518
|
-
* </script>
|
519
|
-
* ```
|
520
|
-
*
|
338
|
+
* @license AGPLv3
|
521
339
|
* @since 1.14.0
|
522
340
|
* @copyright schukai GmbH
|
523
341
|
* @memberOf Monster.DOM
|
@@ -565,24 +383,14 @@ function findClosestByAttribute(element, key, value) {
|
|
565
383
|
* findClosestByClass(document.getElementById('2'),'myclass'); // ↦ node with id 2
|
566
384
|
* ```
|
567
385
|
*
|
568
|
-
* You can call the method via the monster namespace `new Monster.DOM.findClosestByClass()`.
|
569
|
-
*
|
570
386
|
* ```
|
571
387
|
* <script type="module">
|
572
|
-
* import {
|
573
|
-
* Monster.DOM.findClosestByClass();
|
574
|
-
* </script>
|
575
|
-
* ```
|
576
|
-
*
|
577
|
-
* Alternatively, you can also integrate this function individually.
|
578
|
-
*
|
579
|
-
* ```
|
580
|
-
* <script type="module">
|
581
|
-
* import {findClosestByClass} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.0/dist/modules/dom/attributes.js';
|
388
|
+
* import {findClosestByClass} from '@schukai/monster/source/dom/attributes.mjs';
|
582
389
|
* findClosestByClass();
|
583
390
|
* </script>
|
584
391
|
* ```
|
585
392
|
*
|
393
|
+
* @license AGPLv3
|
586
394
|
* @since 1.27.0
|
587
395
|
* @copyright schukai GmbH
|
588
396
|
* @memberOf Monster.DOM
|
@@ -602,25 +410,6 @@ function findClosestByClass(element, className) {
|
|
602
410
|
if (result instanceof HTMLElement) {
|
603
411
|
return result;
|
604
412
|
}
|
605
|
-
|
606
|
-
return undefined;
|
607
|
-
}
|
608
413
|
|
609
|
-
|
610
|
-
assignToNamespace('Monster.DOM', findClosestByClass, getLinkedObjects, addToObjectLink, removeObjectLink, findClosestByAttribute, hasObjectLink, clearAttributeTokens, replaceAttributeToken, containsAttributeToken, removeAttributeToken, addAttributeToken, toggleAttributeToken);
|
611
|
-
export {
|
612
|
-
Monster,
|
613
|
-
addToObjectLink,
|
614
|
-
removeObjectLink,
|
615
|
-
hasObjectLink,
|
616
|
-
findClosestByAttribute,
|
617
|
-
clearAttributeTokens,
|
618
|
-
replaceAttributeToken,
|
619
|
-
containsAttributeToken,
|
620
|
-
removeAttributeToken,
|
621
|
-
addAttributeToken,
|
622
|
-
toggleAttributeToken,
|
623
|
-
getLinkedObjects,
|
624
|
-
findClosestObjectLink,
|
625
|
-
findClosestByClass
|
414
|
+
return undefined;
|
626
415
|
}
|