@schukai/monster 5.2.5 → 5.2.6
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":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","exports":{".":"./source/monster.mjs","./CHANGELOG.md":"./CHANGELOG.md","./LICENSE":"./LICENSE","./README.md":"./README.md","./documentation/migrations/monster-5-options.md":"./documentation/migrations/monster-5-options.md","./package.json":"./package.json","./source/*":"./source/*","./test/*":"./test/*"},"files":["source","test/cases","test/util","documentation/migrations/monster-5-options.md","CHANGELOG.md"],"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"},"sideEffects":["./source/monster.mjs","./source/components/**","./source/i18n/**","./test/**"],"type":"module","version":"5.2.
|
|
1
|
+
{"author":"Volker Schukai","dependencies":{"@floating-ui/dom":"^1.7.6"},"description":"Monster is a simple library for creating fast, robust and lightweight websites.","exports":{".":"./source/monster.mjs","./CHANGELOG.md":"./CHANGELOG.md","./LICENSE":"./LICENSE","./README.md":"./README.md","./documentation/migrations/monster-5-options.md":"./documentation/migrations/monster-5-options.md","./package.json":"./package.json","./source/*":"./source/*","./test/*":"./test/*"},"files":["source","test/cases","test/util","documentation/migrations/monster-5-options.md","CHANGELOG.md"],"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"},"sideEffects":["./source/monster.mjs","./source/components/**","./source/i18n/**","./test/**"],"type":"module","version":"5.2.6"}
|
|
@@ -265,12 +265,23 @@ function isPositionedPopperOpen(popperElement) {
|
|
|
265
265
|
}
|
|
266
266
|
|
|
267
267
|
function normalizePopperConfig(options, controlElement, popperElement) {
|
|
268
|
+
// Keep ordinary content scrollable while implicit nested overlays escape it.
|
|
269
|
+
// Explicit strategies still override this default below.
|
|
270
|
+
const parentContent = resolveParentPopperContentBoundary(
|
|
271
|
+
controlElement,
|
|
272
|
+
popperElement,
|
|
273
|
+
);
|
|
274
|
+
const defaultStrategy =
|
|
275
|
+
parentContent?.dataset.monsterOverflowMode === "horizontal" &&
|
|
276
|
+
isClippingContainer(getComputedStyle(parentContent))
|
|
277
|
+
? "fixed"
|
|
278
|
+
: "absolute";
|
|
268
279
|
const config = Object.assign(
|
|
269
280
|
{},
|
|
270
281
|
{
|
|
271
282
|
placement: "top",
|
|
272
283
|
engine: "floating",
|
|
273
|
-
strategy:
|
|
284
|
+
strategy: defaultStrategy,
|
|
274
285
|
adaptiveSize: true,
|
|
275
286
|
hideWhenReferenceHidden: false,
|
|
276
287
|
},
|
package/source/types/version.mjs
CHANGED
|
@@ -11,6 +11,8 @@ let createVisibilityRecoveryConfig;
|
|
|
11
11
|
let getFloatingVisibleRatio;
|
|
12
12
|
let resolveFloatingArrowStaticOffset;
|
|
13
13
|
let resetAdaptiveFloatingElementSize;
|
|
14
|
+
let openPositionedPopper;
|
|
15
|
+
let closePositionedPopper;
|
|
14
16
|
|
|
15
17
|
describe("form floating-ui boundary resolution", function () {
|
|
16
18
|
before(function (done) {
|
|
@@ -31,6 +33,8 @@ describe("form floating-ui boundary resolution", function () {
|
|
|
31
33
|
resolveFloatingArrowStaticOffset =
|
|
32
34
|
m.resolveFloatingArrowStaticOffset;
|
|
33
35
|
resetAdaptiveFloatingElementSize = m.resetAdaptiveFloatingElementSize;
|
|
36
|
+
openPositionedPopper = m.openPositionedPopper;
|
|
37
|
+
closePositionedPopper = m.closePositionedPopper;
|
|
34
38
|
done();
|
|
35
39
|
})
|
|
36
40
|
.catch((e) => done(e));
|
|
@@ -41,6 +45,50 @@ describe("form floating-ui boundary resolution", function () {
|
|
|
41
45
|
mocks.innerHTML = "";
|
|
42
46
|
});
|
|
43
47
|
|
|
48
|
+
for (const [mode, overflow, strategy, expected] of [
|
|
49
|
+
["horizontal", "auto", undefined, "fixed"],
|
|
50
|
+
["horizontal", "auto", "absolute", "absolute"],
|
|
51
|
+
["horizontal", "auto", "fixed", "fixed"],
|
|
52
|
+
["horizontal", "visible", undefined, "absolute"],
|
|
53
|
+
["both", "auto", undefined, "absolute"],
|
|
54
|
+
["visible", "visible", undefined, "absolute"],
|
|
55
|
+
]) {
|
|
56
|
+
it(`preserves positioning for ${mode}/${overflow}/${strategy ?? "implicit"} (#612)`, () => {
|
|
57
|
+
const parent = document.createElement("div");
|
|
58
|
+
parent.dataset.monsterRole = "popper";
|
|
59
|
+
const content = document.createElement("div");
|
|
60
|
+
content.setAttribute("part", "content");
|
|
61
|
+
content.dataset.monsterOverflowMode = mode;
|
|
62
|
+
content.style.overflow = overflow;
|
|
63
|
+
const reference = document.createElement("button");
|
|
64
|
+
const floating = document.createElement("div");
|
|
65
|
+
parent.append(content);
|
|
66
|
+
content.append(reference, floating);
|
|
67
|
+
document.getElementById("mocks").append(parent);
|
|
68
|
+
const options = strategy ? { strategy } : {};
|
|
69
|
+
openPositionedPopper(reference, floating, options);
|
|
70
|
+
expect(floating.style.position).to.equal(expected);
|
|
71
|
+
expect(options).to.deep.equal(strategy ? { strategy } : {});
|
|
72
|
+
closePositionedPopper(floating);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
it("resolves horizontal clipping through a slot without changing standalone defaults (#612)", () => {
|
|
77
|
+
const reference = document.createElement("button");
|
|
78
|
+
const floating = document.createElement("div");
|
|
79
|
+
document.getElementById("mocks").append(reference, floating);
|
|
80
|
+
openPositionedPopper(reference, floating, {});
|
|
81
|
+
expect(floating.style.position).to.equal("absolute");
|
|
82
|
+
closePositionedPopper(floating);
|
|
83
|
+
const host = document.createElement("div");
|
|
84
|
+
host.attachShadow({ mode: "open" }).innerHTML = '<div data-monster-role="popper"><div part="content" data-monster-overflow-mode="horizontal" style="overflow:auto"><slot></slot></div></div>';
|
|
85
|
+
host.append(reference, floating);
|
|
86
|
+
document.getElementById("mocks").append(host);
|
|
87
|
+
openPositionedPopper(reference, floating, {});
|
|
88
|
+
expect(floating.style.position).to.equal("fixed");
|
|
89
|
+
closePositionedPopper(floating);
|
|
90
|
+
});
|
|
91
|
+
|
|
44
92
|
it("should overlap the popper edge by half of the rendered arrow size", function () {
|
|
45
93
|
expect(resolveFloatingArrowStaticOffset(8)).to.equal(-4);
|
|
46
94
|
expect(resolveFloatingArrowStaticOffset(0)).to.equal(0);
|