@shower/core 3.2.0 → 3.3.0
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/README.md +1 -1
- package/dist/shower.js +47 -2
- package/lib/default-options.js +2 -0
- package/lib/modules/install.js +2 -0
- package/lib/modules/mouse.js +41 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Core of Shower [](https://travis-ci.org/shower/core)
|
|
2
2
|
|
|
3
3
|
Core of the [Shower](https://github.com/shower/shower) presentation engine. Doesn’t include themes. [See it in action](https://shwr.me). Follow [@shower_me](https://twitter.com/shower_me) for support and updates, [file an issue] if you have any.
|
|
4
4
|
|
package/dist/shower.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Core for Shower HTML presentation engine
|
|
3
|
-
* @shower/core v3.
|
|
3
|
+
* @shower/core v3.2.0, https://github.com/shower/core
|
|
4
4
|
* @copyright 2010–2021 Vadim Makeev, https://pepelsbey.net
|
|
5
5
|
* @license MIT
|
|
6
6
|
*/
|
|
@@ -36,6 +36,8 @@
|
|
|
36
36
|
stepSelector: '.next',
|
|
37
37
|
fullModeClass: 'full',
|
|
38
38
|
listModeClass: 'list',
|
|
39
|
+
mouseHiddenClass: 'pointless',
|
|
40
|
+
mouseInactivityTimeout: 5000,
|
|
39
41
|
|
|
40
42
|
slideSelector: '.slide',
|
|
41
43
|
slideTitleSelector: 'h2',
|
|
@@ -596,6 +598,48 @@
|
|
|
596
598
|
});
|
|
597
599
|
};
|
|
598
600
|
|
|
601
|
+
var mouse = (shower) => {
|
|
602
|
+
const { mouseHiddenClass, mouseInactivityTimeout } = shower.options;
|
|
603
|
+
|
|
604
|
+
let hideMouseTimeoutId = null;
|
|
605
|
+
|
|
606
|
+
const cleanUp = () => {
|
|
607
|
+
shower.container.classList.remove(mouseHiddenClass);
|
|
608
|
+
clearTimeout(hideMouseTimeoutId);
|
|
609
|
+
hideMouseTimeoutId = null;
|
|
610
|
+
};
|
|
611
|
+
|
|
612
|
+
const hideMouseIfInactive = () => {
|
|
613
|
+
if (hideMouseTimeoutId !== null) {
|
|
614
|
+
cleanUp();
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
hideMouseTimeoutId = setTimeout(() => {
|
|
618
|
+
shower.container.classList.add(mouseHiddenClass);
|
|
619
|
+
}, mouseInactivityTimeout);
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
const initHideMouseIfInactiveModule = () => {
|
|
623
|
+
shower.container.addEventListener('mousemove', hideMouseIfInactive);
|
|
624
|
+
};
|
|
625
|
+
|
|
626
|
+
const destroyHideMouseIfInactiveModule = () => {
|
|
627
|
+
shower.container.removeEventListener('mousemove', hideMouseIfInactive);
|
|
628
|
+
cleanUp();
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
const handleModeChange = () => {
|
|
632
|
+
if (shower.isFullMode) {
|
|
633
|
+
initHideMouseIfInactiveModule();
|
|
634
|
+
} else {
|
|
635
|
+
destroyHideMouseIfInactiveModule();
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
shower.addEventListener('start', handleModeChange);
|
|
640
|
+
shower.addEventListener('modechange', handleModeChange);
|
|
641
|
+
};
|
|
642
|
+
|
|
599
643
|
var installModules = (shower) => {
|
|
600
644
|
a11y(shower);
|
|
601
645
|
progress(shower);
|
|
@@ -606,6 +650,7 @@
|
|
|
606
650
|
location$1(shower); // should come after `title`
|
|
607
651
|
view(shower);
|
|
608
652
|
touch(shower);
|
|
653
|
+
mouse(shower);
|
|
609
654
|
|
|
610
655
|
// maintains invariant: active slide always exists in `full` mode
|
|
611
656
|
if (shower.isFullMode && !shower.activeSlide) {
|
|
@@ -788,4 +833,4 @@
|
|
|
788
833
|
shower.start();
|
|
789
834
|
});
|
|
790
835
|
|
|
791
|
-
}()
|
|
836
|
+
})();
|
package/lib/default-options.js
CHANGED
package/lib/modules/install.js
CHANGED
|
@@ -7,6 +7,7 @@ import timer from './timer';
|
|
|
7
7
|
import title from './title';
|
|
8
8
|
import view from './view';
|
|
9
9
|
import touch from './touch';
|
|
10
|
+
import mouse from './mouse';
|
|
10
11
|
|
|
11
12
|
export default (shower) => {
|
|
12
13
|
a11y(shower);
|
|
@@ -18,6 +19,7 @@ export default (shower) => {
|
|
|
18
19
|
location(shower); // should come after `title`
|
|
19
20
|
view(shower);
|
|
20
21
|
touch(shower);
|
|
22
|
+
mouse(shower);
|
|
21
23
|
|
|
22
24
|
// maintains invariant: active slide always exists in `full` mode
|
|
23
25
|
if (shower.isFullMode && !shower.activeSlide) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export default (shower) => {
|
|
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
|
+
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shower/core",
|
|
3
3
|
"description": "Core for Shower HTML presentation engine",
|
|
4
|
-
"version": "3.
|
|
4
|
+
"version": "3.3.0",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -30,15 +30,15 @@
|
|
|
30
30
|
"eslint": "^7.29.0",
|
|
31
31
|
"eslint-config-airbnb-base": "^14.2.1",
|
|
32
32
|
"eslint-config-prettier": "^6.15.0",
|
|
33
|
-
"eslint-plugin-import": "^2.
|
|
34
|
-
"eslint-plugin-prettier": "^3.4.
|
|
33
|
+
"eslint-plugin-import": "^2.25.2",
|
|
34
|
+
"eslint-plugin-prettier": "^3.4.1",
|
|
35
35
|
"husky": "^4.3.8",
|
|
36
36
|
"lint-staged": "^10.5.4",
|
|
37
37
|
"mocha": "^7.2.0",
|
|
38
38
|
"nightwatch": "^1.7.6",
|
|
39
39
|
"prettier": "^2.3.1",
|
|
40
40
|
"puppeteer": "^3.3.0",
|
|
41
|
-
"rollup": "^2.
|
|
41
|
+
"rollup": "^2.58.0",
|
|
42
42
|
"sauce-connect-launcher": "^1.3.2",
|
|
43
43
|
"serve": "^11.3.2",
|
|
44
44
|
"serve-handler": "^6.1.3"
|