@schukai/monster 4.36.0 → 4.37.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.md CHANGED
@@ -2,6 +2,22 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.37.1] - 2025-07-19
6
+
7
+ ### Bug Fixes
8
+
9
+ - add import statement
10
+
11
+
12
+
13
+ ## [4.37.0] - 2025-07-19
14
+
15
+ ### Add Features
16
+
17
+ - add resetAttributeError function
18
+
19
+
20
+
5
21
  ## [4.36.0] - 2025-07-19
6
22
 
7
23
  ### Add Features
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.2","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.36.0"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.2","@popperjs/core":"^2.11.8"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","homepage":"https://monsterjs.org/","keywords":["framework","web","dom","css","sass","mobile-first","app","front-end","templates","schukai","core","shopcloud","alvine","monster","buildmap","stack","observer","observable","uuid","node","nodelist","css-in-js","logger","log","theme"],"license":"AGPL 3.0","main":"source/monster.mjs","module":"source/monster.mjs","name":"@schukai/monster","repository":{"type":"git","url":"https://gitlab.schukai.com/oss/libraries/javascript/monster.git"},"type":"module","version":"4.37.1"}
@@ -27,7 +27,11 @@ import {
27
27
  getSlottedElements,
28
28
  registerCustomElement,
29
29
  } from "../../dom/customelement.mjs";
30
- import { addErrorAttribute, removeErrorAttribute } from "../../dom/error.mjs";
30
+ import {
31
+ resetErrorAttribute,
32
+ addErrorAttribute,
33
+ removeErrorAttribute,
34
+ } from "../../dom/error.mjs";
31
35
  import {
32
36
  findTargetElementFromEvent,
33
37
  fireCustomEvent,
@@ -579,7 +583,7 @@ class Select extends CustomControl {
579
583
  this.setOption("messages.total", "");
580
584
  this.setOption("messages.summary", "");
581
585
 
582
- removeErrorAttribute(this);
586
+ resetErrorAttribute.call(this);
583
587
 
584
588
  this[lazyLoadDoneSymbol] = false;
585
589
  this[runLookupOnceSymbol] = false;
@@ -15,7 +15,15 @@
15
15
  import { validateInstance, validateString } from "../types/validate.mjs";
16
16
  import { ATTRIBUTE_ERRORMESSAGE } from "./constants.mjs";
17
17
 
18
- export { addErrorAttribute, removeErrorAttribute };
18
+ export { resetErrorAttribute, addErrorAttribute, removeErrorAttribute };
19
+
20
+ function resetErrorAttribute(element) {
21
+ validateInstance(element, HTMLElement);
22
+ if (element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
23
+ element.removeAttribute(ATTRIBUTE_ERRORMESSAGE);
24
+ }
25
+ return element;
26
+ }
19
27
 
20
28
  /**
21
29
  * This method can be used to add an error message to an element.
@@ -28,45 +36,45 @@ export { addErrorAttribute, removeErrorAttribute };
28
36
  * @return {HTMLElement}
29
37
  */
30
38
  function addErrorAttribute(element, message) {
31
- validateInstance(element, HTMLElement);
39
+ validateInstance(element, HTMLElement);
32
40
 
33
- if (message instanceof Error) {
34
- message = message.message;
35
- }
41
+ if (message instanceof Error) {
42
+ message = message.message;
43
+ }
36
44
 
37
- if (typeof message !== "string") {
38
- if (typeof message === "object" && message !== null) {
39
- if (typeof message.toString === "function") {
40
- message = message.toString();
41
- } else {
42
- message = JSON.stringify(message);
43
- }
44
- } else {
45
- message = String(message);
46
- }
47
- }
45
+ if (typeof message !== "string") {
46
+ if (typeof message === "object" && message !== null) {
47
+ if (typeof message.toString === "function") {
48
+ message = message.toString();
49
+ } else {
50
+ message = JSON.stringify(message);
51
+ }
52
+ } else {
53
+ message = String(message);
54
+ }
55
+ }
48
56
 
49
- validateString(message);
57
+ validateString(message);
50
58
 
51
- if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
52
- element.setAttribute(ATTRIBUTE_ERRORMESSAGE, message);
53
- return element;
54
- }
59
+ if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
60
+ element.setAttribute(ATTRIBUTE_ERRORMESSAGE, message);
61
+ return element;
62
+ }
55
63
 
56
- const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
57
- const list = current.split("::");
64
+ const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
65
+ const list = current.split("::");
58
66
 
59
- for (let i = 0; i < list.length; i++) {
60
- if (list[i] === message) {
61
- return element;
62
- }
63
- }
67
+ for (let i = 0; i < list.length; i++) {
68
+ if (list[i] === message) {
69
+ return element;
70
+ }
71
+ }
64
72
 
65
- list.push(message);
73
+ list.push(message);
66
74
 
67
- element.setAttribute(ATTRIBUTE_ERRORMESSAGE, list.join("::"));
75
+ element.setAttribute(ATTRIBUTE_ERRORMESSAGE, list.join("::"));
68
76
 
69
- return element;
77
+ return element;
70
78
  }
71
79
 
72
80
  /**
@@ -80,20 +88,20 @@ function addErrorAttribute(element, message) {
80
88
  * @return {HTMLElement}
81
89
  */
82
90
  function removeErrorAttribute(element, message) {
83
- validateInstance(element, HTMLElement);
84
- validateString(message);
91
+ validateInstance(element, HTMLElement);
92
+ validateString(message);
85
93
 
86
- if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
87
- return element;
88
- }
94
+ if (!element.hasAttribute(ATTRIBUTE_ERRORMESSAGE)) {
95
+ return element;
96
+ }
89
97
 
90
- const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
91
- const list = current.split("::");
92
- const newList = list.filter(function (token) {
93
- return token !== message;
94
- });
98
+ const current = element.getAttribute(ATTRIBUTE_ERRORMESSAGE);
99
+ const list = current.split("::");
100
+ const newList = list.filter(function (token) {
101
+ return token !== message;
102
+ });
95
103
 
96
- element.setAttribute(ATTRIBUTE_ERRORMESSAGE, newList.join("::"));
104
+ element.setAttribute(ATTRIBUTE_ERRORMESSAGE, newList.join("::"));
97
105
 
98
- return element;
106
+ return element;
99
107
  }
@@ -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("4.32.2");
159
+ monsterVersion = new Version("4.36.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("4.32.2")
10
+ monsterVersion = new Version("4.36.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 4.32.2</h1>
13
- <div id="lastupdate" style='font-size:0.7em'>last update Sa 12. Jul 18:12:57 CEST 2025</div>
12
+ <h1 style='margin-bottom: 0.1em;'>Monster 4.36.0</h1>
13
+ <div id="lastupdate" style='font-size:0.7em'>last update Sa 19. Jul 18:39:06 CEST 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>