@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.
@@ -188,7 +188,7 @@ function initButtonLabel() {
188
188
  label = "";
189
189
  }
190
190
 
191
- if (label==="") {
191
+ if (label === "") {
192
192
  label = this.innerText;
193
193
  }
194
194
 
@@ -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
- assembleMethodSymbol,
18
- CustomElement,
19
- getSlottedElements,
20
- registerCustomElement,
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
- * @return {void}
90
- */
91
- [assembleMethodSymbol]() {
92
- super[assembleMethodSymbol]();
93
-
94
- initControlReferences.call(this);
95
- initEventHandler.call(this);
96
- }
97
-
98
- /**
99
- * This method is called by the `instanceof` operator.
100
- * @returns {symbol}
101
- */
102
- static get [instanceSymbol]() {
103
- return Symbol.for("@schukai/monster/components/state/log@@instance");
104
- }
105
-
106
- /**
107
- * To set the options via the HTML tag, the attribute `data-monster-options` must be used.
108
- * @see {@link https://monsterjs.org/en/doc/#configurate-a-monster-control}
109
- *
110
- * The individual configuration values can be found in the table.
111
- *
112
- * @property {Object} templates Template definitions
113
- * @property {string} templates.main Main template
114
- * @property {Object} labels Labels
115
- * @property {string} labels.nothingToReport Label for empty state
116
- */
117
- get defaults() {
118
- return Object.assign({}, super.defaults, {
119
- templates: {
120
- main: getTemplate(),
121
- },
122
-
123
- labels: {
124
- nothingToReport: "There is nothing to report yet.",
125
- },
126
-
127
- entries: [],
128
- });
129
- }
130
-
131
- /**
132
- * @return {void}
133
- */
134
- connectedCallback() {
135
- super.connectedCallback();
136
-
137
- const slottedElements = getSlottedElements.call(this);
138
- if (slottedElements.size > 0) {
139
- this[emptyStateElementSymbol].style.display = "none";
140
- }
141
- }
142
-
143
- /**
144
- * Clear the log
145
- *
146
- * @return {Log}
147
- */
148
- clear() {
149
- this[logElementSymbol].innerHTML = "";
150
- this[emptyStateElementSymbol].style.display = "block";
151
- return this;
152
- }
153
-
154
- /**
155
- * Add an entry to the log
156
- * @param entry
157
- * @returns {Log}
158
- */
159
- addEntry(entry) {
160
- validateInstance(entry, Entry);
161
-
162
- const entries = this.getOption("entries");
163
- entries.push(entry);
164
-
165
- /** this field is not used, but triggers a change event */
166
- this.setOption("length", entries.length - 1);
167
-
168
- return this;
169
- }
170
-
171
- /**
172
- * Add a log message
173
- * @param message
174
- * @param date
175
- * @returns {Log}
176
- */
177
- addMessage(message, date) {
178
- if (!date) {
179
- date = new Date();
180
- }
181
-
182
- this.addEntry(
183
- new Entry({
184
- message: message,
185
- date: date,
186
- }),
187
- );
188
-
189
- return this;
190
- }
191
-
192
- /**
193
- *
194
- * @return {string}
195
- */
196
- static getTag() {
197
- return "monster-log";
198
- }
199
-
200
- /**
201
- * @return {CSSStyleSheet[]}
202
- */
203
- static getCSSStyleSheet() {
204
- return [LogStyleSheet];
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
- if (!this.shadowRoot) {
215
- throw new Error("no shadow-root is defined");
216
- }
217
-
218
- this[logElementSymbol] = this.shadowRoot.querySelector(
219
- "[data-monster-role=control]",
220
- );
221
- this[emptyStateElementSymbol] = this.shadowRoot.querySelector(
222
- "[data-monster-role=empty-state]",
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
- if (!this.shadowRoot) {
231
- throw new Error("no shadow-root is defined");
232
- }
229
+ if (!this.shadowRoot) {
230
+ throw new Error("no shadow-root is defined");
231
+ }
233
232
 
234
- this.shadowRoot.addEventListener("slotchange", (event) => {
235
- const slottedElements = getSlottedElements.call(this);
233
+ this.shadowRoot.addEventListener("slotchange", (event) => {
234
+ const slottedElements = getSlottedElements.call(this);
236
235
 
237
- if (slottedElements.size > 0) {
238
- this[emptyStateElementSymbol].style.display = "none";
239
- } else {
240
- this[emptyStateElementSymbol].style.display = "block";
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
- return this;
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
- // language=HTML
253
- return `
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
- FormStyleSheet.insertRule(`
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
- }`, 0);
29
+ }`,
30
+ 0,
31
+ );
29
32
  } catch (e) {
30
- addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
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
- html = new Formatter(mapping).format(html);
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;
@@ -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
- //export * from "./components/tree-menu/dragable-tree-menu.mjs";
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";
@@ -159,7 +159,7 @@ function getMonsterVersion() {
159
159
  }
160
160
 
161
161
  /** don't touch, replaced by make with package.json version */
162
- monsterVersion = new Version("3.74.0");
162
+ monsterVersion = new Version("3.79.0");
163
163
 
164
164
  return monsterVersion;
165
165
  }
@@ -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.74.0")
10
+ monsterVersion = new Version("3.79.0")
11
11
 
12
12
  let m = getMonsterVersion();
13
13
 
@@ -78,8 +78,6 @@ function initJSDOM(options) {
78
78
  } catch(e) {
79
79
  console.error("Error setting key", key, e);
80
80
  }
81
-
82
-
83
81
  });
84
82
 
85
83
  import("dom-storage").then(({default: Storage}) => {
@@ -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.74.0</h1>
13
- <div id="lastupdate" style='font-size:0.7em'>last update Fr 20. Sep 17:42:55 CEST 2024</div>
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>