@vnejs/plugins.canvas.child.fill 0.2.0 → 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.js CHANGED
@@ -5,9 +5,4 @@ import { LayerFillChange } from "./modules/change.js";
5
5
  import { LayerFillHide } from "./modules/hide.js";
6
6
  import { LayerFillShow } from "./modules/show.js";
7
7
  import { LayerFillState } from "./modules/state.js";
8
- regPlugin(PLUGIN_NAME, { constants: CONSTANTS, events: SUBSCRIBE_EVENTS, params: PARAMS }, [
9
- LayerFillShow,
10
- LayerFillHide,
11
- LayerFillChange,
12
- LayerFillState,
13
- ]);
8
+ regPlugin(PLUGIN_NAME, { constants: CONSTANTS, events: SUBSCRIBE_EVENTS, params: PARAMS }, [LayerFillShow, LayerFillHide, LayerFillChange, LayerFillState]);
@@ -1,9 +1,9 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
2
  import type { FillPluginConstants, FillPluginEvents, FillPluginParams, FillPluginSettings } from "../types.js";
3
- import type { FillChangePayload } from "../utils/fill.js";
3
+ import type { FillChangePayload } from "@vnejs/contracts.canvas.child.fill";
4
4
  export declare class LayerFillChange extends ModuleCore<FillPluginEvents, FillPluginConstants, FillPluginSettings, FillPluginParams> {
5
5
  name: string;
6
6
  subscribe: () => void;
7
- onChange: ({ id, layer, color, duration }?: FillChangePayload) => Promise<unknown[] | undefined>;
8
- emitChildChange: (layer: string, childId: string, duration: number, props: Record<string, unknown>) => Promise<unknown[]> | undefined;
7
+ onChange: ({ id, layer, color, duration }?: FillChangePayload) => Promise<import("@vnejs/shared").EmitResults<"vne:interact:push_pop"> | undefined>;
8
+ emitChildChange: (layer: string, childId: string, duration: number, props: Record<string, unknown>) => Promise<import("@vnejs/shared").EmitResults<"vne:layer:child_change">> | undefined;
9
9
  }
@@ -1,10 +1,9 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
- import type { FillTransitionProps } from "@vnejs/contracts.canvas.child.fill";
2
+ import type { FillHidePayload, FillTransitionProps } from "@vnejs/contracts.canvas.child.fill";
3
3
  import type { FillPluginConstants, FillPluginEvents, FillPluginParams, FillPluginSettings } from "../types.js";
4
- import type { FillHidePayload } from "../utils/fill.js";
5
4
  export declare class LayerFillHide extends ModuleCore<FillPluginEvents, FillPluginConstants, FillPluginSettings, FillPluginParams> {
6
5
  name: string;
7
6
  subscribe: () => void;
8
- onHide: ({ id, layer, duration }?: FillHidePayload) => Promise<unknown[] | undefined>;
7
+ onHide: ({ id, layer, duration }?: FillHidePayload) => Promise<import("@vnejs/shared").EmitResults<"vne:layer:child_rm"> | undefined>;
9
8
  getTransitionProps: (duration: number) => FillTransitionProps;
10
9
  }
@@ -1,10 +1,9 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
- import type { FillTransitionProps } from "@vnejs/contracts.canvas.child.fill";
2
+ import type { FillShowPayload, FillTransitionProps } from "@vnejs/contracts.canvas.child.fill";
3
3
  import type { FillPluginConstants, FillPluginEvents, FillPluginParams, FillPluginSettings } from "../types.js";
4
- import type { FillShowPayload } from "../utils/fill.js";
5
4
  export declare class LayerFillShow extends ModuleCore<FillPluginEvents, FillPluginConstants, FillPluginSettings, FillPluginParams> {
6
5
  name: string;
7
6
  subscribe: () => void;
8
- onShow: ({ id, layer, color, duration }?: FillShowPayload) => Promise<unknown[] | undefined>;
7
+ onShow: ({ id, layer, color, duration }?: FillShowPayload) => Promise<import("@vnejs/shared").EmitResults<"vne:layer:child_add"> | undefined>;
9
8
  getTransitionProps: (duration: number) => FillTransitionProps;
10
9
  }
@@ -1,6 +1,6 @@
1
1
  import { ModuleCore, type ModuleGlobalStateRegistry } from "@vnejs/module.core";
2
2
  import type { FillPluginConstants, FillPluginEvents, FillPluginParams, FillPluginSettings } from "../types.js";
3
- import type { FillRecord, FillState, FillStateIdPayload } from "../utils/fill.js";
3
+ import type { FillRecord, FillState, FillStateIdPayload } from "@vnejs/contracts.canvas.child.fill";
4
4
  export declare class LayerFillState extends ModuleCore<FillPluginEvents, FillPluginConstants, FillPluginSettings, FillPluginParams, FillState> {
5
5
  name: string;
6
6
  subscribe: () => void;
@@ -14,9 +14,9 @@ export declare class LayerFillState extends ModuleCore<FillPluginEvents, FillPlu
14
14
  cloneFillAndChange: (fill: FillRecord) => Promise<unknown>;
15
15
  cloneFillAndHide: (fill: FillRecord) => Promise<unknown>;
16
16
  cloneFillAndShow: (fill: FillRecord) => Promise<unknown>;
17
- emitFillChange: (fill: FillRecord) => Promise<unknown[]> | undefined;
18
- emitFillHide: (fill: FillRecord) => Promise<unknown[]> | undefined;
19
- emitFillShow: (fill: FillRecord) => Promise<unknown[]> | undefined;
17
+ emitFillChange: (fill: FillRecord) => Promise<import("@vnejs/shared").EmitResults<"vne:layer_fill:change">> | undefined;
18
+ emitFillHide: (fill: FillRecord) => Promise<import("@vnejs/shared").EmitResults<"vne:layer_fill:hide">> | undefined;
19
+ emitFillShow: (fill: FillRecord) => Promise<import("@vnejs/shared").EmitResults<"vne:layer_fill:show">> | undefined;
20
20
  emitEventWithFill: (fill: FillRecord, cb: (fill: FillRecord) => unknown) => unknown;
21
21
  getFillsByLayerFromState: (acc: Record<string, FillRecord[]>, fill: FillRecord) => Record<string, FillRecord[]>;
22
22
  getDefaultState: () => FillState;
@@ -1,33 +1,4 @@
1
- export type FillRecord = {
2
- id: string;
3
- layer?: string;
4
- color?: string;
5
- };
6
- export type FillState = {
7
- fills: FillRecord[];
8
- };
9
- export type FillShowPayload = {
10
- id?: string;
11
- layer?: string;
12
- color?: string;
13
- duration?: number;
14
- };
15
- export type FillHidePayload = {
16
- id?: string;
17
- layer?: string;
18
- duration?: number;
19
- };
20
- export type FillChangePayload = {
21
- id?: string;
22
- layer?: string;
23
- color?: string;
24
- duration?: number;
25
- };
26
- export type FillStateIdPayload = {
27
- id?: string;
28
- layer?: string;
29
- color?: string;
30
- };
1
+ import type { FillRecord } from "@vnejs/contracts.canvas.child.fill";
31
2
  export type LayerFillChild = {
32
3
  type: string;
33
4
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.canvas.child.fill",
3
- "version": "0.2.0",
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
@@ -8,9 +8,4 @@ import { LayerFillHide } from "./modules/hide.js";
8
8
  import { LayerFillShow } from "./modules/show.js";
9
9
  import { LayerFillState } from "./modules/state.js";
10
10
 
11
- regPlugin(PLUGIN_NAME, { constants: CONSTANTS, events: SUBSCRIBE_EVENTS, params: PARAMS }, [
12
- LayerFillShow,
13
- LayerFillHide,
14
- LayerFillChange,
15
- LayerFillState,
16
- ]);
11
+ regPlugin(PLUGIN_NAME, { constants: CONSTANTS, events: SUBSCRIBE_EVENTS, params: PARAMS }, [LayerFillShow, LayerFillHide, LayerFillChange, LayerFillState]);
@@ -2,7 +2,7 @@ import { createPromiseResolve } from "@vnejs/helpers";
2
2
  import { ModuleCore } from "@vnejs/module.core";
3
3
 
4
4
  import type { FillPluginConstants, FillPluginEvents, FillPluginParams, FillPluginSettings } from "../types.js";
5
- import type { FillChangePayload, FillRecord } from "../utils/fill.js";
5
+ import type { FillChangePayload, FillRecord } from "@vnejs/contracts.canvas.child.fill";
6
6
 
7
7
  export class LayerFillChange extends ModuleCore<FillPluginEvents, FillPluginConstants, FillPluginSettings, FillPluginParams> {
8
8
  name = "layer.fill.change";
@@ -22,8 +22,7 @@ export class LayerFillChange extends ModuleCore<FillPluginEvents, FillPluginCons
22
22
 
23
23
  await this.emit(this.EVENTS.LAYER_FILL.STATE_UPDATE, { id, color });
24
24
 
25
- if (!duration || this.shared.viewForceAnimationSources.isNotEmpty())
26
- return this.emitChildChange(layer, id, 0, { ...changeArgs, transition: 0 });
25
+ if (!duration || this.shared.viewForceAnimationSources.isNotEmpty()) return this.emitChildChange(layer, id, 0, { ...changeArgs, transition: 0 });
27
26
 
28
27
  const { resolve: skipResolve, promise: skipPromise } = createPromiseResolve();
29
28
 
@@ -1,9 +1,8 @@
1
1
  import { createPromiseResolve } from "@vnejs/helpers";
2
2
  import { ModuleCore } from "@vnejs/module.core";
3
- import type { FillTransitionProps } from "@vnejs/contracts.canvas.child.fill";
3
+ import type { FillHidePayload, FillTransitionProps } from "@vnejs/contracts.canvas.child.fill";
4
4
 
5
5
  import type { FillPluginConstants, FillPluginEvents, FillPluginParams, FillPluginSettings } from "../types.js";
6
- import type { FillHidePayload } from "../utils/fill.js";
7
6
 
8
7
  export class LayerFillHide extends ModuleCore<FillPluginEvents, FillPluginConstants, FillPluginSettings, FillPluginParams> {
9
8
  name = "layer.fill.hide";
@@ -1,9 +1,8 @@
1
1
  import { createPromiseResolve } from "@vnejs/helpers";
2
2
  import { ModuleCore } from "@vnejs/module.core";
3
- import type { FillTransitionProps } from "@vnejs/contracts.canvas.child.fill";
3
+ import type { FillRecord, FillShowPayload, FillTransitionProps } from "@vnejs/contracts.canvas.child.fill";
4
4
 
5
5
  import type { FillPluginConstants, FillPluginEvents, FillPluginParams, FillPluginSettings } from "../types.js";
6
- import type { FillRecord, FillShowPayload } from "../utils/fill.js";
7
6
  import { assertIdNotExists, buildChild } from "../utils/fill.js";
8
7
 
9
8
  export class LayerFillShow extends ModuleCore<FillPluginEvents, FillPluginConstants, FillPluginSettings, FillPluginParams> {
@@ -24,8 +23,7 @@ export class LayerFillShow extends ModuleCore<FillPluginEvents, FillPluginConsta
24
23
 
25
24
  await this.emit(this.EVENTS.LAYER_FILL.STATE_ADD, { id, layer, color });
26
25
 
27
- if (!duration || this.shared.viewForceAnimationSources.isNotEmpty())
28
- return this.emit(this.EVENTS.LAYER.CHILD_ADD, { layer, child: childCommon });
26
+ if (!duration || this.shared.viewForceAnimationSources.isNotEmpty()) return this.emit(this.EVENTS.LAYER.CHILD_ADD, { layer, child: childCommon });
29
27
 
30
28
  const { initialProps = {}, finishProps = {} } = this.getTransitionProps(Number(duration));
31
29
  const { resolve: skipResolve, promise: skipPromise } = createPromiseResolve();
@@ -1,7 +1,7 @@
1
1
  import { ModuleCore, type ModuleGlobalStateRegistry } from "@vnejs/module.core";
2
2
 
3
3
  import type { FillPluginConstants, FillPluginEvents, FillPluginParams, FillPluginSettings } from "../types.js";
4
- import type { FillRecord, FillState, FillStateIdPayload } from "../utils/fill.js";
4
+ import type { FillRecord, FillState, FillStateIdPayload } from "@vnejs/contracts.canvas.child.fill";
5
5
 
6
6
  export class LayerFillState extends ModuleCore<FillPluginEvents, FillPluginConstants, FillPluginSettings, FillPluginParams, FillState> {
7
7
  name = "layer.fill.state";
package/src/types.ts CHANGED
@@ -2,9 +2,7 @@ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCor
2
2
  import type { Constants, Params, PluginName, SubscribeEvents } from "@vnejs/contracts.canvas.child.fill";
3
3
  import type { PluginName as LayerPluginName, SettingsKeys as LayerSettingsKeys, SubscribeEvents as LayerSubscribeEvents } from "@vnejs/contracts.canvas.layer";
4
4
 
5
- export type FillPluginEvents = ModuleCoreEvents &
6
- Record<PluginName, SubscribeEvents> &
7
- Record<LayerPluginName, LayerSubscribeEvents>;
5
+ export type FillPluginEvents = ModuleCoreEvents & Record<PluginName, SubscribeEvents> & Record<LayerPluginName, LayerSubscribeEvents>;
8
6
 
9
7
  export type FillPluginConstants = ModuleCoreConstants & Record<PluginName, Constants>;
10
8
 
package/src/utils/fill.ts CHANGED
@@ -1,38 +1,4 @@
1
- export type FillRecord = {
2
- id: string;
3
- layer?: string;
4
- color?: string;
5
- };
6
-
7
- export type FillState = {
8
- fills: FillRecord[];
9
- };
10
-
11
- export type FillShowPayload = {
12
- id?: string;
13
- layer?: string;
14
- color?: string;
15
- duration?: number;
16
- };
17
-
18
- export type FillHidePayload = {
19
- id?: string;
20
- layer?: string;
21
- duration?: number;
22
- };
23
-
24
- export type FillChangePayload = {
25
- id?: string;
26
- layer?: string;
27
- color?: string;
28
- duration?: number;
29
- };
30
-
31
- export type FillStateIdPayload = {
32
- id?: string;
33
- layer?: string;
34
- color?: string;
35
- };
1
+ import type { FillRecord } from "@vnejs/contracts.canvas.child.fill";
36
2
 
37
3
  export type LayerFillChild = {
38
4
  type: string;
package/tsconfig.json CHANGED
@@ -4,12 +4,6 @@
4
4
  "rootDir": "src",
5
5
  "outDir": "dist"
6
6
  },
7
- "include": [
8
- "src/**/*.ts"
9
- ],
10
- "exclude": [
11
- "dist",
12
- "node_modules",
13
- "src/tests"
14
- ]
7
+ "include": ["src/**/*.ts"],
8
+ "exclude": ["dist", "node_modules", "src/tests"]
15
9
  }