@vnejs/plugins.views.screens.loading 0.2.4 → 0.2.6
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.js +2 -2
- package/dist/modules/controller.bg.d.ts +1 -1
- package/dist/modules/controller.d.ts +1 -1
- package/dist/modules/loading.d.ts +2 -1
- package/dist/modules/loading.js +2 -2
- package/dist/modules/view.d.ts +1 -1
- package/dist/types.d.ts +8 -2
- package/dist/utils/loading.d.ts +1 -11
- package/dist/view/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -2
- package/src/modules/controller.bg.ts +1 -2
- package/src/modules/controller.ts +1 -2
- package/src/modules/loading.ts +4 -3
- package/src/modules/view.ts +1 -2
- package/src/tests/setup.ts +2 -2
- package/src/types.ts +9 -2
- package/src/utils/loading.ts +1 -13
- package/src/view/index.tsx +1 -2
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@vnejs/contracts.views.screens.loading";
|
|
2
2
|
import { regPlugin } from "@vnejs/shared";
|
|
3
|
-
import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/contracts.views.screens.loading";
|
|
3
|
+
import { CONSTANTS, PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/contracts.views.screens.loading";
|
|
4
4
|
import { LoadingController } from "./modules/controller.js";
|
|
5
5
|
import { LoadingControllerBg } from "./modules/controller.bg.js";
|
|
6
6
|
import { Loading } from "./modules/loading.js";
|
|
7
7
|
import { LoadingView } from "./modules/view.js";
|
|
8
|
-
regPlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS, params: PARAMS }, [LoadingController, LoadingControllerBg, Loading, LoadingView]);
|
|
8
|
+
regPlugin(PLUGIN_NAME, { constants: CONSTANTS, events: SUBSCRIBE_EVENTS, params: PARAMS }, [LoadingController, LoadingControllerBg, Loading, LoadingView]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleControllerBg } from "@vnejs/module.controller.bg";
|
|
2
2
|
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings } from "../types.js";
|
|
3
|
-
import type { LoadingPluginState } from "../
|
|
3
|
+
import type { LoadingPluginState } from "../types.js";
|
|
4
4
|
export declare class LoadingControllerBg extends ModuleControllerBg<LoadingPluginEvents, LoadingPluginConstants, LoadingPluginSettings, LoadingPluginParams, LoadingPluginState> {
|
|
5
5
|
name: string;
|
|
6
6
|
EVENT_SHOW: "vne:loading:show";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleController } from "@vnejs/module.components";
|
|
2
2
|
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings } from "../types.js";
|
|
3
|
-
import type { LoadingPluginState } from "../
|
|
3
|
+
import type { LoadingPluginState } from "../types.js";
|
|
4
4
|
export declare class LoadingController extends ModuleController<LoadingPluginEvents, LoadingPluginConstants, LoadingPluginSettings, LoadingPluginParams, LoadingPluginState> {
|
|
5
5
|
name: string;
|
|
6
6
|
EVENT_UPDATE_VIEW: "vne:loading:update";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ModuleCore } from "@vnejs/module.core";
|
|
2
2
|
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings } from "../types.js";
|
|
3
|
-
import type {
|
|
3
|
+
import type { LoadingPluginState } from "../types.js";
|
|
4
|
+
import type { LoadingEmitPayload } from "@vnejs/contracts.views.screens.loading";
|
|
4
5
|
export declare class Loading extends ModuleCore<LoadingPluginEvents, LoadingPluginConstants, LoadingPluginSettings, LoadingPluginParams, LoadingPluginState> {
|
|
5
6
|
name: string;
|
|
6
7
|
subscribe: () => void;
|
package/dist/modules/loading.js
CHANGED
|
@@ -5,10 +5,10 @@ export class Loading extends ModuleCore {
|
|
|
5
5
|
this.on(this.EVENTS.LOADING.EMIT, this.onLoadingEmit);
|
|
6
6
|
};
|
|
7
7
|
onLoadingEmit = async ({ promiseFunc } = {}) => {
|
|
8
|
-
this.
|
|
8
|
+
this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.LOADING.LOGS_ACTIONS.START });
|
|
9
9
|
await this.emit(this.EVENTS.LOADING.SHOW);
|
|
10
10
|
await Promise.all([promiseFunc?.(), this.waitTimeout(this.PARAMS.LOADING.MIN_SHOW_TIME)]);
|
|
11
11
|
await this.emit(this.EVENTS.LOADING.HIDE);
|
|
12
|
-
this.
|
|
12
|
+
this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.LOADING.LOGS_ACTIONS.FINISH });
|
|
13
13
|
};
|
|
14
14
|
}
|
package/dist/modules/view.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ModuleView } from "@vnejs/module.components";
|
|
2
2
|
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings } from "../types.js";
|
|
3
|
-
import type { LoadingPluginState } from "../
|
|
3
|
+
import type { LoadingPluginState } from "../types.js";
|
|
4
4
|
export declare class LoadingView extends ModuleView<LoadingPluginEvents, LoadingPluginConstants, LoadingPluginSettings, LoadingPluginParams, LoadingPluginState> {
|
|
5
5
|
name: string;
|
|
6
6
|
EVENT_UPDATE_VIEW: "vne:loading:update";
|
package/dist/types.d.ts
CHANGED
|
@@ -3,8 +3,14 @@ import type { PluginName as LogsPluginName, SubscribeEvents as LogsSubscribeEven
|
|
|
3
3
|
import type { PluginName as MemoryPluginName, SubscribeEvents as MemorySubscribeEvents } from "@vnejs/contracts.core.memory";
|
|
4
4
|
import type { PluginName as SystemPluginName, SubscribeEvents as SystemSubscribeEvents } from "@vnejs/contracts.core.system";
|
|
5
5
|
import type { PluginName as LocsPluginName, SubscribeEvents as LocsSubscribeEvents } from "@vnejs/contracts.text.locs";
|
|
6
|
-
import type { Params, PluginName, SubscribeEvents } from "@vnejs/contracts.views.screens.loading";
|
|
6
|
+
import type { Constants, Params, PluginName, SubscribeEvents } from "@vnejs/contracts.views.screens.loading";
|
|
7
7
|
export type LoadingPluginEvents = ModuleComponentsEvents & Record<PluginName, SubscribeEvents> & Record<LogsPluginName, LogsSubscribeEvents> & Record<MemoryPluginName, MemorySubscribeEvents> & Record<SystemPluginName, SystemSubscribeEvents> & Record<LocsPluginName, LocsSubscribeEvents>;
|
|
8
|
-
export type LoadingPluginConstants = ModuleComponentsConstants
|
|
8
|
+
export type LoadingPluginConstants = ModuleComponentsConstants & Record<PluginName, Constants>;
|
|
9
9
|
export type LoadingPluginSettings = ModuleComponentsSettings;
|
|
10
10
|
export type LoadingPluginParams = ModuleComponentsParams & Record<PluginName, Params>;
|
|
11
|
+
export type LoadingPluginState = {
|
|
12
|
+
isShow: boolean;
|
|
13
|
+
isForce: boolean;
|
|
14
|
+
bgSrc?: string;
|
|
15
|
+
locs?: Record<string, string>;
|
|
16
|
+
};
|
package/dist/utils/loading.d.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
1
|
import type { Module } from "@vnejs/module";
|
|
2
|
-
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings } from "../types.js";
|
|
3
|
-
export type LoadingPluginState = {
|
|
4
|
-
isShow: boolean;
|
|
5
|
-
isForce: boolean;
|
|
6
|
-
bgSrc?: string;
|
|
7
|
-
locs?: Record<string, string>;
|
|
8
|
-
};
|
|
9
|
-
export type LoadingEmitPayload = {
|
|
10
|
-
promiseFunc?: () => void | Promise<void>;
|
|
11
|
-
source?: string;
|
|
12
|
-
};
|
|
2
|
+
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings, LoadingPluginState } from "../types.js";
|
|
13
3
|
export type LoadingViewContext = {
|
|
14
4
|
emit: Module<LoadingPluginEvents, LoadingPluginConstants, LoadingPluginSettings, LoadingPluginParams, LoadingPluginState>["emit"];
|
|
15
5
|
EVENTS: LoadingPluginEvents;
|
package/dist/view/index.d.ts
CHANGED
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "@vnejs/contracts.views.screens.loading";
|
|
2
2
|
|
|
3
3
|
import { regPlugin } from "@vnejs/shared";
|
|
4
|
-
import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/contracts.views.screens.loading";
|
|
4
|
+
import { CONSTANTS, PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/contracts.views.screens.loading";
|
|
5
5
|
|
|
6
6
|
import { LoadingController } from "./modules/controller.js";
|
|
7
7
|
import { LoadingControllerBg } from "./modules/controller.bg.js";
|
|
8
8
|
import { Loading } from "./modules/loading.js";
|
|
9
9
|
import { LoadingView } from "./modules/view.js";
|
|
10
10
|
|
|
11
|
-
regPlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS, params: PARAMS }, [LoadingController, LoadingControllerBg, Loading, LoadingView]);
|
|
11
|
+
regPlugin(PLUGIN_NAME, { constants: CONSTANTS, events: SUBSCRIBE_EVENTS, params: PARAMS }, [LoadingController, LoadingControllerBg, Loading, LoadingView]);
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ModuleControllerBg } from "@vnejs/module.controller.bg";
|
|
2
2
|
|
|
3
3
|
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings } from "../types.js";
|
|
4
|
-
import type { LoadingPluginState } from "../
|
|
5
|
-
|
|
4
|
+
import type { LoadingPluginState } from "../types.js";
|
|
6
5
|
export class LoadingControllerBg extends ModuleControllerBg<
|
|
7
6
|
LoadingPluginEvents,
|
|
8
7
|
LoadingPluginConstants,
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ModuleController } from "@vnejs/module.components";
|
|
2
2
|
|
|
3
3
|
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings } from "../types.js";
|
|
4
|
-
import type { LoadingPluginState } from "../
|
|
5
|
-
|
|
4
|
+
import type { LoadingPluginState } from "../types.js";
|
|
6
5
|
export class LoadingController extends ModuleController<
|
|
7
6
|
LoadingPluginEvents,
|
|
8
7
|
LoadingPluginConstants,
|
package/src/modules/loading.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ModuleCore } from "@vnejs/module.core";
|
|
2
2
|
|
|
3
3
|
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings } from "../types.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { LoadingPluginState } from "../types.js";
|
|
5
|
+
import type { LoadingEmitPayload } from "@vnejs/contracts.views.screens.loading";
|
|
5
6
|
|
|
6
7
|
export class Loading extends ModuleCore<LoadingPluginEvents, LoadingPluginConstants, LoadingPluginSettings, LoadingPluginParams, LoadingPluginState> {
|
|
7
8
|
name = "loading";
|
|
@@ -11,10 +12,10 @@ export class Loading extends ModuleCore<LoadingPluginEvents, LoadingPluginConsta
|
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
onLoadingEmit = async ({ promiseFunc }: LoadingEmitPayload = {}) => {
|
|
14
|
-
this.
|
|
15
|
+
this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.LOADING.LOGS_ACTIONS.START });
|
|
15
16
|
await this.emit(this.EVENTS.LOADING.SHOW);
|
|
16
17
|
await Promise.all([promiseFunc?.(), this.waitTimeout(this.PARAMS.LOADING.MIN_SHOW_TIME)]);
|
|
17
18
|
await this.emit(this.EVENTS.LOADING.HIDE);
|
|
18
|
-
this.
|
|
19
|
+
this.emit(this.EVENTS.LOGS.EMIT, { action: this.CONST.LOADING.LOGS_ACTIONS.FINISH });
|
|
19
20
|
};
|
|
20
21
|
}
|
package/src/modules/view.ts
CHANGED
|
@@ -2,8 +2,7 @@ import { ModuleView } from "@vnejs/module.components";
|
|
|
2
2
|
|
|
3
3
|
import { render } from "../view/index.js";
|
|
4
4
|
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings } from "../types.js";
|
|
5
|
-
import type { LoadingPluginState } from "../
|
|
6
|
-
|
|
5
|
+
import type { LoadingPluginState } from "../types.js";
|
|
7
6
|
export class LoadingView extends ModuleView<LoadingPluginEvents, LoadingPluginConstants, LoadingPluginSettings, LoadingPluginParams, LoadingPluginState> {
|
|
8
7
|
name = "loading.view";
|
|
9
8
|
|
package/src/tests/setup.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CONSTANTS as LAYER_CONST, PLUGIN_NAME as LAYER, SETTINGS_KEYS as LAYER_SETTINGS } from "@vnejs/contracts.canvas.layer";
|
|
2
2
|
import { SUBSCRIBE_EVENTS as MEDIA_EVENTS } from "@vnejs/contracts.core.media";
|
|
3
|
-
import { PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/contracts.views.screens.loading";
|
|
3
|
+
import { CONSTANTS, PARAMS, PLUGIN_NAME, SUBSCRIBE_EVENTS } from "@vnejs/contracts.views.screens.loading";
|
|
4
4
|
import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin, stubEvent, stubSilentEvent } from "@vnejs/test-utils";
|
|
5
5
|
|
|
6
6
|
export const registerLoadingPluginVne = () => {
|
|
7
7
|
registerCoreVne();
|
|
8
8
|
registerVnePlugin(LAYER, { constants: LAYER_CONST, settings: LAYER_SETTINGS });
|
|
9
|
-
registerVnePlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS, params: PARAMS });
|
|
9
|
+
registerVnePlugin(PLUGIN_NAME, { constants: CONSTANTS, events: SUBSCRIBE_EVENTS, params: PARAMS });
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export const createLoadingTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
|
package/src/types.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { PluginName as LogsPluginName, SubscribeEvents as LogsSubscribeEven
|
|
|
3
3
|
import type { PluginName as MemoryPluginName, SubscribeEvents as MemorySubscribeEvents } from "@vnejs/contracts.core.memory";
|
|
4
4
|
import type { PluginName as SystemPluginName, SubscribeEvents as SystemSubscribeEvents } from "@vnejs/contracts.core.system";
|
|
5
5
|
import type { PluginName as LocsPluginName, SubscribeEvents as LocsSubscribeEvents } from "@vnejs/contracts.text.locs";
|
|
6
|
-
import type { Params, PluginName, SubscribeEvents } from "@vnejs/contracts.views.screens.loading";
|
|
6
|
+
import type { Constants, Params, PluginName, SubscribeEvents } from "@vnejs/contracts.views.screens.loading";
|
|
7
7
|
|
|
8
8
|
export type LoadingPluginEvents = ModuleComponentsEvents &
|
|
9
9
|
Record<PluginName, SubscribeEvents> &
|
|
@@ -12,8 +12,15 @@ export type LoadingPluginEvents = ModuleComponentsEvents &
|
|
|
12
12
|
Record<SystemPluginName, SystemSubscribeEvents> &
|
|
13
13
|
Record<LocsPluginName, LocsSubscribeEvents>;
|
|
14
14
|
|
|
15
|
-
export type LoadingPluginConstants = ModuleComponentsConstants
|
|
15
|
+
export type LoadingPluginConstants = ModuleComponentsConstants & Record<PluginName, Constants>;
|
|
16
16
|
|
|
17
17
|
export type LoadingPluginSettings = ModuleComponentsSettings;
|
|
18
18
|
|
|
19
19
|
export type LoadingPluginParams = ModuleComponentsParams & Record<PluginName, Params>;
|
|
20
|
+
|
|
21
|
+
export type LoadingPluginState = {
|
|
22
|
+
isShow: boolean;
|
|
23
|
+
isForce: boolean;
|
|
24
|
+
bgSrc?: string;
|
|
25
|
+
locs?: Record<string, string>;
|
|
26
|
+
};
|
package/src/utils/loading.ts
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
1
|
import type { Module } from "@vnejs/module";
|
|
2
2
|
|
|
3
|
-
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings } from "../types.js";
|
|
4
|
-
|
|
5
|
-
export type LoadingPluginState = {
|
|
6
|
-
isShow: boolean;
|
|
7
|
-
isForce: boolean;
|
|
8
|
-
bgSrc?: string;
|
|
9
|
-
locs?: Record<string, string>;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type LoadingEmitPayload = {
|
|
13
|
-
promiseFunc?: () => void | Promise<void>;
|
|
14
|
-
source?: string;
|
|
15
|
-
};
|
|
3
|
+
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings, LoadingPluginState } from "../types.js";
|
|
16
4
|
|
|
17
5
|
export type LoadingViewContext = {
|
|
18
6
|
emit: Module<LoadingPluginEvents, LoadingPluginConstants, LoadingPluginSettings, LoadingPluginParams, LoadingPluginState>["emit"];
|
package/src/view/index.tsx
CHANGED
|
@@ -3,8 +3,7 @@ import type { ReactComponentProps } from "@vnejs/uis.react";
|
|
|
3
3
|
import { PositionBox, Screen, Text, createRenderFunc, useMemo, useStoreState } from "@vnejs/uis.react";
|
|
4
4
|
|
|
5
5
|
import type { LoadingPluginConstants, LoadingPluginEvents, LoadingPluginParams, LoadingPluginSettings } from "../types.js";
|
|
6
|
-
import type { LoadingPluginState } from "../
|
|
7
|
-
|
|
6
|
+
import type { LoadingPluginState } from "../types.js";
|
|
8
7
|
type LoadingComponentProps = ReactComponentProps<LoadingPluginEvents, LoadingPluginConstants, LoadingPluginSettings, LoadingPluginParams, LoadingPluginState>;
|
|
9
8
|
|
|
10
9
|
const Loading = ({ store, onMount, PARAMS }: LoadingComponentProps) => {
|