@schukai/monster 4.95.0 → 4.97.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,22 @@
2
2
 
3
3
 
4
4
 
5
+ ## [4.97.0] - 2026-01-14
6
+
7
+ ### Add Features
8
+
9
+ - Add innerDisabledObserver to enhance button state management
10
+
11
+
12
+
13
+ ## [4.96.0] - 2026-01-13
14
+
15
+ ### Add Features
16
+
17
+ - Improve dots visibility logic in columnbar component
18
+
19
+
20
+
5
21
  ## [4.95.0] - 2026-01-13
6
22
 
7
23
  ### Add Features
package/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.4","@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.95.0"}
1
+ {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.4","@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.97.0"}
@@ -502,25 +502,27 @@ function updateDotsVisibility() {
502
502
  return;
503
503
  }
504
504
 
505
- if (maxDots >= dots.length) {
506
- if (!enforceMaxVisible) {
507
- return;
508
- }
509
- }
510
-
511
- let visibleDots = Math.max(1, maxDots - 1);
512
- if (enforceMaxVisible) {
513
- visibleDots = Math.min(visibleDots, configuredMaxVisible);
505
+ const configLimit = enforceMaxVisible
506
+ ? configuredMaxVisible
507
+ : Number.POSITIVE_INFINITY;
508
+ const baseLimit = Math.min(maxDots, configLimit, dots.length);
509
+ const needsIndicator = baseLimit < dots.length;
510
+
511
+ let visibleDots = baseLimit;
512
+ if (needsIndicator) {
513
+ visibleDots = Math.min(Math.max(1, maxDots - 1), configLimit, dots.length);
514
514
  }
515
515
  for (let i = visibleDots; i < dots.length; i++) {
516
516
  dots[i].classList.add("dots-overflow-hidden");
517
517
  }
518
518
 
519
519
  const hiddenCount = dots.length - visibleDots;
520
- const overflowIndicator = document.createElement("li");
521
- overflowIndicator.className = "dots-overflow-indicator";
522
- overflowIndicator.textContent = `+${hiddenCount}`;
523
- dotsContainer.appendChild(overflowIndicator);
520
+ if (hiddenCount > 0) {
521
+ const overflowIndicator = document.createElement("li");
522
+ overflowIndicator.className = "dots-overflow-indicator";
523
+ overflowIndicator.textContent = `+${hiddenCount}`;
524
+ dotsContainer.appendChild(overflowIndicator);
525
+ }
524
526
  } finally {
525
527
  this[dotsUpdateInProgressSymbol] = false;
526
528
  }
@@ -35,6 +35,7 @@ export { MessageStateButton };
35
35
  * @type {symbol}
36
36
  */
37
37
  const buttonElementSymbol = Symbol("buttonElement");
38
+ const innerDisabledObserverSymbol = Symbol("innerDisabledObserver");
38
39
 
39
40
  /**
40
41
  * A specialized button component that combines state management with message display capabilities.
@@ -407,17 +408,44 @@ function initControlReferences() {
407
408
  */
408
409
  function initDisabledSync() {
409
410
  const self = this;
411
+ const attachInnerObserver = (button) => {
412
+ if (!button || !isFunction(button.attachObserver)) {
413
+ return;
414
+ }
415
+
416
+ const existing = self[innerDisabledObserverSymbol];
417
+ if (existing?.button === button) {
418
+ return;
419
+ }
420
+
421
+ if (
422
+ existing?.button &&
423
+ isFunction(existing.button.detachObserver) &&
424
+ existing.observer
425
+ ) {
426
+ existing.button.detachObserver(existing.observer);
427
+ }
428
+
429
+ const observer = new Observer(syncDisabled);
430
+ button.attachObserver(observer);
431
+ self[innerDisabledObserverSymbol] = { button, observer };
432
+ };
433
+
410
434
  const syncDisabled = () => {
411
435
  const disabled = self.getOption("disabled", false);
412
436
  if (self.getOption("features.disableButton", false) !== disabled) {
413
437
  self.setOption("features.disableButton", disabled);
414
438
  }
415
439
 
416
- const button = self[buttonElementSymbol];
440
+ const button =
441
+ self.shadowRoot?.querySelector(`[${ATTRIBUTE_ROLE}=button]`) ??
442
+ self[buttonElementSymbol];
417
443
  if (!button) {
418
444
  return;
419
445
  }
420
446
 
447
+ self[buttonElementSymbol] = button;
448
+
421
449
  if (disabled) {
422
450
  button.setAttribute(ATTRIBUTE_DISABLED, "");
423
451
  } else {
@@ -427,6 +455,8 @@ function initDisabledSync() {
427
455
  if (isFunction(button.setOption)) {
428
456
  button.setOption("disabled", disabled);
429
457
  }
458
+
459
+ attachInnerObserver(button);
430
460
  };
431
461
 
432
462
  syncDisabled();