@shower/core 3.4.1 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Core for Shower HTML presentation engine
3
- * @shower/core v3.4.0, https://github.com/shower/shower/tree/main/packages/core
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,20 +543,6 @@
541
543
  container.classList.add(listModeClass);
542
544
  }
543
545
 
544
- const updateScale = () => {
545
- const firstSlide = shower.slides[0];
546
- if (!firstSlide) return;
547
-
548
- const { innerWidth, innerHeight } = window;
549
- const { offsetWidth, offsetHeight } = firstSlide.element;
550
-
551
- const listScale = 1 / (offsetWidth / innerWidth);
552
- const fullScale = 1 / Math.max(offsetWidth / innerWidth, offsetHeight / innerHeight);
553
-
554
- container.style.setProperty('--shower-list-scale', listScale);
555
- container.style.setProperty('--shower-full-scale', fullScale);
556
- };
557
-
558
546
  const updateModeView = () => {
559
547
  if (shower.isFullMode) {
560
548
  container.classList.remove(listModeClass);
@@ -564,11 +552,9 @@
564
552
  container.classList.add(listModeClass);
565
553
  }
566
554
 
567
- requestAnimationFrame(() => {
568
- updateScale();
569
-
570
- if (shower.isFullMode) return;
555
+ if (shower.isFullMode) return;
571
556
 
557
+ requestAnimationFrame(() => {
572
558
  const slide = shower.activeSlide;
573
559
  if (slide) {
574
560
  slide.element.scrollIntoView({ block: 'center' });
@@ -584,8 +570,6 @@
584
570
  const slide = shower.activeSlide;
585
571
  slide.element.scrollIntoView({ block: 'nearest' });
586
572
  });
587
-
588
- window.addEventListener('resize', updateScale);
589
573
  };
590
574
 
591
575
  var touch = (shower) => {
@@ -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);
@@ -8,20 +8,6 @@ export default (shower) => {
8
8
  container.classList.add(listModeClass);
9
9
  }
10
10
 
11
- const updateScale = () => {
12
- const firstSlide = shower.slides[0];
13
- if (!firstSlide) return;
14
-
15
- const { innerWidth, innerHeight } = window;
16
- const { offsetWidth, offsetHeight } = firstSlide.element;
17
-
18
- const listScale = 1 / (offsetWidth / innerWidth);
19
- const fullScale = 1 / Math.max(offsetWidth / innerWidth, offsetHeight / innerHeight);
20
-
21
- container.style.setProperty('--shower-list-scale', listScale);
22
- container.style.setProperty('--shower-full-scale', fullScale);
23
- };
24
-
25
11
  const updateModeView = () => {
26
12
  if (shower.isFullMode) {
27
13
  container.classList.remove(listModeClass);
@@ -31,11 +17,9 @@ export default (shower) => {
31
17
  container.classList.add(listModeClass);
32
18
  }
33
19
 
34
- requestAnimationFrame(() => {
35
- updateScale();
36
-
37
- if (shower.isFullMode) return;
20
+ if (shower.isFullMode) return;
38
21
 
22
+ requestAnimationFrame(() => {
39
23
  const slide = shower.activeSlide;
40
24
  if (slide) {
41
25
  slide.element.scrollIntoView({ block: 'center' });
@@ -51,6 +35,4 @@ export default (shower) => {
51
35
  const slide = shower.activeSlide;
52
36
  slide.element.scrollIntoView({ block: 'nearest' });
53
37
  });
54
-
55
- window.addEventListener('resize', updateScale);
56
38
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "name": "@shower/core",
4
4
  "description": "Core for Shower HTML presentation engine",
5
- "version": "3.4.1",
5
+ "version": "3.5.1",
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },