@vnejs/plugins.view.coralina.interface.fastforward 0.0.1 → 0.1.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/index.js +1 -4
- package/modules/controller.js +38 -18
- package/modules/view.js +4 -4
- package/package.json +5 -6
- package/view/index.jsx +33 -13
- package/view/index.styl +3 -39
package/index.js
CHANGED
|
@@ -5,7 +5,4 @@ import { SUBSCRIBE_EVENTS } from "./const/events";
|
|
|
5
5
|
import { InterfaceFastForwardController } from "./modules/controller";
|
|
6
6
|
import { InterfaceFastForwardView } from "./modules/view";
|
|
7
7
|
|
|
8
|
-
regPlugin("INTERFACE_FASTFORWARD", { events: SUBSCRIBE_EVENTS }, [
|
|
9
|
-
InterfaceFastForwardController,
|
|
10
|
-
InterfaceFastForwardView,
|
|
11
|
-
]);
|
|
8
|
+
regPlugin("INTERFACE_FASTFORWARD", { events: SUBSCRIBE_EVENTS }, [InterfaceFastForwardController, InterfaceFastForwardView]);
|
package/modules/controller.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleController } from "@vnejs/module.components";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import { ZINDEX } from "../view";
|
|
4
|
+
|
|
5
|
+
export class InterfaceFastForwardController extends ModuleController {
|
|
4
6
|
name = "interface.fastforward.controller";
|
|
5
7
|
|
|
6
8
|
updateEvent = this.EVENTS.INTERFACE_FASTFORWARD.UPDATE;
|
|
@@ -12,7 +14,7 @@ export class InterfaceFastForwardController extends Module.Controller {
|
|
|
12
14
|
};
|
|
13
15
|
controlsUnvisible = {};
|
|
14
16
|
controlsCheckNext = true;
|
|
15
|
-
controlsIndex =
|
|
17
|
+
controlsIndex = ZINDEX;
|
|
16
18
|
|
|
17
19
|
subscribe = () => {
|
|
18
20
|
this.on(this.EVENTS.INTERFACE_FASTFORWARD.SHOW, this.onShow);
|
|
@@ -20,7 +22,9 @@ export class InterfaceFastForwardController extends Module.Controller {
|
|
|
20
22
|
this.on(this.EVENTS.INTERFACE_FASTFORWARD.CLICK, this.onClick);
|
|
21
23
|
|
|
22
24
|
this.on(this.EVENTS.INTERFACE.SHOW_CHANGED, this.onShowChanged);
|
|
23
|
-
this.on(this.EVENTS.INTERFACE.
|
|
25
|
+
this.on(this.EVENTS.INTERFACE.VIEW_CHANGED, this.onViewChanged);
|
|
26
|
+
this.on(this.EVENTS.INTERFACE.STATE_CHANGED, this.onStateChanged);
|
|
27
|
+
this.on(this.EVENTS.INTERFACE.VISIBLE_CHANGED, this.onVisibleChanged);
|
|
24
28
|
|
|
25
29
|
this.on(this.EVENTS.CHOOSE.SHOW, this.onChooseShow);
|
|
26
30
|
this.on(this.EVENTS.CHOOSE.HIDE, this.onChooseHide);
|
|
@@ -34,31 +38,47 @@ export class InterfaceFastForwardController extends Module.Controller {
|
|
|
34
38
|
if (isShow && isVisible) return this.emitFastforwardEvent(this.EVENTS.FASTFORWARD.TOGGLE);
|
|
35
39
|
};
|
|
36
40
|
|
|
37
|
-
onShowChanged = ({
|
|
38
|
-
const { isShow = false
|
|
41
|
+
onShowChanged = ({ isForce = false } = {}) => {
|
|
42
|
+
const { isShow = false } = this.globalState.interface;
|
|
39
43
|
const event = isShow ? this.EVENTS.INTERFACE_FASTFORWARD.SHOW : this.EVENTS.INTERFACE_FASTFORWARD.HIDE;
|
|
40
44
|
|
|
41
|
-
this.
|
|
42
|
-
|
|
45
|
+
if (this.state.isShow !== isShow) return this.emit(event, { isForce });
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
onViewChanged = ({ isForce = false } = {}) => {
|
|
49
|
+
const { view = "" } = this.globalState.interface;
|
|
50
|
+
|
|
51
|
+
if (this.state.view !== view) return this.updateStateAndView({ view }, isForce, !isForce);
|
|
43
52
|
};
|
|
44
53
|
|
|
45
|
-
|
|
54
|
+
onVisibleChanged = ({ isForce = false } = {}) => {
|
|
46
55
|
const { isVisible = false } = this.globalState.interface;
|
|
47
56
|
|
|
48
|
-
|
|
57
|
+
this.toggleUnvisibleControls(isVisible);
|
|
49
58
|
|
|
50
|
-
|
|
51
|
-
await this.emit(isVisible ? this.EVENTS.CONTROLS.POP : this.EVENTS.CONTROLS.PUSH, args);
|
|
52
|
-
await this.updateStateAndView({ isVisible }, force, !force);
|
|
59
|
+
if (this.state.isVisible !== isVisible) return this.updateStateAndView({ isVisible }, isForce, !isForce);
|
|
53
60
|
};
|
|
54
61
|
|
|
55
|
-
|
|
62
|
+
onStateChanged = () => {
|
|
63
|
+
const { isShow = false, isVisible = false, view = "" } = this.globalState.interface;
|
|
64
|
+
|
|
65
|
+
this.toggleUnvisibleControls(isVisible);
|
|
56
66
|
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
return this.updateStateAndViewForce({ isVisible, isShow, view });
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
onFastForward = ({ value } = {}) => this.isReady && this.updateStateAndViewFast({ isActive: value });
|
|
71
|
+
|
|
72
|
+
onChooseShow = () => this.updateStateAndViewFast({ isChooseShow: true });
|
|
73
|
+
onChooseHide = () => this.updateStateAndViewFast({ isChooseShow: false });
|
|
74
|
+
|
|
75
|
+
toggleUnvisibleControls = (isVisible) => {
|
|
76
|
+
const args = { key: `${this.name}-unvisible`, controls: this.controlsUnvisible, index: this.controlsIndex + 500 };
|
|
77
|
+
|
|
78
|
+
return this.emit(isVisible ? this.EVENTS.CONTROLS.POP : this.EVENTS.CONTROLS.PUSH, args);
|
|
79
|
+
};
|
|
59
80
|
|
|
60
|
-
emitFastforwardEvent = (event) =>
|
|
61
|
-
this.globalState.interface.isVisible ? this.emit(event) : this.emit(this.EVENTS.INTERFACE.VISIBLE);
|
|
81
|
+
emitFastforwardEvent = (event) => this.emit(this.globalState.interface.isVisible ? event : this.EVENTS.INTERFACE.VISIBLE);
|
|
62
82
|
|
|
63
83
|
getDefaultState = () => ({ isActive: false, isVisible: false, isShow: false, isChooseShow: false });
|
|
64
84
|
}
|
package/modules/view.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleView } from "@vnejs/module.components";
|
|
2
2
|
|
|
3
|
-
import { render } from "../view";
|
|
3
|
+
import { render, TRANSITION } from "../view";
|
|
4
4
|
|
|
5
|
-
export class InterfaceFastForwardView extends
|
|
5
|
+
export class InterfaceFastForwardView extends ModuleView {
|
|
6
6
|
name = "interface.fastforward.view";
|
|
7
|
-
animationTime =
|
|
7
|
+
animationTime = TRANSITION;
|
|
8
8
|
renderFunc = render;
|
|
9
9
|
updateEvent = this.EVENTS.INTERFACE_FASTFORWARD.UPDATE;
|
|
10
10
|
updateHandler = this.onUpdateReactComponent;
|
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/plugins.view.coralina.interface.fastforward",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
7
|
+
"publish:major:plugin": "npm run publish:major",
|
|
8
|
+
"publish:minor:plugin": "npm run publish:minor",
|
|
9
|
+
"publish:patch:plugin": "npm run publish:patch",
|
|
7
10
|
"publish:major": "npm version major && npm publish --access public",
|
|
8
11
|
"publish:minor": "npm version minor && npm publish --access public",
|
|
9
12
|
"publish:patch": "npm version patch && npm publish --access public"
|
|
10
13
|
},
|
|
11
14
|
"author": "",
|
|
12
15
|
"license": "ISC",
|
|
13
|
-
"description": ""
|
|
14
|
-
"peerDependencies": {
|
|
15
|
-
"@vnejs/shared": "*",
|
|
16
|
-
"@vnejs/module": "*"
|
|
17
|
-
}
|
|
16
|
+
"description": ""
|
|
18
17
|
}
|
package/view/index.jsx
CHANGED
|
@@ -3,28 +3,48 @@ import ReactDOM from "react-dom";
|
|
|
3
3
|
|
|
4
4
|
import { cn } from "@bem-react/classname";
|
|
5
5
|
|
|
6
|
+
import { Icon, View } from "@vnejs/uis.base";
|
|
7
|
+
|
|
6
8
|
import "./index.styl";
|
|
7
9
|
|
|
10
|
+
import iconSrc from "./media/fastforward.png";
|
|
11
|
+
|
|
8
12
|
const b = cn("InterfaceFastForward");
|
|
9
13
|
|
|
14
|
+
export const TRANSITION = 500;
|
|
15
|
+
export const ZINDEX = 1100;
|
|
16
|
+
|
|
10
17
|
class InterfaceFastForward extends React.Component {
|
|
11
18
|
state = {};
|
|
12
|
-
onClick = (
|
|
13
|
-
e.stopPropagation();
|
|
14
|
-
this.props.emit(this.props.EVENTS.INTERFACE_FASTFORWARD.CLICK);
|
|
15
|
-
};
|
|
19
|
+
onClick = () => this.props.emit(this.props.EVENTS.INTERFACE_FASTFORWARD.CLICK);
|
|
16
20
|
render() {
|
|
17
|
-
const {
|
|
18
|
-
isShow = false,
|
|
19
|
-
isVisible = false,
|
|
20
|
-
isForce = false,
|
|
21
|
-
isActive = false,
|
|
22
|
-
isChooseShow = false,
|
|
23
|
-
view = "",
|
|
24
|
-
} = this.state;
|
|
21
|
+
const { isShow = false, isVisible = false, isForce = false, isActive = false, isChooseShow = false, view = "" } = this.state;
|
|
25
22
|
const isAnimated = isActive && !isChooseShow;
|
|
26
23
|
|
|
27
|
-
return
|
|
24
|
+
return (
|
|
25
|
+
<View
|
|
26
|
+
className={b({ isAnimated })}
|
|
27
|
+
isShow={isShow}
|
|
28
|
+
isForce={isForce}
|
|
29
|
+
isHidden={!isVisible}
|
|
30
|
+
bottom={0}
|
|
31
|
+
right={0}
|
|
32
|
+
translateY={view === "adv" ? "calc(-1px * var(--vne-length-96))" : "calc(-1px * var(--vne-length-24))"}
|
|
33
|
+
translateX={view === "adv" ? "calc(-1px * var(--vne-length-96))" : "calc(-1px * var(--vne-length-360))"}
|
|
34
|
+
zIndex={ZINDEX}
|
|
35
|
+
transition={TRANSITION}
|
|
36
|
+
onClick={this.onClick}
|
|
37
|
+
>
|
|
38
|
+
<Icon
|
|
39
|
+
width={384}
|
|
40
|
+
height={384}
|
|
41
|
+
scale={view === "adv" ? 1 : 0.25}
|
|
42
|
+
isOpacityOnHover={true}
|
|
43
|
+
src={iconSrc}
|
|
44
|
+
transition={isForce ? 0 : TRANSITION}
|
|
45
|
+
/>
|
|
46
|
+
</View>
|
|
47
|
+
);
|
|
28
48
|
}
|
|
29
49
|
}
|
|
30
50
|
|
package/view/index.styl
CHANGED
|
@@ -1,55 +1,19 @@
|
|
|
1
1
|
@keyframes fastforward
|
|
2
2
|
from
|
|
3
|
-
transform:
|
|
3
|
+
transform: scale(1.1)
|
|
4
4
|
|
|
5
5
|
50%
|
|
6
|
-
transform:
|
|
6
|
+
transform: scale(0.9)
|
|
7
7
|
|
|
8
8
|
to
|
|
9
|
-
transform:
|
|
9
|
+
transform: scale(1.1)
|
|
10
10
|
|
|
11
11
|
.InterfaceFastForward
|
|
12
|
-
position: absolute
|
|
13
|
-
transform: translateY(50%) scale(1)
|
|
14
|
-
aspect-ratio: 1/1
|
|
15
|
-
background-position: center
|
|
16
|
-
background-repeat: no-repeat
|
|
17
|
-
background-size: contain
|
|
18
|
-
background-image: url("./media/fastforward.png")
|
|
19
|
-
cursor: pointer
|
|
20
|
-
opacity: 0
|
|
21
|
-
pointer-events: none
|
|
22
|
-
z-index: 1200
|
|
23
|
-
|
|
24
|
-
&:not(&_isForce)
|
|
25
|
-
transition: opacity 500ms, right 500ms, width 500ms, bottom 500ms, transform 500ms
|
|
26
|
-
|
|
27
12
|
&_isAnimated
|
|
28
13
|
animation-duration: 500ms
|
|
29
14
|
animation-name: fastforward
|
|
30
15
|
animation-iteration-count: infinite
|
|
31
16
|
animation-timing-function: ease-in-out
|
|
32
17
|
|
|
33
|
-
&:hover
|
|
34
|
-
opacity 1
|
|
35
|
-
transform: translateY(50%) scale(0.95)
|
|
36
|
-
|
|
37
|
-
&:not(&_isVisible)
|
|
38
|
-
opacity: 0
|
|
39
|
-
|
|
40
|
-
&_isShow
|
|
41
|
-
pointer-events: all
|
|
42
|
-
opacity: 0.7
|
|
43
|
-
|
|
44
|
-
&_view
|
|
45
|
-
&_line
|
|
46
|
-
right: 15%
|
|
47
|
-
width: calc(100 / 3840 * 100%)
|
|
48
|
-
bottom: 3.25%
|
|
49
|
-
&_adv
|
|
50
|
-
right: 2.5%
|
|
51
|
-
width: calc(375 / 3840 * 100%)
|
|
52
|
-
bottom: calc(300 / 2160 * 100%)
|
|
53
|
-
|
|
54
18
|
|
|
55
19
|
|