@vnejs/plugins.views.scenario.interface 0.1.13 → 0.1.15
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 +23 -0
- package/dist/modules/controller.js +77 -0
- package/dist/modules/interface.d.ts +27 -0
- package/dist/modules/interface.js +74 -0
- package/dist/modules/view.d.ts +11 -0
- package/dist/modules/view.js +10 -0
- package/dist/types.d.ts +17 -0
- package/dist/types.js +1 -0
- package/dist/utils/interface.d.ts +35 -0
- package/dist/utils/interface.js +1 -0
- package/dist/view/components/InterfaceBackdrop.d.ts +2 -0
- package/dist/view/components/InterfaceBackdrop.js +9 -0
- package/dist/view/components/InterfaceViewDialog.d.ts +2 -0
- package/dist/view/components/InterfaceViewDialog.js +19 -0
- package/dist/view/components/InterfaceViewLine.d.ts +2 -0
- package/dist/view/components/InterfaceViewLine.js +12 -0
- package/dist/view/components/InterfaceViewWall.d.ts +2 -0
- package/dist/view/components/InterfaceViewWall.js +24 -0
- package/dist/view/components/index.d.ts +4 -0
- package/dist/view/components/index.js +4 -0
- package/dist/view/components/tokens.hook.d.ts +6 -0
- package/dist/view/components/tokens.hook.js +30 -0
- package/dist/view/index.d.ts +3 -0
- package/dist/view/index.js +27 -0
- package/package.json +38 -6
- package/src/index.ts +8 -0
- package/{modules/controller.js → src/modules/controller.ts} +36 -10
- package/{modules/interface.js → src/modules/interface.ts} +33 -19
- package/src/modules/view.ts +22 -0
- package/src/types.ts +35 -0
- package/src/utils/interface.ts +43 -0
- package/src/view/components/InterfaceBackdrop.tsx +24 -0
- package/{view/components/InterfaceViewDialog.jsx → src/view/components/InterfaceViewDialog.tsx} +11 -11
- package/src/view/components/InterfaceViewLine.tsx +27 -0
- package/src/view/components/InterfaceViewWall.tsx +101 -0
- package/src/view/components/index.ts +4 -0
- package/{view/components/tokens.hook.jsx → src/view/components/tokens.hook.ts} +8 -10
- package/src/view/index.tsx +70 -0
- package/tsconfig.json +10 -0
- package/const/events.js +0 -31
- package/const/params.js +0 -37
- package/index.js +0 -10
- package/modules/view.js +0 -14
- package/view/components/InterfaceBackdrop.jsx +0 -22
- package/view/components/InterfaceViewLine.jsx +0 -25
- package/view/components/InterfaceViewWall.jsx +0 -65
- package/view/components/index.js +0 -4
- package/view/index.jsx +0 -65
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.scenario.interface.contract";
|
|
3
|
+
import { InterfaceController } from "./modules/controller.js";
|
|
4
|
+
import { Interface } from "./modules/interface.js";
|
|
5
|
+
import { InterfaceView } from "./modules/view.js";
|
|
6
|
+
regPlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS, params: PARAMS }, [InterfaceController, Interface, InterfaceView]);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ModuleController } from "@vnejs/module.components";
|
|
2
|
+
import type { InterfacePluginConstants, InterfacePluginEvents, InterfacePluginParams, InterfacePluginSettings } from "../types.js";
|
|
3
|
+
import type { InterfaceForcePayload, InterfacePluginState } from "../utils/interface.js";
|
|
4
|
+
export declare class InterfaceController extends ModuleController<InterfacePluginEvents, InterfacePluginConstants, InterfacePluginSettings, InterfacePluginParams, InterfacePluginState> {
|
|
5
|
+
name: string;
|
|
6
|
+
isStateChangeInProcess: boolean;
|
|
7
|
+
updateEvent: "vne:interface:view_update";
|
|
8
|
+
controls: {
|
|
9
|
+
abstract_interact: () => undefined;
|
|
10
|
+
abstract_accept: () => undefined;
|
|
11
|
+
};
|
|
12
|
+
controlsUnvisible: {};
|
|
13
|
+
controlsIndex: number;
|
|
14
|
+
subscribe: () => void;
|
|
15
|
+
init: () => Promise<unknown[]> | undefined;
|
|
16
|
+
onShowChanged: ({ isForce }?: InterfaceForcePayload) => Promise<unknown[]> | undefined;
|
|
17
|
+
onViewChanged: ({ isForce }?: InterfaceForcePayload) => Promise<unknown[]> | undefined;
|
|
18
|
+
onTextChanged: () => Promise<unknown[] | undefined>;
|
|
19
|
+
onSpeakerChanged: () => Promise<unknown[] | undefined>;
|
|
20
|
+
onVisibleChanged: ({ isForce }?: InterfaceForcePayload) => Promise<void>;
|
|
21
|
+
onStateChanged: () => Promise<void>;
|
|
22
|
+
getDefaultState: () => InterfacePluginState;
|
|
23
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ModuleController } from "@vnejs/module.components";
|
|
2
|
+
import { CONSTANTS as ControlsConstants } from "@vnejs/plugins.controls.contract";
|
|
3
|
+
export class InterfaceController extends ModuleController {
|
|
4
|
+
name = "interface.controller";
|
|
5
|
+
isStateChangeInProcess = false;
|
|
6
|
+
updateEvent = this.EVENTS.INTERFACE.VIEW_UPDATE;
|
|
7
|
+
controls = {
|
|
8
|
+
[ControlsConstants.BUTTONS.INTERACT]: () => void this.emit(this.EVENTS.INTERFACE.INTERACT),
|
|
9
|
+
[ControlsConstants.BUTTONS.ACCEPT]: () => void this.emit(this.EVENTS.INTERFACE.INTERACT),
|
|
10
|
+
};
|
|
11
|
+
controlsUnvisible = {};
|
|
12
|
+
controlsIndex = this.PARAMS.INTERFACE.ZINDEX;
|
|
13
|
+
subscribe = () => {
|
|
14
|
+
this.on(this.EVENTS.INTERFACE.VIEW_SHOW, this.onShow);
|
|
15
|
+
this.on(this.EVENTS.INTERFACE.VIEW_HIDE, this.onHide);
|
|
16
|
+
this.on(this.EVENTS.INTERFACE.SHOW_CHANGED, this.onShowChanged);
|
|
17
|
+
this.on(this.EVENTS.INTERFACE.VIEW_CHANGED, this.onViewChanged);
|
|
18
|
+
this.on(this.EVENTS.INTERFACE.TEXT_CHANGED, this.onTextChanged);
|
|
19
|
+
this.on(this.EVENTS.INTERFACE.SPEAKER_CHANGED, this.onSpeakerChanged);
|
|
20
|
+
this.on(this.EVENTS.INTERFACE.STATE_CHANGED, this.onStateChanged);
|
|
21
|
+
this.on(this.EVENTS.INTERFACE.VISIBLE_CHANGED, this.onVisibleChanged);
|
|
22
|
+
};
|
|
23
|
+
init = () => this.emit(this.EVENTS.INTERFACE.VIEW, { view: this.PARAMS.INTERFACE.DEFAULT_VIEW, isForce: true });
|
|
24
|
+
onShowChanged = ({ isForce = false } = {}) => {
|
|
25
|
+
const { isShow = false } = this.globalState.interface;
|
|
26
|
+
const event = isShow ? this.EVENTS.INTERFACE.VIEW_SHOW : this.EVENTS.INTERFACE.VIEW_HIDE;
|
|
27
|
+
if (this.state.isShow !== isShow)
|
|
28
|
+
return this.emit(event, { isForce });
|
|
29
|
+
};
|
|
30
|
+
onViewChanged = ({ isForce = false } = {}) => {
|
|
31
|
+
const { view = "" } = this.globalState.interface;
|
|
32
|
+
if (this.state.view !== view)
|
|
33
|
+
return this.updateStateAndView({ view }, isForce, !isForce);
|
|
34
|
+
};
|
|
35
|
+
onTextChanged = async () => {
|
|
36
|
+
const { tokens = [], wall = [], uid = "", tokensVisible = 0 } = this.globalState.interface;
|
|
37
|
+
while (this.isStateChangeInProcess)
|
|
38
|
+
await this.waitRerender();
|
|
39
|
+
return this.updateStateAndViewFast({ tokens, wall, uid, tokensVisible });
|
|
40
|
+
};
|
|
41
|
+
onSpeakerChanged = async () => {
|
|
42
|
+
const { speaker = "", meet = 0 } = this.globalState.interface;
|
|
43
|
+
while (this.isStateChangeInProcess)
|
|
44
|
+
await this.waitRerender();
|
|
45
|
+
return this.updateStateAndViewFast({ speaker, meet });
|
|
46
|
+
};
|
|
47
|
+
onVisibleChanged = async ({ isForce = false } = {}) => {
|
|
48
|
+
const { isVisible = false } = this.globalState.interface;
|
|
49
|
+
if (this.state.isVisible === isVisible)
|
|
50
|
+
return;
|
|
51
|
+
const args = {
|
|
52
|
+
key: `${this.name}-unvisible`,
|
|
53
|
+
controls: this.controlsUnvisible,
|
|
54
|
+
index: this.controlsIndex + 500,
|
|
55
|
+
};
|
|
56
|
+
await this.emit(isVisible ? this.EVENTS.CONTROLS.POP : this.EVENTS.CONTROLS.PUSH, args);
|
|
57
|
+
await this.updateStateAndView({ isVisible }, isForce, !isForce);
|
|
58
|
+
};
|
|
59
|
+
onStateChanged = async () => {
|
|
60
|
+
const { view = "", isShow = false, isVisible = false } = this.globalState.interface;
|
|
61
|
+
this.isStateChangeInProcess = true;
|
|
62
|
+
await this.updateStateAndViewForce({ view, isShow, isVisible });
|
|
63
|
+
this.isStateChangeInProcess = false;
|
|
64
|
+
};
|
|
65
|
+
getDefaultState = () => ({
|
|
66
|
+
tokens: [],
|
|
67
|
+
wall: [],
|
|
68
|
+
uid: "",
|
|
69
|
+
tokensVisible: 0,
|
|
70
|
+
speaker: "",
|
|
71
|
+
meet: 0,
|
|
72
|
+
isShow: false,
|
|
73
|
+
isVisible: false,
|
|
74
|
+
isForce: false,
|
|
75
|
+
view: "",
|
|
76
|
+
});
|
|
77
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Module, type ModuleGlobalStateRegistry } from "@vnejs/module";
|
|
2
|
+
import type { InterfacePluginConstants, InterfacePluginEvents, InterfacePluginParams, InterfacePluginSettings } from "../types.js";
|
|
3
|
+
import type { InterfaceForcePayload, InterfaceLineExecPayload, InterfaceModuleState, InterfaceSpeakerChangedPayload, InterfaceTextChangedPayload, InterfaceViewPayload } from "../utils/interface.js";
|
|
4
|
+
export declare class Interface extends Module<InterfacePluginEvents, InterfacePluginConstants, InterfacePluginSettings, InterfacePluginParams, InterfaceModuleState> {
|
|
5
|
+
name: string;
|
|
6
|
+
subscribe: () => void;
|
|
7
|
+
init: () => Promise<unknown[]> | undefined;
|
|
8
|
+
onLineExec: ({ line }?: InterfaceLineExecPayload) => Promise<void>;
|
|
9
|
+
onInteract: () => Promise<unknown[]> | undefined;
|
|
10
|
+
onShow: ({ isForce }?: InterfaceForcePayload) => false | Promise<unknown[] | undefined>;
|
|
11
|
+
onHide: ({ isForce }?: InterfaceForcePayload) => false | Promise<unknown[] | undefined>;
|
|
12
|
+
onVisible: ({ isForce }?: InterfaceForcePayload) => Promise<unknown[]> | undefined;
|
|
13
|
+
onTextChanged: ({ tokens, wall, uid, tokensVisible }?: InterfaceTextChangedPayload) => Promise<unknown[]> | undefined;
|
|
14
|
+
onTextSpeakerChanged: ({ speaker, meet }?: InterfaceSpeakerChangedPayload) => Promise<unknown[]> | undefined;
|
|
15
|
+
onTextEmitBefore: () => Promise<unknown[]> | undefined;
|
|
16
|
+
onTextHide: () => Promise<unknown[]> | undefined;
|
|
17
|
+
onView: ({ view, isForce }?: InterfaceViewPayload) => Promise<unknown[]> | undefined;
|
|
18
|
+
onStateSet: (payload: ModuleGlobalStateRegistry) => Promise<unknown[]> | undefined;
|
|
19
|
+
onStateClear: () => Promise<unknown[]> | undefined;
|
|
20
|
+
setView: (view?: string, isForce?: boolean) => Promise<unknown[]> | undefined;
|
|
21
|
+
setShow: (isShow: boolean, isForce?: boolean) => Promise<unknown[] | undefined>;
|
|
22
|
+
setVisible: (isVisible: boolean, isForce?: boolean) => Promise<unknown[]> | undefined;
|
|
23
|
+
setText: (tokens?: InterfaceModuleState["tokens"], wall?: InterfaceModuleState["wall"], uid?: string, tokensVisible?: number) => Promise<unknown[]> | undefined;
|
|
24
|
+
setSpeaker: (speaker?: string, meet?: number) => Promise<unknown[]> | undefined;
|
|
25
|
+
setNewState: (view?: string, isVisible?: boolean, isShow?: boolean) => Promise<unknown[]> | undefined;
|
|
26
|
+
getDefaultState: () => InterfaceModuleState;
|
|
27
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Module } from "@vnejs/module";
|
|
2
|
+
import { tokenizeExecLine } from "@vnejs/helpers";
|
|
3
|
+
export class Interface extends Module {
|
|
4
|
+
name = "interface";
|
|
5
|
+
subscribe = () => {
|
|
6
|
+
this.on(this.EVENTS.INTERFACE.INTERACT, this.onInteract);
|
|
7
|
+
this.on(this.EVENTS.INTERFACE.SHOW, this.onShow);
|
|
8
|
+
this.on(this.EVENTS.INTERFACE.HIDE, this.onHide);
|
|
9
|
+
this.on(this.EVENTS.INTERFACE.VISIBLE, this.onVisible);
|
|
10
|
+
this.on(this.EVENTS.INTERFACE.TEXT_HIDE, this.onTextHide);
|
|
11
|
+
this.on(this.EVENTS.INTERFACE.VIEW, this.onView);
|
|
12
|
+
this.on(this.EVENTS.TEXT.CHANGED, this.onTextChanged);
|
|
13
|
+
this.on(this.EVENTS.TEXT.SPEAKER_CHANGED, this.onTextSpeakerChanged);
|
|
14
|
+
this.on(this.EVENTS.TEXT.EMIT_BEFORE, this.onTextEmitBefore);
|
|
15
|
+
this.on(this.EVENTS.STATE.SET, this.onStateSet);
|
|
16
|
+
this.on(this.EVENTS.STATE.CLEAR, this.onStateClear);
|
|
17
|
+
};
|
|
18
|
+
init = () => this.emit(this.EVENTS.SCENARIO.LINE_EXEC_REG, { module: this.name, handler: this.onLineExec });
|
|
19
|
+
onLineExec = async ({ line = "" } = {}) => {
|
|
20
|
+
const isForce = Boolean(this.shared.viewForceAnimationSources.length);
|
|
21
|
+
const [action = "", execArg = ""] = tokenizeExecLine(line);
|
|
22
|
+
if (action === "show")
|
|
23
|
+
await this.emit(this.EVENTS.INTERFACE.SHOW, { isForce });
|
|
24
|
+
if (action === "hide")
|
|
25
|
+
await this.emit(this.EVENTS.INTERFACE.HIDE, { isForce });
|
|
26
|
+
if (action === "view")
|
|
27
|
+
await this.emit(this.EVENTS.INTERFACE.VIEW, { view: execArg, isForce });
|
|
28
|
+
this.emit(this.EVENTS.SCENARIO.NEXT, { module: this.name });
|
|
29
|
+
};
|
|
30
|
+
onInteract = () => this.emit(this.state.isVisible ? this.EVENTS.INTERACT.EMIT : this.EVENTS.INTERFACE.VISIBLE);
|
|
31
|
+
onShow = ({ isForce = false } = {}) => !this.state.isShow && this.setShow(true, isForce);
|
|
32
|
+
onHide = ({ isForce = false } = {}) => this.state.isShow && this.setShow(false, isForce);
|
|
33
|
+
onVisible = ({ isForce = false } = {}) => this.setVisible(!this.state.isVisible, isForce);
|
|
34
|
+
onTextChanged = ({ tokens, wall, uid, tokensVisible } = {}) => this.setText(tokens, wall, uid, tokensVisible);
|
|
35
|
+
onTextSpeakerChanged = ({ speaker, meet } = {}) => this.setSpeaker(speaker, meet);
|
|
36
|
+
onTextEmitBefore = () => this.emit(this.EVENTS.INTERFACE.SHOW);
|
|
37
|
+
onTextHide = () => this.setText([], [], "", 0);
|
|
38
|
+
onView = ({ view, isForce = false } = {}) => this.setView(view, isForce);
|
|
39
|
+
onStateSet = (payload) => {
|
|
40
|
+
const moduleState = this.getStateSlice(payload);
|
|
41
|
+
return this.setNewState(moduleState?.view, moduleState?.isVisible, moduleState?.isShow);
|
|
42
|
+
};
|
|
43
|
+
onStateClear = () => this.setNewState(this.PARAMS.INTERFACE.DEFAULT_VIEW, false, false);
|
|
44
|
+
setView = (view, isForce = false) => {
|
|
45
|
+
this.state.view = view ?? "";
|
|
46
|
+
return this.emit(this.EVENTS.INTERFACE.VIEW_CHANGED, { isForce });
|
|
47
|
+
};
|
|
48
|
+
setShow = async (isShow, isForce = false) => {
|
|
49
|
+
this.state.isShow = isShow;
|
|
50
|
+
if (isShow && !this.state.isVisible)
|
|
51
|
+
await this.setVisible(true, isForce);
|
|
52
|
+
return this.emit(this.EVENTS.INTERFACE.SHOW_CHANGED, { isForce });
|
|
53
|
+
};
|
|
54
|
+
setVisible = (isVisible, isForce = false) => {
|
|
55
|
+
this.state.isVisible = isVisible;
|
|
56
|
+
return this.emit(this.EVENTS.INTERFACE.VISIBLE_CHANGED, { isForce });
|
|
57
|
+
};
|
|
58
|
+
setText = (tokens = [], wall = [], uid = "", tokensVisible) => {
|
|
59
|
+
Object.assign(this.state, { tokens, wall, uid, tokensVisible });
|
|
60
|
+
return this.emit(this.EVENTS.INTERFACE.TEXT_CHANGED);
|
|
61
|
+
};
|
|
62
|
+
setSpeaker = (speaker = "", meet = 0) => {
|
|
63
|
+
Object.assign(this.state, { speaker, meet });
|
|
64
|
+
return this.emit(this.EVENTS.INTERFACE.SPEAKER_CHANGED);
|
|
65
|
+
};
|
|
66
|
+
setNewState = (view, isVisible, isShow) => {
|
|
67
|
+
Object.assign(this.state, { isShow, view, isVisible });
|
|
68
|
+
return this.emit(this.EVENTS.INTERFACE.STATE_CHANGED);
|
|
69
|
+
};
|
|
70
|
+
getDefaultState = () => {
|
|
71
|
+
const result = { tokens: [], view: this.PARAMS.INTERFACE.DEFAULT_VIEW, uid: "", speaker: "" };
|
|
72
|
+
return { ...result, meet: 0, tokensVisible: 0, isShow: false, isVisible: false, wall: [] };
|
|
73
|
+
};
|
|
74
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ModuleView } from "@vnejs/module.components";
|
|
2
|
+
import type { InterfacePluginConstants, InterfacePluginEvents, InterfacePluginParams, InterfacePluginSettings } from "../types.js";
|
|
3
|
+
import type { InterfacePluginState } from "../utils/interface.js";
|
|
4
|
+
export declare class InterfaceView extends ModuleView<InterfacePluginEvents, InterfacePluginConstants, InterfacePluginSettings, InterfacePluginParams, InterfacePluginState> {
|
|
5
|
+
name: string;
|
|
6
|
+
locLabel: string;
|
|
7
|
+
animationTime: number;
|
|
8
|
+
updateEvent: "vne:interface:view_update";
|
|
9
|
+
renderFunc: import("@vnejs/module.components").ViewRenderFunc<InterfacePluginState>;
|
|
10
|
+
updateHandler: (state?: InterfacePluginState | undefined) => Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ModuleView } from "@vnejs/module.components";
|
|
2
|
+
import { render } from "../view/index.js";
|
|
3
|
+
export class InterfaceView extends ModuleView {
|
|
4
|
+
name = "interface.view";
|
|
5
|
+
locLabel = this.PARAMS.INTERFACE.LOC_LABEL;
|
|
6
|
+
animationTime = this.PARAMS.INTERFACE.TRANSITION;
|
|
7
|
+
updateEvent = this.EVENTS.INTERFACE.VIEW_UPDATE;
|
|
8
|
+
renderFunc = render;
|
|
9
|
+
updateHandler = this.onUpdateStoreComponent;
|
|
10
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ModuleComponentsConstants, ModuleComponentsEvents, ModuleComponentsParams, ModuleComponentsSettings } from "@vnejs/module.components";
|
|
2
|
+
import type { ReactComponentProps } from "@vnejs/uis.react";
|
|
3
|
+
import type { Constants as ControlsConstants, PluginName as ControlsPluginName } from "@vnejs/plugins.controls.contract";
|
|
4
|
+
import type { PluginName as InteractPluginName, SubscribeEvents as InteractSubscribeEvents } from "@vnejs/plugins.core.interact.contract";
|
|
5
|
+
import type { PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/plugins.core.scenario.contract";
|
|
6
|
+
import type { PluginName as StatePluginName, SubscribeEvents as StateSubscribeEvents } from "@vnejs/plugins.core.state.contract";
|
|
7
|
+
import type { PluginName as TextPluginName, Params as TextParams, SubscribeEvents as TextSubscribeEvents } from "@vnejs/plugins.text.contract";
|
|
8
|
+
import type { Params, PluginName, SubscribeEvents } from "@vnejs/plugins.views.scenario.interface.contract";
|
|
9
|
+
import type { InterfacePluginState } from "./utils/interface.js";
|
|
10
|
+
export type InterfacePluginEvents = ModuleComponentsEvents & Record<PluginName, SubscribeEvents> & Record<ScenarioPluginName, ScenarioSubscribeEvents> & Record<StatePluginName, StateSubscribeEvents> & Record<TextPluginName, TextSubscribeEvents> & Record<InteractPluginName, InteractSubscribeEvents>;
|
|
11
|
+
export type InterfacePluginConstants = ModuleComponentsConstants & Record<ControlsPluginName, ControlsConstants>;
|
|
12
|
+
export type InterfacePluginSettings = ModuleComponentsSettings;
|
|
13
|
+
export type InterfacePluginParams = ModuleComponentsParams & Record<PluginName, Params> & Record<TextPluginName, TextParams>;
|
|
14
|
+
export type InterfacePluginViewState = InterfacePluginState & {
|
|
15
|
+
isViewActive?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export type InterfaceViewProps = ReactComponentProps<InterfacePluginEvents, InterfacePluginConstants, InterfacePluginSettings, InterfacePluginParams, InterfacePluginViewState>;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ModuleControllerState } from "@vnejs/module.components";
|
|
2
|
+
import type { TokenizedChar, WallElement } from "@vnejs/plugins.text.contract";
|
|
3
|
+
import type { InterfaceModuleState } from "@vnejs/plugins.views.scenario.interface.contract";
|
|
4
|
+
export type { InterfaceModuleState };
|
|
5
|
+
export type InterfacePluginState = ModuleControllerState & InterfaceModuleState & {
|
|
6
|
+
isFast?: boolean;
|
|
7
|
+
locs?: Record<string, string>;
|
|
8
|
+
prefix?: string;
|
|
9
|
+
postfix?: string;
|
|
10
|
+
transition?: number;
|
|
11
|
+
speakerText?: string;
|
|
12
|
+
speakerName?: string;
|
|
13
|
+
speakerColor?: string;
|
|
14
|
+
color?: string;
|
|
15
|
+
opacity?: number;
|
|
16
|
+
};
|
|
17
|
+
export type InterfaceLineExecPayload = {
|
|
18
|
+
line?: string;
|
|
19
|
+
};
|
|
20
|
+
export type InterfaceForcePayload = {
|
|
21
|
+
isForce?: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type InterfaceViewPayload = InterfaceForcePayload & {
|
|
24
|
+
view?: string;
|
|
25
|
+
};
|
|
26
|
+
export type InterfaceTextChangedPayload = {
|
|
27
|
+
tokens?: TokenizedChar[];
|
|
28
|
+
wall?: WallElement[];
|
|
29
|
+
uid?: string;
|
|
30
|
+
tokensVisible?: number;
|
|
31
|
+
};
|
|
32
|
+
export type InterfaceSpeakerChangedPayload = {
|
|
33
|
+
speaker?: string;
|
|
34
|
+
meet?: number;
|
|
35
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Backdrop, PositionBox, useMemo } from "@vnejs/uis.react";
|
|
3
|
+
export const InterfaceBackdrop = ({ view = "", transition = 0, PARAMS }) => {
|
|
4
|
+
const propsByView = useMemo(() => PARAMS.INTERFACE.VIEW_PROPS[view]?.backdrop || {}, [view, PARAMS.INTERFACE.VIEW_PROPS]);
|
|
5
|
+
const propsBackdrop = useMemo(() => ({ ...propsByView.props, transition }), [propsByView, transition]);
|
|
6
|
+
const propsPosition = useMemo(() => ({ ...propsByView.flatPosition, transition }), [propsByView, transition]);
|
|
7
|
+
const styleFlatBackdrop = useMemo(() => ({ ...propsByView.flatStyle, width: "100%", height: "100%", transition: `${transition}ms` }), [propsByView, transition]);
|
|
8
|
+
return (_jsxs(_Fragment, { children: [_jsx(Backdrop, { ...propsBackdrop }), _jsx(PositionBox, { ...propsPosition, children: _jsx("div", { style: styleFlatBackdrop }) })] }));
|
|
9
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Flex, PositionBox, SmoothText, Text, useMemo } from "@vnejs/uis.react";
|
|
3
|
+
import { getVneLength } from "@vnejs/uis.utils";
|
|
4
|
+
import { useTokensHook } from "./tokens.hook.js";
|
|
5
|
+
export const InterfaceViewDialog = (props) => {
|
|
6
|
+
const { isViewActive = false, transition, tokensVisible = 0, tokens = [], speakerText, speakerName, speakerColor, opacity, color, uid = "", PARAMS } = props;
|
|
7
|
+
const propsByView = PARAMS.INTERFACE.VIEW_PROPS.adv;
|
|
8
|
+
const propsPosition = useMemo(() => ({ ...propsByView.position, opacity: isViewActive ? 1 : 0, transition }), [isViewActive, transition, propsByView.position]);
|
|
9
|
+
const speakerOpacity = speakerName ? 1 : 0;
|
|
10
|
+
const speakerTransition = speakerName ? transition : 0;
|
|
11
|
+
const backgroundSep = useMemo(() => `linear-gradient(to right, ${speakerColor} 0%, transparent 100%)`, [speakerColor]);
|
|
12
|
+
const styleSepBg = useMemo(() => ({ height: getVneLength(6), width: "calc(200% / 3)", background: backgroundSep }), [backgroundSep]);
|
|
13
|
+
const styleSepColor = useMemo(() => ({ opacity: speakerOpacity, transition: `${speakerTransition}ms` || "none" }), [speakerOpacity, speakerTransition]);
|
|
14
|
+
const styleSep = useMemo(() => ({ ...styleSepBg, ...styleSepColor }), [styleSepBg, styleSepColor]);
|
|
15
|
+
const { realTokens, realTokensVisible } = useTokensHook(isViewActive, tokens, tokensVisible, uid);
|
|
16
|
+
const propsSpeaker = useMemo(() => ({ ...propsByView.speaker, text: speakerText, color: speakerColor, opacity: speakerOpacity, transition: speakerTransition }), [speakerText, speakerColor, speakerOpacity, speakerTransition, propsByView.speaker]);
|
|
17
|
+
const propsText = useMemo(() => ({ ...propsByView.text, opacity, color, tokens: realTokens, tokensVisibleForce: realTokensVisible, transition }), [opacity, color, realTokens, realTokensVisible, transition, propsByView.text]);
|
|
18
|
+
return (_jsx(PositionBox, { ...propsPosition, children: _jsxs(Flex, { ...propsByView.flex, children: [_jsx(Text, { ...propsSpeaker }), _jsx("div", { style: styleSep }), _jsx(SmoothText, { ...propsText })] }) }));
|
|
19
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Flex, PositionBox, SmoothText, useMemo } from "@vnejs/uis.react";
|
|
3
|
+
import { useTokensHook } from "./tokens.hook.js";
|
|
4
|
+
export const InterfaceViewLine = (props) => {
|
|
5
|
+
const { isViewActive = false, transition = 0, tokensVisible = 0, tokens = [], opacity, color, uid = "", PARAMS } = props;
|
|
6
|
+
const propsByView = PARAMS.INTERFACE.VIEW_PROPS.line;
|
|
7
|
+
const { realTokens, realTokensVisible } = useTokensHook(isViewActive, tokens, tokensVisible, uid);
|
|
8
|
+
const propsTextTokens = useMemo(() => ({ tokens: realTokens, tokensVisibleForce: realTokensVisible }), [realTokens, realTokensVisible]);
|
|
9
|
+
const propsText = useMemo(() => ({ ...propsByView.text, opacity, color, transition, ...propsTextTokens }), [opacity, color, transition, propsTextTokens, propsByView.text]);
|
|
10
|
+
const propsPosition = useMemo(() => ({ ...propsByView.position, opacity: isViewActive ? 1 : 0, transition }), [isViewActive, transition, propsByView.position]);
|
|
11
|
+
return (_jsx(PositionBox, { ...propsPosition, children: _jsx(Flex, { ...propsByView.flex, children: _jsx(SmoothText, { ...propsText }) }) }));
|
|
12
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Flex, PositionBox, Scrollbar, SmoothText, Text, useMemo } from "@vnejs/uis.react";
|
|
3
|
+
import { useTokensHook } from "./tokens.hook.js";
|
|
4
|
+
const renderOneText = (wallElement) => (_jsxs("div", { children: [wallElement.speakerName && (_jsx(Text, { ...wallElement.propsByView.text, isInlineBlock: true, color: wallElement.speakerColor, text: `${wallElement.speakerName}:`, marginRight: 12 })), _jsx(SmoothText, { ...wallElement.propsByView.text, isNoScrollBar: true, color: wallElement.color, opacity: wallElement.opacity, transition: wallElement.transition, tokens: wallElement.tokens, tokensVisibleForce: wallElement.tokensVisible })] }, wallElement.uid));
|
|
5
|
+
const mapWall = ({ uid = "", tokens = [], speaker = "", meet = 0, transition = 0, props, }) => {
|
|
6
|
+
const propsByView = props.PARAMS.INTERFACE.VIEW_PROPS.wall;
|
|
7
|
+
const speakersInfo = props.PARAMS.TEXT.SPEAKERS_INFO;
|
|
8
|
+
const speakerInfo = speakersInfo[speaker] ?? speakersInfo[props.PARAMS.TEXT.DEFAULT_SPEAKER_NAME];
|
|
9
|
+
const { color, opacity = 1, speakerColor = "white" } = speakerInfo;
|
|
10
|
+
const locs = props.locs ?? {};
|
|
11
|
+
const speakerName = locs[`speaker.${speaker}.${meet ?? 0}`];
|
|
12
|
+
return { speakerName, speakerColor, uid, color, opacity, tokens, tokensVisible: tokens.length, transition, propsByView };
|
|
13
|
+
};
|
|
14
|
+
export const InterfaceViewWall = (props) => {
|
|
15
|
+
const { isViewActive = false, transition = 0, tokensVisible = 0, tokens = [], wall = [], uid = "", speakerName, speakerColor, color, opacity, PARAMS, } = props;
|
|
16
|
+
const propsByView = PARAMS.INTERFACE.VIEW_PROPS.wall;
|
|
17
|
+
const propsPosition = useMemo(() => ({ ...propsByView.position, opacity: isViewActive ? 1 : 0, transition }), [isViewActive, transition, propsByView.position]);
|
|
18
|
+
const wallWithProps = useMemo(() => wall.map((item) => ({ ...item, transition, props })), [wall, transition, props]);
|
|
19
|
+
const { realTokens, realTokensVisible } = useTokensHook(isViewActive, tokens, tokensVisible, uid);
|
|
20
|
+
const wallTexts = useMemo(() => wallWithProps.map(mapWall), [wallWithProps]);
|
|
21
|
+
const curText = useMemo(() => ({ speakerName, speakerColor, uid, color, opacity, tokens: realTokens, tokensVisible: realTokensVisible, transition, propsByView }), [speakerName, speakerColor, uid, color, opacity, realTokens, realTokensVisible, transition, propsByView]);
|
|
22
|
+
const texts = useMemo(() => [...wallTexts, curText], [wallTexts, curText]);
|
|
23
|
+
return (_jsx(PositionBox, { ...propsPosition, children: _jsx(Scrollbar, { ...propsByView.scrollBar, children: _jsx(Flex, { ...propsByView.flex, children: texts.map(renderOneText) }) }) }));
|
|
24
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { TokenizedChar } from "@vnejs/plugins.text.contract";
|
|
2
|
+
export declare const useTokensHook: (isShow: boolean, tokens: TokenizedChar[], tokensVisible: number, uid: string) => {
|
|
3
|
+
isShowTokens: boolean;
|
|
4
|
+
realTokensVisible: number;
|
|
5
|
+
realTokens: TokenizedChar[];
|
|
6
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { flushSync, useEffect, useMemo, useState } from "@vnejs/uis.react";
|
|
2
|
+
export const useTokensHook = (isShow, tokens, tokensVisible, uid) => {
|
|
3
|
+
const [savedUid, setSavedUid] = useState("");
|
|
4
|
+
const [tokensSync, setTokensSync] = useState([]);
|
|
5
|
+
const [tokensWrong, setTokensWrong] = useState([]);
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
if (isShow)
|
|
8
|
+
setTokensWrong(tokens);
|
|
9
|
+
}, [isShow, tokens]);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
setTimeout(() => {
|
|
12
|
+
if (savedUid === uid) {
|
|
13
|
+
if (!isShow)
|
|
14
|
+
setTokensWrong(tokens);
|
|
15
|
+
setTokensSync(tokens);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
flushSync(() => {
|
|
19
|
+
setSavedUid(uid);
|
|
20
|
+
if (!isShow)
|
|
21
|
+
setTokensWrong(tokens);
|
|
22
|
+
setTokensSync(tokens);
|
|
23
|
+
});
|
|
24
|
+
}, 0);
|
|
25
|
+
}, [tokens, savedUid, uid, isShow]);
|
|
26
|
+
const isShowTokens = useMemo(() => tokensSync !== tokensWrong, [tokensSync, tokensWrong]);
|
|
27
|
+
const realTokensVisible = useMemo(() => (isShowTokens ? tokensVisible : 0), [isShowTokens, tokensVisible]);
|
|
28
|
+
const realTokens = useMemo(() => (isShowTokens ? tokensSync : []), [isShowTokens, tokensSync]);
|
|
29
|
+
return { isShowTokens, realTokensVisible, realTokens };
|
|
30
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Screen, createRenderFunc, useCallback, useIsForceHook, useMemo, useStoreState } from "@vnejs/uis.react";
|
|
3
|
+
import { InterfaceBackdrop, InterfaceViewDialog, InterfaceViewLine, InterfaceViewWall } from "./components/index.js";
|
|
4
|
+
const Interface = (props) => {
|
|
5
|
+
const { store, onMount, emit, EVENTS, PARAMS } = props;
|
|
6
|
+
const state = useStoreState(store, onMount);
|
|
7
|
+
const { isShow = false, isVisible = false, isForce = false, tokensVisible = 0, view = "", locs = {} } = state;
|
|
8
|
+
const { speaker = "", meet = 0, tokens = [], wall = [], postfix = "", prefix = "", uid = "" } = state;
|
|
9
|
+
const onClick = useCallback(() => emit(EVENTS.INTERFACE.INTERACT), [emit, EVENTS.INTERFACE.INTERACT]);
|
|
10
|
+
const isRealForce = useIsForceHook(isForce);
|
|
11
|
+
const speakerName = locs[`speaker.${speaker}.${meet ?? 0}`];
|
|
12
|
+
const speakerText = speakerName ? `${`${locs[`prefix.${prefix}`] ?? ""} `}${speakerName}${` ${locs[`postfix.${postfix}`] ?? ""}`}` : ".";
|
|
13
|
+
const transition = isRealForce ? 0 : PARAMS.INTERFACE.TRANSITION;
|
|
14
|
+
const speakersInfo = PARAMS.TEXT.SPEAKERS_INFO;
|
|
15
|
+
const speakerInfo = speakersInfo[speaker] ?? speakersInfo[PARAMS.TEXT.DEFAULT_SPEAKER_NAME];
|
|
16
|
+
const { color, opacity = 1, speakerColor = "white" } = speakerInfo;
|
|
17
|
+
const propsCommon = useMemo(() => ({ isForce: isRealForce, transition, tokensVisible, tokens, wall, uid, locs }), [isRealForce, transition, tokensVisible, tokens, wall, uid, locs]);
|
|
18
|
+
const propsSpeaker = useMemo(() => ({ speakerText, speakerName, speakerColor }), [speakerText, speakerName, speakerColor]);
|
|
19
|
+
const propsText = useMemo(() => ({ opacity, color }), [opacity, color]);
|
|
20
|
+
const propsView = useMemo(() => ({ ...propsCommon, ...propsSpeaker, ...propsText }), [propsCommon, propsSpeaker, propsText]);
|
|
21
|
+
const propsBackdrop = useMemo(() => ({ view, transition, ...props }), [view, transition, props]);
|
|
22
|
+
const propsDialog = useMemo(() => ({ isViewActive: view === "adv", ...propsView, ...props }), [view, propsView, props]);
|
|
23
|
+
const propsLine = useMemo(() => ({ isViewActive: view === "line", ...propsView, ...props }), [view, propsView, props]);
|
|
24
|
+
const propsWall = useMemo(() => ({ isViewActive: view === "wall", ...propsView, ...props }), [view, propsView, props]);
|
|
25
|
+
return (_jsxs(Screen, { isShow: isShow, isForce: isRealForce, isHidden: !isVisible, isDisableAutoread: false, isAllowAutoread: Boolean(isShow && isVisible), isIgnoreOnScreenshot: false, transition: transition, zIndex: PARAMS.INTERFACE.ZINDEX, onClick: onClick, children: [_jsx(InterfaceBackdrop, { ...propsBackdrop }), _jsx(InterfaceViewDialog, { ...propsDialog }), _jsx(InterfaceViewLine, { ...propsLine }), _jsx(InterfaceViewWall, { ...propsWall })] }));
|
|
26
|
+
};
|
|
27
|
+
export const render = createRenderFunc(Interface);
|
package/package.json
CHANGED
|
@@ -1,17 +1,49 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/plugins.views.scenario.interface",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.1.15",
|
|
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.scenario.interface.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.core.scenario.contract": "~0.0.1",
|
|
40
|
+
"@vnejs/plugins.core.state.contract": "~0.0.1",
|
|
41
|
+
"@vnejs/plugins.text.contract": "~0.0.1",
|
|
42
|
+
"@vnejs/shared": "~0.0.9",
|
|
43
|
+
"@vnejs/uis.react": "~0.1.0",
|
|
44
|
+
"@vnejs/uis.utils": "~0.1.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@vnejs/configs.ts-common": "~0.0.1"
|
|
48
|
+
}
|
|
17
49
|
}
|
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.scenario.interface.contract";
|
|
3
|
+
|
|
4
|
+
import { InterfaceController } from "./modules/controller.js";
|
|
5
|
+
import { Interface } from "./modules/interface.js";
|
|
6
|
+
import { InterfaceView } from "./modules/view.js";
|
|
7
|
+
|
|
8
|
+
regPlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS, params: PARAMS }, [InterfaceController, Interface, InterfaceView]);
|
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import { ModuleController } from "@vnejs/module.components";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import type { ControlsPopPayload, ControlsPushPayload } from "@vnejs/module.components";
|
|
3
|
+
import { CONSTANTS as ControlsConstants } from "@vnejs/plugins.controls.contract";
|
|
4
|
+
|
|
5
|
+
import type { InterfacePluginConstants, InterfacePluginEvents, InterfacePluginParams, InterfacePluginSettings } from "../types.js";
|
|
6
|
+
import type { InterfaceForcePayload, InterfacePluginState } from "../utils/interface.js";
|
|
7
|
+
|
|
8
|
+
export class InterfaceController extends ModuleController<
|
|
9
|
+
InterfacePluginEvents,
|
|
10
|
+
InterfacePluginConstants,
|
|
11
|
+
InterfacePluginSettings,
|
|
12
|
+
InterfacePluginParams,
|
|
13
|
+
InterfacePluginState
|
|
14
|
+
> {
|
|
4
15
|
name = "interface.controller";
|
|
5
16
|
|
|
6
|
-
|
|
17
|
+
isStateChangeInProcess = false;
|
|
7
18
|
|
|
8
19
|
updateEvent = this.EVENTS.INTERFACE.VIEW_UPDATE;
|
|
9
20
|
controls = {
|
|
10
|
-
[
|
|
11
|
-
[
|
|
21
|
+
[ControlsConstants.BUTTONS.INTERACT]: () => void this.emit(this.EVENTS.INTERFACE.INTERACT),
|
|
22
|
+
[ControlsConstants.BUTTONS.ACCEPT]: () => void this.emit(this.EVENTS.INTERFACE.INTERACT),
|
|
12
23
|
};
|
|
13
24
|
controlsUnvisible = {};
|
|
14
25
|
controlsIndex = this.PARAMS.INTERFACE.ZINDEX;
|
|
@@ -27,13 +38,13 @@ export class InterfaceController extends ModuleController {
|
|
|
27
38
|
|
|
28
39
|
init = () => this.emit(this.EVENTS.INTERFACE.VIEW, { view: this.PARAMS.INTERFACE.DEFAULT_VIEW, isForce: true });
|
|
29
40
|
|
|
30
|
-
onShowChanged = ({ isForce = false } = {}) => {
|
|
41
|
+
onShowChanged = ({ isForce = false }: InterfaceForcePayload = {}) => {
|
|
31
42
|
const { isShow = false } = this.globalState.interface;
|
|
32
43
|
const event = isShow ? this.EVENTS.INTERFACE.VIEW_SHOW : this.EVENTS.INTERFACE.VIEW_HIDE;
|
|
33
44
|
|
|
34
45
|
if (this.state.isShow !== isShow) return this.emit(event, { isForce });
|
|
35
46
|
};
|
|
36
|
-
onViewChanged = ({ isForce = false } = {}) => {
|
|
47
|
+
onViewChanged = ({ isForce = false }: InterfaceForcePayload = {}) => {
|
|
37
48
|
const { view = "" } = this.globalState.interface;
|
|
38
49
|
|
|
39
50
|
if (this.state.view !== view) return this.updateStateAndView({ view }, isForce, !isForce);
|
|
@@ -52,12 +63,16 @@ export class InterfaceController extends ModuleController {
|
|
|
52
63
|
|
|
53
64
|
return this.updateStateAndViewFast({ speaker, meet });
|
|
54
65
|
};
|
|
55
|
-
onVisibleChanged = async ({ isForce = false } = {}) => {
|
|
66
|
+
onVisibleChanged = async ({ isForce = false }: InterfaceForcePayload = {}) => {
|
|
56
67
|
const { isVisible = false } = this.globalState.interface;
|
|
57
68
|
|
|
58
69
|
if (this.state.isVisible === isVisible) return;
|
|
59
70
|
|
|
60
|
-
const args = {
|
|
71
|
+
const args = {
|
|
72
|
+
key: `${this.name}-unvisible`,
|
|
73
|
+
controls: this.controlsUnvisible,
|
|
74
|
+
index: this.controlsIndex + 500,
|
|
75
|
+
} satisfies ControlsPushPayload & ControlsPopPayload;
|
|
61
76
|
await this.emit(isVisible ? this.EVENTS.CONTROLS.POP : this.EVENTS.CONTROLS.PUSH, args);
|
|
62
77
|
await this.updateStateAndView({ isVisible }, isForce, !isForce);
|
|
63
78
|
};
|
|
@@ -70,5 +85,16 @@ export class InterfaceController extends ModuleController {
|
|
|
70
85
|
this.isStateChangeInProcess = false;
|
|
71
86
|
};
|
|
72
87
|
|
|
73
|
-
getDefaultState = () => ({
|
|
88
|
+
getDefaultState = (): InterfacePluginState => ({
|
|
89
|
+
tokens: [],
|
|
90
|
+
wall: [],
|
|
91
|
+
uid: "",
|
|
92
|
+
tokensVisible: 0,
|
|
93
|
+
speaker: "",
|
|
94
|
+
meet: 0,
|
|
95
|
+
isShow: false,
|
|
96
|
+
isVisible: false,
|
|
97
|
+
isForce: false,
|
|
98
|
+
view: "",
|
|
99
|
+
});
|
|
74
100
|
}
|