@schukai/monster 3.73.9 → 3.74.0

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,17 @@
2
2
 
3
3
 
4
4
 
5
+ ## [3.74.0] - 2024-09-18
6
+
7
+ ### Add Features
8
+
9
+ - new slider [#237](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/237)
10
+ ### Bug Fixes
11
+
12
+ - performance tweak [#235](https://gitlab.schukai.com/oss/libraries/javascript/monster/issues/235)
13
+
14
+
15
+
5
16
  ## [3.73.9] - 2024-09-15
6
17
 
7
18
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.11","@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.73.9"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.11","@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.74.0"}
@@ -222,7 +222,7 @@ function initControlReferences() {
222
222
  );
223
223
 
224
224
  if (this[stateButtonElementSymbol]) {
225
- setTimeout(() => {
225
+ queueMicrotask(() => {
226
226
  const states = {
227
227
  changed: new State(
228
228
  "changed",
@@ -239,7 +239,7 @@ function initControlReferences() {
239
239
  "labels.button",
240
240
  this.getOption("labels.button"),
241
241
  );
242
- }, 1);
242
+ });
243
243
  }
244
244
 
245
245
  return this;
@@ -278,7 +278,7 @@ function getIndex() {
278
278
  * @private
279
279
  */
280
280
  function initEventHandler() {
281
- setTimeout(() => {
281
+ queueMicrotask(() => {
282
282
  this[stateButtonElementSymbol].setOption("actions.click", () => {
283
283
  const index = getIndex.call(this);
284
284
 
@@ -287,7 +287,7 @@ function initEventHandler() {
287
287
  this[overlayLinkedElementSymbol].open();
288
288
  }
289
289
  });
290
- }, 1);
290
+ });
291
291
  }
292
292
 
293
293
  /**
@@ -249,12 +249,12 @@ function initEventHandler() {
249
249
  if (self[settingsLayerElementSymbol].classList.contains("visible")) {
250
250
  self[popperInstanceSymbol].update();
251
251
 
252
- setTimeout(() => {
252
+ queueMicrotask(() => {
253
253
  document.body.addEventListener(
254
254
  "click",
255
255
  self[settingsButtonEventHandlerSymbol],
256
256
  );
257
- }, 0);
257
+ });
258
258
  }
259
259
  }
260
260
  });
@@ -198,7 +198,7 @@ class DataSet extends CustomElement {
198
198
  return;
199
199
  }
200
200
 
201
- setTimeout(() => {
201
+ queueMicrotask(() => {
202
202
  const path = this.getOption("mapping.data");
203
203
  const index = this.getOption("mapping.index");
204
204
 
@@ -224,7 +224,7 @@ class DataSet extends CustomElement {
224
224
  this[datasourceLinkedElementSymbol].data = ref;
225
225
 
226
226
  resolve();
227
- }, 0);
227
+ });
228
228
  });
229
229
  }
230
230
 
@@ -215,6 +215,7 @@ class Rest extends Datasource {
215
215
  * @returns {Promise<never>|*}
216
216
  */
217
217
  fetch() {
218
+
218
219
  const opt = clone(this.getOption("read"));
219
220
  this[dataSourceSymbol].setOption("read", opt);
220
221
 
@@ -234,7 +235,7 @@ class Rest extends Datasource {
234
235
  datasource: this,
235
236
  });
236
237
 
237
- setTimeout(() => {
238
+ queueMicrotask(() => {
238
239
  this[dataSourceSymbol]
239
240
  .read()
240
241
  .then((response) => {
@@ -252,7 +253,7 @@ class Rest extends Datasource {
252
253
  addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error.toString());
253
254
  reject(error);
254
255
  });
255
- }, 0);
256
+ });
256
257
  });
257
258
  }
258
259
 
@@ -289,11 +290,11 @@ class Rest extends Datasource {
289
290
  connectedCallback() {
290
291
  super.connectedCallback();
291
292
 
292
- setTimeout(() => {
293
+ queueMicrotask(() => {
293
294
  if (this.getOption("features.filter", false) === true) {
294
295
  initFilter.call(this);
295
296
  }
296
- }, 0);
297
+ });
297
298
  }
298
299
 
299
300
  /**
@@ -335,7 +336,7 @@ class Rest extends Datasource {
335
336
  datasource: this,
336
337
  });
337
338
 
338
- setTimeout(() => {
339
+ queueMicrotask(() => {
339
340
  this[dataSourceSymbol]
340
341
  .write()
341
342
  .then((response) => {
@@ -353,7 +354,7 @@ class Rest extends Datasource {
353
354
  addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error.toString());
354
355
  reject(error);
355
356
  });
356
- }, 0);
357
+ });
357
358
  });
358
359
  }
359
360
  }
@@ -492,9 +493,9 @@ function initAutoInit() {
492
493
  return;
493
494
  }
494
495
 
495
- setTimeout(() => {
496
+ queueMicrotask(() => {
496
497
  this.fetch().catch(() => {});
497
- }, 0);
498
+ });
498
499
  }
499
500
 
500
501
  function initEventHandler() {
@@ -290,12 +290,12 @@ class DataTable extends CustomElement {
290
290
 
291
291
  this[datasourceLinkedElementSymbol] = element;
292
292
 
293
- setTimeout(() => {
293
+ queueMicrotask(() => {
294
294
  handleDataSourceChanges.call(this);
295
295
  element.datasource.attachObserver(
296
296
  new Observer(handleDataSourceChanges.bind(this)),
297
297
  );
298
- }, 0);
298
+ });
299
299
  }
300
300
 
301
301
  getHostConfig
@@ -658,7 +658,7 @@ function initEventHandler() {
658
658
 
659
659
  headers[index].changeDirection();
660
660
 
661
- setTimeout(function () {
661
+ queueMicrotask(function () {
662
662
  /** hotfix, normally this should be done via the updater, no idea why this is not possible. */
663
663
  element.setAttribute(
664
664
  ATTRIBUTE_DATATABLE_SORTABLE,
@@ -666,7 +666,7 @@ function initEventHandler() {
666
666
  );
667
667
 
668
668
  storeOrderStatement.call(self, true);
669
- }, 0);
669
+ });
670
670
  }
