@vnejs/plugins.views.scenario.interface 0.2.1 → 0.2.3

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.
@@ -3,14 +3,14 @@ import type { InterfacePluginConstants, InterfacePluginEvents, InterfacePluginPa
3
3
  import type { InterfaceForcePayload, InterfacePluginState, InterfaceSpeakerChangedPayload, InterfaceTextChangedPayload, InterfaceWallChangedPayload } from "../utils/interface.js";
4
4
  export declare class InterfaceController extends ModuleController<InterfacePluginEvents, InterfacePluginConstants, InterfacePluginSettings, InterfacePluginParams, InterfacePluginState> {
5
5
  name: string;
6
- isStateChangeInProcess: boolean;
7
- updateEvent: "vne:interface:view_update";
8
- controls: {
6
+ EVENT_UPDATE_VIEW: "vne:interface:view_update";
7
+ CONTROLS: {
9
8
  abstract_interact: () => undefined;
10
9
  abstract_accept: () => undefined;
11
10
  };
12
- controlsUnvisible: {};
13
- controlsIndex: number;
11
+ CONTROLS_UNVISIBLE: {};
12
+ CONTROLS_INDEX: number;
13
+ isStateChangeInProcess: boolean;
14
14
  subscribe: () => void;
15
15
  init: () => Promise<unknown[]> | undefined;
16
16
  onShowChanged: ({ isForce }?: InterfaceForcePayload) => Promise<unknown[]> | undefined;
@@ -3,14 +3,14 @@ import { CONSTANTS as ControlsConstants } from "@vnejs/contracts.controls";
3
3
  import { getTextSpeakerInfo } from "@vnejs/contracts.text";
4
4
  export class InterfaceController extends ModuleController {
5
5
  name = "interface.controller";
6
- isStateChangeInProcess = false;
7
- updateEvent = this.EVENTS.INTERFACE.VIEW_UPDATE;
8
- controls = {
6
+ EVENT_UPDATE_VIEW = this.EVENTS.INTERFACE.VIEW_UPDATE;
7
+ CONTROLS = {
9
8
  [ControlsConstants.BUTTONS.INTERACT]: () => void this.emit(this.EVENTS.INTERFACE.INTERACT),
10
9
  [ControlsConstants.BUTTONS.ACCEPT]: () => void this.emit(this.EVENTS.INTERFACE.INTERACT),
11
10
  };
12
- controlsUnvisible = {};
13
- controlsIndex = this.PARAMS.INTERFACE.ZINDEX;
11
+ CONTROLS_UNVISIBLE = {};
12
+ CONTROLS_INDEX = this.PARAMS.INTERFACE.ZINDEX;
13
+ isStateChangeInProcess = false;
14
14
  subscribe = () => {
15
15
  this.on(this.EVENTS.INTERFACE.VIEW_SHOW, this.onShow);
16
16
  this.on(this.EVENTS.INTERFACE.VIEW_HIDE, this.onHide);
@@ -56,7 +56,7 @@ export class InterfaceController extends ModuleController {
56
56
  const { isVisible = false } = this.globalState.interface;
57
57
  if (this.state.isVisible === isVisible)
58
58
  return;
59
- const args = { key: `${this.name}-unvisible`, controls: this.controlsUnvisible, index: this.controlsIndex + 500 };
59
+ const args = { key: `${this.name}-unvisible`, controls: this.CONTROLS_UNVISIBLE, index: this.CONTROLS_INDEX + 500 };
60
60
  await this.emit(isVisible ? this.EVENTS.CONTROLS.POP : this.EVENTS.CONTROLS.PUSH, args);
61
61
  await this.updateStateAndView({ isVisible }, isForce, !isForce);
62
62
  };
@@ -3,9 +3,8 @@ import type { InterfacePluginConstants, InterfacePluginEvents, InterfacePluginPa
3
3
  import type { InterfacePluginState } from "../utils/interface.js";
4
4
  export declare class InterfaceView extends ModuleView<InterfacePluginEvents, InterfacePluginConstants, InterfacePluginSettings, InterfacePluginParams, InterfacePluginState> {
5
5
  name: string;
6
- locLabel: string;
7
- animationTime: number;
8
- updateEvent: "vne:interface:view_update";
6
+ EVENT_UPDATE_VIEW: "vne:interface:view_update";
7
+ LOC_LABEL: string;
8
+ TRANSITION: number;
9
9
  renderFunc: import("@vnejs/module.components").ViewRenderFunc<InterfacePluginState>;
10
- updateHandler: (state?: InterfacePluginState | undefined) => Promise<void>;
11
10
  }
@@ -2,9 +2,8 @@ import { ModuleView } from "@vnejs/module.components";
2
2
  import { render } from "../view/index.js";
3
3
  export class InterfaceView extends ModuleView {
4
4
  name = "interface.view";
5
- locLabel = this.PARAMS.INTERFACE.LOC_LABEL;
6
- animationTime = this.PARAMS.INTERFACE.TRANSITION;
7
- updateEvent = this.EVENTS.INTERFACE.VIEW_UPDATE;
5
+ EVENT_UPDATE_VIEW = this.EVENTS.INTERFACE.VIEW_UPDATE;
6
+ LOC_LABEL = this.PARAMS.INTERFACE.LOC_LABEL;
7
+ TRANSITION = this.PARAMS.INTERFACE.TRANSITION;
8
8
  renderFunc = render;
9
- updateHandler = this.onUpdateStoreComponent;
10
9
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.views.scenario.interface",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,15 +21,16 @@ export class InterfaceController extends ModuleController<
21
21
  > {
22
22
  name = "interface.controller";
23
23
 
24
- isStateChangeInProcess = false;
24
+ EVENT_UPDATE_VIEW = this.EVENTS.INTERFACE.VIEW_UPDATE;
25
25
 
26
- updateEvent = this.EVENTS.INTERFACE.VIEW_UPDATE;
27
- controls = {
26
+ CONTROLS = {
28
27
  [ControlsConstants.BUTTONS.INTERACT]: () => void this.emit(this.EVENTS.INTERFACE.INTERACT),
29
28
  [ControlsConstants.BUTTONS.ACCEPT]: () => void this.emit(this.EVENTS.INTERFACE.INTERACT),
30
29
  };
31
- controlsUnvisible = {};
32
- controlsIndex = this.PARAMS.INTERFACE.ZINDEX;
30
+ CONTROLS_UNVISIBLE = {};
31
+ CONTROLS_INDEX = this.PARAMS.INTERFACE.ZINDEX;
32
+
33
+ isStateChangeInProcess = false;
33
34
 
34
35
  subscribe = () => {
35
36
  this.on(this.EVENTS.INTERFACE.VIEW_SHOW, this.onShow);
@@ -81,7 +82,7 @@ export class InterfaceController extends ModuleController<
81
82
 
82
83
  if (this.state.isVisible === isVisible) return;
83
84
 
84
- const args = { key: `${this.name}-unvisible`, controls: this.controlsUnvisible, index: this.controlsIndex + 500 } satisfies ControlsPushPayload &
85
+ const args = { key: `${this.name}-unvisible`, controls: this.CONTROLS_UNVISIBLE, index: this.CONTROLS_INDEX + 500 } satisfies ControlsPushPayload &
85
86
  ControlsPopPayload;
86
87
  await this.emit(isVisible ? this.EVENTS.CONTROLS.POP : this.EVENTS.CONTROLS.PUSH, args);
87
88
  await this.updateStateAndView({ isVisible }, isForce, !isForce);
@@ -13,10 +13,11 @@ export class InterfaceView extends ModuleView<
13
13
  > {
14
14
  name = "interface.view";
15
15
 
16
- locLabel = this.PARAMS.INTERFACE.LOC_LABEL;
17
- animationTime = this.PARAMS.INTERFACE.TRANSITION;
18
- updateEvent = this.EVENTS.INTERFACE.VIEW_UPDATE;
16
+ EVENT_UPDATE_VIEW = this.EVENTS.INTERFACE.VIEW_UPDATE;
17
+
18
+ LOC_LABEL = this.PARAMS.INTERFACE.LOC_LABEL;
19
+
20
+ TRANSITION = this.PARAMS.INTERFACE.TRANSITION;
19
21
 
20
22
  renderFunc = render;
21
- updateHandler = this.onUpdateStoreComponent;
22
23
  }
@@ -3,13 +3,7 @@ import { SUBSCRIBE_EVENTS as SCENARIO_EVENTS } from "@vnejs/contracts.core.scena
3
3
  import { SUBSCRIBE_EVENTS as TEXT_EVENTS, PLUGIN_NAME as TEXT } from "@vnejs/contracts.text";
4
4
  import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/contracts.views.scenario.interface";
5
5
  import { SourcesSet } from "@vnejs/sources-set";
6
- import {
7
- createTestModule as baseCreateTestModule,
8
- registerCoreVne,
9
- registerVnePlugin,
10
- stubEvent,
11
- stubSilentEvent,
12
- } from "@vnejs/test-utils";
6
+ import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin, stubEvent, stubSilentEvent } from "@vnejs/test-utils";
13
7
 
14
8
  export const registerInterfacePluginVne = () => {
15
9
  registerCoreVne();
@@ -9,7 +9,10 @@ export const InterfaceViewDialog = (props: InterfaceViewProps) => {
9
9
 
10
10
  const propsByView = PARAMS.INTERFACE.VIEW_PROPS.adv;
11
11
 
12
- const propsPosition = useMemo(() => ({ ...propsByView.position, opacity: isViewActive ? 1 : 0, transition }), [isViewActive, transition, propsByView.position]);
12
+ const propsPosition = useMemo(
13
+ () => ({ ...propsByView.position, opacity: isViewActive ? 1 : 0, transition }),
14
+ [isViewActive, transition, propsByView.position],
15
+ );
13
16
 
14
17
  const speakerOpacity = speakerName ? 1 : 0;
15
18
  const speakerTransition = speakerName ? transition : 0;
@@ -15,7 +15,10 @@ export const InterfaceViewLine = (props: InterfaceViewProps) => {
15
15
  () => ({ ...propsByView.text, opacity, color, transition, ...propsTextTokens }),
16
16
  [opacity, color, transition, propsTextTokens, propsByView.text],
17
17
  );
18
- const propsPosition = useMemo(() => ({ ...propsByView.position, opacity: isViewActive ? 1 : 0, transition }), [isViewActive, transition, propsByView.position]);
18
+ const propsPosition = useMemo(
19
+ () => ({ ...propsByView.position, opacity: isViewActive ? 1 : 0, transition }),
20
+ [isViewActive, transition, propsByView.position],
21
+ );
19
22
 
20
23
  return (
21
24
  <PositionBox {...propsPosition}>
package/tsconfig.json CHANGED
@@ -5,13 +5,6 @@
5
5
  "outDir": "dist",
6
6
  "jsx": "react-jsx"
7
7
  },
8
- "include": [
9
- "src/**/*.ts",
10
- "src/**/*.tsx"
11
- ],
12
- "exclude": [
13
- "dist",
14
- "node_modules",
15
- "src/tests"
16
- ]
8
+ "include": ["src/**/*.ts", "src/**/*.tsx"],
9
+ "exclude": ["dist", "node_modules", "src/tests"]
17
10
  }