@schukai/monster 4.29.1 → 4.30.0

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.30.0] - 2025-07-08
6
+
7
+ ### Add Features
8
+
9
+ - Refactor Select and Updater for improved readability and functionality
10
+
11
+
12
+
5
13
  ## [4.29.1] - 2025-07-07
6
14
 
7
15
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.2","@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":"4.29.1"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.7.2","@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":"4.30.0"}
@@ -608,9 +608,9 @@ class Select extends CustomControl {
608
608
  let lastValue = self.value;
609
609
  self[internalSymbol].attachObserver(
610
610
  new Observer(function () {
611
+ // this is here not the Control, but the ProxyObserver
611
612
  if (isObject(this) && this instanceof ProxyObserver) {
612
613
  const n = this.getSubject()?.options?.value;
613
-
614
614
  if (lastValue !== n && n !== undefined) {
615
615
  lastValue = n;
616
616
  setSelection
@@ -806,6 +806,7 @@ class Select extends CustomControl {
806
806
  * @returns {any}
807
807
  */
808
808
  function importOptionsIntern(data) {
809
+
809
810
  const self = this;
810
811
  const mappingOptions = this.getOption("mapping", {});
811
812
  const selector = mappingOptions?.["selector"];
@@ -154,26 +154,25 @@ class Updater extends Base {
154
154
  }
155
155
  this[processingSymbol] = true;
156
156
 
157
- while (this[pendingDiffsSymbol].length > 0) {
157
+ while (this[pendingDiffsSymbol].length) {
158
158
  const diffResult = this[pendingDiffsSymbol].shift();
159
- for (const [, change] of Object.entries(diffResult)) {
160
- await new Promise((resolve, reject) => {
161
- try {
162
- removeElement.call(this, change);
163
- insertElement.call(this, change);
164
- updateContent.call(this, change);
165
- updateAttributes.call(this, change);
166
- resolve();
167
- } catch (err) {
168
- reject(err);
169
- }
170
- });
159
+ for (const change of Object.values(diffResult)) {
160
+ await this.#applyChange(change);
171
161
  }
172
162
  }
173
163
 
174
164
  this[processingSymbol] = false;
175
165
  }
176
166
 
167
+ /** @private **/
168
+ async #applyChange(change) {
169
+ removeElement.call(this, change);
170
+ insertElement.call(this, change);
171
+ updateContent.call(this, change);
172
+ await Promise.resolve();
173
+ updateAttributes.call(this, change);
174
+ }
175
+
177
176
  /**
178
177
  * Defaults: 'keyup', 'click', 'change', 'drop', 'touchend'
179
178
  *