671
671
  });
672
672
  }
@@ -797,9 +797,9 @@ function initGridAndStructs(hostConfig, headerOrderMap) {
797
797
  }
798
798
 
799
799
  this.setOption("headers", headers);
800
- setTimeout(() => {
800
+ queueMicrotask(() => {
801
801
  storeOrderStatement.call(this, this.getOption("features.autoInit"));
802
- }, 0);
802
+ });
803
803
  }
804
804
 
805
805
  /**
@@ -480,9 +480,9 @@ function initEventHandler() {
480
480
 
481
481
  // change the input value if the user change the value of the radio button
482
482
  this[inputElementSymbol].addEventListener("change", (event) => {
483
- setTimeout(() => {
483
+ queueMicrotask(() => {
484
484
  updatePopperInputsFromMainValue.call(this);
485
- }, 0);
485
+ });
486
486
  });
487
487
 
488
488
  // if the user change the value of on of the input fields, we should update the value of the input field
@@ -514,9 +514,9 @@ function initEventHandler() {
514
514
  if (event.key === "Escape") {
515
515
  hide.call(this);
516
516
 
517
- setTimeout(() => {
517
+ queueMicrotask(() => {
518
518
  this[inputElementSymbol].focus();
519
- }, 10);
519
+ });
520
520
 
521
521
  return;
522
522
  }
@@ -600,10 +600,10 @@ function show() {
600
600
  clearAndDisableFormGroups.call(this);
601
601
  }
602
602
 
603
- setTimeout(() => {
603
+ queueMicrotask(() => {
604
604
  updatePopperInputsFromMainValue.call(this);
605
605
  updatePopper.call(this);
606
- }, 0);
606
+ });
607
607
  }
608
608
 
609
609
  /**
@@ -412,9 +412,9 @@ function initEventHandler() {
412
412
  // if key code esc than hide dialog
413
413
  if (event.key === "Escape") {
414
414
  hide.call(this);
415
- setTimeout(() => {
415
+ queueMicrotask(() => {
416
416
  this[inputElementSymbol].focus();
417
- }, 10);
417
+ });
418
418
 
419
419
  return;
420
420
  }
@@ -438,7 +438,7 @@ function initEventHandler() {
438
438
  if (radio) {
439
439
  radio.checked = true;
440
440
  }
441
- setTimeout(() => {
441
+ queueMicrotask(() => {
442
442
  // focus the input field
443
443
  const input = this[formContainerElementSymbol].querySelector(
444
444
  "input[type=radio][value=single] ~ input[name=singleValue]",
@@ -446,7 +446,7 @@ function initEventHandler() {
446
446
  if (input) {
447
447
  input.focus();
448
448
  }
449
- }, 10);
449
+ });
450
450
  }
451
451
  });
452
452
 
@@ -386,14 +386,14 @@ function initControlReferences() {
386
386
  }
387
387
 
388
388
  function updateFilterSelections() {
389
- setTimeout(() => {
389
+ queueMicrotask(() => {
390
390
  const options = this[settingsSymbol].getOptions();
391
391
  this[filterSelectElementSymbol].setOption("options", options);
392
- setTimeout(() => {
392
+ queueMicrotask(() => {
393
393
  this[filterSelectElementSymbol].value =
394
394
  this[settingsSymbol].getSelected();
395
- }, 10);
396
- }, 10);
395
+ });
396
+ });
397
397
  }
398
398
 
399
399
  /**
@@ -260,7 +260,7 @@ function initControlReferences() {
260
260
  );
261
261
 
262
262
  if (this[stateButtonElementSymbol]) {
263
- setTimeout(() => {
263
+ queueMicrotask(() => {
264
264
  const states = {
265
265
  changed: new State(
266
266
  "changed",
@@ -278,7 +278,7 @@ function initControlReferences() {
278
278
  "labels.button",
279
279
  this.getOption("labels.button"),
280
280
  );
281
- }, 1);
281
+ });
282
282
  }
283
283
 
284
284
  return this;
@@ -288,7 +288,7 @@ function initControlReferences() {
288
288
  * @private
289
289
  */
290
290
  function initEventHandler() {
291
- setTimeout(() => {
291
+ queueMicrotask(() => {
292
292
  this[stateButtonElementSymbol].setOption("actions.click", () => {
293
293
  this[datasourceLinkedElementSymbol]
294
294
  .write()
@@ -308,7 +308,7 @@ function initEventHandler() {
308
308
  addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, error.toString());
309
309
  });
310
310
  });
311
- }, 1);
311
+ });
312
312
  }
313
313
 
314
314
  /**
@@ -66,7 +66,7 @@ function handleDataSourceChanges() {
66
66
  return;
67
67
  }
68
68
 
69
- setTimeout(() => {
69
+ queueMicrotask(() => {
70
70
  this.setOption("data", data);
71
- }, 0);
71
+ });
72
72
  }