@schukai/monster 4.136.15 → 4.136.16
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.136.
|
|
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.136.16"}
|
|
@@ -310,6 +310,18 @@ class MessageStateButton extends Popper {
|
|
|
310
310
|
return resolveContentOverflowMode.call(this);
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
+
/**
|
|
314
|
+
* Recalculates the open message popper after dynamic content changes.
|
|
315
|
+
*
|
|
316
|
+
* @return {MessageStateButton}
|
|
317
|
+
*/
|
|
318
|
+
recalcMessage() {
|
|
319
|
+
applyResolvedMessagePresentation.call(this);
|
|
320
|
+
applyMeasuredMessageWidth.call(this);
|
|
321
|
+
super.recalcPopper();
|
|
322
|
+
return this;
|
|
323
|
+
}
|
|
324
|
+
|
|
313
325
|
/**
|
|
314
326
|
*
|
|
315
327
|
* @return {MessageStateButton}
|
|
@@ -115,8 +115,6 @@ const dismissRecordSymbol = Symbol("dismissRecord");
|
|
|
115
115
|
* @type {symbol}
|
|
116
116
|
*/
|
|
117
117
|
const usesHostDismissSymbol = Symbol("usesHostDismiss");
|
|
118
|
-
const contentUpdateHandlerSymbol = Symbol("contentUpdateHandler");
|
|
119
|
-
const scheduledUpdateFrameSymbol = Symbol("scheduledUpdateFrame");
|
|
120
118
|
|
|
121
119
|
/**
|
|
122
120
|
* Popper component for displaying floating UI elements
|
|
@@ -250,7 +248,6 @@ class Popper extends CustomElement {
|
|
|
250
248
|
}
|
|
251
249
|
|
|
252
250
|
updatePopper.call(this);
|
|
253
|
-
attachContentUpdateListeners.call(this);
|
|
254
251
|
attachResizeObserver.call(this);
|
|
255
252
|
}
|
|
256
253
|
|
|
@@ -269,9 +266,6 @@ class Popper extends CustomElement {
|
|
|
269
266
|
}
|
|
270
267
|
|
|
271
268
|
unregisterFromHost.call(this);
|
|
272
|
-
|
|
273
|
-
detachContentUpdateListeners.call(this);
|
|
274
|
-
cancelScheduledPopperUpdate.call(this);
|
|
275
269
|
disconnectResizeObserver.call(this);
|
|
276
270
|
}
|
|
277
271
|
|
|
@@ -284,6 +278,17 @@ class Popper extends CustomElement {
|
|
|
284
278
|
return this;
|
|
285
279
|
}
|
|
286
280
|
|
|
281
|
+
/**
|
|
282
|
+
* Recalculates the size and position of an already open popper.
|
|
283
|
+
*
|
|
284
|
+
* @return {Popper}
|
|
285
|
+
*/
|
|
286
|
+
recalcPopper() {
|
|
287
|
+
applyContentOverflowMode.call(this);
|
|
288
|
+
updatePopper.call(this);
|
|
289
|
+
return this;
|
|
290
|
+
}
|
|
291
|
+
|
|
287
292
|
/**
|
|
288
293
|
* Resolves the effective popper options for the current render pass.
|
|
289
294
|
* Subclasses can override this to adapt positioning without mutating
|
|
@@ -525,55 +530,6 @@ function attachResizeObserver() {
|
|
|
525
530
|
});
|
|
526
531
|
}
|
|
527
532
|
|
|
528
|
-
function attachContentUpdateListeners() {
|
|
529
|
-
const popperElement = this[popperElementSymbol];
|
|
530
|
-
if (!(popperElement instanceof HTMLElement)) {
|
|
531
|
-
return;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
if (typeof this[contentUpdateHandlerSymbol] !== "function") {
|
|
535
|
-
this[contentUpdateHandlerSymbol] = () => {
|
|
536
|
-
schedulePopperUpdate.call(this);
|
|
537
|
-
};
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
for (const type of ["input", "change", "transitionend", "animationend"]) {
|
|
541
|
-
popperElement.addEventListener(type, this[contentUpdateHandlerSymbol]);
|
|
542
|
-
}
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
function detachContentUpdateListeners() {
|
|
546
|
-
const popperElement = this[popperElementSymbol];
|
|
547
|
-
const handler = this[contentUpdateHandlerSymbol];
|
|
548
|
-
if (!(popperElement instanceof HTMLElement) || typeof handler !== "function") {
|
|
549
|
-
return;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
for (const type of ["input", "change", "transitionend", "animationend"]) {
|
|
553
|
-
popperElement.removeEventListener(type, handler);
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
function schedulePopperUpdate() {
|
|
558
|
-
if (this[scheduledUpdateFrameSymbol] !== undefined) {
|
|
559
|
-
return;
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
this[scheduledUpdateFrameSymbol] = requestAnimationFrame(() => {
|
|
563
|
-
this[scheduledUpdateFrameSymbol] = undefined;
|
|
564
|
-
updatePopper.call(this);
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
function cancelScheduledPopperUpdate() {
|
|
569
|
-
if (this[scheduledUpdateFrameSymbol] === undefined) {
|
|
570
|
-
return;
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
cancelAnimationFrame(this[scheduledUpdateFrameSymbol]);
|
|
574
|
-
this[scheduledUpdateFrameSymbol] = undefined;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
533
|
/**
|
|
578
534
|
* Disconnects resize observer
|
|
579
535
|
* @private
|
|
@@ -263,7 +263,7 @@ describe("MessageStateButton", function () {
|
|
|
263
263
|
}, 0);
|
|
264
264
|
});
|
|
265
265
|
|
|
266
|
-
it("should
|
|
266
|
+
it("should recalculate the open popper after checkbox-driven form growth", function (done) {
|
|
267
267
|
let mocks = document.getElementById("mocks");
|
|
268
268
|
const button = document.createElement("monster-message-state-button");
|
|
269
269
|
button.innerHTML = "Save";
|
|
@@ -299,9 +299,7 @@ describe("MessageStateButton", function () {
|
|
|
299
299
|
};
|
|
300
300
|
|
|
301
301
|
checkbox.checked = true;
|
|
302
|
-
|
|
303
|
-
new Event("change", { bubbles: true, composed: true }),
|
|
304
|
-
);
|
|
302
|
+
button.recalcMessage();
|
|
305
303
|
|
|
306
304
|
setTimeout(() => {
|
|
307
305
|
try {
|