@schukai/monster 3.107.0 → 3.108.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.
@@ -12,120 +12,115 @@
12
12
  * SPDX-License-Identifier: AGPL-3.0
13
13
  */
14
14
 
15
- import {Formatter} from "./formatter.mjs";
16
- import {getLocaleOfDocument} from "../dom/locale.mjs";
17
- import {Translations} from "./translations.mjs";
15
+ import { Formatter } from "./formatter.mjs";
16
+ import { getLocaleOfDocument } from "../dom/locale.mjs";
17
+ import { Translations } from "./translations.mjs";
18
18
 
19
- export {getInternalLocalizationMessage};
19
+ export { getInternalLocalizationMessage };
20
20
 
21
21
  let internalTranslations = null;
22
22
  getInternalTranslations();
23
23
 
24
-
25
24
  function getInternalTranslations() {
26
-
27
- if (internalTranslations) {
28
- return internalTranslations;
29
- }
30
-
31
- let locale = "en";
32
- try {
33
- let locale = getLocaleOfDocument();
34
- } catch (error) {
35
- }
36
-
37
- let messages = {};
38
-
39
- switch (locale.language) {
40
- case "de":
41
- messages = {
42
- "the-response-does-not-contain-an-accepted-status": `Der Server hat die Anfrage nicht akzeptiert (Status \${status}).`,
43
- "the-response-does-not-contain-a-valid-json": `Die Antwort des Servers ist kein gültiges JSON (actual=\${actual}).`,
44
- };
45
- break;
46
- case "es":
47
- messages = {
48
- "the-response-does-not-contain-an-accepted-status": `El servidor no ha aceptado la solicitud (Estado \${status}).`,
49
- "the-response-does-not-contain-a-valid-json": `La respuesta del servidor no es un JSON válido (actual=\${actual}).`,
50
- };
51
- break;
52
- case "zh":
53
- messages = {
54
- "the-response-does-not-contain-an-accepted-status": `服务器未接受请求(状态 \${status})。`,
55
- "the-response-does-not-contain-a-valid-json": `服务器响应不是有效的JSON(实际=\${actual})。`,
56
- };
57
- break;
58
- case "fr":
59
- messages = {
60
- "the-response-does-not-contain-an-accepted-status": `Le serveur n'a pas accepté la demande (Statut \${status}).`,
61
- "the-response-does-not-contain-a-valid-json": `La réponse du serveur n'est pas un JSON valide (actuel=\${actual}).`,
62
- };
63
- break;
64
- case "it":
65
- messages = {
66
- "the-response-does-not-contain-an-accepted-status": `Il server non ha accettato la richiesta (Stato \${status}).`,
67
- "the-response-does-not-contain-a-valid-json": `La risposta del server non è un JSON valido (attuale=\${actual}).`,
68
- };
69
- break;
70
- case "nl":
71
- messages = {
72
- "the-response-does-not-contain-an-accepted-status": `De server heeft het verzoek niet geaccepteerd (Status \${status}).`,
73
- "the-response-does-not-contain-a-valid-json": `De serverrespons is geen geldige JSON (actueel=\${actual}).`,
74
- };
75
- break;
76
- case "sv":
77
- messages = {
78
- "the-response-does-not-contain-an-accepted-status": `Servern accepterade inte begäran (Status \${status}).`,
79
- "the-response-does-not-contain-a-valid-json": `Serverns svar är inte en giltig JSON (faktisk=\${actual}).`,
80
- };
81
- break;
82
- case "pl":
83
- messages = {
84
- "the-response-does-not-contain-an-accepted-status": `Serwer nie zaakceptował żądania (Status \${status}).`,
85
- "the-response-does-not-contain-a-valid-json": `Odpowiedź serwera nie jest prawidłowym JSON-em (aktualne=\${actual}).`,
86
- };
87
- break;
88
- case "da":
89
- messages = {
90
- "the-response-does-not-contain-an-accepted-status": `Serveren accepterede ikke forespørgslen (Status \${status}).`,
91
- "the-response-does-not-contain-a-valid-json": `Serverens svar er ikke en gyldig JSON (aktuel=\${actual}).`,
92
- };
93
- break;
94
- case "fi":
95
- messages = {
96
- "the-response-does-not-contain-an-accepted-status": `Palvelin ei hyväksynyt pyyntöä (Tila \${status}).`,
97
- "the-response-does-not-contain-a-valid-json": `Palvelimen vastaus ei ole kelvollinen JSON (todellinen=\${actual}).`,
98
- };
99
- break;
100
- case "no":
101
- messages = {
102
- "the-response-does-not-contain-an-accepted-status": `Serveren aksepterte ikke forespørselen (Status \${status}).`,
103
- "the-response-does-not-contain-a-valid-json": `Serverens respons er ikke en gyldig JSON (faktisk=\${actual}).`,
104
- };
105
- break;
106
- case "cs":
107
- messages = {
108
- "the-response-does-not-contain-an-accepted-status": `Server nepřijal požadavek (Stav \${status}).`,
109
- "the-response-does-not-contain-a-valid-json": `Odpověď serveru není platný JSON (skutečný=\${actual}).`,
110
- };
111
- break;
112
- default: // English
113
- messages = {
114
- "the-response-does-not-contain-an-accepted-status": `The server did not accept the request (Status \${status}).`,
115
- "the-response-does-not-contain-a-valid-json": `The server response is not a valid JSON (actual=\${actual}).`,
116
- };
117
- }
118
-
119
-
120
- const translation = new Translations(locale);
121
- translation.assignTranslations(messages);
122
-
123
- internalTranslations = translation;
124
-
125
- return translation
25
+ if (internalTranslations) {
26
+ return internalTranslations;
27
+ }
28
+
29
+ let locale = "en";
30
+ try {
31
+ let locale = getLocaleOfDocument();
32
+ } catch (error) {}
33
+
34
+ let messages = {};
35
+
36
+ switch (locale.language) {
37
+ case "de":
38
+ messages = {
39
+ "the-response-does-not-contain-an-accepted-status": `Der Server hat die Anfrage nicht akzeptiert (Status \${status}).`,
40
+ "the-response-does-not-contain-a-valid-json": `Die Antwort des Servers ist kein gültiges JSON (actual=\${actual}).`,
41
+ };
42
+ break;
43
+ case "es":
44
+ messages = {
45
+ "the-response-does-not-contain-an-accepted-status": `El servidor no ha aceptado la solicitud (Estado \${status}).`,
46
+ "the-response-does-not-contain-a-valid-json": `La respuesta del servidor no es un JSON válido (actual=\${actual}).`,
47
+ };
48
+ break;
49
+ case "zh":
50
+ messages = {
51
+ "the-response-does-not-contain-an-accepted-status": `服务器未接受请求(状态 \${status})。`,
52
+ "the-response-does-not-contain-a-valid-json": `服务器响应不是有效的JSON(实际=\${actual})。`,
53
+ };
54
+ break;
55
+ case "fr":
56
+ messages = {
57
+ "the-response-does-not-contain-an-accepted-status": `Le serveur n'a pas accepté la demande (Statut \${status}).`,
58
+ "the-response-does-not-contain-a-valid-json": `La réponse du serveur n'est pas un JSON valide (actuel=\${actual}).`,
59
+ };
60
+ break;
61
+ case "it":
62
+ messages = {
63
+ "the-response-does-not-contain-an-accepted-status": `Il server non ha accettato la richiesta (Stato \${status}).`,
64
+ "the-response-does-not-contain-a-valid-json": `La risposta del server non è un JSON valido (attuale=\${actual}).`,
65
+ };
66
+ break;
67
+ case "nl":
68
+ messages = {
69
+ "the-response-does-not-contain-an-accepted-status": `De server heeft het verzoek niet geaccepteerd (Status \${status}).`,
70
+ "the-response-does-not-contain-a-valid-json": `De serverrespons is geen geldige JSON (actueel=\${actual}).`,
71
+ };
72
+ break;
73
+ case "sv":
74
+ messages = {
75
+ "the-response-does-not-contain-an-accepted-status": `Servern accepterade inte begäran (Status \${status}).`,
76
+ "the-response-does-not-contain-a-valid-json": `Serverns svar är inte en giltig JSON (faktisk=\${actual}).`,
77
+ };
78
+ break;
79
+ case "pl":
80
+ messages = {
81
+ "the-response-does-not-contain-an-accepted-status": `Serwer nie zaakceptował żądania (Status \${status}).`,
82
+ "the-response-does-not-contain-a-valid-json": `Odpowiedź serwera nie jest prawidłowym JSON-em (aktualne=\${actual}).`,
83
+ };
84
+ break;
85
+ case "da":
86
+ messages = {
87
+ "the-response-does-not-contain-an-accepted-status": `Serveren accepterede ikke forespørgslen (Status \${status}).`,
88
+ "the-response-does-not-contain-a-valid-json": `Serverens svar er ikke en gyldig JSON (aktuel=\${actual}).`,
89
+ };
90
+ break;
91
+ case "fi":
92
+ messages = {
93
+ "the-response-does-not-contain-an-accepted-status": `Palvelin ei hyväksynyt pyyntöä (Tila \${status}).`,
94
+ "the-response-does-not-contain-a-valid-json": `Palvelimen vastaus ei ole kelvollinen JSON (todellinen=\${actual}).`,
95
+ };
96
+ break;
97
+ case "no":
98
+ messages = {
99
+ "the-response-does-not-contain-an-accepted-status": `Serveren aksepterte ikke forespørselen (Status \${status}).`,
100
+ "the-response-does-not-contain-a-valid-json": `Serverens respons er ikke en gyldig JSON (faktisk=\${actual}).`,
101
+ };
102
+ break;
103
+ case "cs":
104
+ messages = {
105
+ "the-response-does-not-contain-an-accepted-status": `Server nepřijal požadavek (Stav \${status}).`,
106
+ "the-response-does-not-contain-a-valid-json": `Odpověď serveru není platný JSON (skutečný=\${actual}).`,
107
+ };
108
+ break;
109
+ default: // English
110
+ messages = {
111
+ "the-response-does-not-contain-an-accepted-status": `The server did not accept the request (Status \${status}).`,
112
+ "the-response-does-not-contain-a-valid-json": `The server response is not a valid JSON (actual=\${actual}).`,
113
+ };
114
+ }
115
+
116
+ const translation = new Translations(locale);
117
+ translation.assignTranslations(messages);
118
+
119
+ internalTranslations = translation;
120
+
121
+ return translation;
126
122
  }
