@schukai/monster 4.121.0 → 4.122.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 +8 -0
- package/package.json +1 -1
- package/source/components/layout/tabs.mjs +19 -12
package/CHANGELOG.md
CHANGED
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.
|
|
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.122.0"}
|
|
@@ -712,11 +712,12 @@ function initPopper() {
|
|
|
712
712
|
* @private
|
|
713
713
|
* @param {HTMLElement} element
|
|
714
714
|
*/
|
|
715
|
-
function show(element) {
|
|
715
|
+
function show(element, options = {}) {
|
|
716
716
|
if (!this.shadowRoot) {
|
|
717
717
|
throw new Error("no shadow-root is defined");
|
|
718
718
|
}
|
|
719
719
|
|
|
720
|
+
const emitEvents = options?.emitEvents !== false;
|
|
720
721
|
const reference = element.getAttribute(`${ATTRIBUTE_PREFIX}tab-reference`);
|
|
721
722
|
|
|
722
723
|
const nodes = getSlottedElements.call(this);
|
|
@@ -726,9 +727,11 @@ function show(element) {
|
|
|
726
727
|
if (id === reference) {
|
|
727
728
|
node.classList.add("active");
|
|
728
729
|
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
730
|
+
if (emitEvents) {
|
|
731
|
+
fireCustomEvent(this, "monster-tab-change", {
|
|
732
|
+
reference,
|
|
733
|
+
});
|
|
734
|
+
}
|
|
732
735
|
|
|
733
736
|
const openDelay = Number.parseInt(
|
|
734
737
|
this.getOption("features.openDelay"),
|
|
@@ -774,18 +777,22 @@ function show(element) {
|
|
|
774
777
|
const filter = undefined;
|
|
775
778
|
loadAndAssignContent(node, url, options, filter)
|
|
776
779
|
.then(() => {
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
+
if (emitEvents) {
|
|
781
|
+
fireCustomEvent(this, "monster-tab-changed", {
|
|
782
|
+
reference,
|
|
783
|
+
});
|
|
784
|
+
}
|
|
780
785
|
})
|
|
781
786
|
.catch((e) => {
|
|
782
787
|
addAttributeToken(this, ATTRIBUTE_ERRORMESSAGE, e.message);
|
|
783
788
|
});
|
|
784
789
|
} else {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
790
|
+
if (emitEvents) {
|
|
791
|
+
fireCustomEvent(this, "monster-tab-changed", {
|
|
792
|
+
reference,
|
|
793
|
+
data,
|
|
794
|
+
});
|
|
795
|
+
}
|
|
789
796
|
}
|
|
790
797
|
} else {
|
|
791
798
|
node.classList.remove("active");
|
|
@@ -1126,7 +1133,7 @@ function initTabButtons() {
|
|
|
1126
1133
|
`[${ATTRIBUTE_PREFIX}tab-reference="${activeReference}"]`,
|
|
1127
1134
|
);
|
|
1128
1135
|
if (button instanceof HTMLButtonElement && button.disabled !== true) {
|
|
1129
|
-
show.call(this, button);
|
|
1136
|
+
show.call(this, button, { emitEvents: false });
|
|
1130
1137
|
}
|
|
1131
1138
|
})
|
|
1132
1139
|
.run(undefined)
|