@schukai/monster 4.136.25 → 4.136.26

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/package.json CHANGED
@@ -1 +1 @@
1
- {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"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.136.25"}
1
+ {"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"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.136.26"}
@@ -359,6 +359,25 @@ function isElementTrulyVisible(element) {
359
359
  );
360
360
  }
361
361
 
362
+ /**
363
+ * @private
364
+ * @param {HTMLElement} element
365
+ * @return {boolean}
366
+ */
367
+ function isElementSelfHidden(element) {
368
+ if (!(element instanceof HTMLElement)) {
369
+ return true;
370
+ }
371
+
372
+ const computedStyle = getComputedStyle(element);
373
+ return (
374
+ element.hidden === true ||
375
+ element.hasAttribute("hidden") ||
376
+ computedStyle.display === "none" ||
377
+ computedStyle.visibility === "hidden"
378
+ );
379
+ }
380
+
362
381
  /**
363
382
  * @private
364
383
  */
@@ -372,8 +391,10 @@ function initEventHandler() {
372
391
  const target = mutation.target;
373
392
  if (target instanceof HTMLElement) {
374
393
  const ref = target.getAttribute("data-monster-reference");
375
- if (ref && !isElementTrulyVisible(target)) {
376
- self[dimensionsSymbol].setVia(`data.button.${ref}`, 0);
394
+ if (ref) {
395
+ if (!isElementTrulyVisible(target)) {
396
+ self[dimensionsSymbol].setVia(`data.button.${ref}`, 0);
397
+ }
377
398
  needsRecalc = true;
378
399
  }
379
400
  }
@@ -596,12 +617,10 @@ function rearrangeButtons() {
596
617
  // In this case, we assume the width is 0.
597
618
  // This can happen for buttons that have never been visible.
598
619
  }
599
- const style = getComputedStyle(element);
600
-
601
620
  buttonEntries.push({
602
621
  element,
603
622
  width: buttonWidth,
604
- hidden: style.display === "none",
623
+ hidden: isElementSelfHidden(element),
605
624
  });
606
625
  }
607
626
 
@@ -617,11 +636,7 @@ function rearrangeButtons() {
617
636
 
618
637
  for (const entry of buttonEntries) {
619
638
  if (entry.hidden) {
620
- if (entry.width > 0) {
621
- buttonsToMoveToPopper.push(entry.element);
622
- } else {
623
- visibleButtonsInMainSlot.push(entry.element);
624
- }
639
+ visibleButtonsInMainSlot.push(entry.element);
625
640
  continue;
626
641
  }
627
642
 
@@ -826,7 +841,7 @@ function updateResizeObserverObservation() {
826
841
  if (this[mutationObserverSymbol]) {
827
842
  this[mutationObserverSymbol].observe(node, {
828
843
  attributes: true,
829
- attributeFilter: ["style", "class"],
844
+ attributeFilter: ["style", "class", "hidden"],
830
845
  });
831
846
  }
832
847
  });