@shower/core 3.3.0 → 3.3.1
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/LICENSE.md +5 -17
- package/README.md +7 -3
- package/dist/index.js +838 -0
- package/lib/default-options.js +11 -11
- package/lib/{start.js → index.js} +5 -5
- package/lib/modules/a11y.js +31 -29
- package/lib/modules/install.js +24 -24
- package/lib/modules/keys.js +96 -96
- package/lib/modules/location.js +51 -51
- package/lib/modules/mouse.js +39 -39
- package/lib/modules/next.js +39 -39
- package/lib/modules/parse-timing.js +28 -0
- package/lib/modules/progress.js +16 -16
- package/lib/modules/timer.js +25 -25
- package/lib/modules/title.js +15 -15
- package/lib/modules/touch.js +30 -30
- package/lib/modules/view.js +52 -52
- package/lib/shower.js +164 -164
- package/lib/slide.js +94 -94
- package/lib/utils.js +14 -14
- package/package.json +38 -61
- package/CHANGELOG.md +0 -13
- package/dist/shower.js +0 -836
- package/lib/modules/parse-timing.mjs +0 -28
package/lib/default-options.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
export default {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
containerSelector: '.shower',
|
|
3
|
+
progressSelector: '.progress',
|
|
4
|
+
stepSelector: '.next',
|
|
5
|
+
fullModeClass: 'full',
|
|
6
|
+
listModeClass: 'list',
|
|
7
|
+
mouseHiddenClass: 'pointless',
|
|
8
|
+
mouseInactivityTimeout: 5000,
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
slideSelector: '.slide',
|
|
11
|
+
slideTitleSelector: 'h2',
|
|
12
|
+
activeSlideClass: 'active',
|
|
13
|
+
visitedSlideClass: 'visited',
|
|
14
14
|
};
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { contentLoaded } from './utils';
|
|
2
|
-
import Shower from './shower';
|
|
1
|
+
import { contentLoaded } from './utils.js';
|
|
2
|
+
import Shower from './shower.js';
|
|
3
3
|
|
|
4
4
|
const options = document.currentScript.dataset;
|
|
5
5
|
const shower = new Shower(options);
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(window, 'shower', {
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
value: shower,
|
|
9
|
+
configurable: true,
|
|
10
10
|
});
|
|
11
11
|
|
|
12
12
|
contentLoaded(() => {
|
|
13
|
-
|
|
13
|
+
shower.start();
|
|
14
14
|
});
|
package/lib/modules/a11y.js
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
const createLiveRegion = () => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
const liveRegion = document.createElement('section');
|
|
3
|
+
liveRegion.className = 'region';
|
|
4
|
+
liveRegion.setAttribute('role', 'region');
|
|
5
|
+
liveRegion.setAttribute('aria-live', 'assertive');
|
|
6
|
+
liveRegion.setAttribute('aria-relevant', 'all');
|
|
7
|
+
liveRegion.setAttribute('aria-label', 'Slide Content: Auto-updating');
|
|
8
|
+
return liveRegion;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export default (shower) => {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const { container } = shower;
|
|
13
|
+
const liveRegion = createLiveRegion();
|
|
14
|
+
container.appendChild(liveRegion);
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const updateDocumentRole = () => {
|
|
17
|
+
if (shower.isFullMode) {
|
|
18
|
+
container.setAttribute('role', 'application');
|
|
19
|
+
} else {
|
|
20
|
+
container.removeAttribute('role');
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
const updateLiveRegion = () => {
|
|
25
|
+
const slide = shower.activeSlide;
|
|
26
|
+
if (slide) {
|
|
27
|
+
const clone = slide.element.cloneNode(true);
|
|
28
|
+
clone.querySelectorAll('style').forEach((style) => style.remove());
|
|
29
|
+
liveRegion.innerHTML = clone.innerHTML;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
shower.addEventListener('start', () => {
|
|
34
|
+
updateDocumentRole();
|
|
35
|
+
updateLiveRegion();
|
|
36
|
+
});
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
shower.addEventListener('modechange', updateDocumentRole);
|
|
39
|
+
shower.addEventListener('slidechange', updateLiveRegion);
|
|
38
40
|
};
|
package/lib/modules/install.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import a11y from './a11y';
|
|
2
|
-
import keys from './keys';
|
|
3
|
-
import location from './location';
|
|
4
|
-
import next from './next';
|
|
5
|
-
import progress from './progress';
|
|
6
|
-
import timer from './timer';
|
|
7
|
-
import title from './title';
|
|
8
|
-
import view from './view';
|
|
9
|
-
import touch from './touch';
|
|
10
|
-
import mouse from './mouse';
|
|
1
|
+
import a11y from './a11y.js';
|
|
2
|
+
import keys from './keys.js';
|
|
3
|
+
import location from './location.js';
|
|
4
|
+
import next from './next.js';
|
|
5
|
+
import progress from './progress.js';
|
|
6
|
+
import timer from './timer.js';
|
|
7
|
+
import title from './title.js';
|
|
8
|
+
import view from './view.js';
|
|
9
|
+
import touch from './touch.js';
|
|
10
|
+
import mouse from './mouse.js';
|
|
11
11
|
|
|
12
12
|
export default (shower) => {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
a11y(shower);
|
|
14
|
+
progress(shower);
|
|
15
|
+
keys(shower);
|
|
16
|
+
next(shower);
|
|
17
|
+
timer(shower); // should come after `keys` and `next`
|
|
18
|
+
title(shower);
|
|
19
|
+
location(shower); // should come after `title`
|
|
20
|
+
view(shower);
|
|
21
|
+
touch(shower);
|
|
22
|
+
mouse(shower);
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
// maintains invariant: active slide always exists in `full` mode
|
|
25
|
+
if (shower.isFullMode && !shower.activeSlide) {
|
|
26
|
+
shower.first();
|
|
27
|
+
}
|
|
28
28
|
};
|
package/lib/modules/keys.js
CHANGED
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
import { isInteractiveElement } from '../utils';
|
|
1
|
+
import { isInteractiveElement } from '../utils.js';
|
|
2
2
|
|
|
3
3
|
export default (shower) => {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const doSlideActions = (event) => {
|
|
5
|
+
const isShowerAction = !(event.ctrlKey || event.altKey || event.metaKey);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
switch (event.key.toUpperCase()) {
|
|
8
|
+
case 'ENTER':
|
|
9
|
+
if (event.metaKey && shower.isListMode) {
|
|
10
|
+
if (event.shiftKey) {
|
|
11
|
+
event.preventDefault();
|
|
12
|
+
shower.first();
|
|
13
|
+
}
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
if (event.shiftKey) {
|
|
20
|
+
shower.prev();
|
|
21
|
+
} else {
|
|
22
|
+
shower.next();
|
|
23
|
+
}
|
|
24
|
+
break;
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
26
|
+
case 'BACKSPACE':
|
|
27
|
+
case 'PAGEUP':
|
|
28
|
+
case 'ARROWUP':
|
|
29
|
+
case 'ARROWLEFT':
|
|
30
|
+
case 'H':
|
|
31
|
+
case 'K':
|
|
32
|
+
case 'P':
|
|
33
|
+
if (isShowerAction) {
|
|
34
|
+
event.preventDefault();
|
|
35
|
+
shower.prev(event.shiftKey);
|
|
36
|
+
}
|
|
37
|
+
break;
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
39
|
+
case 'PAGEDOWN':
|
|
40
|
+
case 'ARROWDOWN':
|
|
41
|
+
case 'ARROWRIGHT':
|
|
42
|
+
case 'L':
|
|
43
|
+
case 'J':
|
|
44
|
+
case 'N':
|
|
45
|
+
if (isShowerAction) {
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
shower.next(event.shiftKey);
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
case ' ':
|
|
52
|
+
if (isShowerAction && shower.isFullMode) {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
if (event.shiftKey) {
|
|
55
|
+
shower.prev();
|
|
56
|
+
} else {
|
|
57
|
+
shower.next();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
61
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
case 'HOME':
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
shower.first();
|
|
65
|
+
break;
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
67
|
+
case 'END':
|
|
68
|
+
event.preventDefault();
|
|
69
|
+
shower.last();
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
const doModeActions = (event) => {
|
|
75
|
+
switch (event.key.toUpperCase()) {
|
|
76
|
+
case 'ESCAPE':
|
|
77
|
+
if (shower.isFullMode) {
|
|
78
|
+
event.preventDefault();
|
|
79
|
+
shower.exitFullMode();
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
case 'ENTER':
|
|
84
|
+
if (event.metaKey && shower.isListMode) {
|
|
85
|
+
event.preventDefault();
|
|
86
|
+
shower.enterFullMode();
|
|
87
|
+
}
|
|
88
|
+
break;
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
case 'P':
|
|
91
|
+
if (event.metaKey && event.altKey && shower.isListMode) {
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
shower.enterFullMode();
|
|
94
|
+
}
|
|
95
|
+
break;
|
|
96
96
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
97
|
+
case 'F5':
|
|
98
|
+
if (event.shiftKey && shower.isListMode) {
|
|
99
|
+
event.preventDefault();
|
|
100
|
+
shower.enterFullMode();
|
|
101
|
+
}
|
|
102
|
+
break;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
shower.container.addEventListener('keydown', (event) => {
|
|
107
|
+
if (event.defaultPrevented) return;
|
|
108
|
+
if (isInteractiveElement(event.target)) return;
|
|
109
109
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
doSlideActions(event);
|
|
111
|
+
doModeActions(event);
|
|
112
|
+
});
|
|
113
113
|
};
|
package/lib/modules/location.js
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
1
|
export default (shower) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
2
|
+
const composeURL = () => {
|
|
3
|
+
const search = shower.isFullMode ? '?full' : '';
|
|
4
|
+
const slide = shower.activeSlide;
|
|
5
|
+
const hash = slide ? `#${slide.id}` : '';
|
|
6
|
+
|
|
7
|
+
return location.pathname + search + hash; // path is required to clear search params
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const applyURLMode = () => {
|
|
11
|
+
const isFull = new URLSearchParams(location.search).has('full');
|
|
12
|
+
if (isFull) {
|
|
13
|
+
shower.enterFullMode();
|
|
14
|
+
} else {
|
|
15
|
+
shower.exitFullMode();
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const applyURLSlide = () => {
|
|
20
|
+
const id = location.hash.slice(1);
|
|
21
|
+
if (!id) return;
|
|
22
|
+
|
|
23
|
+
const target = shower.slides.find((slide) => slide.id === id);
|
|
24
|
+
if (target) {
|
|
25
|
+
target.activate();
|
|
26
|
+
} else if (!shower.activeSlide) {
|
|
27
|
+
shower.first(); // invalid hash
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const applyURL = () => {
|
|
32
|
+
applyURLMode();
|
|
33
|
+
applyURLSlide();
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
applyURL();
|
|
37
|
+
window.addEventListener('popstate', applyURL);
|
|
38
|
+
|
|
39
|
+
shower.addEventListener('start', () => {
|
|
40
|
+
history.replaceState(null, document.title, composeURL());
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
shower.addEventListener('modechange', () => {
|
|
44
|
+
history.replaceState(null, document.title, composeURL());
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
shower.addEventListener('slidechange', () => {
|
|
48
|
+
const url = composeURL();
|
|
49
|
+
if (!location.href.endsWith(url)) {
|
|
50
|
+
history.pushState(null, document.title, url);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
53
|
};
|
package/lib/modules/mouse.js
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
export default (shower) => {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
2
|
+
const { mouseHiddenClass, mouseInactivityTimeout } = shower.options;
|
|
3
|
+
|
|
4
|
+
let hideMouseTimeoutId = null;
|
|
5
|
+
|
|
6
|
+
const cleanUp = () => {
|
|
7
|
+
shower.container.classList.remove(mouseHiddenClass);
|
|
8
|
+
clearTimeout(hideMouseTimeoutId);
|
|
9
|
+
hideMouseTimeoutId = null;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const hideMouseIfInactive = () => {
|
|
13
|
+
if (hideMouseTimeoutId !== null) {
|
|
14
|
+
cleanUp();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
hideMouseTimeoutId = setTimeout(() => {
|
|
18
|
+
shower.container.classList.add(mouseHiddenClass);
|
|
19
|
+
}, mouseInactivityTimeout);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const initHideMouseIfInactiveModule = () => {
|
|
23
|
+
shower.container.addEventListener('mousemove', hideMouseIfInactive);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const destroyHideMouseIfInactiveModule = () => {
|
|
27
|
+
shower.container.removeEventListener('mousemove', hideMouseIfInactive);
|
|
28
|
+
cleanUp();
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const handleModeChange = () => {
|
|
32
|
+
if (shower.isFullMode) {
|
|
33
|
+
initHideMouseIfInactiveModule();
|
|
34
|
+
} else {
|
|
35
|
+
destroyHideMouseIfInactiveModule();
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
shower.addEventListener('start', handleModeChange);
|
|
40
|
+
shower.addEventListener('modechange', handleModeChange);
|
|
41
41
|
};
|
package/lib/modules/next.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
1
|
export default (shower) => {
|
|
2
|
-
|
|
2
|
+
const { stepSelector, activeSlideClass, visitedSlideClass } = shower.options;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
let innerSteps;
|
|
5
|
+
let activeIndex;
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
const isActive = (step) => step.classList.contains(activeSlideClass);
|
|
8
|
+
const isVisited = (step) => step.classList.contains(visitedSlideClass);
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
const setInnerStepsState = () => {
|
|
11
|
+
if (shower.isListMode) return;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
const slide = shower.activeSlide;
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
innerSteps = [...slide.element.querySelectorAll(stepSelector)];
|
|
16
|
+
activeIndex =
|
|
17
|
+
innerSteps.length && innerSteps.every(isVisited)
|
|
18
|
+
? innerSteps.length
|
|
19
|
+
: innerSteps.filter(isActive).length - 1;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
slide.state.innerStepCount = innerSteps.length;
|
|
22
|
+
};
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
shower.addEventListener('start', setInnerStepsState);
|
|
25
|
+
shower.addEventListener('modechange', setInnerStepsState);
|
|
26
|
+
shower.addEventListener('slidechange', setInnerStepsState);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
shower.addEventListener('next', (event) => {
|
|
29
|
+
if (shower.isListMode || event.defaultPrevented || !event.cancelable) return;
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
activeIndex++;
|
|
32
|
+
innerSteps.forEach((step, index) => {
|
|
33
|
+
step.classList.toggle(visitedSlideClass, index < activeIndex);
|
|
34
|
+
step.classList.toggle(activeSlideClass, index === activeIndex);
|
|
35
|
+
});
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
if (activeIndex < innerSteps.length) {
|
|
38
|
+
event.preventDefault();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
shower.addEventListener('prev', (event) => {
|
|
43
|
+
if (shower.isListMode || event.defaultPrevented || !event.cancelable) return;
|
|
44
|
+
if (activeIndex === -1 || activeIndex === innerSteps.length) return;
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
46
|
+
activeIndex--;
|
|
47
|
+
innerSteps.forEach((step, index) => {
|
|
48
|
+
step.classList.toggle(visitedSlideClass, index < activeIndex + 1);
|
|
49
|
+
step.classList.toggle(activeSlideClass, index === activeIndex);
|
|
50
|
+
});
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
event.preventDefault();
|
|
53
|
+
});
|
|
54
54
|
};
|