@schukai/monster 3.5.0 → 3.8.0
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +1 -1
- package/source/constants.mjs +4 -9
- package/source/constraints/abstract.mjs +4 -6
- package/source/constraints/abstractoperator.mjs +6 -12
- package/source/constraints/andoperator.mjs +3 -6
- package/source/constraints/invalid.mjs +3 -6
- package/source/constraints/isarray.mjs +6 -9
- package/source/constraints/isobject.mjs +4 -7
- package/source/constraints/namespace.mjs +1 -3
- package/source/constraints/oroperator.mjs +26 -25
- package/source/constraints/valid.mjs +3 -6
- package/source/data/buildmap.mjs +20 -36
- package/source/data/buildtree.mjs +29 -29
- package/source/data/datasource/namespace.mjs +1 -1
- package/source/data/datasource/server/restapi/writeerror.mjs +6 -6
- package/source/data/datasource/server/restapi.mjs +51 -65
- package/source/data/datasource/server/webconnect.mjs +26 -35
- package/source/data/datasource/server.mjs +16 -20
- package/source/data/datasource/storage/localstorage.mjs +8 -11
- package/source/data/datasource/storage/sessionstorage.mjs +8 -10
- package/source/data/datasource/storage.mjs +18 -22
- package/source/data/datasource.mjs +27 -43
- package/source/data/diff.mjs +20 -32
- package/source/data/extend.mjs +20 -14
- package/source/data/namespace.mjs +1 -3
- package/source/data/pathfinder.mjs +105 -87
- package/source/data/pipe.mjs +6 -10
- package/source/data/transformer.mjs +141 -157
- package/source/dom/assembler.mjs +6 -9
- package/source/dom/attributes.mjs +36 -48
- package/source/dom/constants.mjs +55 -71
- package/source/dom/customcontrol.mjs +16 -21
- package/source/dom/customelement.mjs +140 -164
- package/source/dom/events.mjs +17 -24
- package/source/dom/focusmanager.mjs +31 -49
- package/source/dom/locale.mjs +18 -20
- package/source/dom/namespace.mjs +1 -1
- package/source/dom/ready.mjs +7 -10
- package/source/dom/resource/data.mjs +38 -46
- package/source/dom/resource/link/namespace.mjs +1 -3
- package/source/dom/resource/link/stylesheet.mjs +7 -11
- package/source/dom/resource/link.mjs +36 -17
- package/source/dom/resource/namespace.mjs +1 -1
- package/source/dom/resource/script.mjs +23 -13
- package/source/dom/resource.mjs +47 -60
- package/source/dom/resourcemanager.mjs +36 -43
- package/source/dom/template.mjs +17 -24
- package/source/dom/theme.mjs +8 -12
- package/source/dom/updater.mjs +150 -196
- package/source/dom/util.mjs +11 -12
- package/source/dom/worker/factory.mjs +21 -25
- package/source/dom/worker/namespace.mjs +1 -1
- package/source/i18n/formatter.mjs +20 -24
- package/source/i18n/locale.mjs +42 -55
- package/source/i18n/namespace.mjs +1 -1
- package/source/i18n/provider.mjs +4 -7
- package/source/i18n/providers/embed.mjs +16 -26
- package/source/i18n/providers/fetch.mjs +30 -36
- package/source/i18n/translations.mjs +17 -24
- package/source/logging/handler/console.mjs +6 -10
- package/source/logging/handler.mjs +15 -18
- package/source/logging/logentry.mjs +8 -9
- package/source/logging/logger.mjs +73 -55
- package/source/logging/namespace.mjs +1 -1
- package/source/math/namespace.mjs +1 -1
- package/source/math/random.mjs +13 -14
- package/source/monster.mjs +132 -100
- package/source/net/namespace.mjs +1 -3
- package/source/net/webconnect/message.mjs +6 -8
- package/source/net/webconnect/namespace.mjs +1 -3
- package/source/net/webconnect.mjs +28 -39
- package/source/text/formatter.mjs +44 -55
- package/source/types/base.mjs +16 -26
- package/source/types/basewithoptions.mjs +8 -14
- package/source/types/binary.mjs +4 -5
- package/source/types/dataurl.mjs +19 -27
- package/source/types/global.mjs +14 -26
- package/source/types/id.mjs +4 -6
- package/source/types/is.mjs +11 -16
- package/source/types/mediatype.mjs +29 -44
- package/source/types/namespace.mjs +0 -1
- package/source/types/node.mjs +16 -22
- package/source/types/nodelist.mjs +10 -14
- package/source/types/noderecursiveiterator.mjs +11 -14
- package/source/types/observablequeue.mjs +13 -16
- package/source/types/observer.mjs +16 -23
- package/source/types/observerlist.mjs +18 -21
- package/source/types/proxyobserver.mjs +24 -37
- package/source/types/queue.mjs +8 -13
- package/source/types/randomid.mjs +10 -10
- package/source/types/regex.mjs +3 -5
- package/source/types/stack.mjs +4 -8
- package/source/types/tokenlist.mjs +24 -31
- package/source/types/typeof.mjs +5 -7
- package/source/types/uniquequeue.mjs +8 -13
- package/source/types/uuid.mjs +18 -25
- package/source/types/validate.mjs +26 -27
- package/source/types/version.mjs +17 -25
- package/source/util/clone.mjs +23 -32
- package/source/util/comparator.mjs +7 -15
- package/source/util/deadmansswitch.mjs +16 -23
- package/source/util/freeze.mjs +5 -7
- package/source/util/namespace.mjs +1 -1
- package/source/util/processing.mjs +33 -39
- package/source/util/trimspaces.mjs +17 -24
- package/test/cases/monster.mjs +1 -1
package/source/dom/template.mjs
CHANGED
@@ -5,13 +5,13 @@
|
|
5
5
|
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
6
6
|
*/
|
7
7
|
|
8
|
-
import {Base} from
|
9
|
-
import {getGlobalFunction, getGlobalObject} from
|
10
|
-
import {validateInstance, validateString} from "../types/validate.mjs";
|
11
|
-
import {ATTRIBUTE_TEMPLATE_PREFIX} from "./constants.mjs";
|
12
|
-
import {getDocumentTheme} from "./theme.mjs";
|
13
|
-
import {instanceSymbol} from
|
14
|
-
export {Template}
|
8
|
+
import { Base } from "../types/base.mjs";
|
9
|
+
import { getGlobalFunction, getGlobalObject } from "../types/global.mjs";
|
10
|
+
import { validateInstance, validateString } from "../types/validate.mjs";
|
11
|
+
import { ATTRIBUTE_TEMPLATE_PREFIX } from "./constants.mjs";
|
12
|
+
import { getDocumentTheme } from "./theme.mjs";
|
13
|
+
import { instanceSymbol } from "../constants.mjs";
|
14
|
+
export { Template };
|
15
15
|
|
16
16
|
/**
|
17
17
|
* The template class provides methods for creating templates.
|
@@ -32,7 +32,7 @@ class Template extends Base {
|
|
32
32
|
*/
|
33
33
|
constructor(template) {
|
34
34
|
super();
|
35
|
-
const HTMLTemplateElement = getGlobalFunction(
|
35
|
+
const HTMLTemplateElement = getGlobalFunction("HTMLTemplateElement");
|
36
36
|
validateInstance(template, HTMLTemplateElement);
|
37
37
|
this.template = template;
|
38
38
|
}
|
@@ -46,7 +46,6 @@ class Template extends Base {
|
|
46
46
|
return Symbol.for("@schukai/monster/dom/resource/template");
|
47
47
|
}
|
48
48
|
|
49
|
-
|
50
49
|
/**
|
51
50
|
*
|
52
51
|
* @returns {HTMLTemplateElement}
|
@@ -63,7 +62,6 @@ class Template extends Base {
|
|
63
62
|
createDocumentFragment() {
|
64
63
|
return this.template.content.cloneNode(true);
|
65
64
|
}
|
66
|
-
|
67
65
|
}
|
68
66
|
|
69
67
|
/**
|
@@ -132,20 +130,17 @@ class Template extends Base {
|
|
132
130
|
export function findDocumentTemplate(id, currentNode) {
|
133
131
|
validateString(id);
|
134
132
|
|
135
|
-
const document = getGlobalObject(
|
136
|
-
const HTMLTemplateElement = getGlobalFunction(
|
137
|
-
const DocumentFragment = getGlobalFunction(
|
138
|
-
const Document = getGlobalFunction(
|
139
|
-
|
133
|
+
const document = getGlobalObject("document");
|
134
|
+
const HTMLTemplateElement = getGlobalFunction("HTMLTemplateElement");
|
135
|
+
const DocumentFragment = getGlobalFunction("DocumentFragment");
|
136
|
+
const Document = getGlobalFunction("Document");
|
140
137
|
|
141
138
|
let prefixID;
|
142
139
|
|
143
140
|
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
|
144
|
-
|
145
141
|
if (currentNode instanceof Node) {
|
146
|
-
|
147
142
|
if (currentNode.hasAttribute(ATTRIBUTE_TEMPLATE_PREFIX)) {
|
148
|
-
prefixID = currentNode.getAttribute(ATTRIBUTE_TEMPLATE_PREFIX)
|
143
|
+
prefixID = currentNode.getAttribute(ATTRIBUTE_TEMPLATE_PREFIX);
|
149
144
|
}
|
150
145
|
|
151
146
|
currentNode = currentNode.getRootNode();
|
@@ -153,7 +148,6 @@ export function findDocumentTemplate(id, currentNode) {
|
|
153
148
|
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
|
154
149
|
currentNode = currentNode.ownerDocument;
|
155
150
|
}
|
156
|
-
|
157
151
|
}
|
158
152
|
|
159
153
|
if (!(currentNode instanceof Document || currentNode instanceof DocumentFragment)) {
|
@@ -162,10 +156,10 @@ export function findDocumentTemplate(id, currentNode) {
|
|
162
156
|
}
|
163
157
|
|
164
158
|
let template;
|
165
|
-
let theme = getDocumentTheme()
|
159
|
+
let theme = getDocumentTheme();
|
166
160
|
|
167
161
|
if (prefixID) {
|
168
|
-
let themedPrefixID = prefixID
|
162
|
+
let themedPrefixID = `${prefixID}-${id}-${theme.getName()}`;
|
169
163
|
|
170
164
|
// current + themedPrefixID
|
171
165
|
template = currentNode.getElementById(themedPrefixID);
|
@@ -180,7 +174,7 @@ export function findDocumentTemplate(id, currentNode) {
|
|
180
174
|
}
|
181
175
|
}
|
182
176
|
|
183
|
-
let themedID = id
|
177
|
+
let themedID = `${id}-${theme.getName()}`;
|
184
178
|
|
185
179
|
// current + themedID
|
186
180
|
template = currentNode.getElementById(themedID);
|
@@ -206,6 +200,5 @@ export function findDocumentTemplate(id, currentNode) {
|
|
206
200
|
return new Template(template);
|
207
201
|
}
|
208
202
|
|
209
|
-
throw new Error(
|
203
|
+
throw new Error(`template ${id} not found.`);
|
210
204
|
}
|
211
|
-
|
package/source/dom/theme.mjs
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
* License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
|
6
6
|
*/
|
7
7
|
|
8
|
-
import {Base} from
|
9
|
-
import {getGlobalObject} from
|
10
|
-
import {validateString} from "../types/validate.mjs";
|
11
|
-
import {ATTRIBUTE_THEME_NAME, DEFAULT_THEME} from "./constants.mjs";
|
12
|
-
import {instanceSymbol} from
|
13
|
-
export {Theme, getDocumentTheme}
|
8
|
+
import { Base } from "../types/base.mjs";
|
9
|
+
import { getGlobalObject } from "../types/global.mjs";
|
10
|
+
import { validateString } from "../types/validate.mjs";
|
11
|
+
import { ATTRIBUTE_THEME_NAME, DEFAULT_THEME } from "./constants.mjs";
|
12
|
+
import { instanceSymbol } from "../constants.mjs";
|
13
|
+
export { Theme, getDocumentTheme };
|
14
14
|
|
15
15
|
/**
|
16
16
|
* The Theme class provides the functionality for the theme.
|
@@ -23,7 +23,6 @@ export {Theme, getDocumentTheme}
|
|
23
23
|
* @summary A theme class
|
24
24
|
*/
|
25
25
|
class Theme extends Base {
|
26
|
-
|
27
26
|
/**
|
28
27
|
*
|
29
28
|
* @param name
|
@@ -44,7 +43,6 @@ class Theme extends Base {
|
|
44
43
|
return Symbol.for("@schukai/monster/dom/theme");
|
45
44
|
}
|
46
45
|
|
47
|
-
|
48
46
|
/**
|
49
47
|
*
|
50
48
|
* @returns {string}
|
@@ -52,7 +50,6 @@ class Theme extends Base {
|
|
52
50
|
getName() {
|
53
51
|
return this.name;
|
54
52
|
}
|
55
|
-
|
56
53
|
}
|
57
54
|
|
58
55
|
/**
|
@@ -73,10 +70,10 @@ class Theme extends Base {
|
|
73
70
|
* @since 1.7.0
|
74
71
|
*/
|
75
72
|
function getDocumentTheme() {
|
76
|
-
let document = getGlobalObject(
|
73
|
+
let document = getGlobalObject("document");
|
77
74
|
let name = DEFAULT_THEME;
|
78
75
|
|
79
|
-
let element = document.querySelector(
|
76
|
+
let element = document.querySelector("html");
|
80
77
|
if (element instanceof HTMLElement) {
|
81
78
|
let theme = element.getAttribute(ATTRIBUTE_THEME_NAME);
|
82
79
|
if (theme) {
|
@@ -85,5 +82,4 @@ function getDocumentTheme() {
|
|
85
82
|
}
|
86
83
|
|
87
84
|
return new Theme(name);
|
88
|
-
|
89
85
|
}
|