@schukai/monster 4.32.0 → 4.32.2
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 +16 -0
- package/package.json +1 -1
- package/source/components/content/viewer/html.mjs +111 -111
- package/source/components/content/viewer/message.mjs +763 -573
- package/source/components/content/viewer/style/html.pcss +25 -2
- package/source/components/content/viewer/stylesheet/html.mjs +7 -14
- package/source/components/content/viewer/stylesheet/message.mjs +6 -13
- package/source/components/form/select.mjs +2 -0
- package/source/components/notify/style/message.pcss +1 -1
- package/source/components/notify/stylesheet/message.mjs +7 -14
package/CHANGELOG.md
CHANGED
@@ -2,6 +2,22 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
+
## [4.32.2] - 2025-07-12
|
6
|
+
|
7
|
+
### Bug Fixes
|
8
|
+
|
9
|
+
- Update Message Viewer - fetch URL and improve error handling
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
## [4.32.1] - 2025-07-08
|
14
|
+
|
15
|
+
### Bug Fixes
|
16
|
+
|
17
|
+
- Improve select reset functionality with additional hiding logic
|
18
|
+
|
19
|
+
|
20
|
+
|
5
21
|
## [4.32.0] - 2025-07-08
|
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.32.
|
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.32.2"}
|
@@ -14,10 +14,10 @@
|
|
14
14
|
|
15
15
|
import { instanceSymbol } from "../../../constants.mjs";
|
16
16
|
import {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
assembleMethodSymbol,
|
18
|
+
CustomElement,
|
19
|
+
registerCustomElement,
|
20
|
+
updaterTransformerMethodsSymbol,
|
21
21
|
} from "../../../dom/customelement.mjs";
|
22
22
|
import { HtmlStyleSheet } from "./stylesheet/html.mjs";
|
23
23
|
import { sanitizeHtml } from "../../../dom/sanitize-html.mjs";
|
@@ -38,106 +38,106 @@ const htmlContentElementSymbol = Symbol("htmlContentElement");
|
|
38
38
|
* @summary An HTML content component that can display sanitized HTML.
|
39
39
|
*/
|
40
40
|
class HtmlContent extends CustomElement {
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
41
|
+
/**
|
42
|
+
* This method is called by the `instanceof` operator.
|
43
|
+
* @return {symbol}
|
44
|
+
*/
|
45
|
+
static get [instanceSymbol]() {
|
46
|
+
return Symbol.for(
|
47
|
+
"@schukai/monster/components/content/viewer/html-content@@instance",
|
48
|
+
);
|
49
|
+
}
|
50
|
+
|
51
|
+
/**
|
52
|
+
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
53
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
54
|
+
*
|
55
|
+
* The individual configuration values can be found in the table.
|
56
|
+
*
|
57
|
+
* @property {Object} templates Template definitions
|
58
|
+
* @property {string} templates.main Main template
|
59
|
+
* @property {string} content The HTML string to be displayed.
|
60
|
+
* @property {Object} features Features to enable or disable specific functionalities.
|
61
|
+
* @property {boolean} features.sanitize Whether to sanitize the HTML content (removes scripts, etc.). Defaults to true.
|
62
|
+
* @property {object} sanitize Sanitization options.
|
63
|
+
* @property {function} sanitize.callback A callback function to sanitize the HTML content. Defaults to a built-in sanitizer. You can use libraries like DOMPurify for this purpose.
|
64
|
+
*/
|
65
|
+
get defaults() {
|
66
|
+
return Object.assign({}, super.defaults, {
|
67
|
+
templates: {
|
68
|
+
main: getTemplate(),
|
69
|
+
},
|
70
|
+
content: "", // Default content is an empty slot
|
71
|
+
|
72
|
+
features: {
|
73
|
+
sanitize: true,
|
74
|
+
},
|
75
|
+
|
76
|
+
sanitize: {
|
77
|
+
callback: sanitizeHtml.bind(this),
|
78
|
+
},
|
79
|
+
});
|
80
|
+
}
|
81
|
+
|
82
|
+
/**
|
83
|
+
* Returns the updater transformer methods for this component.
|
84
|
+
* @returns {{sanitizeHtml: ((function(*): (*))|*)}}
|
85
|
+
*/
|
86
|
+
[updaterTransformerMethodsSymbol]() {
|
87
|
+
return {
|
88
|
+
sanitizeHtml: (value) => {
|
89
|
+
if (this.getOption("features.sanitize")) {
|
90
|
+
return this.getOption("sanitize.callback")(value);
|
91
|
+
}
|
92
|
+
return value;
|
93
|
+
},
|
94
|
+
};
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Sets the content of the HtmlContent component.
|
99
|
+
* @param content
|
100
|
+
* @returns {HtmlContent}
|
101
|
+
*/
|
102
|
+
setContent(content) {
|
103
|
+
this.setOption("content", content);
|
104
|
+
return this;
|
105
|
+
}
|
106
|
+
|
107
|
+
/**
|
108
|
+
* @return {string}
|
109
|
+
*/
|
110
|
+
static getTag() {
|
111
|
+
return "monster-html-content";
|
112
|
+
}
|
113
|
+
|
114
|
+
/**
|
115
|
+
* @return {HtmlContent}
|
116
|
+
*/
|
117
|
+
[assembleMethodSymbol]() {
|
118
|
+
super[assembleMethodSymbol]();
|
119
|
+
initControlReferences.call(this);
|
120
|
+
grabChildren.call(this);
|
121
|
+
}
|
122
|
+
|
123
|
+
/**
|
124
|
+
* @return {Array}
|
125
|
+
*/
|
126
|
+
static getCSSStyleSheet() {
|
127
|
+
return [HtmlStyleSheet];
|
128
|
+
}
|
129
129
|
}
|
130
130
|
|
131
131
|
function grabChildren() {
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
132
|
+
// If there are children, we grab them and set the content
|
133
|
+
if (this.children.length > 0) {
|
134
|
+
const content = Array.from(this.children)
|
135
|
+
.map((child) => child.outerHTML)
|
136
|
+
.join("");
|
137
|
+
this.setContent(content);
|
138
|
+
|
139
|
+
this.innerHTML = "";
|
140
|
+
}
|
141
141
|
}
|
142
142
|
|
143
143
|
/**
|
@@ -145,14 +145,14 @@ function grabChildren() {
|
|
145
145
|
* @return {HtmlContent}
|
146
146
|
*/
|
147
147
|
function initControlReferences() {
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
148
|
+
if (!this.shadowRoot) {
|
149
|
+
throw new Error("no shadow-root is defined");
|
150
|
+
}
|
151
|
+
|
152
|
+
this[htmlContentElementSymbol] = this.shadowRoot.querySelector(
|
153
|
+
"[data-monster-role=content-container]",
|
154
|
+
);
|
155
|
+
return this;
|
156
156
|
}
|
157
157
|
|
158
158
|
/**
|
@@ -160,8 +160,8 @@ function initControlReferences() {
|
|
160
160
|
* @return {string}
|
161
161
|
*/
|
162
162
|
function getTemplate() {
|
163
|
-
|
164
|
-
|
163
|
+
// language=HTML
|
164
|
+
return `
|
165
165
|
<div data-monster-role="content-container" part="content-container"
|
166
166
|
data-monster-replace="path:content | call:sanitizeHtml | default: "
|
167
167
|
></div>
|