rails_toastify 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/app/assets/javascripts/rails_toastify.js +13 -8
- data/app/assets/stylesheets/rails_toastify.css +5 -3
- data/lib/rails_toastify/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6d828b6b26290af46ef2beb27cbd662e963f2b8b9969e55a782ce34a5a4bf4d
|
4
|
+
data.tar.gz: 768fa851fdcb5d66f8e692346f0d13fa3d99e75bfc69683a6d2f022b09b78139
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 845a520486d658392542d67daf6e70b5b72fb4854c04e05b497f4b2d89f421040bcedf5a08b871c9827745420d2d3ea7e8a1523c09ecf9bf56d429fc04e5ec5a
|
7
|
+
data.tar.gz: '00893d8c3e0237247046bdea15d9a01a418f684037c398a707bac9f91a033012667ccac26620de2cc0123f623681cea0c0e28ae0a3337d3a6e8c1d400fb28107'
|
data/CHANGELOG.md
CHANGED
@@ -5,22 +5,27 @@ document.addEventListener('DOMContentLoaded', () => {
|
|
5
5
|
const toast = createToast(message, type, duration);
|
6
6
|
toastContainer.appendChild(toast);
|
7
7
|
|
8
|
-
let
|
8
|
+
let startTime = Date.now();
|
9
|
+
let remainingTime = duration;
|
10
|
+
|
11
|
+
const hideToast = () => {
|
9
12
|
toast.classList.add('hide');
|
10
13
|
toast.addEventListener('transitionend', () => toast.remove());
|
11
|
-
}
|
14
|
+
};
|
15
|
+
|
16
|
+
let timeoutId = setTimeout(hideToast, remainingTime);
|
12
17
|
|
13
18
|
toast.addEventListener('mouseover', () => {
|
14
19
|
clearTimeout(timeoutId);
|
15
|
-
|
20
|
+
const elapsedTime = Date.now() - startTime;
|
21
|
+
remainingTime -= elapsedTime;
|
22
|
+
toast.querySelector('.toast__progress-bar').style.animationPlayState = 'paused';
|
16
23
|
});
|
17
24
|
|
18
25
|
toast.addEventListener('mouseout', () => {
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
toast.addEventListener('transitionend', () => toast.remove());
|
23
|
-
}, duration - progressBar.getBoundingClientRect().width * (duration / progressBar.offsetWidth));
|
26
|
+
startTime = Date.now();
|
27
|
+
toast.querySelector('.toast__progress-bar').style.animationPlayState = 'running';
|
28
|
+
timeoutId = setTimeout(hideToast, remainingTime);
|
24
29
|
});
|
25
30
|
}
|
26
31
|
};
|
@@ -20,7 +20,7 @@
|
|
20
20
|
transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
21
21
|
transform: translateX(100%);
|
22
22
|
max-width: 300px;
|
23
|
-
pointer-events: auto;
|
23
|
+
pointer-events: auto;
|
24
24
|
}
|
25
25
|
|
26
26
|
.toast.show {
|
@@ -71,6 +71,7 @@
|
|
71
71
|
width: 100%;
|
72
72
|
height: 4px;
|
73
73
|
animation: progress-bar 5s linear forwards;
|
74
|
+
animation-play-state: running;
|
74
75
|
}
|
75
76
|
|
76
77
|
@keyframes progress-bar {
|
@@ -91,11 +92,11 @@
|
|
91
92
|
transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
|
92
93
|
transform: translateX(100%);
|
93
94
|
}
|
94
|
-
|
95
|
+
|
95
96
|
.toast.show {
|
96
97
|
transform: translateX(0);
|
97
98
|
}
|
98
|
-
|
99
|
+
|
99
100
|
.toast.hide {
|
100
101
|
transform: translateX(100%);
|
101
102
|
opacity: 0;
|
@@ -127,6 +128,7 @@
|
|
127
128
|
.toast__progress-bar {
|
128
129
|
@apply absolute bottom-0 left-0 w-full h-1;
|
129
130
|
animation: progress-bar 5s linear forwards;
|
131
|
+
animation-play-state: running;
|
130
132
|
}
|
131
133
|
|
132
134
|
@keyframes progress-bar {
|