@schukai/monster 4.143.2 → 4.143.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.143.
|
|
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.143.3"}
|
|
@@ -392,6 +392,9 @@ class ControlBar extends CustomElement {
|
|
|
392
392
|
}
|
|
393
393
|
delete this[layoutFrameSymbol];
|
|
394
394
|
this[layoutTokenSymbol] = (this[layoutTokenSymbol] || 0) + 1;
|
|
395
|
+
if (this[layoutStateSymbol]) {
|
|
396
|
+
this[layoutStateSymbol].scheduled = false;
|
|
397
|
+
}
|
|
395
398
|
|
|
396
399
|
disconnectResizeObserver.call(this);
|
|
397
400
|
defuseLayoutChangedEvent.call(this);
|
|
@@ -762,6 +762,100 @@ describe("ControlBar", function () {
|
|
|
762
762
|
}
|
|
763
763
|
});
|
|
764
764
|
|
|
765
|
+
it("should reveal the control bar after reconnecting before initial layout", async function () {
|
|
766
|
+
const originalRequestAnimationFrame = window.requestAnimationFrame;
|
|
767
|
+
const originalGlobalRequestAnimationFrame = globalThis.requestAnimationFrame;
|
|
768
|
+
|
|
769
|
+
const scheduledCallbacks = [];
|
|
770
|
+
const flushFrames = async () => {
|
|
771
|
+
while (scheduledCallbacks.length > 0) {
|
|
772
|
+
scheduledCallbacks.shift()();
|
|
773
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
774
|
+
}
|
|
775
|
+
};
|
|
776
|
+
|
|
777
|
+
try {
|
|
778
|
+
window.requestAnimationFrame = (callback) => {
|
|
779
|
+
scheduledCallbacks.push(callback);
|
|
780
|
+
return scheduledCallbacks.length;
|
|
781
|
+
};
|
|
782
|
+
globalThis.requestAnimationFrame = window.requestAnimationFrame;
|
|
783
|
+
|
|
784
|
+
const mocks = document.getElementById("mocks");
|
|
785
|
+
mocks.innerHTML = `
|
|
786
|
+
<div id="reconnect-bar-wrapper">
|
|
787
|
+
<monster-control-bar
|
|
788
|
+
id="reconnect-bar"
|
|
789
|
+
class="nucleus-list-main-actions"
|
|
790
|
+
data-monster-option-layout-alignment="right"
|
|
791
|
+
data-monster-option-layout-stacked-alignment="left"
|
|
792
|
+
data-monster-option-layout-stacked-breakpoint="30rem"
|
|
793
|
+
>
|
|
794
|
+
<button id="reconnect-create">Create</button>
|
|
795
|
+
<button id="reconnect-tags">Manage tags</button>
|
|
796
|
+
<button id="reconnect-import">Import</button>
|
|
797
|
+
</monster-control-bar>
|
|
798
|
+
</div>
|
|
799
|
+
`;
|
|
800
|
+
|
|
801
|
+
const wrapper = document.getElementById("reconnect-bar-wrapper");
|
|
802
|
+
const bar = document.getElementById("reconnect-bar");
|
|
803
|
+
const buttons = [
|
|
804
|
+
document.getElementById("reconnect-create"),
|
|
805
|
+
document.getElementById("reconnect-tags"),
|
|
806
|
+
document.getElementById("reconnect-import"),
|
|
807
|
+
];
|
|
808
|
+
const controlBar = bar.shadowRoot.querySelector(
|
|
809
|
+
'[data-monster-role="control-bar"]',
|
|
810
|
+
);
|
|
811
|
+
|
|
812
|
+
wrapper.style.boxSizing = "border-box";
|
|
813
|
+
Object.defineProperty(wrapper, "clientWidth", {
|
|
814
|
+
configurable: true,
|
|
815
|
+
value: 480,
|
|
816
|
+
});
|
|
817
|
+
|
|
818
|
+
for (const button of buttons) {
|
|
819
|
+
Object.defineProperty(button, "offsetWidth", {
|
|
820
|
+
configurable: true,
|
|
821
|
+
value: 90,
|
|
822
|
+
});
|
|
823
|
+
Object.defineProperty(button, "offsetHeight", {
|
|
824
|
+
configurable: true,
|
|
825
|
+
value: 30,
|
|
826
|
+
});
|
|
827
|
+
button.getBoundingClientRect = () => ({
|
|
828
|
+
width: 90,
|
|
829
|
+
height: 30,
|
|
830
|
+
top: 0,
|
|
831
|
+
right: 90,
|
|
832
|
+
bottom: 30,
|
|
833
|
+
left: 0,
|
|
834
|
+
x: 0,
|
|
835
|
+
y: 0,
|
|
836
|
+
toJSON: () => {},
|
|
837
|
+
});
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
expect(controlBar.style.opacity).to.equal("0");
|
|
841
|
+
|
|
842
|
+
bar.remove();
|
|
843
|
+
wrapper.append(bar);
|
|
844
|
+
|
|
845
|
+
await flushFrames();
|
|
846
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
847
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
848
|
+
|
|
849
|
+
expect(controlBar.style.opacity).to.equal("");
|
|
850
|
+
expect(controlBar.getAttribute("data-monster-layout-alignment")).to.equal(
|
|
851
|
+
"right",
|
|
852
|
+
);
|
|
853
|
+
} finally {
|
|
854
|
+
window.requestAnimationFrame = originalRequestAnimationFrame;
|
|
855
|
+
globalThis.requestAnimationFrame = originalGlobalRequestAnimationFrame;
|
|
856
|
+
}
|
|
857
|
+
});
|
|
858
|
+
|
|
765
859
|
it("should keep the overflow switch stable across the switch-width threshold", async function () {
|
|
766
860
|
const OriginalResizeObserver = window.ResizeObserver;
|
|
767
861
|
const originalGlobalResizeObserver = globalThis.ResizeObserver;
|