@vnejs/plugins.canvas.child.bg 0.2.4 → 0.2.5

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.
@@ -1,10 +1,10 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
+ import type { BgChangePayload } from "@vnejs/contracts.canvas.child.bg";
2
3
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
3
- import type { BgChangePayload } from "../utils/bg.js";
4
4
  export declare class LayerBgChange extends ModuleCore<BgPluginEvents, BgPluginConstants, BgPluginSettings, BgPluginParams> {
5
5
  name: string;
6
6
  subscribe: () => void;
7
- onBgChange: ({ id, name, layer, duration, args }?: BgChangePayload) => Promise<unknown[] | undefined>;
7
+ onBgChange: ({ id, name, layer, duration, args }?: BgChangePayload) => Promise<import("@vnejs/shared").EmitResults<"vne:interact:push_pop"> | undefined>;
8
8
  getBgId: (id: string | undefined, layer: string) => Promise<string>;
9
- emitChildChange: (layer: string, childId: string, duration: number, props: Record<string, unknown>) => Promise<unknown[]> | undefined;
9
+ emitChildChange: (layer: string, childId: string, duration: number, props: Record<string, unknown>) => Promise<import("@vnejs/shared").EmitResults<"vne:layer:child_change">> | undefined;
10
10
  }
@@ -1,10 +1,11 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
2
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
3
- import type { BgHidePayload, TransitionProps } from "../utils/bg.js";
3
+ import type { BgHidePayload } from "@vnejs/contracts.canvas.child.bg";
4
+ import type { TransitionProps } from "../utils/bg.js";
4
5
  export declare class LayerBgHide extends ModuleCore<BgPluginEvents, BgPluginConstants, BgPluginSettings, BgPluginParams> {
5
6
  name: string;
6
7
  subscribe: () => void;
7
8
  onBgHide: ({ layer, transition, duration }?: BgHidePayload) => Promise<void>;
8
9
  getTransitionProps: (transition: string, duration: number) => TransitionProps;
9
- emitStateRm: (id: string) => Promise<unknown[]> | undefined;
10
+ emitStateRm: (id: string) => Promise<import("@vnejs/shared").EmitResults<"vne:layer_bg:state_rm">> | undefined;
10
11
  }
@@ -1,9 +1,9 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
+ import type { BgPreloadPayload } from "@vnejs/contracts.canvas.child.bg";
2
3
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
3
- import type { BgPreloadPayload } from "../utils/bg.js";
4
4
  export declare class LayerBgPreload extends ModuleCore<BgPluginEvents, BgPluginConstants, BgPluginSettings, BgPluginParams> {
5
5
  name: string;
6
6
  subscribe: () => void;
7
- onPreload: ({ name, mediaType, priority, overlays }?: BgPreloadPayload) => Promise<unknown[] | undefined>;
8
- loadMedia: (name: string, args: Record<string, unknown>) => Promise<unknown[]> | undefined;
7
+ onPreload: ({ name, mediaType, priority, overlays }?: BgPreloadPayload) => Promise<(import("@vnejs/shared").EmitResults<"vne:media:load"> | undefined)[] | import("@vnejs/shared").EmitResults<"vne:media:load"> | undefined>;
8
+ loadMedia: (name: string, args: Record<string, unknown>) => Promise<import("@vnejs/shared").EmitResults<"vne:media:load">> | undefined;
9
9
  }
@@ -1,10 +1,11 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
+ import type { BgShowPayload } from "@vnejs/contracts.canvas.child.bg";
2
3
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
3
- import type { BgShowPayload, TransitionProps } from "../utils/bg.js";
4
+ import type { TransitionProps } from "../utils/bg.js";
4
5
  export declare class LayerBgShow extends ModuleCore<BgPluginEvents, BgPluginConstants, BgPluginSettings, BgPluginParams> {
5
6
  name: string;
6
7
  subscribe: () => void;
7
- onBgShow: ({ name, layer, transition, duration, args, hideOldBgsOnShow }?: BgShowPayload) => Promise<[...(unknown[] | undefined)[], unknown[] | undefined] | undefined>;
8
+ onBgShow: ({ name, layer, transition, duration, args, hideOldBgsOnShow }?: BgShowPayload) => Promise<[...(import("@vnejs/shared").EmitResults<"vne:layer_bg:state_rm"> | undefined)[], import("@vnejs/shared").EmitResults<"vne:layer:childs_rm"> | undefined] | undefined>;
8
9
  getTransitionProps: (transition: string, duration: number) => TransitionProps;
9
- emitStateRm: (id: string) => Promise<unknown[]> | undefined;
10
+ emitStateRm: (id: string) => Promise<import("@vnejs/shared").EmitResults<"vne:layer_bg:state_rm">> | undefined;
10
11
  }
