@schukai/monster 1.30.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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} +30 -53
- 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 -15489
- 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,31 +1,33 @@
|
|
|
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 {internalSymbol} from "../constants.
|
|
8
|
-
import {extend} from "../data/extend.
|
|
9
|
-
import {Pathfinder} from "../data/pathfinder.
|
|
10
|
-
|
|
11
|
-
import {parseDataURL} from "../types/dataurl.
|
|
12
|
-
import {getGlobalObject} from "../types/global.
|
|
13
|
-
import {isArray, isFunction, isObject, isString} from "../types/is.
|
|
14
|
-
import {Observer} from "../types/observer.
|
|
15
|
-
import {ProxyObserver} from "../types/proxyobserver.
|
|
16
|
-
import {validateFunction, validateInstance, validateObject, validateString} from "../types/validate.
|
|
17
|
-
import {clone} from "../util/clone.
|
|
18
|
-
import {addAttributeToken, addToObjectLink, getLinkedObjects, hasObjectLink} from "./attributes.
|
|
8
|
+
import {internalSymbol} from "../constants.mjs";
|
|
9
|
+
import {extend} from "../data/extend.mjs";
|
|
10
|
+
import {Pathfinder} from "../data/pathfinder.mjs";
|
|
11
|
+
|
|
12
|
+
import {parseDataURL} from "../types/dataurl.mjs";
|
|
13
|
+
import {getGlobalObject} from "../types/global.mjs";
|
|
14
|
+
import {isArray, isFunction, isObject, isString} from "../types/is.mjs";
|
|
15
|
+
import {Observer} from "../types/observer.mjs";
|
|
16
|
+
import {ProxyObserver} from "../types/proxyobserver.mjs";
|
|
17
|
+
import {validateFunction, validateInstance, validateObject, validateString} from "../types/validate.mjs";
|
|
18
|
+
import {clone} from "../util/clone.mjs";
|
|
19
|
+
import {addAttributeToken, addToObjectLink, getLinkedObjects, hasObjectLink} from "./attributes.mjs";
|
|
19
20
|
import {
|
|
20
21
|
ATTRIBUTE_DISABLED,
|
|
21
22
|
ATTRIBUTE_ERRORMESSAGE,
|
|
22
23
|
ATTRIBUTE_OPTIONS,
|
|
23
24
|
ATTRIBUTE_OPTIONS_SELECTOR,
|
|
24
25
|
objectUpdaterLinkSymbol
|
|
25
|
-
} from "./constants.
|
|
26
|
-
import {findDocumentTemplate, Template} from "./template.
|
|
27
|
-
import {Updater} from "./updater.
|
|
26
|
+
} from "./constants.mjs";
|
|
27
|
+
import {findDocumentTemplate, Template} from "./template.mjs";
|
|
28
|
+
import {Updater} from "./updater.mjs";
|
|
28
29
|
|
|
30
|
+
export {CustomElement, initMethodSymbol, assembleMethodSymbol, attributeObserverSymbol, registerCustomElement, assignUpdaterToElement}
|
|
29
31
|
|
|
30
32
|
/**
|
|
31
33
|
* @memberOf Monster.DOM
|
|
@@ -101,12 +103,6 @@ const attributeObserverSymbol = Symbol('attributeObserver');
|
|
|
101
103
|
*
|
|
102
104
|
* You can create the object via the function `document.createElement()`.
|
|
103
105
|
*
|
|
104
|
-
* ```
|
|
105
|
-
* <script type="module">
|
|
106
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/monster.js';
|
|
107
|
-
* document.createElement('monster-')
|
|
108
|
-
* </script>
|
|
109
|
-
* ```
|
|
110
106
|
*
|
|
111
107
|
* ## Interaction
|
|
112
108
|
*
|
|
@@ -172,24 +168,10 @@ const attributeObserverSymbol = Symbol('attributeObserver');
|
|
|
172
168
|
* }
|
|
173
169
|
* ```
|
|
174
170
|
*
|
|
175
|
-
* @example
|
|
176
|
-
*
|
|
177
|
-
* // In the example the the user can use his own template by creating a template in the DOM with the ID `my-custom-element`.
|
|
178
|
-
* // You can also specify a theme (for example `mytheme`), then it will search for the ID `my-custom-element-mytheme` and
|
|
179
|
-
* // if not available for the ID `my-custom-element`.
|
|
180
|
-
*
|
|
181
|
-
* class MyCustomElement extends CustomElement {
|
|
182
|
-
*
|
|
183
|
-
* static getTag() {
|
|
184
|
-
* return "my-custom-element"
|
|
185
|
-
* }
|
|
186
|
-
*
|
|
187
|
-
* }
|
|
188
|
-
*
|
|
189
|
-
* // ↦ <my-custom-element></my-custom-element>
|
|
190
|
-
*
|
|
171
|
+
* @externalExample ../../example/dom/theme.mjs
|
|
191
172
|
* @see https://github.com/WICG/webcomponents
|
|
192
173
|
* @see https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements
|
|
174
|
+
* @license AGPLv3
|
|
193
175
|
* @since 1.7.0
|
|
194
176
|
* @copyright schukai GmbH
|
|
195
177
|
* @memberOf Monster.DOM
|
|
@@ -234,7 +216,7 @@ class CustomElement extends HTMLElement {
|
|
|
234
216
|
* }
|
|
235
217
|
* ```
|
|
236
218
|
*
|
|
237
|
-
*
|
|
219
|
+
* To set the options via the html tag the attribute data-monster-options must be set.
|
|
238
220
|
* As value a JSON object with the desired values must be defined.
|
|
239
221
|
*
|
|
240
222
|
* Since 1.18.0 the JSON can be specified as a DataURI.
|
|
@@ -261,6 +243,7 @@ class CustomElement extends HTMLElement {
|
|
|
261
243
|
* </script>
|
|
262
244
|
* ```
|
|
263
245
|
*
|
|
246
|
+
* The individual configuration values can be found in the table.
|
|
264
247
|
*
|
|
265
248
|
* @property {boolean} disabled=false Object The Boolean disabled attribute, when present, makes the element not mutable, focusable, or even submitted with the form.
|
|
266
249
|
* @property {string} shadowMode=open `open` Elements of the shadow root are accessible from JavaScript outside the root, for example using. `close` Denies access to the node(s) of a closed shadow root from JavaScript outside it
|
|
@@ -556,6 +539,7 @@ class CustomElement extends HTMLElement {
|
|
|
556
539
|
* @param {String|undefined|null} name name of the slot (if the parameter is undefined, all slots are searched, if the parameter has the value null, all slots without a name are searched. if a string is specified, the slots with this name are searched.)
|
|
557
540
|
* @return {*}
|
|
558
541
|
* @this CustomElement
|
|
542
|
+
* @license AGPLv3
|
|
559
543
|
* @since 1.23.0
|
|
560
544
|
* @throws {Error} query must be a string
|
|
561
545
|
*/
|
|
@@ -630,6 +614,7 @@ function containChildNode(node) {
|
|
|
630
614
|
}
|
|
631
615
|
|
|
632
616
|
/**
|
|
617
|
+
* @license AGPLv3
|
|
633
618
|
* @since 1.15.0
|
|
634
619
|
* @private
|
|
635
620
|
* @this CustomElement
|
|
@@ -827,6 +812,7 @@ function initHtmlContent() {
|
|
|
827
812
|
* @return {CustomElement}
|
|
828
813
|
* @memberOf Monster.DOM
|
|
829
814
|
* @this CustomElement
|
|
815
|
+
* @license AGPLv3
|
|
830
816
|
* @since 1.16.0
|
|
831
817
|
* @throws {TypeError} value is not an instance of
|
|
832
818
|
*/
|
|
@@ -890,6 +876,7 @@ function initCSSStylesheet() {
|
|
|
890
876
|
* @throws {Error} html is not set.
|
|
891
877
|
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/attachShadow
|
|
892
878
|
* @memberOf Monster.DOM
|
|
879
|
+
* @license AGPLv3
|
|
893
880
|
* @since 1.8.0
|
|
894
881
|
*/
|
|
895
882
|
function initShadowRoot() {
|
|
@@ -926,6 +913,7 @@ function initShadowRoot() {
|
|
|
926
913
|
*
|
|
927
914
|
* @param {CustomElement} element
|
|
928
915
|
* @return {void}
|
|
916
|
+
* @license AGPLv3
|
|
929
917
|
* @since 1.7.0
|
|
930
918
|
* @copyright schukai GmbH
|
|
931
919
|
* @memberOf Monster.DOM
|
|
@@ -942,6 +930,7 @@ function registerCustomElement(element) {
|
|
|
942
930
|
* @param element
|
|
943
931
|
* @param object
|
|
944
932
|
* @return {Promise[]}
|
|
933
|
+
* @license AGPLv3
|
|
945
934
|
* @since 1.23.0
|
|
946
935
|
* @memberOf Monster.DOM
|
|
947
936
|
*/
|
|
@@ -976,15 +965,3 @@ function assignUpdaterToElement(elements, object) {
|
|
|
976
965
|
|
|
977
966
|
return result;
|
|
978
967
|
}
|
|
979
|
-
|
|
980
|
-
assignToNamespace('Monster.DOM', CustomElement, registerCustomElement, assignUpdaterToElement);
|
|
981
|
-
export {
|
|
982
|
-
Monster,
|
|
983
|
-
registerCustomElement,
|
|
984
|
-
CustomElement,
|
|
985
|
-
initMethodSymbol,
|
|
986
|
-
assembleMethodSymbol,
|
|
987
|
-
assignUpdaterToElement,
|
|
988
|
-
attributeObserverSymbol,
|
|
989
|
-
getSlottedElements
|
|
990
|
-
}
|
|
@@ -1,36 +1,23 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
|
-
*
|
|
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
|
|
6
6
|
*/
|
|
7
|
-
|
|
8
|
-
import {isArray,isObject} from "../types/is.
|
|
9
|
-
import {validateInstance, validateString} from "../types/validate.
|
|
10
|
-
import {getDocument} from "./util.
|
|
7
|
+
|
|
8
|
+
import {isArray, isObject} from "../types/is.mjs";
|
|
9
|
+
import {validateInstance, validateString} from "../types/validate.mjs";
|
|
10
|
+
import {getDocument} from "./util.mjs";
|
|
11
|
+
|
|
12
|
+
export {fireEvent, fireCustomEvent, findTargetElementFromEvent}
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* ```
|
|
16
|
-
* <script type="module">
|
|
17
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/monster.js';
|
|
18
|
-
* new Monster.DOM.fireEvent()
|
|
19
|
-
* </script>
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* Alternatively, you can also integrate this function individually.
|
|
23
|
-
*
|
|
24
|
-
* ```
|
|
25
|
-
* <script type="module">
|
|
26
|
-
* import {fireEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/modules/dom/events.js';
|
|
27
|
-
* fireEvent()
|
|
28
|
-
* </script>
|
|
29
|
-
* ```
|
|
15
|
+
* The function sends an event
|
|
30
16
|
*
|
|
31
17
|
* @param {HTMLElement|HTMLCollection|NodeList} element
|
|
32
18
|
* @param {string} type
|
|
33
19
|
* @return {void}
|
|
20
|
+
* @license AGPLv3
|
|
34
21
|
* @since 1.10.0
|
|
35
22
|
* @copyright schukai GmbH
|
|
36
23
|
* @memberOf Monster.DOM
|
|
@@ -68,25 +55,10 @@ function fireEvent(element, type) {
|
|
|
68
55
|
/**
|
|
69
56
|
* You can call the function via the monster namespace `new Monster.DOM.fireCustomEvent()`.
|
|
70
57
|
*
|
|
71
|
-
* ```
|
|
72
|
-
* <script type="module">
|
|
73
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/monster.js';
|
|
74
|
-
* new Monster.DOM.fireCustomEvent()
|
|
75
|
-
* </script>
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* Alternatively, you can also integrate this function individually.
|
|
79
|
-
*
|
|
80
|
-
* ```
|
|
81
|
-
* <script type="module">
|
|
82
|
-
* import {fireCustomEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/modules/dom/events.js';
|
|
83
|
-
* fireCustomEvent()
|
|
84
|
-
* </script>
|
|
85
|
-
* ```
|
|
86
|
-
*
|
|
87
58
|
* @param {HTMLElement|HTMLCollection|NodeList} element
|
|
88
59
|
* @param {string} type
|
|
89
60
|
* @return {void}
|
|
61
|
+
* @license AGPLv3
|
|
90
62
|
* @since 1.29.0
|
|
91
63
|
* @copyright schukai GmbH
|
|
92
64
|
* @memberOf Monster.DOM
|
|
@@ -125,25 +97,8 @@ function fireCustomEvent(element, type, detail) {
|
|
|
125
97
|
* This function gets the path `Event.composedPath()` from an event and tries to find the next element
|
|
126
98
|
* up the tree `element.closest()` with the attribute and value. If no value, or a value that is undefined or null,
|
|
127
99
|
* is specified, only the attribute is searched.
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
* ```
|
|
132
|
-
* <script type="module">
|
|
133
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/monster.js';
|
|
134
|
-
* new Monster.DOM.findTargetElementFromEvent()
|
|
135
|
-
* </script>
|
|
136
|
-
* ```
|
|
137
|
-
*
|
|
138
|
-
* Alternatively, you can also integrate this function individually.
|
|
139
|
-
*
|
|
140
|
-
* ```
|
|
141
|
-
* <script type="module">
|
|
142
|
-
* import {findTargetElementFromEvent} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/modules/dom/events.js';
|
|
143
|
-
* findTargetElementFromEvent()
|
|
144
|
-
* </script>
|
|
145
|
-
* ```
|
|
146
|
-
*
|
|
100
|
+
*
|
|
101
|
+
* @license AGPLv3
|
|
147
102
|
* @since 1.14.0
|
|
148
103
|
* @param {Event} event
|
|
149
104
|
* @param {string} attributeName
|
|
@@ -179,7 +134,3 @@ function findTargetElementFromEvent(event, attributeName, attributeValue) {
|
|
|
179
134
|
return undefined;
|
|
180
135
|
|
|
181
136
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
assignToNamespace('Monster.DOM', findTargetElementFromEvent, fireEvent, fireCustomEvent);
|
|
185
|
-
export {Monster, findTargetElementFromEvent, fireEvent, fireCustomEvent}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
|
-
*
|
|
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
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
import {extend} from "../data/extend.mjs";
|
|
9
|
+
import {BaseWithOptions} from "../types/basewithoptions.mjs";
|
|
10
|
+
import {getGlobalObject} from "../types/global.mjs";
|
|
11
|
+
import {isArray} from "../types/is.mjs";
|
|
12
|
+
import {Stack} from "../types/stack.mjs";
|
|
13
|
+
import {validateInstance, validateString} from "../types/validate.mjs";
|
|
8
14
|
|
|
9
|
-
|
|
10
|
-
import {assignToNamespace} from "../namespace.js";
|
|
11
|
-
import {BaseWithOptions} from "../types/basewithoptions.js";
|
|
12
|
-
import {getGlobalObject} from "../types/global.js";
|
|
13
|
-
import {isArray} from "../types/is.js";
|
|
14
|
-
import {Stack} from "../types/stack.js";
|
|
15
|
-
import {validateInstance, validateString} from "../types/validate.js";
|
|
15
|
+
export {FocusManager}
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* @private
|
|
@@ -37,31 +37,14 @@ const stackSymbol = Symbol('stack');
|
|
|
37
37
|
/**
|
|
38
38
|
* With the focusmanager the focus can be stored in a document, recalled and moved.
|
|
39
39
|
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
* ```
|
|
43
|
-
* <script type="module">
|
|
44
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/monster.js';
|
|
45
|
-
* new Monster.DOM.FocusManager()
|
|
46
|
-
* </script>
|
|
47
|
-
* ```
|
|
48
|
-
*
|
|
49
|
-
* Alternatively, you can also integrate this object individually.
|
|
50
|
-
*
|
|
51
|
-
* ```
|
|
52
|
-
* <script type="module">
|
|
53
|
-
* import {FocusManager} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/modules/dom/focusmanager.js';
|
|
54
|
-
* new FocusManager()
|
|
55
|
-
* </script>
|
|
56
|
-
* ```
|
|
57
|
-
*
|
|
40
|
+
* @license AGPLv3
|
|
58
41
|
* @since 1.25.0
|
|
59
42
|
* @copyright schukai GmbH
|
|
60
43
|
* @memberOf Monster.DOM
|
|
61
44
|
* @throws {Error} unsupported locale
|
|
62
45
|
* @summary Handle the focus
|
|
63
46
|
*/
|
|
64
|
-
class FocusManager extends BaseWithOptions {
|
|
47
|
+
class FocusManager extends BaseWithOptions {
|
|
65
48
|
|
|
66
49
|
/**
|
|
67
50
|
*
|
|
@@ -239,10 +222,6 @@ class FocusManager extends BaseWithOptions {
|
|
|
239
222
|
}
|
|
240
223
|
|
|
241
224
|
|
|
242
|
-
assignToNamespace('Monster.DOM', FocusManager);
|
|
243
|
-
export {FocusManager}
|
|
244
|
-
|
|
245
|
-
|
|
246
225
|
|
|
247
226
|
|
|
248
227
|
|
|
@@ -1,12 +1,15 @@
|
|
|
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 {parseLocale} from "../i18n/locale.
|
|
8
|
-
|
|
9
|
-
import {getDocument} from "./util.
|
|
8
|
+
import {parseLocale} from "../i18n/locale.mjs";
|
|
9
|
+
|
|
10
|
+
import {getDocument} from "./util.mjs";
|
|
11
|
+
|
|
12
|
+
export {getLocaleOfDocument}
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* @private
|
|
@@ -17,29 +20,14 @@ const DEFAULT_LANGUAGE = 'en';
|
|
|
17
20
|
/**
|
|
18
21
|
* With this function you can read the language version set by the document.
|
|
19
22
|
* For this the attribute `lang` in the html tag is read. If no attribute is set, `en` is used as default.
|
|
20
|
-
*
|
|
23
|
+
*
|
|
21
24
|
* ```html
|
|
22
25
|
* <html lang="en">
|
|
23
26
|
* ```
|
|
24
27
|
*
|
|
25
28
|
* You can call the function via the monster namespace `new Monster.DOM.getLocaleOfDocument()`.
|
|
26
29
|
*
|
|
27
|
-
*
|
|
28
|
-
* <script type="module">
|
|
29
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/monster.js';
|
|
30
|
-
* new Monster.DOM.getLocaleOfDocument()
|
|
31
|
-
* </script>
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* Alternatively, you can also integrate this function individually.
|
|
35
|
-
*
|
|
36
|
-
* ```
|
|
37
|
-
* <script type="module">
|
|
38
|
-
* import {getLocaleOfDocument} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/modules/dom/locale.js';
|
|
39
|
-
* new getLocaleOfDocument()
|
|
40
|
-
* </script>
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
30
|
+
* @license AGPLv3
|
|
43
31
|
* @since 1.13.0
|
|
44
32
|
* @copyright schukai GmbH
|
|
45
33
|
* @memberOf Monster.DOM
|
|
@@ -61,6 +49,3 @@ function getLocaleOfDocument() {
|
|
|
61
49
|
|
|
62
50
|
return parseLocale(DEFAULT_LANGUAGE);
|
|
63
51
|
}
|
|
64
|
-
|
|
65
|
-
assignToNamespace('Monster.DOM', getLocaleOfDocument);
|
|
66
|
-
export {Monster, getLocaleOfDocument}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* In this namespace you will find classes and methods for handling the DOM.
|
|
5
3
|
*
|
|
@@ -7,9 +5,4 @@
|
|
|
7
5
|
* @memberOf Monster
|
|
8
6
|
* @author schukai GmbH
|
|
9
7
|
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @private
|
|
13
|
-
* @type {string}
|
|
14
|
-
*/
|
|
15
|
-
export const namespace = "Monster.DOM";
|
|
8
|
+
const ns = {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
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
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {getDocument, getWindow} from "./util.mjs";
|
|
9
|
+
|
|
10
|
+
export {domReady, windowReady}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* This variable is a promise that is fulfilled as soon as the dom is available.
|
|
14
|
+
*
|
|
15
|
+
* The DOMContentLoaded event is fired when the original HTML document is fully loaded and parsed
|
|
16
|
+
* without waiting for stylesheets, images, and subframes to finish loading.
|
|
17
|
+
*
|
|
18
|
+
* @license AGPLv3
|
|
19
|
+
* @since 1.31.0
|
|
20
|
+
* @memberOf Monster.DOM
|
|
21
|
+
* @summary variable to check if dom is ready
|
|
22
|
+
* @type {Promise}
|
|
23
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/DOMContentLoaded_event
|
|
24
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState
|
|
25
|
+
*/
|
|
26
|
+
const domReady = new Promise(resolve => {
|
|
27
|
+
|
|
28
|
+
const document = getDocument();
|
|
29
|
+
|
|
30
|
+
if (document.readyState === "loading") {
|
|
31
|
+
document.addEventListener('DOMContentLoaded', resolve);
|
|
32
|
+
} else {
|
|
33
|
+
resolve();
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* This variable is a promise that is fulfilled as soon as the windows is available.
|
|
40
|
+
*
|
|
41
|
+
* The load event fires when the entire page is loaded, including all dependent resources such as stylesheets,
|
|
42
|
+
* assets, and images. Unlike DOMContentLoaded, which fires as soon as the DOM of the page is loaded,
|
|
43
|
+
* without waiting for the resources to finish loading.
|
|
44
|
+
*
|
|
45
|
+
* @license AGPLv3
|
|
46
|
+
* @since 1.31.0
|
|
47
|
+
* @memberOf Monster.DOM
|
|
48
|
+
* @summary variable to check if window is ready
|
|
49
|
+
* @type {Promise}
|
|
50
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window/load_event
|
|
51
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/API/Document/readyState
|
|
52
|
+
*/
|
|
53
|
+
const windowReady = new Promise(resolve => {
|
|
54
|
+
|
|
55
|
+
const document = getDocument();
|
|
56
|
+
const window = getWindow();
|
|
57
|
+
|
|
58
|
+
if (document.readyState === 'complete') {
|
|
59
|
+
resolve();
|
|
60
|
+
} else {
|
|
61
|
+
window.addEventListener('load', resolve);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
@@ -1,13 +1,13 @@
|
|
|
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 {internalStateSymbol} from "../../constants.
|
|
8
|
-
import {extend} from "../../data/extend.
|
|
9
|
-
import {
|
|
10
|
-
import {getGlobalFunction} from "../../types/global.js";
|
|
8
|
+
import {internalStateSymbol} from "../../constants.mjs";
|
|
9
|
+
import {extend} from "../../data/extend.mjs";
|
|
10
|
+
import {getGlobalFunction} from "../../types/global.mjs";
|
|
11
11
|
import {
|
|
12
12
|
ATTRIBUTE_CLASS,
|
|
13
13
|
ATTRIBUTE_ERRORMESSAGE,
|
|
@@ -16,31 +16,15 @@ import {
|
|
|
16
16
|
ATTRIBUTE_TITLE,
|
|
17
17
|
ATTRIBUTE_TYPE,
|
|
18
18
|
TAG_SCRIPT
|
|
19
|
-
} from "../constants.
|
|
20
|
-
import {KEY_DOCUMENT, KEY_QUERY, referenceSymbol, Resource} from "../resource.
|
|
19
|
+
} from "../constants.mjs";
|
|
20
|
+
import {KEY_DOCUMENT, KEY_QUERY, referenceSymbol, Resource} from "../resource.mjs";
|
|
21
21
|
|
|
22
|
+
export {Data}
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* This class is used by the resource manager to embed data.
|
|
25
26
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* ```
|
|
29
|
-
* <script type="module">
|
|
30
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/monster.js';
|
|
31
|
-
* new Monster.DOM.Resource.Data()
|
|
32
|
-
* </script>
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* Alternatively, you can also integrate this function individually.
|
|
36
|
-
*
|
|
37
|
-
* ```
|
|
38
|
-
* <script type="module">
|
|
39
|
-
* import {Data} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/modules/dom/resource/data.js';
|
|
40
|
-
* new Data()
|
|
41
|
-
* </script>
|
|
42
|
-
* ```
|
|
43
|
-
*
|
|
27
|
+
* @license AGPLv3
|
|
44
28
|
* @since 1.25.0
|
|
45
29
|
* @copyright schukai GmbH
|
|
46
30
|
* @memberOf Monster.DOM.Resource
|
|
@@ -164,7 +148,3 @@ function appendToDocument() {
|
|
|
164
148
|
|
|
165
149
|
return self;
|
|
166
150
|
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
assignToNamespace('Monster.DOM.Resource', Data);
|
|
170
|
-
export {Monster, Data}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
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
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {extend} from "../../../data/extend.mjs";
|
|
9
|
+
import {Link} from "../link.mjs";
|
|
10
|
+
|
|
11
|
+
export {Stylesheet}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* This class is used by the resource manager to embed external resources.
|
|
15
|
+
*
|
|
16
|
+
* @license AGPLv3
|
|
17
|
+
* @since 1.25.0
|
|
18
|
+
* @copyright schukai GmbH
|
|
19
|
+
* @memberOf Monster.DOM.Resource
|
|
20
|
+
* @summary A Resource class
|
|
21
|
+
* @see https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link
|
|
22
|
+
*/
|
|
23
|
+
class Stylesheet extends Link {
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @property {string} rel {@link https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#attr-rel}
|
|
27
|
+
*/
|
|
28
|
+
get defaults() {
|
|
29
|
+
return extend({}, super.defaults, {
|
|
30
|
+
rel: 'stylesheet'
|
|
31
|
+
})
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
}
|
|
35
|
+
|
|
@@ -1,11 +1,11 @@
|
|
|
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 {extend} from "../../data/extend.
|
|
8
|
-
import {assignToNamespace, Monster} from "../../namespace.js";
|
|
8
|
+
import {extend} from "../../data/extend.mjs";
|
|
9
9
|
import {
|
|
10
10
|
ATTRIBUTE_CLASS,
|
|
11
11
|
ATTRIBUTE_HREF,
|
|
@@ -13,31 +13,15 @@ import {
|
|
|
13
13
|
ATTRIBUTE_NONCE, ATTRIBUTE_SRC,
|
|
14
14
|
ATTRIBUTE_TITLE, ATTRIBUTE_TYPE,
|
|
15
15
|
TAG_LINK
|
|
16
|
-
} from "../constants.
|
|
17
|
-
import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.
|
|
16
|
+
} from "../constants.mjs";
|
|
17
|
+
import {KEY_DOCUMENT, referenceSymbol, Resource} from "../resource.mjs";
|
|
18
18
|
|
|
19
|
+
export {Link}
|
|
19
20
|
|
|
20
21
|
/**
|
|
21
22
|
* This class is used by the resource manager to embed external resources.
|
|
22
23
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* ```
|
|
26
|
-
* <script type="module">
|
|
27
|
-
* import {Monster} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/monster.js';
|
|
28
|
-
* new Monster.DOM.Resource.Link()
|
|
29
|
-
* </script>
|
|
30
|
-
* ```
|
|
31
|
-
*
|
|
32
|
-
* Alternatively, you can also integrate this function individually.
|
|
33
|
-
*
|
|
34
|
-
* ```
|
|
35
|
-
* <script type="module">
|
|
36
|
-
* import {Link} from 'https://cdn.jsdelivr.net/npm/@schukai/monster@1.30.1/dist/modules/dom/resource/link.js';
|
|
37
|
-
* new Link()
|
|
38
|
-
* </script>
|
|
39
|
-
* ```
|
|
40
|
-
*
|
|
24
|
+
* @license AGPLv3
|
|
41
25
|
* @since 1.25.0
|
|
42
26
|
* @copyright schukai GmbH
|
|
43
27
|
* @memberOf Monster.DOM.Resource
|
|
@@ -119,7 +103,3 @@ function createElement() {
|
|
|
119
103
|
|
|
120
104
|
return self;
|
|
121
105
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
assignToNamespace('Monster.DOM.Resource', Link);
|
|
125
|
-
export {Monster, Link}
|