@vnejs/module.controller.interact 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.
- package/dist/index.d.ts +3 -4
- package/dist/index.js +12 -23
- package/dist/types.d.ts +1 -3
- package/package.json +1 -1
- package/src/index.ts +9 -21
- package/src/types.ts +1 -3
package/dist/index.d.ts
CHANGED
|
@@ -7,14 +7,13 @@ export declare abstract class ModuleControllerInteract<TEvents extends ModuleCon
|
|
|
7
7
|
abstract EVENT_HIDE: string;
|
|
8
8
|
abstract CONTROLS_ZINDEX: number;
|
|
9
9
|
CONTROLS_CHECK_NEXT: boolean;
|
|
10
|
-
get CONTROLS(): {
|
|
11
|
-
abstract_any: () => undefined;
|
|
12
|
-
};
|
|
13
10
|
subscribe: () => void;
|
|
14
|
-
getDefaultState: () => TState;
|
|
15
11
|
abstract onInteract: () => void | Promise<unknown>;
|
|
16
12
|
onShowControls: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:push">> | undefined;
|
|
17
13
|
onShowAfter: () => Promise<import("@vnejs/shared").EmitResults<"vne:interact:push">> | undefined;
|
|
18
14
|
onHideBefore: () => Promise<import("@vnejs/shared").EmitResults<"vne:interact:pop">> | undefined;
|
|
19
15
|
onHideControls: () => Promise<import("@vnejs/shared").EmitResults<"vne:controls:pop">> | undefined;
|
|
16
|
+
get CONTROLS(): {
|
|
17
|
+
abstract_any: () => undefined;
|
|
18
|
+
};
|
|
20
19
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
import { ModuleCore } from "@vnejs/module.core";
|
|
2
2
|
export class ModuleControllerInteract extends ModuleCore {
|
|
3
3
|
CONTROLS_CHECK_NEXT = true;
|
|
4
|
-
get CONTROLS() {
|
|
5
|
-
return {
|
|
6
|
-
[this.CONST.CONTROLS.BUTTONS.ANY]: () => void this.emit(this.EVENTS.INTERACT.EMIT),
|
|
7
|
-
};
|
|
8
|
-
}
|
|
9
4
|
subscribe = () => {
|
|
10
5
|
const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
|
|
11
6
|
this.on(this.EVENT_SHOW, this.onShowControls, { priority: SHOW.CONTROLS });
|
|
@@ -13,30 +8,24 @@ export class ModuleControllerInteract extends ModuleCore {
|
|
|
13
8
|
this.on(this.EVENT_HIDE, this.onHideBefore, { priority: HIDE.BEFORE });
|
|
14
9
|
this.on(this.EVENT_HIDE, this.onHideControls, { priority: HIDE.CONTROLS });
|
|
15
10
|
};
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
this.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
index: this.CONTROLS_ZINDEX + 1,
|
|
23
|
-
checkNext: this.CONTROLS_CHECK_NEXT,
|
|
24
|
-
});
|
|
25
|
-
};
|
|
11
|
+
onShowControls = () => this.emit(this.EVENTS.CONTROLS.PUSH, {
|
|
12
|
+
key: this.name,
|
|
13
|
+
controls: this.CONTROLS,
|
|
14
|
+
index: this.CONTROLS_ZINDEX + 1,
|
|
15
|
+
checkNext: this.CONTROLS_CHECK_NEXT,
|
|
16
|
+
});
|
|
26
17
|
onShowAfter = () => this.emit(this.EVENTS.INTERACT.PUSH, {
|
|
27
18
|
key: this.name,
|
|
28
19
|
handler: () => this.onInteract(),
|
|
29
20
|
});
|
|
30
|
-
onHideBefore = () => {
|
|
31
|
-
if (!this.state.isShow)
|
|
32
|
-
return;
|
|
33
|
-
return this.emit(this.EVENTS.INTERACT.POP, { key: this.name });
|
|
34
|
-
};
|
|
21
|
+
onHideBefore = () => this.emit(this.EVENTS.INTERACT.POP, { key: this.name });
|
|
35
22
|
onHideControls = () => {
|
|
36
|
-
if (!this.state.isShow)
|
|
37
|
-
return;
|
|
38
|
-
this.updateState({ isShow: false });
|
|
39
23
|
this.setDefaultState();
|
|
40
24
|
return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name });
|
|
41
25
|
};
|
|
26
|
+
get CONTROLS() {
|
|
27
|
+
return {
|
|
28
|
+
[this.CONST.CONTROLS.BUTTONS.ANY]: () => void this.emit(this.EVENTS.INTERACT.EMIT),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
42
31
|
}
|
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
package/src/index.ts
CHANGED
|
@@ -33,12 +33,6 @@ export abstract class ModuleControllerInteract<
|
|
|
33
33
|
abstract CONTROLS_ZINDEX: number;
|
|
34
34
|
CONTROLS_CHECK_NEXT = true;
|
|
35
35
|
|
|
36
|
-
get CONTROLS() {
|
|
37
|
-
return {
|
|
38
|
-
[this.CONST.CONTROLS.BUTTONS.ANY]: () => void this.emit(this.EVENTS.INTERACT.EMIT),
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
36
|
subscribe = () => {
|
|
43
37
|
const { SHOW, HIDE } = this.CONST.COMPONENTS.LIFECYCLE_PRIORITY;
|
|
44
38
|
|
|
@@ -48,20 +42,15 @@ export abstract class ModuleControllerInteract<
|
|
|
48
42
|
this.on(this.EVENT_HIDE, this.onHideControls, { priority: HIDE.CONTROLS });
|
|
49
43
|
};
|
|
50
44
|
|
|
51
|
-
getDefaultState = (): TState => ({ isShow: false }) as TState;
|
|
52
|
-
|
|
53
45
|
abstract onInteract: () => void | Promise<unknown>;
|
|
54
46
|
|
|
55
|
-
onShowControls = () =>
|
|
56
|
-
this.
|
|
57
|
-
|
|
58
|
-
return this.emit(this.EVENTS.CONTROLS.PUSH, {
|
|
47
|
+
onShowControls = () =>
|
|
48
|
+
this.emit(this.EVENTS.CONTROLS.PUSH, {
|
|
59
49
|
key: this.name,
|
|
60
50
|
controls: this.CONTROLS,
|
|
61
51
|
index: this.CONTROLS_ZINDEX + 1,
|
|
62
52
|
checkNext: this.CONTROLS_CHECK_NEXT,
|
|
63
53
|
} satisfies ControlsPushPayload);
|
|
64
|
-
};
|
|
65
54
|
|
|
66
55
|
onShowAfter = () =>
|
|
67
56
|
this.emit(this.EVENTS.INTERACT.PUSH, {
|
|
@@ -69,18 +58,17 @@ export abstract class ModuleControllerInteract<
|
|
|
69
58
|
handler: () => this.onInteract(),
|
|
70
59
|
} satisfies InteractPushPayload);
|
|
71
60
|
|
|
72
|
-
onHideBefore = () => {
|
|
73
|
-
if (!this.state.isShow) return;
|
|
74
|
-
|
|
75
|
-
return this.emit(this.EVENTS.INTERACT.POP, { key: this.name } satisfies InteractPopPayload);
|
|
76
|
-
};
|
|
61
|
+
onHideBefore = () => this.emit(this.EVENTS.INTERACT.POP, { key: this.name } satisfies InteractPopPayload);
|
|
77
62
|
|
|
78
63
|
onHideControls = () => {
|
|
79
|
-
if (!this.state.isShow) return;
|
|
80
|
-
|
|
81
|
-
this.updateState({ isShow: false } as Partial<TState>);
|
|
82
64
|
this.setDefaultState();
|
|
83
65
|
|
|
84
66
|
return this.emit(this.EVENTS.CONTROLS.POP, { key: this.name } satisfies ControlsPopPayload);
|
|
85
67
|
};
|
|
68
|
+
|
|
69
|
+
get CONTROLS() {
|
|
70
|
+
return {
|
|
71
|
+
[this.CONST.CONTROLS.BUTTONS.ANY]: () => void this.emit(this.EVENTS.INTERACT.EMIT),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
86
74
|
}
|
package/src/types.ts
CHANGED