@schukai/monster 3.95.2 → 3.96.1

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/package.json +1 -1
  3. package/source/components/content/copy.mjs +1 -1
  4. package/source/components/datatable/dataset.mjs +29 -25
  5. package/source/components/datatable/datasource/dom.mjs +4 -6
  6. package/source/components/datatable/datasource/rest.mjs +472 -474
  7. package/source/components/datatable/datasource.mjs +0 -8
  8. package/source/components/datatable/pagination.mjs +434 -440
  9. package/source/components/datatable/status.mjs +1 -3
  10. package/source/components/datatable/stylesheet/pagination.mjs +13 -6
  11. package/source/components/datatable/util.mjs +1 -1
  12. package/source/components/form/api-bar.mjs +1 -1
  13. package/source/components/form/api-button.mjs +1 -1
  14. package/source/components/form/button-bar.mjs +1 -1
  15. package/source/components/form/button.mjs +2 -2
  16. package/source/components/form/confirm-button.mjs +1 -1
  17. package/source/components/form/form.mjs +7 -5
  18. package/source/components/form/select.mjs +2014 -2006
  19. package/source/components/form/style/field-set.pcss +9 -0
  20. package/source/components/form/style/toggle-switch.pcss +3 -0
  21. package/source/components/form/stylesheet/field-set.mjs +7 -14
  22. package/source/components/form/stylesheet/toggle-switch.mjs +7 -14
  23. package/source/components/form/toggle-switch.mjs +386 -334
  24. package/source/components/layout/tabs.mjs +900 -898
  25. package/source/components/layout/width-toggle.mjs +1 -1
  26. package/source/components/navigation/table-of-content.mjs +1 -1
  27. package/source/components/notify/message.mjs +11 -15
  28. package/source/components/notify/notify.mjs +11 -15
  29. package/source/components/notify/stylesheet/notify.mjs +13 -6
  30. package/source/components/state/log.mjs +185 -185
  31. package/source/components/state/state.mjs +1 -1
  32. package/source/components/state/stylesheet/log.mjs +13 -6
  33. package/source/components/style/theme.css +4 -4
  34. package/source/data/datasource/server/restapi.mjs +2 -3
  35. package/source/data/transformer.mjs +803 -806
  36. package/source/dom/constants.mjs +8 -5
  37. package/source/dom/customelement.mjs +0 -34
  38. package/source/dom/updater.mjs +764 -767
  39. package/source/i18n/time-ago.mjs +1352 -636
  40. package/source/monster.mjs +2 -0
  41. package/source/types/has.mjs +3 -6
  42. package/source/types/version.mjs +1 -1
  43. package/test/cases/components/form/form.mjs +166 -125
  44. package/test/cases/components/form/toggle-switch.mjs +80 -65
  45. package/test/cases/monster.mjs +1 -1
  46. package/test/web/import.js +1 -0
  47. package/test/web/test.html +2 -2
  48. package/test/web/tests.js +2080 -1433
package/CHANGELOG.md CHANGED
@@ -2,6 +2,32 @@
2
2
 
3
3
 
4
4
 
