@shower/core 3.5.0 → 3.5.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 +5 -28
- package/lib/modules/next.js +2 -0
- 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.5.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
|
*/
|
|
@@ -399,6 +399,8 @@
|
|
|
399
399
|
shower.addEventListener('next', (event) => {
|
|
400
400
|
if (shower.isListMode || event.defaultPrevented || !event.cancelable) return;
|
|
401
401
|
|
|
402
|
+
if (activeIndex >= innerSteps.length) return;
|
|
403
|
+
|
|
402
404
|
activeIndex++;
|
|
403
405
|
innerSteps.forEach((step, index) => {
|
|
404
406
|
step.classList.toggle(visitedSlideClass, index < activeIndex);
|
|
@@ -541,31 +543,6 @@
|
|
|
541
543
|
container.classList.add(listModeClass);
|
|
542
544
|
}
|
|
543
545
|
|
|
544
|
-
const needsJSScale = !CSS.supports('transform', 'scale(calc(1px / 1px))');
|
|
545
|
-
|
|
546
|
-
if (needsJSScale) {
|
|
547
|
-
const slideProbe = document.createElement('div');
|
|
548
|
-
slideProbe.style.cssText = 'position:absolute;visibility:hidden;width:var(--slide-width-px);height:var(--slide-height-px)';
|
|
549
|
-
container.appendChild(slideProbe);
|
|
550
|
-
|
|
551
|
-
const updateScale = () => {
|
|
552
|
-
const slideWidth = slideProbe.offsetWidth;
|
|
553
|
-
const slideHeight = slideProbe.offsetHeight;
|
|
554
|
-
if (!slideWidth || !slideHeight) return;
|
|
555
|
-
|
|
556
|
-
const { innerWidth, innerHeight } = window;
|
|
557
|
-
|
|
558
|
-
const listScale = innerWidth / slideWidth;
|
|
559
|
-
const fullScale = Math.min(innerWidth / slideWidth, innerHeight / slideHeight);
|
|
560
|
-
|
|
561
|
-
container.style.setProperty('--shower-list-scale', listScale);
|
|
562
|
-
container.style.setProperty('--shower-full-scale', fullScale);
|
|
563
|
-
};
|
|
564
|
-
|
|
565
|
-
updateScale();
|
|
566
|
-
window.addEventListener('resize', updateScale);
|
|
567
|
-
}
|
|
568
|
-
|
|
569
546
|
const updateModeView = () => {
|
|
570
547
|
if (shower.isFullMode) {
|
|
571
548
|
container.classList.remove(listModeClass);
|
|
@@ -575,9 +552,9 @@
|
|
|
575
552
|
container.classList.add(listModeClass);
|
|
576
553
|
}
|
|
577
554
|
|
|
578
|
-
|
|
579
|
-
if (shower.isFullMode) return;
|
|
555
|
+
if (shower.isFullMode) return;
|
|
580
556
|
|
|
557
|
+
requestAnimationFrame(() => {
|
|
581
558
|
const slide = shower.activeSlide;
|
|
582
559
|
if (slide) {
|
|
583
560
|
slide.element.scrollIntoView({ block: 'center' });
|
package/lib/modules/next.js
CHANGED
|
@@ -28,6 +28,8 @@ export default (shower) => {
|
|
|
28
28
|
shower.addEventListener('next', (event) => {
|
|
29
29
|
if (shower.isListMode || event.defaultPrevented || !event.cancelable) return;
|
|
30
30
|
|
|
31
|
+
if (activeIndex >= innerSteps.length) return;
|
|
32
|
+
|
|
31
33
|
activeIndex++;
|
|
32
34
|
innerSteps.forEach((step, index) => {
|
|
33
35
|
step.classList.toggle(visitedSlideClass, index < activeIndex);
|