@massimo-cassandro/minimo 0.14.4 → 0.15.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/package.json
CHANGED
|
@@ -31,19 +31,20 @@ export function snackbar(message, options = {}){
|
|
|
31
31
|
...options
|
|
32
32
|
};
|
|
33
33
|
|
|
34
|
-
let _popover, _timeoutID;
|
|
34
|
+
let _popover, _timeoutID, _isRemoving = false;
|
|
35
35
|
|
|
36
36
|
const removePopover = () => {
|
|
37
|
-
if (_popover?.matches(':popover-open'))
|
|
38
|
-
|
|
37
|
+
if (_isRemoving || !_popover?.matches(':popover-open')) return;
|
|
38
|
+
_isRemoving = true; // evita sovrapposizioni nel caso in cui removePopover sia chiamato più volte durante l'animazione di chiusura
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
if (_timeoutID) clearTimeout(_timeoutID);
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
_popover.classList.add(styles.isHiding);
|
|
43
|
+
|
|
44
|
+
_popover.addEventListener('animationend', () => {
|
|
45
|
+
_popover.hidePopover();
|
|
46
|
+
_popover.remove();
|
|
47
|
+
}, { once: true }); // `once` già evita duplicati sul listener, ma il flag protegge prima
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
_popover = domBuilder([
|