@@ -1,6 +1,6 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
+ import type { BgSrcGetPayload } from "@vnejs/contracts.canvas.child.bg";
2
3
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
3
- import type { BgSrcGetPayload } from "../utils/bg.js";
4
4
  export declare class LayerBgStaff extends ModuleCore<BgPluginEvents, BgPluginConstants, BgPluginSettings, BgPluginParams> {
5
5
  name: string;
6
6
  subscribe: () => void;
@@ -1,6 +1,6 @@
1
1
  import { ModuleCore, type ModuleGlobalStateRegistry } from "@vnejs/module.core";
2
2
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
3
- import type { BgRecord, BgState, BgStateIdPayload, BgStateLayerPayload } from "../utils/bg.js";
3
+ import type { BgRecord, BgState, BgStateIdPayload, BgStateLayerPayload } from "@vnejs/contracts.canvas.child.bg";
4
4
  export declare class LayerBgState extends ModuleCore<BgPluginEvents, BgPluginConstants, BgPluginSettings, BgPluginParams, BgState> {
5
5
  name: string;
6
6
  subscribe: () => void;
@@ -11,19 +11,19 @@ export declare class LayerBgState extends ModuleCore<BgPluginEvents, BgPluginCon
11
11
  onBgStateRm: ({ id }?: BgStateIdPayload) => void;
12
12
  onStateSet: (payload: ModuleGlobalStateRegistry) => Promise<void>;
13
13
  onStateClear: () => Promise<void>;
14
- onStatePreload: ({ [this.name]: state }: Record<string, BgState>) => Promise<(unknown[] | undefined)[]>;
14
+ onStatePreload: ({ [this.name]: state }: Record<string, BgState>) => Promise<(import("@vnejs/shared").EmitResults<"vne:layer_bg:src_get"> | undefined)[]>;
15
15
  onMemoryCleared: () => Promise<void>;
16
16
  clearState: () => Promise<void>;
17
- preloadState: (state: BgState) => Promise<(unknown[] | undefined)[]>;
17
+ preloadState: (state: BgState) => Promise<(import("@vnejs/shared").EmitResults<"vne:layer_bg:src_get"> | undefined)[]>;
18
18
  cloneBgAndChangeWithNewId: (bg: BgRecord, id: string) => Promise<unknown>;
19
19
  cloneBgAndChange: (bg: BgRecord) => Promise<unknown>;
20
20
  cloneBgAndHide: (bg: BgRecord) => Promise<unknown>;
21
21
  cloneBgAndShow: (bg: BgRecord) => Promise<unknown>;
22
22
  emitEventWithBg: (bg: BgRecord, cb: (bg: BgRecord) => unknown) => unknown;
23
- emitBgSrcGet: (bg: BgRecord) => Promise<unknown[]> | undefined;
24
- emitBgChange: (bg: BgRecord) => Promise<unknown[]> | undefined;
25
- emitBgHide: (bg: BgRecord) => Promise<unknown[]> | undefined;
26
- emitBgShow: (bg: BgRecord) => Promise<unknown[]> | undefined;
23
+ emitBgSrcGet: (bg: BgRecord) => Promise<import("@vnejs/shared").EmitResults<"vne:layer_bg:src_get">> | undefined;
24
+ emitBgChange: (bg: BgRecord) => Promise<import("@vnejs/shared").EmitResults<"vne:layer_bg:change">> | undefined;
25
+ emitBgHide: (bg: BgRecord) => Promise<import("@vnejs/shared").EmitResults<"vne:layer_bg:hide">> | undefined;
26
+ emitBgShow: (bg: BgRecord) => Promise<import("@vnejs/shared").EmitResults<"vne:layer_bg:show">> | undefined;
27
27
  getBgsByLayerFromState: (acc: Record<string, BgRecord[]>, img: BgRecord) => Record<string, BgRecord[]>;
28
28
  getDefaultState: () => BgState;
29
29
  }
@@ -1,56 +1,5 @@
1
- import type { BgArgs, BgPreloadPayload } from "@vnejs/contracts.canvas.child.bg";
2
- export type { BgArgs, BgPreloadPayload };
3
- export type BgArgsInject = Partial<BgArgs>;
4
- export type BgArgsInjectPayload = {
5
- args?: BgArgs;
6
- };
1
+ import type { BgArgs, BgArgsInject } from "@vnejs/contracts.canvas.child.bg";
7
2
  export declare const applyArgsInjections: (base: BgArgs, injections: BgArgsInject[]) => BgArgs;
8
- export type BgRecord = {
9
- id: string;
10
- name?: string;
11
- layer?: string;
12
- args?: BgArgs;
13
- transition?: string;
14
- duration?: number;
15
- hideOldBgsOnShow?: boolean;
16
- };
17
- export type BgState = {
18
- bgs: BgRecord[];
19
- };
20
- export type BgShowPayload = {
21
- name?: string;
22
- layer?: string;
23
- transition?: string;
24
- duration?: number;
25
- args?: BgArgs;
26
- hideOldBgsOnShow?: boolean;
27
- };
28
- export type BgHidePayload = {
29
- layer?: string;
30
- transition?: string;
31
- duration?: number;
32
- };
33
- export type BgChangePayload = {
34
- id?: string;
35
- name?: string;
36
- layer?: string;
37
- duration?: number;
38
- args?: BgArgs;
39
- };
40
- export type BgSrcGetPayload = {
41
- name?: string;
42
- layer?: string;
43
- args?: BgArgs;
44
- };
45
- export type BgStateLayerPayload = {
46
- layer?: string;
47
- };
48
- export type BgStateIdPayload = {
49
- id?: string;
50
- name?: string;
51
- layer?: string;
52
- args?: BgArgs;
53
- };
54
3
  export type TransitionProps = {
55
4
  initialProps?: Record<string, unknown>;
56
5
  finishProps?: Record<string, unknown>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.canvas.child.bg",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -1,8 +1,9 @@
1
1
  import { createPromiseResolve } from "@vnejs/helpers";
2
2
  import { ModuleCore } from "@vnejs/module.core";
3
3
 
4
+ import type { BgArgs, BgChangePayload, BgRecord } from "@vnejs/contracts.canvas.child.bg";
5
+
4
6
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
5
- import type { BgArgs, BgChangePayload, BgRecord } from "../utils/bg.js";
6
7
 
7
8
  export class LayerBgChange extends ModuleCore<BgPluginEvents, BgPluginConstants, BgPluginSettings, BgPluginParams> {
8
9
  name = "layer.bg.change";
@@ -2,7 +2,9 @@ import { createPromiseResolve } from "@vnejs/helpers";
2
2
  import { ModuleCore } from "@vnejs/module.core";
3
3
 
4
4
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
5
- import type { BgHidePayload, BgStateIdPayload, TransitionProps } from "../utils/bg.js";
5
+ import type { BgHidePayload, BgStateIdPayload } from "@vnejs/contracts.canvas.child.bg";
6
+
7
+ import type { TransitionProps } from "../utils/bg.js";
6
8
 
7
9
  export class LayerBgHide extends ModuleCore<BgPluginEvents, BgPluginConstants, BgPluginSettings, BgPluginParams> {
8
10
  name = "layer.bg.hide";
@@ -1,7 +1,8 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
2
 
3
+ import type { BgPreloadPayload } from "@vnejs/contracts.canvas.child.bg";
4
+
3
5
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
4
- import type { BgPreloadPayload } from "../utils/bg.js";
5
6
 
6
7
  export class LayerBgPreload extends ModuleCore<BgPluginEvents, BgPluginConstants, BgPluginSettings, BgPluginParams> {
7
8
  name = "layer.bg.preload";
@@ -1,8 +1,10 @@
1
1
  import { createPromiseResolve } from "@vnejs/helpers";
2
2
  import { ModuleCore } from "@vnejs/module.core";
3
3
 
4
+ import type { BgArgs, BgShowPayload, BgStateIdPayload } from "@vnejs/contracts.canvas.child.bg";
5
+
4
6
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
5
- import type { BgArgs, BgShowPayload, BgStateIdPayload, TransitionProps } from "../utils/bg.js";
7
+ import type { TransitionProps } from "../utils/bg.js";
6
8
 
7
9
  export class LayerBgShow extends ModuleCore<BgPluginEvents, BgPluginConstants, BgPluginSettings, BgPluginParams> {
8
10
  name = "layer.bg.show";
@@ -1,7 +1,8 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
2
 
3
+ import type { BgArgs, BgArgsInject, BgSrcGetPayload } from "@vnejs/contracts.canvas.child.bg";
4
+
3
5
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
4
- import type { BgArgs, BgArgsInject, BgSrcGetPayload } from "../utils/bg.js";
5
6
  import { applyArgsInjections } from "../utils/bg.js";
6
7
 
7
8
  const mediaToSrcs = (q: { src: string }) => ({ url: q.src });
@@ -1,7 +1,7 @@
1
1
  import { ModuleCore, type ModuleGlobalStateRegistry } from "@vnejs/module.core";
2
2
 
3
3
  import type { BgPluginConstants, BgPluginEvents, BgPluginParams, BgPluginSettings } from "../types.js";
4
- import type { BgRecord, BgState, BgStateIdPayload, BgStateLayerPayload } from "../utils/bg.js";
4
+ import type { BgRecord, BgState, BgStateIdPayload, BgStateLayerPayload } from "@vnejs/contracts.canvas.child.bg";
5
5
 
6
6
  export class LayerBgState extends ModuleCore<BgPluginEvents, BgPluginConstants, BgPluginSettings, BgPluginParams, BgState> {
7
7
  name = "layer.bg.state";
package/src/utils/bg.ts CHANGED
@@ -1,12 +1,4 @@
1
- import type { BgArgs, BgPreloadPayload } from "@vnejs/contracts.canvas.child.bg";
2
-
3
- export type { BgArgs, BgPreloadPayload };
4
-
5
- export type BgArgsInject = Partial<BgArgs>;
6
-
7
- export type BgArgsInjectPayload = {
8
- args?: BgArgs;
9
- };
1
+ import type { BgArgs, BgArgsInject } from "@vnejs/contracts.canvas.child.bg";
10
2
 
11
3
  export const applyArgsInjections = (base: BgArgs, injections: BgArgsInject[]): BgArgs =>
12
4
  injections.reduce(
@@ -18,60 +10,6 @@ export const applyArgsInjections = (base: BgArgs, injections: BgArgsInject[]): B
18
10
  base,
19
11
  );
20
12
 
21
- export type BgRecord = {
22
- id: string;
23
- name?: string;
24
- layer?: string;
25
- args?: BgArgs;
26
- transition?: string;
27
- duration?: number;
28
- hideOldBgsOnShow?: boolean;
29
- };
30
-
31
- export type BgState = {
32
- bgs: BgRecord[];
33
- };
34
-
35
- export type BgShowPayload = {
36
- name?: string;
37
- layer?: string;
38
- transition?: string;
39
- duration?: number;
40
- args?: BgArgs;
41
- hideOldBgsOnShow?: boolean;
42
- };
43
-
44
- export type BgHidePayload = {
45
- layer?: string;
46
- transition?: string;
47
- duration?: number;
48
- };
49
-
50
- export type BgChangePayload = {
51
- id?: string;
52
- name?: string;
53
- layer?: string;
54
- duration?: number;
55
- args?: BgArgs;
56
- };
57
-
58
- export type BgSrcGetPayload = {
59
- name?: string;
60
- layer?: string;
61
- args?: BgArgs;
62
- };
63
-
64
- export type BgStateLayerPayload = {
65
- layer?: string;
66
- };
67
-
68
- export type BgStateIdPayload = {
69
- id?: string;
70
- name?: string;
71
- layer?: string;
72
- args?: BgArgs;
73
- };
74
-
75
13
  export type TransitionProps = {
76
14
  initialProps?: Record<string, unknown>;
77
15
  finishProps?: Record<string, unknown>;