5
+ ## [3.96.1] - 2024-12-30
6
+
7
+ ### Bug Fixes
8
+
9
+ - **monster-toggle-switch:** bouncing effekt [#274](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/274)
10
+ - **toggle-switch:** repair test [#274](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/274)
11
+ ### Changes
12
+
13
+ - update doc, small issues, etc [#274](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/274)
14
+
15
+
16
+
17
+ ## [3.96.0] - 2024-12-29
18
+
19
+ ### Add Features
20
+
21
+ - **tabs:** add auto open feature [#273](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/273)
22
+ ### Bug Fixes
23
+
24
+ - the form tests are outdated
25
+ ### Changes
26
+
27
+ - update project
28
+
29
+
30
+
5
31
  ## [3.95.2] - 2024-12-28
6
32
 
7
33
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.12","@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":"3.95.2"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.12","@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":"3.96.1"}
@@ -84,7 +84,7 @@ const resizeObserverSymbol = Symbol("resizeObserver");
84
84
  *
85
85
  * @fragments /fragments/components/content/copy/
86
86
  *
87
- * @example /examples/components/content/copy-simple
87
+ * @example /examples/components/content/copy-simple Copy
88
88
  *
89
89
  * @since 3.77.0
90
90
  * @copyright schukai GmbH
@@ -20,7 +20,7 @@ import {
20
20
  attributeObserverSymbol,
21
21
  registerCustomElement,
22
22
  } from "../../dom/customelement.mjs";
23
- import {findElementWithSelectorUpwards} from "../../dom/util.mjs";
23
+ import {findElementWithSelectorUpwards, getDocument, getWindow} from "../../dom/util.mjs";
24
24
  import {isString} from "../../types/is.mjs";
25
25
  import {Observer} from "../../types/observer.mjs";
26
26
  import {
@@ -42,8 +42,8 @@ export {DataSet};
42
42
  *
43
43
  * @fragments /fragments/components/datatable/dataset
44
44
  *
45
- * @example /examples/components/datatable/dataset-simple
46
- * @example /examples/components/datatable/dataset-rest
45
+ * @example /examples/components/datatable/dataset-dom Dom dataset
46
+ * @example /examples/components/datatable/dataset-rest Rest dataset
47
47
  *
48
48
  * @issue https://localhost.alvine.dev:8443/development/issues/closed/272.html
49
49
  *
@@ -56,7 +56,7 @@ class DataSet extends CustomElement {
56
56
  * @return {symbol}
57
57
  */
58
58
  static get [instanceSymbol]() {
59
- return Symbol.for("@schukai/monster/components/dataset@@instance");
59
+ return Symbol.for("@schukai/monster/components/datatable/dataset@@instance");
60
60
  }
61
61
 
62
62
  /**
@@ -118,7 +118,7 @@ class DataSet extends CustomElement {
118
118
  * @type {boolean}
119
119
  */
120
120
  refreshOnMutation: {
121
- selector: "input, select, textarea",
121
+ selector: "input, select, textarea, monster-select, monster-toggle-switch",
122
122
  },
123
123
 
124
124
  data: {},
@@ -139,12 +139,12 @@ class DataSet extends CustomElement {
139
139
  /**
140
140
  * This method is called when the component is created.
141
141
  * @since 3.70.0
142
- * @return {DataSet}
142
+ * @return {Promise}
143
143
  */
144
144
  refresh() {
145
145
  // makes sure that handleDataSourceChanges is called
146
146
  this.setOption("data", {});
147
- return this;
147
+ return Promise.resolve(this);
148
148
  }
149
149
 
150
150
  /**
@@ -224,7 +224,6 @@ class DataSet extends CustomElement {
224
224
  super[assembleMethodSymbol]();
225
225
 
226
226
  requestAnimationFrame(() => {
227
-
228
227
  if (!this[datasourceLinkedElementSymbol]) {
229
228
  const selector = this.getOption("datasource.selector");
230
229
 
@@ -257,9 +256,7 @@ class DataSet extends CustomElement {
257
256
  }
258
257
 
259
258
  initEventHandler.call(this);
260
-
261
259
  });
262
-
263
260
  }
264
261
 
265
262
  /**
@@ -274,8 +271,8 @@ class DataSet extends CustomElement {
274
271
  * @private
275
272
  */
276
273
  function initEventHandler() {
277
-
278
- this[attributeObserverSymbol][ATTRIBUTE_DATATABLE_INDEX] = () => { // @deprecated use data-monster-option-mapping-index
274
+ this[attributeObserverSymbol][ATTRIBUTE_DATATABLE_INDEX] = () => {
275
+ // @deprecated use data-monster-option-mapping-index
279
276
  const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX);
280
277
  if (index) {
281
278
  this.setOption("mapping.index", parseInt(index, 10));
@@ -292,32 +289,39 @@ function initEventHandler() {
292
289
  };
293
290
 
294
291
  if (this[datasourceLinkedElementSymbol]) {
295
-
296
292
  this[datasourceLinkedElementSymbol].datasource.attachObserver(
297
293
  new Observer(() => {
298
- const page = this[datasourceLinkedElementSymbol]?.currentPage();
299
- if (page !== null && page !== undefined && page !== "") {
300
- const index = parseInt(page, 10) - 1;
301
- this.setOption("mapping.index", index);
302
- handleDataSourceChanges.call(this);
294
+
295
+ let index = 0;
296
+ if (typeof this[datasourceLinkedElementSymbol]?.currentPage === "function") {
297
+ const page = this[datasourceLinkedElementSymbol].currentPage();
298
+ if (page !== null && page !== undefined && page !== "") {
299
+ index = parseInt(page, 10) - 1;
300
+ }
303
301
  }
302
+
303
+ this.setOption("mapping.index", index);
304
+ handleDataSourceChanges.call(this);
304
305
  }),
305
306
  );
306
307
 
307
308
  this[datasourceLinkedElementSymbol].attachObserver(
308
309
  new Observer(() => {
309
- const page = this[datasourceLinkedElementSymbol]?.currentPage();
310
- if (page !== null && page !== undefined && page !== "") {
311
- const index = parseInt(page, 10) - 1;
312
- this.setOption("mapping.index", index);
313
- handleDataSourceChanges.call(this);
310
+ let index = 0;
311
+ if (typeof this[datasourceLinkedElementSymbol]?.currentPage === "function") {
312
+ const page = this[datasourceLinkedElementSymbol].currentPage();
313
+ if (page !== null && page !== undefined && page !== "") {
314
+ index = parseInt(page, 10) - 1;
315
+ }
314
316
  }
317
+
318
+ this.setOption("mapping.index", index);
319
+ handleDataSourceChanges.call(this);
315
320
  }),
316
321
  );
317
322
 
318
323
  handleDataSourceChanges.call(this);
319
324
  }
320
-
321
325
  }
322
326
 
323
327
  /**
@@ -325,7 +329,7 @@ function initEventHandler() {
325
329
  * @param {Object} options
326
330
  */
327
331
  function updateOptionsFromArguments(options) {
328
- const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX); // @deprecated use data-monster-option-mapping-index
332
+ const index = this.getAttribute(ATTRIBUTE_DATATABLE_INDEX); // @deprecated use data-monster-option-mapping-index
329
333
 
330
334
  if (index !== null && index !== undefined) {
331
335
  options.mapping.index = parseInt(index, 10);
@@ -72,8 +72,8 @@ class Dom extends Datasource {
72
72
  pages: 1,
73
73
  objectsPerPage: 10,
74
74
  currentPage: 1,
75
- }
76
- }
75
+ },
76
+ },
77
77
  });
78
78
  }
79
79
 
@@ -92,7 +92,7 @@ class Dom extends Datasource {
92
92
  * @param {string} page
93
93
  * @return {Dom}
94
94
  */
95
- setParameters({page}) {
95
+ setParameters({ page }) {
96
96
  this.setOption("sys.pagination.currentPage", page);
97
97
  return this;
98
98
  }
@@ -199,14 +199,12 @@ function updateDataSource() {
199
199
  }
200
200
 
201
201
  // set pagination
202
- this.setOption("sys.pagination.objectsPerPage", 1 );
202
+ this.setOption("sys.pagination.objectsPerPage", 1);
203
203
  this.setOption("sys.pagination.pages", data.length);
204
204
  this.setOption("sys.pagination.currentPage", 1);
205
205
 
206
206
  /** call setter */
207
207
  this.data = data;
208
-
209
-
210
208
  }
211
209
 
212
210
  /**