127
123
 
128
-
129
124
  /**
130
125
  * Returns the internal localization message.
131
126
  * @param message
@@ -133,7 +128,6 @@ function getInternalTranslations() {
133
128
  */
134
129
 
135
130
  function getInternalLocalizationMessage(message) {
136
- const formatter = new Formatter({}, getInternalTranslations());
137
- return formatter.format(message);
138
-
131
+ const formatter = new Formatter({}, getInternalTranslations());
132
+ return formatter.format(message);
139
133
  }
@@ -36,11 +36,9 @@ export const currentSupportedLanguages = [
36
36
  "da", // Danish
37
37
  "fi", // Finnish
38
38
  "no", // Norwegian
39
- "cs" // Czech
39
+ "cs", // Czech
40
40
  ];
41
41
 
42
-
43
-
44
42
  export const languages = {
45
43
  en: "English",
46
44
  "en-GB": "English (United Kingdom)",
@@ -199,6 +199,7 @@ export * from "./types/queue.mjs";
199
199
  export * from "./types/noderecursiveiterator.mjs";
200
200
  export * from "./i18n/time-ago.mjs";
201
201
  export * from "./i18n/formatter.mjs";
202
+ export * from "./i18n/internal.mjs";
202
203
  export * from "./i18n/locale.mjs";
203
204
  export * from "./i18n/provider.mjs";
204
205
  export * from "./i18n/providers/fetch.mjs";
@@ -13,12 +13,12 @@
13
13
  */
14
14
 
15
15
  import {
16
- validateFunction,
17
- validateObject,
18
- validateString,
16
+ validateFunction,
17
+ validateObject,
18
+ validateString,
19
19
  } from "./validate.mjs";
20
20
 
21
- export {getGlobal, getGlobalObject, getGlobalFunction};
21
+ export { getGlobal, getGlobalObject, getGlobalFunction };
22
22
 
23
23
  /**
24
24
  * @type {object}
@@ -31,40 +31,39 @@ let globalReference;
31
31
  * @throws {Error} unsupported environment.
32
32
  */
33
33
  (function () {
34
- if (typeof globalThis === "object") {
35
- globalReference = globalThis;
36
- return;
37
- }
34
+ if (typeof globalThis === "object") {
35
+ globalReference = globalThis;
36
+ return;
37
+ }
38
38
 
39
- if (typeof self !== "undefined") {
40
- globalReference = self;
41
- return;
42
- } else if (typeof window !== "undefined") {
43
- globalReference = window;
44
- return;
45
- }
39
+ if (typeof self !== "undefined") {
40
+ globalReference = self;
41
+ return;
42
+ } else if (typeof window !== "undefined") {
43
+ globalReference = window;
44
+ return;
45
+ }
46
46
 
47
- Object.defineProperty(Object.prototype, "__monster__", {
48
- get: function () {
49
- return this;
50
- },
51
- configurable: true,
52
- });
47
+ Object.defineProperty(Object.prototype, "__monster__", {
48
+ get: function () {
49
+ return this;
50
+ },
51
+ configurable: true,
52
+ });
53
53
 
54
- if (typeof __monster__ === "object") {
55
- __monster__.globalThis = __monster__;
56
- delete Object.prototype.__monster__;
54
+ if (typeof __monster__ === "object") {
55
+ __monster__.globalThis = __monster__;
56
+ delete Object.prototype.__monster__;
57
57
 
58
- globalReference = globalThis;
59
- return;
60
- }
58
+ globalReference = globalThis;
59
+ return;
60
+ }
61
61
 
62
- try {
63
- globalReference = Function("return this")();
64
- } catch (e) {
65
- }
62
+ try {
63
+ globalReference = Function("return this")();
64
+ } catch (e) {}
66
65
 
67
- throw new Error("unsupported environment.");
66
+ throw new Error("unsupported environment.");
68
67
  })();
69
68
 
70
69
  /**
@@ -77,7 +76,7 @@ let globalReference;
77
76
  * @return {object} globalThis
78
77
  */
79
78
  function getGlobal() {
80
- return globalReference;
79
+ return globalReference;
81
80
  }
82
81
 
83
82
  /**
@@ -112,12 +111,12 @@ function getGlobal() {
112
111
  * @throws {TypeError} value is not a string
113
112
  */
114
113
  function getGlobalObject(name) {
115
- validateString(name);
116
- const o = globalReference?.[name];
117
- if (typeof o === "undefined")
118
- throw new Error(`the object ${name} is not defined`);
119
- validateObject(o);
120
- return o;
114
+ validateString(name);
115
+ const o = globalReference?.[name];
116
+ if (typeof o === "undefined")
117
+ throw new Error(`the object ${name} is not defined`);
118
+ validateObject(o);
119
+ return o;
121
120
  }
122
121
 
123
122
  /**
@@ -150,11 +149,11 @@ function getGlobalObject(name) {
150
149
  * @throws {TypeError} value is not a string
151
150
  */
152
151
  function getGlobalFunction(name) {
153
- validateString(name);
154
- const f = globalReference?.[name];
155
- if (typeof f === "undefined") {
156
- throw new Error(`the function ${name} is not defined`);
157
- }
158
- validateFunction(f);
159
- return f;
152
+ validateString(name);
153
+ const f = globalReference?.[name];
154
+ if (typeof f === "undefined") {
155
+ throw new Error(`the function ${name} is not defined`);
156
+ }
157
+ validateFunction(f);
158
+ return f;
160
159
  }
@@ -156,7 +156,7 @@ function getMonsterVersion() {
156
156
  }
157
157
 
158
158
  /** don't touch, replaced by make with package.json version */
159
- monsterVersion = new Version("3.104.1");
159
+ monsterVersion = new Version("3.107.0");
160
160
 
161
161
  return monsterVersion;
162
162
  }
@@ -7,7 +7,7 @@ describe('Monster', function () {
7
7
  let monsterVersion
8
8
 
9
9
  /** don´t touch, replaced by make with package.json version */
10
- monsterVersion = new Version("3.104.1")
10
+ monsterVersion = new Version("3.107.0")
11
11
 
12
12
  let m = getMonsterVersion();
13
13
 
@@ -9,8 +9,8 @@
9
9
  </head>
10
10
  <body>
11
11
  <div id="headline" style="display: flex;align-items: center;justify-content: center;flex-direction: column;">
12
- <h1 style='margin-bottom: 0.1em;'>Monster 3.104.1</h1>
13
- <div id="lastupdate" style='font-size:0.7em'>last update Mi 5. Feb 19:28:33 CET 2025</div>
12
+ <h1 style='margin-bottom: 0.1em;'>Monster 3.107.0</h1>
13
+ <div id="lastupdate" style='font-size:0.7em'>last update Di 11. Feb 14:09:24 CET 2025</div>
14
14
  </div>
15
15
  <div id="mocha-errors"
16
16
  style="color: red;font-weight: bold;display: flex;align-items: center;justify-content: center;flex-direction: column;margin:20px;"></div>