@shower/core 3.3.1 → 3.4.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/dist/index.js +31 -7
- package/lib/modules/fullscreen.js +22 -0
- package/lib/modules/install.js +2 -0
- package/lib/modules/view.js +8 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core for Shower HTML presentation engine
|
|
3
|
-
* @shower/core v3.
|
|
3
|
+
* @shower/core v3.4.0, https://github.com/shower/shower/tree/main/packages/core
|
|
4
4
|
* @copyright 2010–2026 Vadim Makeev, https://pepelsbey.dev
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -182,6 +182,27 @@
|
|
|
182
182
|
shower.addEventListener('slidechange', updateLiveRegion);
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
+
var fullscreen = (shower) => {
|
|
186
|
+
const toggleFullScreen = () => {
|
|
187
|
+
if (document.fullscreenElement) {
|
|
188
|
+
document.exitFullscreen();
|
|
189
|
+
} else {
|
|
190
|
+
document.documentElement.requestFullscreen();
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
shower.container.addEventListener('keydown', (event) => {
|
|
195
|
+
if (event.defaultPrevented) return;
|
|
196
|
+
if (isInteractiveElement(event.target)) return;
|
|
197
|
+
if (event.ctrlKey || event.altKey || event.metaKey) return;
|
|
198
|
+
|
|
199
|
+
if (event.key.toUpperCase() === 'F') {
|
|
200
|
+
event.preventDefault();
|
|
201
|
+
toggleFullScreen();
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
|
|
185
206
|
var keys = (shower) => {
|
|
186
207
|
const doSlideActions = (event) => {
|
|
187
208
|
const isShowerAction = !(event.ctrlKey || event.altKey || event.metaKey);
|
|
@@ -543,14 +564,16 @@
|
|
|
543
564
|
container.classList.add(listModeClass);
|
|
544
565
|
}
|
|
545
566
|
|
|
546
|
-
|
|
567
|
+
requestAnimationFrame(() => {
|
|
568
|
+
updateScale();
|
|
547
569
|
|
|
548
|
-
|
|
570
|
+
if (shower.isFullMode) return;
|
|
549
571
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
572
|
+
const slide = shower.activeSlide;
|
|
573
|
+
if (slide) {
|
|
574
|
+
slide.element.scrollIntoView({ block: 'center' });
|
|
575
|
+
}
|
|
576
|
+
});
|
|
554
577
|
};
|
|
555
578
|
|
|
556
579
|
shower.addEventListener('start', updateModeView);
|
|
@@ -644,6 +667,7 @@
|
|
|
644
667
|
|
|
645
668
|
var installModules = (shower) => {
|
|
646
669
|
a11y(shower);
|
|
670
|
+
fullscreen(shower);
|
|
647
671
|
progress(shower);
|
|
648
672
|
keys(shower);
|
|
649
673
|
next(shower);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isInteractiveElement } from '../utils.js';
|
|
2
|
+
|
|
3
|
+
export default (shower) => {
|
|
4
|
+
const toggleFullScreen = () => {
|
|
5
|
+
if (document.fullscreenElement) {
|
|
6
|
+
document.exitFullscreen();
|
|
7
|
+
} else {
|
|
8
|
+
document.documentElement.requestFullscreen();
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
shower.container.addEventListener('keydown', (event) => {
|
|
13
|
+
if (event.defaultPrevented) return;
|
|
14
|
+
if (isInteractiveElement(event.target)) return;
|
|
15
|
+
if (event.ctrlKey || event.altKey || event.metaKey) return;
|
|
16
|
+
|
|
17
|
+
if (event.key.toUpperCase() === 'F') {
|
|
18
|
+
event.preventDefault();
|
|
19
|
+
toggleFullScreen();
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
package/lib/modules/install.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import a11y from './a11y.js';
|
|
2
|
+
import fullscreen from './fullscreen.js';
|
|
2
3
|
import keys from './keys.js';
|
|
3
4
|
import location from './location.js';
|
|
4
5
|
import next from './next.js';
|
|
@@ -11,6 +12,7 @@ import mouse from './mouse.js';
|
|
|
11
12
|
|
|
12
13
|
export default (shower) => {
|
|
13
14
|
a11y(shower);
|
|
15
|
+
fullscreen(shower);
|
|
14
16
|
progress(shower);
|
|
15
17
|
keys(shower);
|
|
16
18
|
next(shower);
|
package/lib/modules/view.js
CHANGED
|
@@ -31,14 +31,16 @@ export default (shower) => {
|
|
|
31
31
|
container.classList.add(listModeClass);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
requestAnimationFrame(() => {
|
|
35
|
+
updateScale();
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
if (shower.isFullMode) return;
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
const slide = shower.activeSlide;
|
|
40
|
+
if (slide) {
|
|
41
|
+
slide.element.scrollIntoView({ block: 'center' });
|
|
42
|
+
}
|
|
43
|
+
});
|
|
42
44
|
};
|
|
43
45
|
|
|
44
46
|
shower.addEventListener('start', updateModeView);
|