@schukai/monster 3.54.0 → 3.55.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/package.json +1 -1
  3. package/source/components/datatable/datasource/rest.mjs +93 -57
  4. package/source/components/datatable/datatable/header.mjs +8 -0
  5. package/source/components/datatable/datatable.mjs +88 -44
  6. package/source/components/datatable/embedded-pagination.mjs +24 -43
  7. package/source/components/datatable/filter/util.mjs +138 -0
  8. package/source/components/datatable/filter.mjs +418 -174
  9. package/source/components/datatable/pagination.mjs +26 -2
  10. package/source/components/datatable/status.mjs +226 -0
  11. package/source/components/datatable/style/datatable.pcss +1 -0
  12. package/source/components/datatable/style/embedded-pagination.pcss +59 -2
  13. package/source/components/datatable/style/filter.pcss +4 -0
  14. package/source/components/datatable/style/pagination.pcss +28 -4
  15. package/source/components/datatable/style/status.pcss +42 -0
  16. package/source/components/datatable/stylesheet/column-bar.mjs +15 -9
  17. package/source/components/datatable/stylesheet/dataset.mjs +14 -8
  18. package/source/components/datatable/stylesheet/datasource.mjs +14 -8
  19. package/source/components/datatable/stylesheet/datatable.mjs +15 -9
  20. package/source/components/datatable/stylesheet/embedded-pagination.mjs +14 -8
  21. package/source/components/datatable/stylesheet/filter-button.mjs +15 -9
  22. package/source/components/datatable/stylesheet/filter-controls-defaults.mjs +14 -8
  23. package/source/components/datatable/stylesheet/filter-date-range.mjs +14 -8
  24. package/source/components/datatable/stylesheet/filter-range.mjs +14 -8
  25. package/source/components/datatable/stylesheet/filter.mjs +15 -9
  26. package/source/components/datatable/stylesheet/pagination.mjs +15 -9
  27. package/source/components/datatable/stylesheet/select-filter.mjs +14 -8
  28. package/source/components/datatable/stylesheet/status.mjs +33 -0
  29. package/source/components/form/action-button.mjs +3 -1
  30. package/source/components/form/api-button.mjs +1 -1
  31. package/source/components/form/button-bar.mjs +1 -1
  32. package/source/components/form/button.mjs +1 -1
  33. package/source/components/form/confirm-button.mjs +3 -1
  34. package/source/components/form/context-error.mjs +272 -0
  35. package/source/components/form/context-help.mjs +7 -5
  36. package/source/components/form/form.mjs +4 -2
  37. package/source/components/form/message-state-button.mjs +4 -2
  38. package/source/components/form/popper-button.mjs +9 -4
  39. package/source/components/form/popper.mjs +11 -3
  40. package/source/components/form/reload.mjs +1 -1
  41. package/source/components/form/select.mjs +3 -3
  42. package/source/components/form/shadow-reload.mjs +1 -1
  43. package/source/components/form/state-button.mjs +4 -1
  44. package/source/components/form/style/context-error.pcss +32 -0
  45. package/source/components/form/style/context-help.pcss +22 -5
  46. package/source/components/form/stylesheet/action-button.mjs +14 -8
  47. package/source/components/form/stylesheet/api-button.mjs +14 -8
  48. package/source/components/form/stylesheet/button-bar.mjs +14 -8
  49. package/source/components/form/stylesheet/button.mjs +14 -8
  50. package/source/components/form/stylesheet/confirm-button.mjs +14 -8
  51. package/source/components/form/stylesheet/context-error.mjs +33 -0
  52. package/source/components/form/stylesheet/context-help.mjs +15 -9
  53. package/source/components/form/stylesheet/form.mjs +14 -8
  54. package/source/components/form/stylesheet/message-state-button.mjs +14 -8
  55. package/source/components/form/stylesheet/popper-button.mjs +14 -8
  56. package/source/components/form/stylesheet/popper.mjs +14 -8
  57. package/source/components/form/stylesheet/select.mjs +15 -9
  58. package/source/components/form/stylesheet/state-button.mjs +14 -8
  59. package/source/components/form/stylesheet/tabs.mjs +15 -9
  60. package/source/components/form/stylesheet/tree-select.mjs +14 -8
  61. package/source/components/form/tabs.mjs +53 -7
  62. package/source/components/form/template.mjs +1 -1
  63. package/source/components/form/tree-select.mjs +1 -1
  64. package/source/components/host/collapse.mjs +20 -5
  65. package/source/components/host/config-manager.mjs +41 -2
  66. package/source/components/host/host.mjs +14 -0
  67. package/source/components/host/stylesheet/call-button.mjs +15 -9
  68. package/source/components/host/stylesheet/collapse.mjs +14 -8
  69. package/source/components/host/stylesheet/config-manager.mjs +14 -8
  70. package/source/components/host/stylesheet/details.mjs +14 -8
  71. package/source/components/host/stylesheet/host.mjs +14 -8
  72. package/source/components/host/stylesheet/overlay.mjs +15 -9
  73. package/source/components/host/stylesheet/toggle-button.mjs +15 -9
  74. package/source/components/host/stylesheet/viewer.mjs +14 -8
  75. package/source/components/host/util.mjs +6 -1
  76. package/source/components/notify/stylesheet/message.mjs +15 -9
  77. package/source/components/notify/stylesheet/notify.mjs +14 -8
  78. package/source/components/state/stylesheet/log.mjs +14 -8
  79. package/source/components/state/stylesheet/state.mjs +14 -8
  80. package/source/components/stylesheet/badge.mjs +14 -8
  81. package/source/components/stylesheet/border.mjs +14 -8
  82. package/source/components/stylesheet/button.mjs +14 -8
  83. package/source/components/stylesheet/card.mjs +14 -8
  84. package/source/components/stylesheet/color.mjs +14 -8
  85. package/source/components/stylesheet/common.mjs +14 -8
  86. package/source/components/stylesheet/control.mjs +14 -8
  87. package/source/components/stylesheet/data-grid.mjs +14 -8
  88. package/source/components/stylesheet/display.mjs +14 -8
  89. package/source/components/stylesheet/floating-ui.mjs +14 -8
  90. package/source/components/stylesheet/form.mjs +14 -8
  91. package/source/components/stylesheet/host.mjs +14 -8
  92. package/source/components/stylesheet/icons.mjs +15 -9
  93. package/source/components/stylesheet/link.mjs +14 -8
  94. package/source/components/stylesheet/normalize.mjs +14 -8
  95. package/source/components/stylesheet/popper.mjs +14 -8
  96. package/source/components/stylesheet/property.mjs +14 -8
  97. package/source/components/stylesheet/ripple.mjs +14 -8
  98. package/source/components/stylesheet/skeleton.mjs +14 -8
  99. package/source/components/stylesheet/space.mjs +14 -8
  100. package/source/components/stylesheet/spinner.mjs +14 -8
  101. package/source/components/stylesheet/table.mjs +14 -8
  102. package/source/components/stylesheet/theme.mjs +14 -8
  103. package/source/components/stylesheet/typography.mjs +14 -8
  104. package/source/components/tree-menu/stylesheet/tree-menu.mjs +14 -8
  105. package/source/data/transformer.mjs +38 -43
  106. package/source/dom/attributes.mjs +5 -5
  107. package/source/dom/customelement.mjs +1 -1
  108. package/source/dom/updater.mjs +14 -5
  109. package/source/dom/util.mjs +42 -0
  110. package/source/i18n/providers/embed.mjs +3 -3
  111. package/source/monster.mjs +5 -0
  112. package/source/text/formatter.mjs +2 -2
  113. package/source/types/noderecursiveiterator.mjs +9 -7
  114. package/source/types/observer.mjs +1 -1
  115. package/source/types/version.mjs +1 -1
  116. package/source/util/sleep.mjs +17 -0
  117. package/test/cases/components/form/button.mjs +2 -1
  118. package/test/cases/components/form/select.mjs +1 -1
  119. package/test/cases/components/form/tree-select.mjs +1 -1
  120. package/test/cases/data/transformer.mjs +2 -2
  121. package/test/cases/dom/updater.mjs +67 -46
  122. package/test/cases/monster.mjs +1 -1
  123. package/test/web/test.html +2 -2
  124. package/test/web/tests.js +18 -13
