@vnejs/plugins.canvas.child.fill 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/modules/change.d.ts +3 -3
- package/dist/modules/hide.d.ts +2 -3
- package/dist/modules/show.d.ts +2 -3
- package/dist/modules/state.d.ts +4 -4
- package/dist/modules/state.js +4 -4
- package/dist/utils/fill.d.ts +1 -30
- package/package.json +1 -1
- package/src/modules/change.ts +1 -1
- package/src/modules/hide.ts +1 -2
- package/src/modules/show.ts +1 -2
- package/src/modules/state.ts +5 -5
- package/src/utils/fill.ts +1 -35
package/dist/modules/change.d.ts
CHANGED
|
@@ -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 "
|
|
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<
|
|
8
|
-
emitChildChange: (layer: string, childId: string, duration: number, props: Record<string, unknown>) => Promise<
|
|
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
|
}
|
package/dist/modules/hide.d.ts
CHANGED
|
@@ -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<
|
|
7
|
+
onHide: ({ id, layer, duration }?: FillHidePayload) => Promise<import("@vnejs/shared").EmitResults<"vne:layer:child_rm"> | undefined>;
|
|
9
8
|
getTransitionProps: (duration: number) => FillTransitionProps;
|
|
10
9
|
}
|
package/dist/modules/show.d.ts
CHANGED
|
@@ -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<
|
|
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
|
}
|
package/dist/modules/state.d.ts
CHANGED
|
@@ -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 "
|
|
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<
|
|
18
|
-
emitFillHide: (fill: FillRecord) => Promise<
|
|
19
|
-
emitFillShow: (fill: FillRecord) => Promise<
|
|
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;
|
package/dist/modules/state.js
CHANGED
|
@@ -20,7 +20,7 @@ export class LayerFillState extends ModuleCore {
|
|
|
20
20
|
};
|
|
21
21
|
onFillStateGet = ({ id } = {}) => this.state.fills.find((item) => item.id === id);
|
|
22
22
|
onStateSet = async (payload) => {
|
|
23
|
-
const clonedState =
|
|
23
|
+
const clonedState = structuredClone(this.getStateSlice(payload));
|
|
24
24
|
const oldFillsByLayer = this.state.fills.reduce(this.getFillsByLayerFromState, {});
|
|
25
25
|
const newFillsByLayer = clonedState.fills.reduce(this.getFillsByLayerFromState, {});
|
|
26
26
|
const [promises, uniqLayers, oldLayers, newLayers] = [
|
|
@@ -51,9 +51,9 @@ export class LayerFillState extends ModuleCore {
|
|
|
51
51
|
await Promise.all(this.state.fills.map(this.cloneFillAndHide));
|
|
52
52
|
this.shared.viewForceAnimationSources.rm(`${this.name}.clear`);
|
|
53
53
|
};
|
|
54
|
-
cloneFillAndChange = async (fill) => this.emitEventWithFill(
|
|
55
|
-
cloneFillAndHide = async (fill) => this.emitEventWithFill(
|
|
56
|
-
cloneFillAndShow = async (fill) => this.emitEventWithFill(
|
|
54
|
+
cloneFillAndChange = async (fill) => this.emitEventWithFill(structuredClone(fill), this.emitFillChange);
|
|
55
|
+
cloneFillAndHide = async (fill) => this.emitEventWithFill(structuredClone(fill), this.emitFillHide);
|
|
56
|
+
cloneFillAndShow = async (fill) => this.emitEventWithFill(structuredClone(fill), this.emitFillShow);
|
|
57
57
|
emitFillChange = (fill) => this.emit(this.EVENTS.LAYER_FILL.CHANGE, { ...fill, duration: 0 });
|
|
58
58
|
emitFillHide = (fill) => this.emit(this.EVENTS.LAYER_FILL.HIDE, fill);
|
|
59
59
|
emitFillShow = (fill) => this.emit(this.EVENTS.LAYER_FILL.SHOW, fill);
|
package/dist/utils/fill.d.ts
CHANGED
|
@@ -1,33 +1,4 @@
|
|
|
1
|
-
|
|
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
package/src/modules/change.ts
CHANGED
|
@@ -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 "
|
|
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";
|
package/src/modules/hide.ts
CHANGED
|
@@ -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";
|
package/src/modules/show.ts
CHANGED
|
@@ -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> {
|
package/src/modules/state.ts
CHANGED
|
@@ -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 "
|
|
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";
|
|
@@ -31,7 +31,7 @@ export class LayerFillState extends ModuleCore<FillPluginEvents, FillPluginConst
|
|
|
31
31
|
onFillStateGet = ({ id }: FillStateIdPayload = {}) => this.state.fills.find((item) => item.id === id);
|
|
32
32
|
|
|
33
33
|
onStateSet = async (payload: ModuleGlobalStateRegistry) => {
|
|
34
|
-
const clonedState =
|
|
34
|
+
const clonedState = structuredClone(this.getStateSlice(payload));
|
|
35
35
|
|
|
36
36
|
const oldFillsByLayer = this.state.fills.reduce(this.getFillsByLayerFromState, {} as Record<string, FillRecord[]>);
|
|
37
37
|
const newFillsByLayer = clonedState.fills.reduce(this.getFillsByLayerFromState, {} as Record<string, FillRecord[]>);
|
|
@@ -71,11 +71,11 @@ export class LayerFillState extends ModuleCore<FillPluginEvents, FillPluginConst
|
|
|
71
71
|
this.shared.viewForceAnimationSources.rm(`${this.name}.clear`);
|
|
72
72
|
};
|
|
73
73
|
|
|
74
|
-
cloneFillAndChange = async (fill: FillRecord) => this.emitEventWithFill(
|
|
74
|
+
cloneFillAndChange = async (fill: FillRecord) => this.emitEventWithFill(structuredClone(fill), this.emitFillChange);
|
|
75
75
|
|
|
76
|
-
cloneFillAndHide = async (fill: FillRecord) => this.emitEventWithFill(
|
|
76
|
+
cloneFillAndHide = async (fill: FillRecord) => this.emitEventWithFill(structuredClone(fill), this.emitFillHide);
|
|
77
77
|
|
|
78
|
-
cloneFillAndShow = async (fill: FillRecord) => this.emitEventWithFill(
|
|
78
|
+
cloneFillAndShow = async (fill: FillRecord) => this.emitEventWithFill(structuredClone(fill), this.emitFillShow);
|
|
79
79
|
|
|
80
80
|
emitFillChange = (fill: FillRecord) => this.emit(this.EVENTS.LAYER_FILL.CHANGE, { ...fill, duration: 0 });
|
|
81
81
|
emitFillHide = (fill: FillRecord) => this.emit(this.EVENTS.LAYER_FILL.HIDE, fill);
|
package/src/utils/fill.ts
CHANGED
|
@@ -1,38 +1,4 @@
|
|
|
1
|
-
|
|
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;
|