@schukai/monster 4.137.2 → 4.137.3
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.137.
|
|
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.137.3"}
|
|
@@ -580,6 +580,7 @@ function initPopperSwitch() {
|
|
|
580
580
|
}
|
|
581
581
|
|
|
582
582
|
this[switchElementSymbol] = switchButton;
|
|
583
|
+
updatePopperSwitchVisibility.call(this);
|
|
583
584
|
}
|
|
584
585
|
|
|
585
586
|
/**
|
|
@@ -1180,25 +1181,36 @@ function adjustButtonVisibility() {
|
|
|
1180
1181
|
const self = this;
|
|
1181
1182
|
|
|
1182
1183
|
return new Promise((resolve) => {
|
|
1183
|
-
|
|
1184
|
+
let resolved = false;
|
|
1185
|
+
let observer;
|
|
1186
|
+
const runIfRendered = () => {
|
|
1187
|
+
if (resolved === true) return;
|
|
1188
|
+
|
|
1184
1189
|
const defCount = self.getOption("buttons.standard").length;
|
|
1185
1190
|
const domCount = self[navElementSymbol].querySelectorAll(
|
|
1186
|
-
'button[data-monster-role="button"]',
|
|
1191
|
+
'button[data-monster-role="button"][data-monster-tab-reference]',
|
|
1187
1192
|
).length;
|
|
1188
1193
|
|
|
1189
|
-
// in drawing
|
|
1190
1194
|
if (defCount !== domCount) return;
|
|
1191
1195
|
|
|
1192
|
-
|
|
1193
|
-
|
|
1196
|
+
resolved = true;
|
|
1197
|
+
observer?.disconnect();
|
|
1194
1198
|
checkAndRearrangeButtons.call(self);
|
|
1195
|
-
|
|
1196
1199
|
resolve();
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1202
|
+
observer = new MutationObserver(function () {
|
|
1203
|
+
runIfRendered();
|
|
1197
1204
|
});
|
|
1198
1205
|
|
|
1199
1206
|
observer.observe(self[navElementSymbol], {
|
|
1200
1207
|
attributes: true,
|
|
1208
|
+
childList: true,
|
|
1209
|
+
subtree: true,
|
|
1201
1210
|
});
|
|
1211
|
+
|
|
1212
|
+
runIfRendered();
|
|
1213
|
+
getWindow().requestAnimationFrame(runIfRendered);
|
|
1202
1214
|
});
|
|
1203
1215
|
}
|
|
1204
1216
|
|
|
@@ -1273,16 +1285,25 @@ function rearrangeButtons() {
|
|
|
1273
1285
|
|
|
1274
1286
|
setButtonCollections.call(this, standardButtons, popperButtons);
|
|
1275
1287
|
|
|
1276
|
-
|
|
1277
|
-
if (popperButtons.length > 0) {
|
|
1278
|
-
this[switchElementSymbol].classList.remove("hidden");
|
|
1279
|
-
} else {
|
|
1280
|
-
this[switchElementSymbol].classList.add("hidden");
|
|
1281
|
-
}
|
|
1282
|
-
}
|
|
1288
|
+
updatePopperSwitchVisibility.call(this);
|
|
1283
1289
|
});
|
|
1284
1290
|
}
|
|
1285
1291
|
|
|
1292
|
+
/**
|
|
1293
|
+
* @private
|
|
1294
|
+
*/
|
|
1295
|
+
function updatePopperSwitchVisibility() {
|
|
1296
|
+
if (!this[switchElementSymbol]) {
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
if (this.getOption("buttons.popper").length > 0) {
|
|
1301
|
+
this[switchElementSymbol].classList.remove("hidden");
|
|
1302
|
+
} else {
|
|
1303
|
+
this[switchElementSymbol].classList.add("hidden");
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
|
|
1286
1307
|
/**
|
|
1287
1308
|
* @private
|
|
1288
1309
|
* @param {string} ref
|