@@ -1,15 +1,14 @@
1
-
2
1
  /**
3
- * Copyright schukai GmbH and contributors 2023. All Rights Reserved.
2
+ * Copyright schukai GmbH and contributors 2024. All Rights Reserved.
4
3
  * Node module: @schukai/monster
5
4
  * This file is licensed under the AGPLv3 License.
6
5
  * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
7
6
  */
8
7
 
9
- import {addAttributeToken} from "../../../dom/attributes.mjs";
10
- import {ATTRIBUTE_ERRORMESSAGE} from "../../../dom/constants.mjs";
8
+ import { addAttributeToken } from "../../../dom/attributes.mjs";
9
+ import { ATTRIBUTE_ERRORMESSAGE } from "../../../dom/constants.mjs";
11
10
 
12
- export {TreeMenuStyleSheet}
11
+ export { TreeMenuStyleSheet };
13
12
 
14
13
  /**
15
14
  * @private
@@ -18,10 +17,17 @@ export {TreeMenuStyleSheet}
18
17
  const TreeMenuStyleSheet = new CSSStyleSheet();
19
18
 
20
19
  try {
21
- TreeMenuStyleSheet.insertRule(`
20
+ TreeMenuStyleSheet.insertRule(
21
+ `
22
22
  @layer treemenu {
23
23
  :host{border:1px solid #08e808;box-sizing:border-box;display:flex;height:100%;width:100%}[data-monster-role=control]{height:100%;overflow-x:hidden;overflow-y:auto;scrollbar-color:transparent transparent;width:100%}::-webkit-scrollbar{height:10px;width:5px}::-webkit-scrollbar-thumb{background:rgba(0,0,0,.35)}::-webkit-scrollbar-track{background:transparent}[data-monster-role=button]{background:none;border:0;display:block;overflow:hidden;padding:5px;text-align:left;text-overflow:ellipsis;white-space:nowrap;width:100%}[data-monster-role=entry][data-monster-visibility=hidden]{display:none}[data-monster-role=entry] .dropzone{background-color:red;height:20px;width:100%}[data-monster-role=entry][data-monster-intend=\"0\"]{display:flex;font-size:1rem;margin:0}[data-monster-role=entry][data-monster-intend=\"1\"]{margin:0 0 0 20px}[data-monster-role=entry][data-monster-intend=\"2\"]{font-size:.75rem;margin:0 0 0 40px}[data-monster-role=entry][data-monster-intend=\"3\"]{font-size:.7rem;margin:0 0 0 60px}[data-monster-role=entry][data-monster-intend=\"4\"]{font-size:.65rem;margin:0 0 0 80px}[data-monster-role=entry][data-monster-intend=\"5\"]{font-size:.65rem;margin:0 0 0 100px}[data-monster-role=entry][data-monster-intend=\"6\"]{font-size:.65rem;margin:0 0 0 110px}[data-monster-role=entry][data-monster-intend=\"7\"]{font-size:.65rem;margin:0 0 0 120px}[data-monster-role=entry][data-monster-intend=\"8\"]{font-size:.65rem;margin:0 0 0 130px}
24
- }`, 0);
24
+ }`,
25
+ 0,
26
+ );
25
27
  } catch (e) {
26
- addAttributeToken(document.getRootNode().querySelector('html'), ATTRIBUTE_ERRORMESSAGE, e + "");
28
+ addAttributeToken(
29
+ document.getRootNode().querySelector("html"),
30
+ ATTRIBUTE_ERRORMESSAGE,
31
+ e + "",
32
+ );
27
33
  }
@@ -328,45 +328,10 @@ function transform(value) {
328
328
  let trueStatement = args.shift() || undefined;
329
329
  let falseStatement = args.shift() || undefined;
330
330
 
331
- if (trueStatement === "value") {
332
- trueStatement = value;
333
- }
334
- if (trueStatement === "\\value") {
335
- trueStatement = "value";
336
- }
337
-
338
- if (trueStatement === "\\undefined") {
339
- trueStatement = undefined;
340
- }
341
-
342
- if (trueStatement === "\\null") {
343
- trueStatement = null;
344
- }
345
-
346
- if (falseStatement === "value") {
347
- falseStatement = value;
348
- }
349
- if (falseStatement === "\\value") {
350
- falseStatement = "value";
351
- }
352
-
353
- if (falseStatement === "\\undefined") {
354
- falseStatement = undefined;
355
- }
356
-
357
- if (falseStatement === "\\null") {
358
- falseStatement = null;
359
- }
331
+ trueStatement = convertSpecialStrings(trueStatement, value);
332
+ falseStatement = convertSpecialStrings(falseStatement, value);
360
333
 
361
- const condition =
362
- (value !== undefined &&
363
- value !== "" &&
364
- value !== "off" &&
365
- value !== "false" &&
366
- value !== false) ||
367
- value === "on" ||
368
- value === "true" ||
369
- value === true;
334
+ const condition = evaluateCondition(value);
370
335
  return condition ? trueStatement : falseStatement;
371
336
 
372
337
  case "ucfirst":
@@ -622,10 +587,7 @@ function transform(value) {
622
587
  * that null is an object.
623
588
  */
