@vnejs/module.controller.interact 0.2.1 → 0.2.2

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 CHANGED
@@ -11,7 +11,6 @@ export declare abstract class ModuleControllerInteract<TEvents extends ModuleCon
11
11
  abstract_any: () => undefined;
12
12
  };
13
13
  subscribe: () => void;
14
- getDefaultState: () => TState;
15
14
  abstract onInteract: () => void | Promise<unknown>;
16
15
  onShowControls: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:push">> | undefined;
17
16
  onShowAfter: () => Promise<import("@vnejs/shared").EmitResults<"vne:interact:push">> | undefined;
package/dist/index.js CHANGED
@@ -13,29 +13,18 @@ export class ModuleControllerInteract extends ModuleCore {
13
13
  this.on(this.EVENT_HIDE, this.onHideBefore, { priority: HIDE.BEFORE });
14
14
  this.on(this.EVENT_HIDE, this.onHideControls, { priority: HIDE.CONTROLS });
15
15
  };
16
- getDefaultState = () => ({ isShow: false });
17
- onShowControls = () => {
18
- this.updateState({ isShow: true });
19
- return this.emit(this.EVENTS.CONTROLS.PUSH, {
20
- key: this.name,
21
- controls: this.CONTROLS,
22
- index: this.CONTROLS_ZINDEX + 1,
23
- checkNext: this.CONTROLS_CHECK_NEXT,
24
- });
25
- };
16
+ onShowControls = () => this.emit(this.EVENTS.CONTROLS.PUSH, {
17
+ key: this.name,
18
+ controls: this.CONTROLS,
19
+ index: this.CONTROLS_ZINDEX + 1,
20
+ checkNext: this.CONTROLS_CHECK_NEXT,
21
+ });
26
22
  onShowAfter = () => this.emit(this.EVENTS.INTERACT.PUSH, {
27
23
  key: this.name,
28
24
  handler: () => this.onInteract(),
29
25
  });
30
- onHideBefore = () => {
31
- if (!this.state.isShow)
32
- return;
33
- return this.emit(this.EVENTS.INTERACT.POP, { key: this.name });
34
- };
26
+ onHideBefore = () => this.emit(this.EVENTS.INTERACT.POP, { key: this.name });
35
27
  onHideControls = () => {
36
- if (!this.state.isShow)
37
- return;
38
- this.updateState({ isShow: false });
39
28
  this.setDefaultState();
40
29
  return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name });
41
30
  };
package/dist/types.d.ts CHANGED
@@ -4,6 +4,4 @@ export type ModuleControllerInteractEvents = ModuleCoreEvents & Record<ControlsP
4
4
  export type ModuleControllerInteractConstants = ModuleCoreConstants & Record<ControlsPluginName, ControlsConstants>;
5
5
  export type ModuleControllerInteractSettings = ModuleCoreSettings;
6
6
  export type ModuleControllerInteractParams = ModuleCoreParams;
7
- export type ModuleControllerInteractState = {
8
- isShow: boolean;
9
- };
7
+ export type ModuleControllerInteractState = object;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/module.controller.interact",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -48,20 +48,15 @@ export abstract class ModuleControllerInteract<
48
48
  this.on(this.EVENT_HIDE, this.onHideControls, { priority: HIDE.CONTROLS });
49
49
  };
50
50
 
51
- getDefaultState = (): TState => ({ isShow: false }) as TState;
52
-
53
51
  abstract onInteract: () => void | Promise<unknown>;
54
52
 
55
- onShowControls = () => {
56
- this.updateState({ isShow: true } as Partial<TState>);
57
-
58
- return this.emit(this.EVENTS.CONTROLS.PUSH, {
53
+ onShowControls = () =>
54
+ this.emit(this.EVENTS.CONTROLS.PUSH, {
59
55
  key: this.name,
60
56
  controls: this.CONTROLS,
61
57
  index: this.CONTROLS_ZINDEX + 1,
62
58
  checkNext: this.CONTROLS_CHECK_NEXT,
63
59
  } satisfies ControlsPushPayload);
64
- };
65
60
 
66
61
  onShowAfter = () =>
67
62
  this.emit(this.EVENTS.INTERACT.PUSH, {
@@ -69,16 +64,9 @@ export abstract class ModuleControllerInteract<
69
64
  handler: () => this.onInteract(),
70
65
  } satisfies InteractPushPayload);
71
66
 
72
- onHideBefore = () => {
73
- if (!this.state.isShow) return;
74
-
75
- return this.emit(this.EVENTS.INTERACT.POP, { key: this.name } satisfies InteractPopPayload);
76
- };
67
+ onHideBefore = () => this.emit(this.EVENTS.INTERACT.POP, { key: this.name } satisfies InteractPopPayload);
77
68
 
78
69
  onHideControls = () => {
79
- if (!this.state.isShow) return;
80
-
81
- this.updateState({ isShow: false } as Partial<TState>);
82
70
  this.setDefaultState();
83
71
 
84
72
  return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name } satisfies ControlsPopPayload);
package/src/types.ts CHANGED
@@ -9,6 +9,4 @@ export type ModuleControllerInteractSettings = ModuleCoreSettings;
9
9
 
10
10
  export type ModuleControllerInteractParams = ModuleCoreParams;
11
11
 
12
- export type ModuleControllerInteractState = {
13
- isShow: boolean;
14
- };
12
+ export type ModuleControllerInteractState = object;