@schukai/monster 4.136.13 → 4.136.14

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.13"}
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.14"}
@@ -284,16 +284,24 @@ function calcAndSetNavigationTopScrollableParentContext() {
284
284
  return;
285
285
  }
286
286
 
287
- const scrollTop = this[scrollableParentSymbol].scrollTop;
288
- const thisTop = scrollTop;
287
+ const parentRect = this[scrollableParentSymbol].getBoundingClientRect();
288
+ const rect = this.getBoundingClientRect();
289
+ const thisTop = rect.top - parentRect.top;
290
+ const thisBottom = rect.bottom - parentRect.top;
289
291
  let top = 0;
290
- top += scrollTop;
292
+ if (thisTop < 0) {
293
+ top = -1 * thisTop;
294
+ }
291
295
 
292
296
  const offset = this.getOption("offset");
293
297
  if (offset > 0) {
294
298
  top += offset;
295
299
  }
296
300
 
301
+ if (thisBottom < 0) {
302
+ return;
303
+ }
304
+
297
305
  fireCustomEvent(this, "new-top", { top: top });
298
306
 
299
307
  this[navigationElementSymbol].style.top = top + "px";
@@ -388,10 +396,15 @@ function createListFromHeadings(nodeList, currentLevel = 1) {
388
396
  li.addEventListener("click", (e) => {
389
397
  e.stopPropagation();
390
398
  getWindow().requestAnimationFrame(() => {
391
- window.scrollTo(0, 0);
392
- // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
393
- // mostly supported
394
- node?.scrollIntoView({ behavior: "smooth" });
399
+ if (!node) {
400
+ return;
401
+ }
402
+
403
+ node.scrollIntoView({
404
+ behavior: "smooth",
405
+ block: "start",
406
+ inline: "nearest",
407
+ });
395
408
  });
396
409
  });
397
410
 
@@ -579,7 +592,7 @@ function getTemplate() {
579
592
  return `
580
593
  <div data-monster-role="control" part="control">
581
594
  <div class="navigation" data-monster-role="navigation">
582
- <monster-popper data-monster-option-mode="enter">
595
+ <monster-popper data-monster-option-mode="enter" data-monster-option-popper-content-overflow="visible">
583
596
  <div slot="button" data-monster-role="navigation-control">
584
597
  </div>
585
598
  <div data-monster-role="navigation-list">