@schukai/monster 3.79.0 → 3.80.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (35) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/package.json +1 -1
  3. package/source/components/content/copy.mjs +314 -312
  4. package/source/components/content/stylesheet/copy.mjs +13 -6
  5. package/source/components/form/field-set.mjs +1 -2
  6. package/source/components/form/select.mjs +1945 -1957
  7. package/source/components/form/stylesheet/field-set.mjs +13 -6
  8. package/source/components/form/toggle-switch.mjs +319 -319
  9. package/source/components/layout/collapse.mjs +351 -351
  10. package/source/components/layout/details.mjs +1 -1
  11. package/source/components/layout/iframe.mjs +1 -1
  12. package/source/components/layout/width-toggle.mjs +2 -3
  13. package/source/components/state/log.mjs +151 -152
  14. package/source/components/state/state.mjs +1 -1
  15. package/source/components/stylesheet/form.mjs +13 -6
  16. package/source/components/tree-menu/dragable-tree-menu.mjs +664 -664
  17. package/source/components/tree-menu/tree-menu.mjs +3 -27
  18. package/source/dom/customelement.mjs +18 -1
  19. package/source/monster.mjs +1 -1
  20. package/source/types/base.mjs +1 -3
  21. package/source/types/nodelist.mjs +0 -1
  22. package/source/types/proxyobserver.mjs +0 -2
  23. package/source/types/queue.mjs +0 -2
  24. package/source/types/randomid.mjs +0 -1
  25. package/source/types/regex.mjs +0 -1
  26. package/source/types/stack.mjs +1 -2
  27. package/source/types/tokenlist.mjs +0 -2
  28. package/source/types/typeof.mjs +0 -2
  29. package/source/types/uniquequeue.mjs +0 -1
  30. package/source/types/uuid.mjs +1 -2
  31. package/source/types/version.mjs +3 -6
  32. package/test/cases/monster.mjs +1 -1
  33. package/test/util/jsdom.mjs +0 -2
  34. package/test/web/test.html +2 -2
  35. package/test/web/tests.js +7455 -8361
@@ -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";
@@ -73,35 +73,11 @@ const openEntryEventHandlerSymbol = Symbol("openEntryEventHandler");
73
73
  /**
74
74
  * TreeMenu
75
75
  *
76
- * <img src="./images/tree-menu.png">
77
- *
78
- * You can create this control either by specifying the HTML tag `<monster-tree-menu />` directly in the HTML
79
- *
80
- * ```html
81
- * <monster-tree-menu></monster-tree-menu>
82
- * ```
83
- *
84
- * or using Javascript via the `document.createElement('monster-tree-menu');` method.
85
- *
86
- * ```javascript
87
- * import {TreeMenu} from 'https://cdn.jsdelivr.net/npm/@schukai/component-treemenu@0.1.0/dist/modules/treemenu.js';
88
- * document.createElement('monster-treemenu');
89
- * ```
90
- *
91
- * @startuml tree-menu.png
92
- * skinparam monochrome true
93
- * skinparam shadowing false
94
- * HTMLElement <|-- CustomElement
95
- * CustomElement <|-- CustomControl
96
- * CustomControl <|-- TreeMenu
97
- * @enduml
98
76
  * @since 1.0.0
99
- * @copyright schukai GmbH
100
77
  * @summary A TreeMenu control
101
- * @fires Monster.Components.TreeMenu.event:monster-fetched
78
+ * @fires monster-fetched
102
79
  */