624
589
  if (value === null) {
625
- if (equalsValue === "null") {
626
- return true;
627
- }
628
- return false;
590
+ return equalsValue === "null";
629
591
  }
630
592
 
631
593
  const typeOfValue = typeof value;
@@ -672,7 +634,6 @@ function transform(value) {
672
634
 
673
635
  return nf.format(amount);
674
636
 
675
-
676
637
  case "timestamp":
677
638
  date = new Date(value);
678
639
  timestamp = date.getTime();
@@ -810,9 +771,43 @@ function transform(value) {
810
771
  }
811
772
 
812
773
  defaultValue = args.shift() || undefined;
774
+
775
+ defaultValue = convertSpecialStrings(defaultValue, value);
776
+
813
777
  return translations.getText(key, defaultValue);
814
778
 
815
779
  default:
816
780
  throw new Error(`unknown command ${this.command}`);
817
781
  }
818
782
  }
783
+
784
+ function convertSpecialStrings(input, value) {
785
+ switch (input) {
786
+ case "value":
787
+ return value;
788
+ case "\\value":
789
+ return "value";
790
+ case "\\undefined":
791
+ return undefined;
792
+ case "\\null":
793
+ return null;
794
+ default:
795
+ return input;
796
+ }
797
+ }
798
+
799
+ function evaluateCondition(value) {
800
+ const lowerValue = typeof value === "string" ? value.toLowerCase() : value;
801
+
802
+ return (
803
+ (value !== undefined &&
804
+ value !== null &&
805
+ value !== "" &&
806
+ lowerValue !== "off" &&
807
+ lowerValue !== "false" &&
808
+ value !== false) ||
809
+ lowerValue === "on" ||
810
+ lowerValue === "true" ||
811
+ value === true
812
+ );
813
+ }
@@ -55,10 +55,10 @@ function findClosestObjectLink(element) {
55
55
  * @since 1.9.0
56
56
  * @copyright schukai GmbH
57
57
  * @memberOf Monster.DOM
58
- * @param {HTMLElement} element
59
- * @param {Symbol} symbol
60
- * @param {Object} object
61
- * @return {boolean}
58
+ * @param element
59
+ * @param symbol
60
+ * @param object
61
+ * @returns {*}
62
62
  */
63
63
  function addToObjectLink(element, symbol, object) {
64
64
  validateInstance(element, HTMLElement);
@@ -82,7 +82,7 @@ function addToObjectLink(element, symbol, object) {
82
82
  * @memberOf Monster.DOM
83
83
  * @param {HTMLElement} element
84
84
  * @param {Symbol} symbol
85
- * @return {boolean}
85
+ * @returns {*}
86
86
  */
87
87
  function removeObjectLink(element, symbol) {
88
88
  validateInstance(element, HTMLElement);
@@ -1018,7 +1018,7 @@ function initHtmlContent() {
1018
1018
  if (isString(html) && html.length > 0) {
1019
1019
  const mapping = this.getOption("templateMapping", {});
1020
1020
  if (isObject(mapping)) {
1021
- html = new Formatter(mapping).format(html);
1021
+ html = new Formatter(mapping, {}).format(html);
1022
1022
  }
1023
1023
  this.innerHTML = html;
1024
1024
  }
@@ -25,6 +25,7 @@ import { isArray, isInstance, isIterable } from "../types/is.mjs";
25
25
  import { Observer } from "../types/observer.mjs";
26
26
  import { ProxyObserver } from "../types/proxyobserver.mjs";
27
27
  import { validateArray, validateInstance } from "../types/validate.mjs";
28
+ import { Sleep } from "../util/sleep.mjs";
28
29
  import { clone } from "../util/clone.mjs";
29
30
  import { trimSpaces } from "../util/trimspaces.mjs";
30
31
  import { addToObjectLink } from "./attributes.mjs";
@@ -95,12 +96,20 @@ class Updater extends Base {
95
96
  const diffResult = diff(this[internalSymbol].last, s);
96
97
  this[internalSymbol].last = clone(s);
97
98
 
99
+ const promises = [];
100
+
98
101
  for (const [, change] of Object.entries(diffResult)) {
99
- removeElement.call(this, change);
100
- insertElement.call(this, change);
101
- updateContent.call(this, change);
102
- updateAttributes.call(this, change);
102
+ promises.push(
103
+ Sleep(1).then(() => {
104
+ removeElement.call(this, change);
105
+ insertElement.call(this, change);
106
+ updateContent.call(this, change);
107
+ updateAttributes.call(this, change);
108
+ }),
109
+ );
103
110
  }
111
+
112
+ return Promise.all(promises);
104
113
  }),
105
114
  );
106
115
  }
@@ -416,7 +425,7 @@ function insertElement(change) {
416
425
  wd++;
417
426
 
418
427
  const p = clone(change?.["path"]);
419
- if (!isArray(p)) return this;
428
+ if (!isArray(p)) return;
420
429
 
421
430
  while (p.length > 0) {
422
431
  const current = p.join(".");
@@ -15,6 +15,7 @@ export {
15
15
  findElementWithIdUpwards,
16
16
  getContainingDocument,
17
17
  getRegisteredCustomElements,
18
+ findElementWithSelectorUpwards,
18
19
  };
19
20
 
20
21
  /**
@@ -207,6 +208,47 @@ function findElementWithIdUpwards(element, targetId) {
207
208
  return findElementWithIdUpwards(element.parentElement, targetId);
208
209
  }
209
210
 
211
+ /**
212
+ * Recursively searches upwards from a given element to find an ancestor element
213
+ * with a specified selector, considering both normal DOM and shadow DOM.
214
+ * This method is useful for finding a parent element with a specific class.
215
+ *
216
+ * @param {HTMLElement|ShadowRoot} element - The starting element or shadow root to search from.
217
+ * @param {string} selector - The selector of the target element to find.
218
+ * @returns {HTMLElement|null} - The ancestor element with the specified selector, or null if not found.
219
+ * @memberOf Monster.DOM
220
+ * @since 3.55.0
221
+ */
222
+ function findElementWithSelectorUpwards(element, selector) {
223
+ if (!element || !selector) {
224
+ return null;
225
+ }
226
+
227
+ // Search within the current element's shadow root, if it exists
228
+ if (element.shadowRoot) {
229
+ const target = element.shadowRoot.querySelector(selector);
230
+ if (target) {
231
+ return target;
232
+ }
233
+ }
234
+
235
+ if (element === document.documentElement) {
236
+ const target = document.querySelector(selector);
237
+ if (target) {
238
+ return target;
239
+ }
240
+ }
241
+
242
+ // If the current element is inside a shadow root, search its host's ancestors
243
+ const rootNode = element.getRootNode();
244
+ if (rootNode && rootNode instanceof ShadowRoot) {
245
+ return findElementWithSelectorUpwards(rootNode.host, selector);
246
+ }
247
+
248
+ // Otherwise, search the current element's parent
249
+ return findElementWithSelectorUpwards(element.parentElement, selector);
250
+ }
251
+
210
252
  /**
211
253
  * @private
212
254
  * @param {HTMLElement} element
@@ -141,7 +141,7 @@ class Embed extends Provider {
141
141
  * `script[data-monster-role=translations]` is searched for and the translations are assigned to the element.
142
142
  *
143
143
  * @param element
144
- * @returns {Promise<unknown[]>}
144
+ * @returns {Promise<Awaited<unknown>[]>}
145
145
  */
146
146
  static assignTranslationsToElement(element) {
147
147
  const d = getDocument();
@@ -152,13 +152,13 @@ class Embed extends Provider {
152
152
 
153
153
  const list = d.querySelectorAll("script[data-monster-role=translations]");
154
154
  if (list === null) {
155
- return;
155
+ return Promise.resolve([]);
156
156
  }
157
157
 
158
158
  const promises = [];
159
159
 
160
160
  list.forEach((translationElement) => {
161
- const p = new Embed(translationElement);
161
+ const p = new Embed(translationElement, {});
162
162
  promises.push(p.assignToElement(undefined, element));
163
163
  });
164
164
 
@@ -27,6 +27,7 @@ export * from "./components/form/state-button.mjs";
27
27
  export * from "./components/form/popper.mjs";
28
28
  export * from "./components/form/select.mjs";
29
29
  export * from "./components/form/confirm-button.mjs";
30
+ export * from "./components/form/context-error.mjs";
30
31
  export * from "./components/form/action-button.mjs";
31
32
  export * from "./components/form/form.mjs";
32
33
  export * from "./components/form/api-button.mjs";
@@ -45,6 +46,7 @@ export * from "./components/form/stylesheet/state-button.mjs";
45
46
  export * from "./components/form/stylesheet/popper.mjs";
46
47
  export * from "./components/form/stylesheet/select.mjs";
47
48
  export * from "./components/form/stylesheet/confirm-button.mjs";
49
+ export * from "./components/form/stylesheet/context-error.mjs";
48
50
  export * from "./components/form/stylesheet/action-button.mjs";
49
51
  export * from "./components/form/stylesheet/form.mjs";
50
52
  export * from "./components/form/stylesheet/api-button.mjs";
@@ -93,6 +95,7 @@ export * from "./components/datatable/util.mjs";
93
95
  export * from "./components/datatable/filter.mjs";
94
96
  export * from "./components/datatable/dataset.mjs";
95
97
  export * from "./components/datatable/embedded-pagination.mjs";
98
+ export * from "./components/datatable/status.mjs";
96
99
  export * from "./components/datatable/constants.mjs";
97
100
  export * from "./components/datatable/stylesheet/select-filter.mjs";
98
101
  export * from "./components/datatable/stylesheet/datasource.mjs";
@@ -105,6 +108,7 @@ export * from "./components/datatable/stylesheet/filter.mjs";
105
108
  export * from "./components/datatable/stylesheet/dataset.mjs";
106
109
  export * from "./components/datatable/stylesheet/embedded-pagination.mjs";
107
110
  export * from "./components/datatable/stylesheet/filter-controls-defaults.mjs";
111
+ export * from "./components/datatable/stylesheet/status.mjs";
108
112
  export * from "./components/datatable/stylesheet/filter-range.mjs";
109
113
  export * from "./components/state/log/entry.mjs";
110
114
  export * from "./components/state/state.mjs";
@@ -120,6 +124,7 @@ export * from "./components/stylesheet/spinner.mjs";
120
124
  export * from "./components/stylesheet/control.mjs";
121
125
  export * from "./components/stylesheet/card.mjs";
122
126
  export * from "./components/stylesheet/common.mjs";
127
+ export * from "./components/stylesheet/icons.mjs";
123
128
  export * from "./components/stylesheet/popper.mjs";
124
129
  export * from "./components/stylesheet/theme.mjs";
125
130
  export * from "./components/stylesheet/data-grid.mjs";
@@ -112,8 +112,8 @@ class Formatter extends BaseWithOptions {
112
112
  /**
113
113
  * Default values for the markers are `${` and `}`
114
114
  *
115
- * @param {object} object
116
- * @throws {TypeError} value is not a object
115
+ * @param object
116
+ * @param options
117
117
  */
118
118
  constructor(object, options) {
119
119
  super(options);
@@ -22,7 +22,7 @@ export { NodeRecursiveIterator };
22
22
  const isNodeListSymbol = Symbol("isNodeList");
23
23
 
24
24
  /**
25
- * You can create the instance via the monster namespace `new Monster.Types.NodeRecursiveIterator()`.
25
+ * Represents a recursive iterator for traversing nodes in a DOM tree.
26
26
  *
27
27
  * @externalExample ../../example/types/noderecursiveiterator.mjs
28
28
  * @license AGPLv3
@@ -30,22 +30,25 @@ const isNodeListSymbol = Symbol("isNodeList");
30
30
  * @copyright schukai GmbH
31
31
  * @memberOf Monster.Types
32
32
  * @summary An iterator to run recursively through a tree of nodes
33
+ * @extends Base
33
34
  */
34
35
  class NodeRecursiveIterator extends Base {
35
36
  /**
36
- * @param {Node} [data]
37
+ * @param node
37
38
  */
38
39
  constructor(node) {
39
40
  super();
40
41
 
41
42
  this[isNodeListSymbol] = false;
42
43
 
43
- // iterator is a nodelist
44
+ // iterator is a NodeList
44
45
  if (isInstance(node, NodeList)) {
45
46
  const children = node;
46
- node = new Node();
47
- node.childNodes = children;
47
+ let n = new Node();
48
+ n.childNodes = children;
48
49
  this[isNodeListSymbol] = true;
50
+ this[internalSymbol] = n;
51
+ return;
49
52
  }
50
53
 
51
54
  this[internalSymbol] = validateInstance(node, Node);
@@ -77,8 +80,7 @@ class NodeRecursiveIterator extends Base {
77
80
  yield* new NodeRecursiveIterator(node);
78
81
  }
79
82
  }
80
-
81
- return;
83
+
82
84
  };
83
85
 
84
86
  /**
@@ -135,7 +135,7 @@ class Observer extends Base {
135
135
 
136
136
  setTimeout(() => {
137
137
  try {
138
- // the queue and the settimeout ensure that an object is not
138
+ // the queue and the `setTimeout` ensure that an object is not
139
139
  // informed of the same change more than once.
140
140
  if (self.queue.isEmpty()) {
141
141
  resolve();
@@ -152,7 +152,7 @@ function getMonsterVersion() {
152
152
  }
153
153
 
154
154
  /** don't touch, replaced by make with package.json version */
155
- monsterVersion = new Version("3.54.0");
155
+ monsterVersion = new Version("3.55.1");
156
156
 
157
157
  return monsterVersion;
158
158
  }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright schukai GmbH and contributors 2023. All Rights Reserved.
3
+ * Node module: @schukai/monster
4
+ * This file is licensed under the AGPLv3 License.
5
+ * License text available at https://www.gnu.org/licenses/agpl-3.0.en.html
6
+ */
7
+
8
+ /**
9
+ *
10
+ * @param milliseconds
11
+ * @returns {Promise<unknown>}
12
+ * @since 3.55.0
13
+ * @memberOf Monster.Util
14
+ */
15
+ export function Sleep(milliseconds) {
16
+ return new Promise((resolve) => setTimeout(resolve, milliseconds));
17
+ }
@@ -103,6 +103,7 @@ describe('Button', function () {
103
103
 
104
104
  setTimeout(() => {
105
105
  try {
106
+
106
107
  const options = button.shadowRoot.querySelector('button');
107
108
 
108
109
  expect(options).is.instanceof(HTMLButtonElement);
@@ -112,7 +113,7 @@ describe('Button', function () {
112
113
  }
113
114
 
114
115
  done();
115
- }, 0)
116
+ }, 100)
116
117
 
117
118
 
118
119
  });
@@ -176,7 +176,7 @@ describe('Select', function () {
176
176
  done();
177
177
 
178
178
 
179
- }, 0)
179
+ }, 100)
180
180
  }
181
181
  }
182
182
 
@@ -172,7 +172,7 @@ describe('Treeselect', function () {
172
172
  }
173
173
 
174
174
  done();
175
- }, 0)
175
+ }, 100)
176
176
 
177
177
 
178
178
  });
@@ -110,13 +110,13 @@ describe('Transformer', function () {
110
110
  [' if:a: ', false, undefined], // without \\
111
111
  [' if:a:\\ ', false, " "],
112
112
  [' if:a:\\ ', true, "a"],
113
+ ['default:undefined:bool', undefined, false],
113
114
  ['default:yes', null, 'yes'],
114
115
  ['default:yes', undefined, 'yes'],
115
116
  ['default:1:bool', undefined, true],
116
117
  ['default:on:bool', undefined, true],
117
118
  ['default:true:bool', undefined, true],
118
119
  ['default:yes:bool', undefined, true],
119
- ['default:undefined:bool', undefined, false],
120
120
  ['default:false:bool', undefined, false],
121
121
  ['default:1:int', undefined, 1],
122
122
  ['default:1:string', undefined, '1'],
@@ -190,7 +190,7 @@ describe('Transformer', function () {
190
190
  });
191
191
 
192
192
  const r = t.run(b);
193
- expect(r).to.be.eql(c);
193
+ expect(r).to.be.eql(c, "Transformer.run(" + JSON.stringify(a) + ").run(" + JSON.stringify(b) + ") should return " + JSON.stringify(c));
194
194
  });
195
195
  });
196
196