@schukai/monster 3.105.2 → 3.106.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
 
4
4
 
5
+ ## [3.106.1] - 2025-02-09
6
+
7
+ ### Bug Fixes
8
+
9
+ - **select:** update empty value handling
10
+ ### Changes
11
+
12
+ - update nix
13
+
14
+
15
+
16
+ ## [3.106.0] - 2025-02-07
17
+
18
+ ### Add Features
19
+
20
+ - nullabel integer bind, add debug logging for save-button
21
+
22
+
23
+
5
24
  ## [3.105.2] - 2025-02-06
6
25
 
7
26
  ### Bug Fixes
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@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.105.2"}
1
+ {"author":"schukai GmbH","dependencies":{"@floating-ui/dom":"^1.6.13","@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.106.1"}
@@ -99,6 +99,8 @@ class SaveButton extends CustomElement {
99
99
  * @property {string} classes.badge The badge class
100
100
  * @property {Array} ignoreChanges The ignore changes (regex)
101
101
  * @property {Array} data The data
102
+ * @property {boolean} disabled The disabled state
103
+ * @property {string} logLevel The log level (off, debug)
102
104
  * @return {Object}
103
105
  */
104
106
  get defaults() {
@@ -125,6 +127,9 @@ class SaveButton extends CustomElement {
125
127
  data: {},
126
128
 
127
129
  disabled: false,
130
+
131
+ logLevel: "off",
132
+
128
133
  });
129
134
 
130
135
  updateOptionsFromArguments.call(this, obj);
@@ -199,6 +204,27 @@ class SaveButton extends CustomElement {
199
204
  const ignoreChanges = self.getOption("ignoreChanges");
200
205
 
201
206
  const result = diff(self[originValuesSymbol], currentValues);
207
+ if(self.getOption("logLevel") === "debug") {
208
+ console.groupCollapsed("SaveButton");
209
+ console.log(result);
210
+
211
+ if(isArray(result)&&result.length>0) {
212
+ const formattedDiff = result.map(change => ({
213
+ Operator: change?.operator,
214
+ Path: change?.path?.join("."),
215
+ "First Value": change?.first?.value,
216
+ "First Type": change?.first?.type,
217
+ "Second Value": change?.second?.value,
218
+ "Second Type": change?.second?.type
219
+ }));
220
+
221
+ console.table(formattedDiff);
222
+ } else {
223
+ console.log("There are no changes to save");
224
+ }
225
+ console.groupEnd();
226
+
227
+ }
202
228
 
203
229
  if (isArray(ignoreChanges) && ignoreChanges.length > 0) {
204
230
  const itemsToRemove = [];
@@ -2290,12 +2290,13 @@ function isValueIsEmptyThenGetNormalize(value) {
2290
2290
  function setSelection(selection) {
2291
2291
  const self = this;
2292
2292
 
2293
+ selection = isValueIsEmptyThenGetNormalize.call(this, selection);
2294
+
2293
2295
  if (isString(selection) || isInteger(selection)) {
2294
2296
  const result = convertValueToSelection.call(this, selection);
2295
2297
  selection = result?.selection;
2296
2298
  }
2297
2299
 
2298
- selection = isValueIsEmptyThenGetNormalize.call(this, selection);
2299
2300
  validateArray(selection);
2300
2301
 
2301
2302
  let resultSelection = [];
@@ -404,6 +404,16 @@ function retrieveAndSetValue(element) {
404
404
 
405
405
  const type = element.getAttribute(ATTRIBUTE_UPDATER_BIND_TYPE);
406
406
  switch (type) {
407
+
408
+ case "integer?":
409
+ case "int?":
410
+ case "number?":
411
+ value = Number(value);
412
+ if (isNaN(value)||0===value) {
413
+ value = undefined;
414
+ }
415
+ break;
416
+
407
417
  case "number":
408
418
  case "int":
409
419
  case "float":
@@ -238,6 +238,8 @@ function format(text) {
238
238
  throw new Error("too deep nesting");
239
239
  }
240
240
 
241
+ validateString(text);
242
+
241
243
  const openMarker =
242
244
  this[internalSymbol]["marker"]["open"]?.[this[markerOpenIndexSymbol]];
243
245
  const closeMarker =