103
80
  class TreeMenu extends CustomElement {
104
-
105
81
  /**
106
82
  * This method is called by the `instanceof` operator.
107
83
  * @returns {symbol}
@@ -251,7 +227,7 @@ class TreeMenu extends CustomElement {
251
227
  if (!currentNode) {
252
228
  return;
253
229
  }
254
-
230
+
255
231
  currentNode.click();
256
232
 
257
233
  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,6 @@ 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
59
  export * from "./components/tree-menu/tree-menu.mjs";
60
60
  export * from "./components/host/collapse.mjs";
61
61
  export * from "./components/host/config-manager.mjs";
@@ -37,14 +37,12 @@ export { Base };
37
37
  *
38
38
  * The class was formerly called Object.
39
39
  *
40
- * @license AGPLv3
41
40
  * @since 1.5.0
42
41
  * @copyright schukai GmbH
43
- * @memberOf Monster.Types
42
+ * @summary The base class for the most classes in the monster library
44
43
  */
45
44
  class Base extends Object {
46
45
  /**
47
- *
48
46
  * @returns {string}
49
47
  */
50
48
  toString() {
@@ -24,7 +24,6 @@ export { NodeList };
24
24
  * @license AGPLv3
25
25
  * @since 1.26.0
26
26
  * @copyright schukai GmbH
27
- * @memberOf Monster.Types
28
27
  * @summary A NodeList class
29
28
  */
30
29
  class NodeList extends Set {
@@ -30,11 +30,9 @@ export { ProxyObserver };
30
30
  *
31
31
  * This also applies to nested objects.
32
32
  *
33
- * @externalExample ../../example/types/proxyobserver.mjs
34
33
  * @license AGPLv3
35
34
  * @since 1.0.0
36
35
  * @copyright schukai GmbH
37
- * @memberOf Monster.Types
38
36
  */
39
37
  class ProxyObserver extends Base {
40
38
  /**
@@ -26,11 +26,9 @@ export { Queue };
26
26
  *
27
27
  * You can create the instance via `new Queue()`.
28
28
  *
29
- * @externalExample ../../example/types/queue.mjs
30
29
  * @license AGPLv3
31
30
  * @since 1.4.0
32
31
  * @copyright schukai GmbH
33
- * @memberOf Monster.Types
34
32
  * @summary A Queue (Fifo)
35
33
  */
36
34
  class Queue extends Base {
@@ -30,7 +30,6 @@ let internalCounter = 0;
30
30
  * @license AGPLv3
31
31
  * @since 1.6.0
32
32
  * @copyright schukai GmbH
33
- * @memberOf Monster.Types
34
33
  * @summary class to generate random numbers
35
34
  */
36
35
  class RandomID extends ID {
@@ -24,7 +24,6 @@ export { escapeString };
24
24
  * @license AGPLv3
25
25
  * @since 1.26.0
26
26
  * @copyright schukai GmbH
27
- * @memberOf Monster.Types
28
27
  * @throws {TypeError} value is not a string
29
28
  */
30
29
  function escapeString(value) {
@@ -17,12 +17,11 @@ import { instanceSymbol } from "../constants.mjs";
17
17
  export { Stack };
18
18
 
19
19
  /**
20
- * You can call the method via the monster namespace `new Monster.Types.Queue()`.
20
+ * You can call the method via the monster namespace `new Queue()`.
21
21
  *
22
22
  * @license AGPLv3
23
23
  * @since 1.4.0
24
24
  * @copyright schukai GmbH
25
- * @memberOf Monster.Types
26
25
  */
27
26
  class Stack extends Base {
28
27
  /**
@@ -25,11 +25,9 @@ export { TokenList };
25
25
  *
26
26
  * This class implements the [iteration protocol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols).
27
27
  *
28
- * @externalExample ../../example/types/tokenlist-1.mjs
29
28
  * @license AGPLv3
30
29
  * @since 1.2.0
31
30
  * @copyright schukai GmbH
32
- * @memberOf Monster.Types
33
31
  */
34
32
  class TokenList extends Base {
35
33
  /**
@@ -17,13 +17,11 @@ export { typeOf };
17
17
  /**
18
18
  * The built-in typeof method is known to have some historical weaknesses. This function tries to provide a better and more accurate result.
19
19
  *
20
- * @externalExample ../../example/types/typeof.mjs
21
20
  * @param {*} value
22
21
  * @return {string}
23
22
  * @license AGPLv3
24
23
  * @since 1.7.0
25
24
  * @copyright schukai GmbH
26
- * @memberOf Monster.Types
27
25
  * @throws {TypeError} value is not a primitive
28
26
  */
29
27
  function typeOf(value) {
@@ -24,7 +24,6 @@ export { UniqueQueue };
24
24
  * @license AGPLv3
25
25
  * @since 1.4.0
26
26
  * @copyright schukai GmbH
27
- * @memberOf Monster.Types
28
27
  * @summary A queue for unique values
29
28
  */
30
29
  class UniqueQueue extends Queue {
@@ -14,7 +14,7 @@
14
14
 
15
15
  import { internalSymbol } from "../constants.mjs";
16
16
  import { random } from "../math/random.mjs";
17
- import { isObject } from "../types/is.mjs";
17
+ import { isObject } from "./is.mjs";
18
18
  import { Base } from "./base.mjs";
19
19
  import { getGlobalObject } from "./global.mjs";
20
20
 
@@ -26,7 +26,6 @@ export { UUID };
26
26
  * @license AGPLv3
27
27
  * @since 1.25.0
28
28
  * @copyright schukai GmbH
29
- * @memberOf Monster.Types
30
29
  * @throws {Error} unsupported
31
30
  */
32
31
  class UUID extends Base {
@@ -25,8 +25,7 @@ export { Version, getMonsterVersion };
25
25
  * @since 1.0.0
26
26
  * @author schukai GmbH
27
27
  * @copyright schukai GmbH
28
- * @memberOf Monster.Types
29
- * @summary The version object contains a sematic version number
28
+ * @summary The version object contains a semantic version number
30
29
  */
31
30
  class Version extends Base {
32
31
  /**
@@ -145,13 +144,11 @@ let monsterVersion;
145
144
  /**
146
145
  * Version of monster
147
146
  *
148
- * @externalExample ../../example/types/version-2.mjs
149
- * @returns {Monster.Types.Version}
147
+ * @returns {Version}
150
148
  * @license AGPLv3
151
149
  * @since 1.0.0
152
150
  * @copyright schukai GmbH
153
151
  * @author schukai GmbH
154
- * @memberOf Monster
155
152
  */
156
153
  function getMonsterVersion() {
157
154
  if (monsterVersion instanceof Version) {
@@ -159,7 +156,7 @@ function getMonsterVersion() {
159
156
  }
160
157
 
161
158
  /** don't touch, replaced by make with package.json version */
162
- monsterVersion = new Version("3.74.0");
159
+ monsterVersion = new Version("3.79.0");
163
160
 
164
161
  return monsterVersion;
165
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.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:35:17 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>