@schukai/monster 3.79.0 → 3.80.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +14 -0
- package/package.json +1 -1
- package/source/components/content/copy.mjs +313 -311
- package/source/components/content/stylesheet/copy.mjs +13 -6
- package/source/components/form/field-set.mjs +1 -2
- package/source/components/form/select.mjs +1945 -1957
- package/source/components/form/stylesheet/field-set.mjs +13 -6
- package/source/components/form/toggle-switch.mjs +319 -319
- package/source/components/layout/collapse.mjs +351 -351
- package/source/components/layout/details.mjs +1 -1
- package/source/components/layout/iframe.mjs +1 -1
- package/source/components/layout/width-toggle.mjs +2 -3
- package/source/components/state/log.mjs +151 -152
- package/source/components/state/state.mjs +1 -1
- package/source/components/stylesheet/form.mjs +13 -6
- package/source/components/tree-menu/tree-menu.mjs +2 -3
- package/source/dom/customelement.mjs +18 -1
- package/source/monster.mjs +2 -1
- package/source/types/version.mjs +1 -1
- package/test/cases/monster.mjs +1 -1
- package/test/util/jsdom.mjs +0 -2
- package/test/web/test.html +2 -2
- package/test/web/tests.js +7455 -8361
@@ -61,7 +61,7 @@ const timerCallbackSymbol = Symbol("timerCallback");
|
|
61
61
|
* @fragments /fragments/components/layout/iframe/
|
62
62
|
*
|
63
63
|
* @example /examples/components/layout/iframe-simple
|
64
|
-
*
|
64
|
+
*
|
65
65
|
* @since 3.76.0
|
66
66
|
* @copyright schukai GmbH
|
67
67
|
* @summary A cool and fancy Iframe that can make your life easier and also looks good.
|
@@ -63,8 +63,8 @@ const MODE_WIDE = "wide";
|
|
63
63
|
*
|
64
64
|
* @since 3.57.0
|
65
65
|
* @copyright schukai GmbH
|
66
|
-
* @summary The WidthToggle component allows users to dynamically change the width of a panel by clicking a button.
|
67
|
-
* @summary This feature improves readability and space utilization by allowing the panel width to be adjusted
|
66
|
+
* @summary The WidthToggle component allows users to dynamically change the width of a panel by clicking a button.
|
67
|
+
* @summary This feature improves readability and space utilization by allowing the panel width to be adjusted
|
68
68
|
* @summary according to user preferences.
|
69
69
|
*/
|
70
70
|
class WidthToggle extends CustomElement {
|
@@ -124,7 +124,6 @@ class WidthToggle extends CustomElement {
|
|
124
124
|
* @throws {Error} - If the mode is not supported.
|
125
125
|
*/
|
126
126
|
|
127
|
-
|
128
127
|
/**
|
129
128
|
* @param {string} mode
|
130
129
|
* @returns {WidthToggle}
|
@@ -12,19 +12,19 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import {instanceSymbol} from "../../constants.mjs";
|
15
|
+
import { instanceSymbol } from "../../constants.mjs";
|
16
16
|
import {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
assembleMethodSymbol,
|
18
|
+
CustomElement,
|
19
|
+
getSlottedElements,
|
20
|
+
registerCustomElement,
|
21
21
|
} from "../../dom/customelement.mjs";
|
22
|
-
import {LogStyleSheet} from "./stylesheet/log.mjs";
|
23
|
-
import {Entry} from "./log/entry.mjs";
|
24
|
-
import {validateInstance} from "../../types/validate.mjs";
|
22
|
+
import { LogStyleSheet } from "./stylesheet/log.mjs";
|
23
|
+
import { Entry } from "./log/entry.mjs";
|
24
|
+
import { validateInstance } from "../../types/validate.mjs";
|
25
25
|
import "./state.mjs";
|
26
26
|
|
27
|
-
export {Log};
|
27
|
+
export { Log };
|
28
28
|
|
29
29
|
/**
|
30
30
|
* @private
|
@@ -72,7 +72,6 @@ const emptyStateElementSymbol = Symbol("emptyStateElement");
|
|
72
72
|
* @summary Log is a control to show a log message.
|
73
73
|
*/
|
74
74
|
|
75
|
-
|
76
75
|
/**
|
77
76
|
* A Log component
|
78
77
|
*
|
@@ -85,124 +84,124 @@ const emptyStateElementSymbol = Symbol("emptyStateElement");
|
|
85
84
|
* @summary A Log component to show a log message.
|
86
85
|
*/
|
87
86
|
class Log extends CustomElement {
|
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
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
87
|
+
/**
|
88
|
+
* @return {void}
|
89
|
+
*/
|
90
|
+
[assembleMethodSymbol]() {
|
91
|
+
super[assembleMethodSymbol]();
|
92
|
+
|
93
|
+
initControlReferences.call(this);
|
94
|
+
initEventHandler.call(this);
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* This method is called by the `instanceof` operator.
|
99
|
+
* @returns {symbol}
|
100
|
+
*/
|
101
|
+
static get [instanceSymbol]() {
|
102
|
+
return Symbol.for("@schukai/monster/components/state/log@@instance");
|
103
|
+
}
|
104
|
+
|
105
|
+
/**
|
106
|
+
* To set the options via the HTML tag, the attribute `data-monster-options` must be used.
|
107
|
+
* @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
|
108
|
+
*
|
109
|
+
* The individual configuration values can be found in the table.
|
110
|
+
*
|
111
|
+
* @property {Object} templates Template definitions
|
112
|
+
* @property {string} templates.main Main template
|
113
|
+
* @property {Object} labels Labels
|
114
|
+
* @property {string} labels.nothingToReport Label for empty state
|
115
|
+
*/
|
116
|
+
get defaults() {
|
117
|
+
return Object.assign({}, super.defaults, {
|
118
|
+
templates: {
|
119
|
+
main: getTemplate(),
|
120
|
+
},
|
121
|
+
|
122
|
+
labels: {
|
123
|
+
nothingToReport: "There is nothing to report yet.",
|
124
|
+
},
|
125
|
+
|
126
|
+
entries: [],
|
127
|
+
});
|
128
|
+
}
|
129
|
+
|
130
|
+
/**
|
131
|
+
* @return {void}
|
132
|
+
*/
|
133
|
+
connectedCallback() {
|
134
|
+
super.connectedCallback();
|
135
|
+
|
136
|
+
const slottedElements = getSlottedElements.call(this);
|
137
|
+
if (slottedElements.size > 0) {
|
138
|
+
this[emptyStateElementSymbol].style.display = "none";
|
139
|
+
}
|
140
|
+
}
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Clear the log
|
144
|
+
*
|
145
|
+
* @return {Log}
|
146
|
+
*/
|
147
|
+
clear() {
|
148
|
+
this[logElementSymbol].innerHTML = "";
|
149
|
+
this[emptyStateElementSymbol].style.display = "block";
|
150
|
+
return this;
|
151
|
+
}
|
152
|
+
|
153
|
+
/**
|
154
|
+
* Add an entry to the log
|
155
|
+
* @param entry
|
156
|
+
* @returns {Log}
|
157
|
+
*/
|
158
|
+
addEntry(entry) {
|
159
|
+
validateInstance(entry, Entry);
|
160
|
+
|
161
|
+
const entries = this.getOption("entries");
|
162
|
+
entries.push(entry);
|
163
|
+
|
164
|
+
/** this field is not used, but triggers a change event */
|
165
|
+
this.setOption("length", entries.length - 1);
|
166
|
+
|
167
|
+
return this;
|
168
|
+
}
|
169
|
+
|
170
|
+
/**
|
171
|
+
* Add a log message
|
172
|
+
* @param message
|
173
|
+
* @param date
|
174
|
+
* @returns {Log}
|
175
|
+
*/
|
176
|
+
addMessage(message, date) {
|
177
|
+
if (!date) {
|
178
|
+
date = new Date();
|
179
|
+
}
|
180
|
+
|
181
|
+
this.addEntry(
|
182
|
+
new Entry({
|
183
|
+
message: message,
|
184
|
+
date: date,
|
185
|
+
}),
|
186
|
+
);
|
187
|
+
|
188
|
+
return this;
|
189
|
+
}
|
190
|
+
|
191
|
+
/**
|
192
|
+
*
|
193
|
+
* @return {string}
|
194
|
+
*/
|
195
|
+
static getTag() {
|
196
|
+
return "monster-log";
|
197
|
+
}
|
198
|
+
|
199
|
+
/**
|
200
|
+
* @return {CSSStyleSheet[]}
|
201
|
+
*/
|
202
|
+
static getCSSStyleSheet() {
|
203
|
+
return [LogStyleSheet];
|
204
|
+
}
|
206
205
|
}
|
207
206
|
|
208
207
|
/**
|
@@ -211,37 +210,37 @@ class Log extends CustomElement {
|
|
211
210
|
* @throws {Error} no shadow-root is defined
|
212
211
|
*/
|
213
212
|
function initControlReferences() {
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
213
|
+
if (!this.shadowRoot) {
|
214
|
+
throw new Error("no shadow-root is defined");
|
215
|
+
}
|
216
|
+
|
217
|
+
this[logElementSymbol] = this.shadowRoot.querySelector(
|
218
|
+
"[data-monster-role=control]",
|
219
|
+
);
|
220
|
+
this[emptyStateElementSymbol] = this.shadowRoot.querySelector(
|
221
|
+
"[data-monster-role=empty-state]",
|
222
|
+
);
|
224
223
|
}
|
225
224
|
|
226
225
|
/**
|
227
226
|
* @private
|
228
227
|
*/
|
229
228
|
function initEventHandler() {
|
230
|
-
|
231
|
-
|
232
|
-
|
229
|
+
if (!this.shadowRoot) {
|
230
|
+
throw new Error("no shadow-root is defined");
|
231
|
+
}
|
233
232
|
|
234
|
-
|
235
|
-
|
233
|
+
this.shadowRoot.addEventListener("slotchange", (event) => {
|
234
|
+
const slottedElements = getSlottedElements.call(this);
|
236
235
|
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
236
|
+
if (slottedElements.size > 0) {
|
237
|
+
this[emptyStateElementSymbol].style.display = "none";
|
238
|
+
} else {
|
239
|
+
this[emptyStateElementSymbol].style.display = "block";
|
240
|
+
}
|
241
|
+
});
|
243
242
|
|
244
|
-
|
243
|
+
return this;
|
245
244
|
}
|
246
245
|
|
247
246
|
/**
|
@@ -249,8 +248,8 @@ function initEventHandler() {
|
|
249
248
|
* @return {string}
|
250
249
|
*/
|
251
250
|
function getTemplate() {
|
252
|
-
|
253
|
-
|
251
|
+
// language=HTML
|
252
|
+
return `
|
254
253
|
<template id="entry">
|
255
254
|
<li data-monster-role="entry">
|
256
255
|
<span></span>
|
@@ -53,7 +53,7 @@ class State extends CustomControl {
|
|
53
53
|
* @returns {symbol}
|
54
54
|
*/
|
55
55
|
static get [instanceSymbol]() {
|
56
|
-
return Symbol.for("@schukai/monster/components/state/state@@instance");
|
56
|
+
return Symbol.for("@schukai/monster/components/state/state@@instance");
|
57
57
|
}
|
58
58
|
|
59
59
|
/**
|
@@ -10,10 +10,10 @@
|
|
10
10
|
* For more information about purchasing a commercial license, please contact schukai GmbH.
|
11
11
|
*/
|
12
12
|
|
13
|
-
import {addAttributeToken} from "../../dom/attributes.mjs";
|
14
|
-
import {ATTRIBUTE_ERRORMESSAGE} from "../../dom/constants.mjs";
|
13
|
+
import { addAttributeToken } from "../../dom/attributes.mjs";
|
14
|
+
import { ATTRIBUTE_ERRORMESSAGE } from "../../dom/constants.mjs";
|
15
15
|
|
16
|
-
export {FormStyleSheet}
|
16
|
+
export { FormStyleSheet };
|
17
17
|
|
18
18
|
/**
|
19
19
|
* @private
|
@@ -22,10 +22,17 @@ export {FormStyleSheet}
|
|
22
22
|
const FormStyleSheet = new CSSStyleSheet();
|
23
23
|
|
24
24
|
try {
|
25
|
-
|
25
|
+
FormStyleSheet.insertRule(
|
26
|
+
`
|
26
27
|
@layer form {
|
27
28
|
input,meter,progress,select,textarea{accent-color:var(--monster-color-secondary-2);background-color:var(--monster-bg-color-primary-1);border-color:var(--monster-theme-control-border-color);border-radius:var(--monster-theme-control-border-radius);border-style:var(--monster-theme-control-border-style);border-width:var(--monster-theme-control-border-width);box-sizing:border-box;color:var(--monster-color-primary-1);font-family:inherit;font-size:100%;margin:0;outline:none}input,select,textarea{height:-moz-fit-content;height:fit-content;padding:.4rem .6rem}textarea{min-height:6rem;resize:vertical}input[type=color]{height:2rem;margin:0;padding:.1rem;width:2rem}input:hover:not([type=radio]):not([type=checkbox]):not([type=range]),select:hover,textarea:hover{box-shadow:var(--monster-box-shadow-2);transition:background .8s,color .25s .0833333333s}input:focus,select:focus,textarea:focus{outline:1px dashed var(--monster-color-selection-3);outline-offset:3px}
|
28
|
-
}`,
|
29
|
+
}`,
|
30
|
+
0,
|
31
|
+
);
|
29
32
|
} catch (e) {
|
30
|
-
|
33
|
+
addAttributeToken(
|
34
|
+
document.getRootNode().querySelector("html"),
|
35
|
+
ATTRIBUTE_ERRORMESSAGE,
|
36
|
+
e + "",
|
37
|
+
);
|
31
38
|
}
|
@@ -12,7 +12,7 @@
|
|
12
12
|
* SPDX-License-Identifier: AGPL-3.0
|
13
13
|
*/
|
14
14
|
|
15
|
-
import {instanceSymbol} from "../../constants.mjs";
|
15
|
+
import { instanceSymbol } from "../../constants.mjs";
|
16
16
|
import { buildTree } from "../../data/buildtree.mjs";
|
17
17
|
import { Datasource } from "../datatable/datasource.mjs";
|
18
18
|
import { addAttributeToken } from "../../dom/attributes.mjs";
|
@@ -101,7 +101,6 @@ const openEntryEventHandlerSymbol = Symbol("openEntryEventHandler");
|
|
101
101
|
* @fires Monster.Components.TreeMenu.event:monster-fetched
|
102
102
|
*/
|
103
103
|
class TreeMenu extends CustomElement {
|
104
|
-
|
105
104
|
/**
|
106
105
|
* This method is called by the `instanceof` operator.
|
107
106
|
* @returns {symbol}
|
@@ -251,7 +250,7 @@ class TreeMenu extends CustomElement {
|
|
251
250
|
if (!currentNode) {
|
252
251
|
return;
|
253
252
|
}
|
254
|
-
|
253
|
+
|
255
254
|
currentNode.click();
|
256
255
|
|
257
256
|
let intend = parseInt(currentNode.getAttribute(ATTRIBUTE_INTEND));
|
@@ -327,6 +327,10 @@ class CustomElement extends HTMLElement {
|
|
327
327
|
* @property {Object} templates Specifies the templates used by the control.
|
328
328
|
* @property {string} templates.main=undefined Specifies the main template used by the control.
|
329
329
|
* @property {Object} templateMapping Specifies the mapping of templates.
|
330
|
+
* @property {Object} templateFormatter Specifies the formatter for the templates.
|
331
|
+
* @property {Object} templateFormatter.marker Specifies the marker for the templates.
|
332
|
+
* @property {Function} templateFormatter.marker.open=null Specifies the opening marker for the templates.
|
333
|
+
* @property {Function} templateFormatter.marker.close=null Specifies the closing marker for the templates.
|
330
334
|
* @property {Boolean} eventProcessing=false Specifies whether the control processes events.
|
331
335
|
* @since 1.8.0
|
332
336
|
*/
|
@@ -339,6 +343,12 @@ class CustomElement extends HTMLElement {
|
|
339
343
|
main: undefined,
|
340
344
|
},
|
341
345
|
templateMapping: {},
|
346
|
+
templateFormatter: {
|
347
|
+
marker: {
|
348
|
+
open: null,
|
349
|
+
close: null,
|
350
|
+
},
|
351
|
+
},
|
342
352
|
|
343
353
|
eventProcessing: false,
|
344
354
|
};
|
@@ -1200,7 +1210,14 @@ function initShadowRoot() {
|
|
1200
1210
|
|
1201
1211
|
const mapping = this.getOption("templateMapping", {});
|
1202
1212
|
if (isObject(mapping)) {
|
1203
|
-
|
1213
|
+
const formatter = new Formatter(mapping);
|
1214
|
+
if (this.getOption("templateFormatter.marker.open")!==null) {
|
1215
|
+
formatter.setMarker(
|
1216
|
+
this.getOption("templateFormatter.marker.open"),
|
1217
|
+
this.getOption("templateFormatter.marker.close"),
|
1218
|
+
);
|
1219
|
+
}
|
1220
|
+
html = formatter.format(html);
|
1204
1221
|
}
|
1205
1222
|
|
1206
1223
|
this.shadowRoot.innerHTML = html;
|
package/source/monster.mjs
CHANGED
@@ -27,6 +27,7 @@ export * from "./components/layout/width-toggle.mjs";
|
|
27
27
|
export * from "./components/layout/panel.mjs";
|
28
28
|
export * from "./components/layout/details.mjs";
|
29
29
|
export * from "./components/layout/slider.mjs";
|
30
|
+
export * from "./components/content/copy.mjs";
|
30
31
|
export * from "./components/form/message-state-button.mjs";
|
31
32
|
export * from "./components/form/button-bar.mjs";
|
32
33
|
export * from "./components/form/reload.mjs";
|
@@ -55,7 +56,7 @@ export * from "./components/form/constants.mjs";
|
|
55
56
|
export * from "./components/notify/message.mjs";
|
56
57
|
export * from "./components/notify/notify.mjs";
|
57
58
|
export * from "./components/notify/constants.mjs";
|
58
|
-
|
59
|
+
export * from "./components/tree-menu/dragable-tree-menu.mjs";
|
59
60
|
export * from "./components/tree-menu/tree-menu.mjs";
|
60
61
|
export * from "./components/host/collapse.mjs";
|
61
62
|
export * from "./components/host/config-manager.mjs";
|
package/source/types/version.mjs
CHANGED
package/test/cases/monster.mjs
CHANGED
package/test/util/jsdom.mjs
CHANGED
package/test/web/test.html
CHANGED
@@ -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.
|
13
|
-
<div id="lastupdate" style='font-size:0.7em'>last update
|
12
|
+
<h1 style='margin-bottom: 0.1em;'>Monster 3.79.0</h1>
|
13
|
+
<div id="lastupdate" style='font-size:0.7em'>last update So 6. Okt 14:31:55 CEST 2024</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>
|