@schukai/monster 4.43.7 → 4.43.8
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
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"author":"schukai GmbH","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.43.
|
|
1
|
+
{"author":"schukai GmbH","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.43.8"}
|
|
@@ -156,6 +156,18 @@ function initEventHandler() {
|
|
|
156
156
|
|
|
157
157
|
if (!hamburgerButton || !hamburgerNav || !hamburgerCloseButton) return;
|
|
158
158
|
|
|
159
|
+
const getBestPositionStrategy = (element) => {
|
|
160
|
+
let parent = element.parentElement;
|
|
161
|
+
while (parent) {
|
|
162
|
+
const parentPosition = window.getComputedStyle(parent).position;
|
|
163
|
+
if (["fixed", "sticky"].includes(parentPosition)) {
|
|
164
|
+
return "fixed";
|
|
165
|
+
}
|
|
166
|
+
parent = parent.parentElement;
|
|
167
|
+
}
|
|
168
|
+
return "absolute";
|
|
169
|
+
};
|
|
170
|
+
|
|
159
171
|
const handleOutsideClick = (event) => {
|
|
160
172
|
if (
|
|
161
173
|
!hamburgerButton.contains(event.target) &&
|
|
@@ -200,10 +212,12 @@ function initEventHandler() {
|
|
|
200
212
|
});
|
|
201
213
|
|
|
202
214
|
cleanup = autoUpdate(hamburgerButton, hamburgerNav, () => {
|
|
203
|
-
// Desktop view where the hamburger menu is a dropdown
|
|
204
215
|
if (window.innerWidth > 768) {
|
|
216
|
+
const strategy = getBestPositionStrategy(this);
|
|
217
|
+
|
|
205
218
|
computePosition(hamburgerButton, hamburgerNav, {
|
|
206
219
|
placement: "bottom-end",
|
|
220
|
+
strategy: strategy,
|
|
207
221
|
middleware: [
|
|
208
222
|
offset(8),
|
|
209
223
|
flip(),
|