@vnejs/plugins.views.screens.credits 0.1.5 → 0.1.7
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.d.ts +1 -0
- package/dist/index.js +6 -0
- package/dist/modules/controller.d.ts +16 -0
- package/dist/modules/controller.js +18 -0
- package/dist/modules/credits.d.ts +8 -0
- package/dist/modules/credits.js +13 -0
- package/dist/modules/view.d.ts +10 -0
- package/dist/modules/view.js +9 -0
- package/dist/types.d.ts +9 -0
- package/dist/types.js +1 -0
- package/dist/utils/credits.d.ts +7 -0
- package/dist/utils/credits.js +1 -0
- package/dist/view/index.d.ts +3 -0
- package/dist/view/index.js +14 -0
- package/package.json +37 -6
- package/src/index.ts +8 -0
- package/{modules/controller.js → src/modules/controller.ts} +12 -3
- package/{modules/credits.js → src/modules/credits.ts} +5 -3
- package/src/modules/view.ts +21 -0
- package/src/types.ts +16 -0
- package/src/utils/credits.ts +8 -0
- package/src/view/index.tsx +48 -0
- package/tsconfig.json +10 -0
- package/const/events.js +0 -5
- package/const/params.js +0 -11
- package/index.js +0 -10
- package/modules/view.js +0 -13
- package/view/index.jsx +0 -38
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { regPlugin } from "@vnejs/shared";
|
|
2
|
+
import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/plugins.views.screens.credits.contract";
|
|
3
|
+
import { CreditsController } from "./modules/controller.js";
|
|
4
|
+
import { Credits } from "./modules/credits.js";
|
|
5
|
+
import { CreditsView } from "./modules/view.js";
|
|
6
|
+
regPlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS, params: PARAMS }, [CreditsController, Credits, CreditsView]);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ModuleController } from "@vnejs/module.components";
|
|
2
|
+
import type { CreditsPluginConstants, CreditsPluginEvents, CreditsPluginParams, CreditsPluginSettings } from "../types.js";
|
|
3
|
+
import type { CreditsPluginState } from "../utils/credits.js";
|
|
4
|
+
export declare class CreditsController extends ModuleController<CreditsPluginEvents, CreditsPluginConstants, CreditsPluginSettings, CreditsPluginParams, CreditsPluginState> {
|
|
5
|
+
name: string;
|
|
6
|
+
onInteract: () => undefined;
|
|
7
|
+
updateEvent: "vne:credits:update";
|
|
8
|
+
controls: {
|
|
9
|
+
abstract_accept: () => undefined;
|
|
10
|
+
abstract_interact: () => undefined;
|
|
11
|
+
abstract_menu: () => undefined;
|
|
12
|
+
};
|
|
13
|
+
controlsIndex: number;
|
|
14
|
+
subscribe: () => void;
|
|
15
|
+
afterHide: () => undefined;
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ModuleController } from "@vnejs/module.components";
|
|
2
|
+
export class CreditsController extends ModuleController {
|
|
3
|
+
name = "credits.controller";
|
|
4
|
+
onInteract = () => void this.emit(this.EVENTS.CREDITS.HIDE);
|
|
5
|
+
updateEvent = this.EVENTS.CREDITS.UPDATE;
|
|
6
|
+
controls = {
|
|
7
|
+
[this.CONST.CONTROLS.BUTTONS.ACCEPT]: this.onInteract,
|
|
8
|
+
[this.CONST.CONTROLS.BUTTONS.INTERACT]: this.onInteract,
|
|
9
|
+
[this.CONST.CONTROLS.BUTTONS.MENU]: this.onInteract,
|
|
10
|
+
};
|
|
11
|
+
controlsIndex = this.PARAMS.CREDITS.ZINDEX;
|
|
12
|
+
subscribe = () => {
|
|
13
|
+
this.on(this.EVENTS.CREDITS.SHOW, this.onShow);
|
|
14
|
+
this.on(this.EVENTS.CREDITS.HIDE, this.onHide);
|
|
15
|
+
this.on(this.EVENTS.STATE.CLEAR, this.onHide);
|
|
16
|
+
};
|
|
17
|
+
afterHide = () => void this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Module } from "@vnejs/module";
|
|
2
|
+
import type { CreditsPluginConstants, CreditsPluginEvents, CreditsPluginParams, CreditsPluginSettings } from "../types.js";
|
|
3
|
+
import type { CreditsLineExecPayload } from "../utils/credits.js";
|
|
4
|
+
export declare class Credits extends Module<CreditsPluginEvents, CreditsPluginConstants, CreditsPluginSettings, CreditsPluginParams> {
|
|
5
|
+
name: string;
|
|
6
|
+
init: () => Promise<unknown[]> | undefined;
|
|
7
|
+
onLineExec: ({ line }?: CreditsLineExecPayload) => Promise<unknown[]> | undefined;
|
|
8
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { tokenizeExecLine } from "@vnejs/helpers";
|
|
2
|
+
import { Module } from "@vnejs/module";
|
|
3
|
+
export class Credits extends Module {
|
|
4
|
+
name = "credits";
|
|
5
|
+
init = () => this.emit(this.EVENTS.SCENARIO.LINE_EXEC_REG, { module: this.name, handler: this.onLineExec });
|
|
6
|
+
onLineExec = ({ line = "" } = {}) => {
|
|
7
|
+
const [action = ""] = tokenizeExecLine(line);
|
|
8
|
+
if (action === "show")
|
|
9
|
+
return this.emit(this.EVENTS.CREDITS.SHOW);
|
|
10
|
+
if (action === "hide")
|
|
11
|
+
return this.emit(this.EVENTS.CREDITS.HIDE);
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ModuleView } from "@vnejs/module.components";
|
|
2
|
+
import type { CreditsPluginConstants, CreditsPluginEvents, CreditsPluginParams, CreditsPluginSettings } from "../types.js";
|
|
3
|
+
import type { CreditsPluginState } from "../utils/credits.js";
|
|
4
|
+
export declare class CreditsView extends ModuleView<CreditsPluginEvents, CreditsPluginConstants, CreditsPluginSettings, CreditsPluginParams, CreditsPluginState> {
|
|
5
|
+
name: string;
|
|
6
|
+
animationTime: number;
|
|
7
|
+
updateEvent: "vne:credits:update";
|
|
8
|
+
renderFunc: import("@vnejs/module.components").ViewRenderFunc<CreditsPluginState>;
|
|
9
|
+
updateHandler: (state?: CreditsPluginState | undefined) => Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ModuleView } from "@vnejs/module.components";
|
|
2
|
+
import { render } from "../view/index.js";
|
|
3
|
+
export class CreditsView extends ModuleView {
|
|
4
|
+
name = "credits.view";
|
|
5
|
+
animationTime = this.PARAMS.CREDITS.TRANSITION;
|
|
6
|
+
updateEvent = this.EVENTS.CREDITS.UPDATE;
|
|
7
|
+
renderFunc = render;
|
|
8
|
+
updateHandler = this.onUpdateStoreComponent;
|
|
9
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ModuleComponentsConstants, ModuleComponentsEvents, ModuleComponentsParams, ModuleComponentsSettings } from "@vnejs/module.components";
|
|
2
|
+
import type { Constants as ControlsConstants, PluginName as ControlsPluginName } from "@vnejs/plugins.controls.contract";
|
|
3
|
+
import type { PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/plugins.core.scenario.contract";
|
|
4
|
+
import type { PluginName as StatePluginName, SubscribeEvents as StateSubscribeEvents } from "@vnejs/plugins.core.state.contract";
|
|
5
|
+
import type { Params, PluginName, SubscribeEvents } from "@vnejs/plugins.views.screens.credits.contract";
|
|
6
|
+
export type CreditsPluginEvents = ModuleComponentsEvents & Record<PluginName, SubscribeEvents> & Record<ScenarioPluginName, ScenarioSubscribeEvents> & Record<StatePluginName, StateSubscribeEvents>;
|
|
7
|
+
export type CreditsPluginConstants = ModuleComponentsConstants & Record<ControlsPluginName, ControlsConstants>;
|
|
8
|
+
export type CreditsPluginSettings = ModuleComponentsSettings;
|
|
9
|
+
export type CreditsPluginParams = ModuleComponentsParams & Record<PluginName, Params>;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
import { Flex, Screen, ScrollContent, Text, createRenderFunc, useCallback, useMemo, useStoreState } from "@vnejs/uis.react";
|
|
4
|
+
const renderLine = ({ text, props }, i) => (_createElement(Text, { ...props, text: text, key: i }));
|
|
5
|
+
const Credits = ({ store, onMount, PARAMS, emit, EVENTS }) => {
|
|
6
|
+
const { isShow = false, isForce = false } = useStoreState(store, onMount);
|
|
7
|
+
const onClose = useCallback(() => void emit(EVENTS.CREDITS.HIDE), [emit, EVENTS.CREDITS.HIDE]);
|
|
8
|
+
const propsByView = PARAMS.CREDITS.VIEW_PROPS;
|
|
9
|
+
const propsScreen = useMemo(() => ({ ...propsByView.screen, isShow, isForce, onClose }), [isShow, isForce, onClose, propsByView.screen]);
|
|
10
|
+
const propsScroll = useMemo(() => ({ ...propsByView.scroll, shouldScroll: isShow, onClose }), [isShow, onClose, propsByView.scroll]);
|
|
11
|
+
const texts = useMemo(() => PARAMS.CREDITS.LINES.split("\n").map((line) => ({ text: line, props: propsByView.text })), [PARAMS.CREDITS.LINES, propsByView.text]);
|
|
12
|
+
return (_jsx(Screen, { ...propsScreen, children: _jsx(ScrollContent, { ...propsScroll, children: _jsx(Flex, { ...propsByView.flex, children: texts.map(renderLine) }) }) }));
|
|
13
|
+
};
|
|
14
|
+
export const render = createRenderFunc(Credits);
|
package/package.json
CHANGED
|
@@ -1,17 +1,48 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/plugins.views.screens.credits",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.1.7",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src",
|
|
18
|
+
"tsconfig.json"
|
|
19
|
+
],
|
|
5
20
|
"scripts": {
|
|
6
21
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
22
|
+
"build": "npx @vnejs/monorepo package",
|
|
7
23
|
"publish:major:plugin": "npm run publish:major",
|
|
8
24
|
"publish:minor:plugin": "npm run publish:minor",
|
|
9
25
|
"publish:patch:plugin": "npm run publish:patch",
|
|
10
|
-
"publish:major": "
|
|
11
|
-
"publish:minor": "
|
|
12
|
-
"publish:patch": "
|
|
26
|
+
"publish:major": "npx @vnejs/monorepo publish major --access public",
|
|
27
|
+
"publish:minor": "npx @vnejs/monorepo publish minor --access public",
|
|
28
|
+
"publish:patch": "npx @vnejs/monorepo publish patch --access public"
|
|
13
29
|
},
|
|
14
30
|
"author": "",
|
|
15
31
|
"license": "ISC",
|
|
16
|
-
"
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@vnejs/plugins.views.screens.credits.contract": "~0.0.1"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@vnejs/helpers": "~0.1.0",
|
|
37
|
+
"@vnejs/module": "~0.0.1",
|
|
38
|
+
"@vnejs/module.components": "~0.0.1",
|
|
39
|
+
"@vnejs/plugins.controls.contract": "~0.0.1",
|
|
40
|
+
"@vnejs/plugins.core.scenario.contract": "~0.0.1",
|
|
41
|
+
"@vnejs/plugins.core.state.contract": "~0.0.1",
|
|
42
|
+
"@vnejs/shared": "~0.0.9",
|
|
43
|
+
"@vnejs/uis.react": "~0.1.0"
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@vnejs/configs.ts-common": "~0.0.1"
|
|
47
|
+
}
|
|
17
48
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { regPlugin } from "@vnejs/shared";
|
|
2
|
+
import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/plugins.views.screens.credits.contract";
|
|
3
|
+
|
|
4
|
+
import { CreditsController } from "./modules/controller.js";
|
|
5
|
+
import { Credits } from "./modules/credits.js";
|
|
6
|
+
import { CreditsView } from "./modules/view.js";
|
|
7
|
+
|
|
8
|
+
regPlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS, params: PARAMS }, [CreditsController, Credits, CreditsView]);
|
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { ModuleController } from "@vnejs/module.components";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type { CreditsPluginConstants, CreditsPluginEvents, CreditsPluginParams, CreditsPluginSettings } from "../types.js";
|
|
4
|
+
import type { CreditsPluginState } from "../utils/credits.js";
|
|
5
|
+
|
|
6
|
+
export class CreditsController extends ModuleController<
|
|
7
|
+
CreditsPluginEvents,
|
|
8
|
+
CreditsPluginConstants,
|
|
9
|
+
CreditsPluginSettings,
|
|
10
|
+
CreditsPluginParams,
|
|
11
|
+
CreditsPluginState
|
|
12
|
+
> {
|
|
4
13
|
name = "credits.controller";
|
|
5
14
|
|
|
6
|
-
onInteract = () => this.emit(this.EVENTS.CREDITS.HIDE);
|
|
15
|
+
onInteract = () => void this.emit(this.EVENTS.CREDITS.HIDE);
|
|
7
16
|
|
|
8
17
|
updateEvent = this.EVENTS.CREDITS.UPDATE;
|
|
9
18
|
controls = {
|
|
@@ -20,5 +29,5 @@ export class CreditsController extends ModuleController {
|
|
|
20
29
|
this.on(this.EVENTS.STATE.CLEAR, this.onHide);
|
|
21
30
|
};
|
|
22
31
|
|
|
23
|
-
afterHide = () => this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
|
|
32
|
+
afterHide = () => void this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
|
|
24
33
|
}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { tokenizeExecLine } from "@vnejs/helpers";
|
|
1
2
|
import { Module } from "@vnejs/module";
|
|
2
3
|
|
|
3
|
-
import {
|
|
4
|
+
import type { CreditsPluginConstants, CreditsPluginEvents, CreditsPluginParams, CreditsPluginSettings } from "../types.js";
|
|
5
|
+
import type { CreditsLineExecPayload } from "../utils/credits.js";
|
|
4
6
|
|
|
5
|
-
export class Credits extends Module {
|
|
7
|
+
export class Credits extends Module<CreditsPluginEvents, CreditsPluginConstants, CreditsPluginSettings, CreditsPluginParams> {
|
|
6
8
|
name = "credits";
|
|
7
9
|
|
|
8
10
|
init = () => this.emit(this.EVENTS.SCENARIO.LINE_EXEC_REG, { module: this.name, handler: this.onLineExec });
|
|
9
11
|
|
|
10
|
-
onLineExec = ({ line = "" } = {}) => {
|
|
12
|
+
onLineExec = ({ line = "" }: CreditsLineExecPayload = {}) => {
|
|
11
13
|
const [action = ""] = tokenizeExecLine(line);
|
|
12
14
|
|
|
13
15
|
if (action === "show") return this.emit(this.EVENTS.CREDITS.SHOW);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ModuleView } from "@vnejs/module.components";
|
|
2
|
+
|
|
3
|
+
import { render } from "../view/index.js";
|
|
4
|
+
import type { CreditsPluginConstants, CreditsPluginEvents, CreditsPluginParams, CreditsPluginSettings } from "../types.js";
|
|
5
|
+
import type { CreditsPluginState } from "../utils/credits.js";
|
|
6
|
+
|
|
7
|
+
export class CreditsView extends ModuleView<
|
|
8
|
+
CreditsPluginEvents,
|
|
9
|
+
CreditsPluginConstants,
|
|
10
|
+
CreditsPluginSettings,
|
|
11
|
+
CreditsPluginParams,
|
|
12
|
+
CreditsPluginState
|
|
13
|
+
> {
|
|
14
|
+
name = "credits.view";
|
|
15
|
+
|
|
16
|
+
animationTime = this.PARAMS.CREDITS.TRANSITION;
|
|
17
|
+
updateEvent = this.EVENTS.CREDITS.UPDATE;
|
|
18
|
+
|
|
19
|
+
renderFunc = render;
|
|
20
|
+
updateHandler = this.onUpdateStoreComponent;
|
|
21
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ModuleComponentsConstants, ModuleComponentsEvents, ModuleComponentsParams, ModuleComponentsSettings } from "@vnejs/module.components";
|
|
2
|
+
import type { Constants as ControlsConstants, PluginName as ControlsPluginName } from "@vnejs/plugins.controls.contract";
|
|
3
|
+
import type { PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/plugins.core.scenario.contract";
|
|
4
|
+
import type { PluginName as StatePluginName, SubscribeEvents as StateSubscribeEvents } from "@vnejs/plugins.core.state.contract";
|
|
5
|
+
import type { Params, PluginName, SubscribeEvents } from "@vnejs/plugins.views.screens.credits.contract";
|
|
6
|
+
|
|
7
|
+
export type CreditsPluginEvents = ModuleComponentsEvents &
|
|
8
|
+
Record<PluginName, SubscribeEvents> &
|
|
9
|
+
Record<ScenarioPluginName, ScenarioSubscribeEvents> &
|
|
10
|
+
Record<StatePluginName, StateSubscribeEvents>;
|
|
11
|
+
|
|
12
|
+
export type CreditsPluginConstants = ModuleComponentsConstants & Record<ControlsPluginName, ControlsConstants>;
|
|
13
|
+
|
|
14
|
+
export type CreditsPluginSettings = ModuleComponentsSettings;
|
|
15
|
+
|
|
16
|
+
export type CreditsPluginParams = ModuleComponentsParams & Record<PluginName, Params>;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ViewRenderFunc } from "@vnejs/module.components";
|
|
2
|
+
import type { ReactComponentProps } from "@vnejs/uis.react";
|
|
3
|
+
import { Flex, Screen, ScrollContent, Text, createRenderFunc, useCallback, useMemo, useStoreState } from "@vnejs/uis.react";
|
|
4
|
+
|
|
5
|
+
import type { CreditsPluginConstants, CreditsPluginEvents, CreditsPluginParams, CreditsPluginSettings } from "../types.js";
|
|
6
|
+
import type { CreditsPluginState } from "../utils/credits.js";
|
|
7
|
+
|
|
8
|
+
type CreditsComponentProps = ReactComponentProps<
|
|
9
|
+
CreditsPluginEvents,
|
|
10
|
+
CreditsPluginConstants,
|
|
11
|
+
CreditsPluginSettings,
|
|
12
|
+
CreditsPluginParams,
|
|
13
|
+
CreditsPluginState
|
|
14
|
+
>;
|
|
15
|
+
|
|
16
|
+
const renderLine = ({ text, props }: { text: string; props: Record<string, unknown> }, i: number) => (
|
|
17
|
+
<Text
|
|
18
|
+
{...props}
|
|
19
|
+
text={text}
|
|
20
|
+
key={i}
|
|
21
|
+
/>
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
const Credits = ({ store, onMount, PARAMS, emit, EVENTS }: CreditsComponentProps) => {
|
|
25
|
+
const { isShow = false, isForce = false } = useStoreState<CreditsPluginState>(store, onMount);
|
|
26
|
+
|
|
27
|
+
const onClose = useCallback(() => void emit(EVENTS.CREDITS.HIDE), [emit, EVENTS.CREDITS.HIDE]);
|
|
28
|
+
|
|
29
|
+
const propsByView = PARAMS.CREDITS.VIEW_PROPS;
|
|
30
|
+
|
|
31
|
+
const propsScreen = useMemo(() => ({ ...propsByView.screen, isShow, isForce, onClose }), [isShow, isForce, onClose, propsByView.screen]);
|
|
32
|
+
const propsScroll = useMemo(() => ({ ...propsByView.scroll, shouldScroll: isShow, onClose }), [isShow, onClose, propsByView.scroll]);
|
|
33
|
+
|
|
34
|
+
const texts = useMemo(
|
|
35
|
+
() => PARAMS.CREDITS.LINES.split("\n").map((line) => ({ text: line, props: propsByView.text })),
|
|
36
|
+
[PARAMS.CREDITS.LINES, propsByView.text],
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Screen {...propsScreen}>
|
|
41
|
+
<ScrollContent {...propsScroll}>
|
|
42
|
+
<Flex {...propsByView.flex}>{texts.map(renderLine)}</Flex>
|
|
43
|
+
</ScrollContent>
|
|
44
|
+
</Screen>
|
|
45
|
+
);
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const render: ViewRenderFunc<CreditsPluginState> = createRenderFunc(Credits);
|
package/tsconfig.json
ADDED
package/const/events.js
DELETED
package/const/params.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export const LINES = [];
|
|
2
|
-
|
|
3
|
-
export const TRANSITION = 1000;
|
|
4
|
-
export const ZINDEX = 2000;
|
|
5
|
-
|
|
6
|
-
export const VIEW_PROPS = {
|
|
7
|
-
screen: { isDisableAutoread: true, zIndex: ZINDEX, transition: TRANSITION },
|
|
8
|
-
scroll: { waitCommonDelay: TRANSITION, waitStartDelay: 500, waitEndDelay: 2000, duration: 120 * 1000 },
|
|
9
|
-
flex: { paddingHorizontal: 720, paddingVertical: 120, gap: 36, direction: "column" },
|
|
10
|
-
text: { size: 72, align: "center" },
|
|
11
|
-
};
|
package/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { regPlugin } from "@vnejs/shared";
|
|
2
|
-
|
|
3
|
-
import { SUBSCRIBE_EVENTS } from "./const/events";
|
|
4
|
-
import * as params from "./const/params";
|
|
5
|
-
|
|
6
|
-
import { CreditsController } from "./modules/controller";
|
|
7
|
-
import { Credits } from "./modules/credits";
|
|
8
|
-
import { CreditsView } from "./modules/view";
|
|
9
|
-
|
|
10
|
-
regPlugin("CREDITS", { events: SUBSCRIBE_EVENTS, params }, [CreditsController, Credits, CreditsView]);
|
package/modules/view.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ModuleView } from "@vnejs/module.components";
|
|
2
|
-
|
|
3
|
-
import { render } from "../view";
|
|
4
|
-
|
|
5
|
-
export class CreditsView extends ModuleView {
|
|
6
|
-
name = "credits.view";
|
|
7
|
-
|
|
8
|
-
animationTime = this.PARAMS.CREDITS.TRANSITION;
|
|
9
|
-
updateEvent = this.EVENTS.CREDITS.UPDATE;
|
|
10
|
-
|
|
11
|
-
renderFunc = render;
|
|
12
|
-
updateHandler = this.onUpdateStoreComponent;
|
|
13
|
-
}
|
package/view/index.jsx
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
|
-
import { createRoot } from "react-dom/client";
|
|
3
|
-
|
|
4
|
-
import { Flex, Screen, ScrollContent, Text } from "@vnejs/uis.react";
|
|
5
|
-
|
|
6
|
-
const renderLine = ({ text, props } = {}, i) => (
|
|
7
|
-
<Text
|
|
8
|
-
{...props}
|
|
9
|
-
text={text}
|
|
10
|
-
key={i}
|
|
11
|
-
/>
|
|
12
|
-
);
|
|
13
|
-
|
|
14
|
-
const Credits = ({ store, onMount, ...props } = {}) => {
|
|
15
|
-
const [{ isShow = false, isForce = false }, setState] = useState({});
|
|
16
|
-
|
|
17
|
-
useEffect(() => store.subscribe(setState), []);
|
|
18
|
-
useEffect(() => void onMount(), []);
|
|
19
|
-
|
|
20
|
-
const onClose = useCallback(() => props.emit(props.EVENTS.CREDITS.HIDE), []);
|
|
21
|
-
|
|
22
|
-
const propsByView = props.PARAMS.CREDITS.VIEW_PROPS;
|
|
23
|
-
|
|
24
|
-
const propsScreen = useMemo(() => ({ ...propsByView.screen, isShow, isForce, onClose }), [isShow, isForce]);
|
|
25
|
-
const propsScroll = useMemo(() => ({ ...propsByView.scroll, shouldScroll: isShow, onClose }), [isShow]);
|
|
26
|
-
|
|
27
|
-
const texts = useMemo(() => props.PARAMS.CREDITS.LINES.split("\n").map((text) => ({ text, props: propsByView.text })), []);
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Screen {...propsScreen}>
|
|
31
|
-
<ScrollContent {...propsScroll}>
|
|
32
|
-
<Flex {...propsByView.flex}>{texts.map(renderLine)}</Flex>
|
|
33
|
-
</ScrollContent>
|
|
34
|
-
</Screen>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
export const render = (props, root) => createRoot(root).render(<Credits {...props} />);
|