@vnejs/plugins.time.time 0.1.15 → 0.1.17
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/modules/time.d.ts +3 -4
- package/dist/modules/time.js +3 -4
- package/dist/types.d.ts +5 -8
- package/package.json +2 -5
- package/src/modules/time.ts +4 -7
- package/src/types.ts +5 -12
package/dist/modules/time.d.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { LineExecHandlerArg } from "@vnejs/
|
|
1
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
2
|
+
import type { LineExecHandlerArg } from "@vnejs/module.core";
|
|
3
3
|
import type { TimePluginConstants, TimePluginEvents, TimePluginParams, TimePluginSettings } from "../types.js";
|
|
4
4
|
import type { TimeState, TimeValuePayload } from "../utils/time.js";
|
|
5
|
-
export declare class TimeModule extends
|
|
5
|
+
export declare class TimeModule extends ModuleCore<TimePluginEvents, TimePluginConstants, TimePluginSettings, TimePluginParams, TimeState> {
|
|
6
6
|
name: string;
|
|
7
7
|
subscribe: () => void;
|
|
8
8
|
init: () => Promise<unknown[]> | undefined;
|
|
9
9
|
onLineExec: ({ line }?: LineExecHandlerArg) => Promise<void>;
|
|
10
10
|
onTimeSet: ({ hours, minutes, seconds }?: TimeValuePayload) => void;
|
|
11
11
|
onTimeAdd: ({ hours, minutes, seconds }?: TimeValuePayload) => void;
|
|
12
|
-
onStateSet: (payload: ModuleGlobalStateRegistry) => Promise<void>;
|
|
13
12
|
emitTimeEvent: (action: string, arg: TimeValuePayload) => Promise<unknown[]> | undefined;
|
|
14
13
|
getDefaultState: () => TimeState;
|
|
15
14
|
}
|
package/dist/modules/time.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
2
2
|
import { tokenizeExecLine } from "@vnejs/helpers";
|
|
3
|
-
export class TimeModule extends
|
|
3
|
+
export class TimeModule extends ModuleCore {
|
|
4
4
|
name = "time";
|
|
5
5
|
subscribe = () => {
|
|
6
6
|
this.on(this.EVENTS.TIME.SET, this.onTimeSet);
|
|
7
7
|
this.on(this.EVENTS.TIME.ADD, this.onTimeAdd);
|
|
8
|
-
this.on(this.EVENTS.STATE.SET, this.
|
|
8
|
+
this.on(this.EVENTS.STATE.SET, this.onSetStateClone);
|
|
9
9
|
this.on(this.EVENTS.STATE.CLEAR, this.setDefaultState);
|
|
10
10
|
};
|
|
11
11
|
init = () => this.emit(this.EVENTS.SCENARIO.LINE_EXEC_REG, { module: this.name, handler: this.onLineExec });
|
|
@@ -39,7 +39,6 @@ export class TimeModule extends Module {
|
|
|
39
39
|
}
|
|
40
40
|
this.emit(this.EVENTS.TIME.CHANGED);
|
|
41
41
|
};
|
|
42
|
-
onStateSet = async (payload) => this.setState((await this.emitOne(this.EVENTS.VENDORS.CLONE, this.getStateSlice(payload))));
|
|
43
42
|
emitTimeEvent = (action, arg) => {
|
|
44
43
|
if (action === this.CONST.TIME.ACTIONS.ADD)
|
|
45
44
|
return this.emit(this.EVENTS.TIME.ADD, arg);
|
package/dist/types.d.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/plugins.core.scenario.contract";
|
|
3
|
-
import type { PluginName as StatePluginName, SubscribeEvents as StateSubscribeEvents } from "@vnejs/plugins.core.state.contract";
|
|
4
|
-
import type { PluginName as VendorsPluginName, SubscribeEvents as VendorsSubscribeEvents } from "@vnejs/plugins.core.vendors.contract";
|
|
1
|
+
import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
|
|
5
2
|
import type { Constants, PluginName, SubscribeEvents } from "@vnejs/plugins.time.time.contract";
|
|
6
|
-
export type TimePluginEvents =
|
|
7
|
-
export type TimePluginConstants =
|
|
8
|
-
export type TimePluginSettings =
|
|
9
|
-
export type TimePluginParams =
|
|
3
|
+
export type TimePluginEvents = ModuleCoreEvents & Record<PluginName, SubscribeEvents>;
|
|
4
|
+
export type TimePluginConstants = ModuleCoreConstants & Record<PluginName, Constants>;
|
|
5
|
+
export type TimePluginSettings = ModuleCoreSettings;
|
|
6
|
+
export type TimePluginParams = ModuleCoreParams;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/plugins.time.time",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,10 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@vnejs/helpers": "~0.1.0",
|
|
37
|
-
"@vnejs/module": "~0.1.0",
|
|
38
|
-
"@vnejs/plugins.core.scenario.contract": "~0.1.0",
|
|
39
|
-
"@vnejs/plugins.core.state.contract": "~0.1.0",
|
|
40
|
-
"@vnejs/plugins.core.vendors.contract": "~0.1.0",
|
|
37
|
+
"@vnejs/module.core": "~0.1.0",
|
|
41
38
|
"@vnejs/shared": "~0.1.0"
|
|
42
39
|
},
|
|
43
40
|
"devDependencies": {
|
package/src/modules/time.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
2
2
|
import { tokenizeExecLine } from "@vnejs/helpers";
|
|
3
3
|
|
|
4
|
-
import type { LineExecHandlerArg } from "@vnejs/
|
|
4
|
+
import type { LineExecHandlerArg } from "@vnejs/module.core";
|
|
5
5
|
|
|
6
6
|
import type { TimePluginConstants, TimePluginEvents, TimePluginParams, TimePluginSettings } from "../types.js";
|
|
7
7
|
import type { TimeState, TimeValuePayload } from "../utils/time.js";
|
|
8
8
|
|
|
9
|
-
export class TimeModule extends
|
|
9
|
+
export class TimeModule extends ModuleCore<TimePluginEvents, TimePluginConstants, TimePluginSettings, TimePluginParams, TimeState> {
|
|
10
10
|
name = "time";
|
|
11
11
|
|
|
12
12
|
subscribe = () => {
|
|
13
13
|
this.on(this.EVENTS.TIME.SET, this.onTimeSet);
|
|
14
14
|
this.on(this.EVENTS.TIME.ADD, this.onTimeAdd);
|
|
15
15
|
|
|
16
|
-
this.on(this.EVENTS.STATE.SET, this.
|
|
16
|
+
this.on(this.EVENTS.STATE.SET, this.onSetStateClone);
|
|
17
17
|
this.on(this.EVENTS.STATE.CLEAR, this.setDefaultState);
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -60,9 +60,6 @@ export class TimeModule extends Module<TimePluginEvents, TimePluginConstants, Ti
|
|
|
60
60
|
this.emit(this.EVENTS.TIME.CHANGED);
|
|
61
61
|
};
|
|
62
62
|
|
|
63
|
-
onStateSet = async (payload: ModuleGlobalStateRegistry) =>
|
|
64
|
-
this.setState((await this.emitOne(this.EVENTS.VENDORS.CLONE, this.getStateSlice(payload))) as TimeState);
|
|
65
|
-
|
|
66
63
|
emitTimeEvent = (action: string, arg: TimeValuePayload) => {
|
|
67
64
|
if (action === this.CONST.TIME.ACTIONS.ADD) return this.emit(this.EVENTS.TIME.ADD, arg);
|
|
68
65
|
if (action === this.CONST.TIME.ACTIONS.SET) return this.emit(this.EVENTS.TIME.SET, arg);
|
package/src/types.ts
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { PluginName as ScenarioPluginName, SubscribeEvents as ScenarioSubscribeEvents } from "@vnejs/plugins.core.scenario.contract";
|
|
3
|
-
import type { PluginName as StatePluginName, SubscribeEvents as StateSubscribeEvents } from "@vnejs/plugins.core.state.contract";
|
|
4
|
-
import type { PluginName as VendorsPluginName, SubscribeEvents as VendorsSubscribeEvents } from "@vnejs/plugins.core.vendors.contract";
|
|
1
|
+
import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
|
|
5
2
|
import type { Constants, PluginName, SubscribeEvents } from "@vnejs/plugins.time.time.contract";
|
|
6
3
|
|
|
7
|
-
export type TimePluginEvents =
|
|
8
|
-
Record<PluginName, SubscribeEvents> &
|
|
9
|
-
Record<ScenarioPluginName, ScenarioSubscribeEvents> &
|
|
10
|
-
Record<StatePluginName, StateSubscribeEvents> &
|
|
11
|
-
Record<VendorsPluginName, VendorsSubscribeEvents>;
|
|
4
|
+
export type TimePluginEvents = ModuleCoreEvents & Record<PluginName, SubscribeEvents>;
|
|
12
5
|
|
|
13
|
-
export type TimePluginConstants =
|
|
6
|
+
export type TimePluginConstants = ModuleCoreConstants & Record<PluginName, Constants>;
|
|
14
7
|
|
|
15
|
-
export type TimePluginSettings =
|
|
8
|
+
export type TimePluginSettings = ModuleCoreSettings;
|
|
16
9
|
|
|
17
|
-
export type TimePluginParams =
|
|
10
|
+
export type TimePluginParams = ModuleCoreParams;
|