@vnejs/plugins.canvas.child.bg 0.2.5 → 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/modules/change.js +1 -1
- package/dist/modules/show.js +1 -1
- package/dist/modules/staff.js +1 -1
- package/dist/modules/state.js +6 -6
- package/package.json +1 -1
- package/src/modules/change.ts +1 -1
- package/src/modules/show.ts +1 -1
- package/src/modules/staff.ts +1 -1
- package/src/modules/state.ts +6 -6
package/dist/modules/change.js
CHANGED
|
@@ -11,7 +11,7 @@ export class LayerBgChange extends ModuleCore {
|
|
|
11
11
|
const realId = await this.getBgId(id, layer);
|
|
12
12
|
if (!realId)
|
|
13
13
|
return;
|
|
14
|
-
const clonedArgs =
|
|
14
|
+
const clonedArgs = structuredClone(args);
|
|
15
15
|
const src = await this.emitOne(this.EVENTS.LAYER_BG.SRC_GET, { name, layer, args: clonedArgs });
|
|
16
16
|
const changeArgs = { src, isAllSrcRendered: Boolean(clonedArgs.overlays), name, args: clonedArgs };
|
|
17
17
|
await this.emit(this.EVENTS.LAYER_BG.STATE_UPDATE, { id: realId, name, args: clonedArgs });
|
package/dist/modules/show.js
CHANGED
|
@@ -6,7 +6,7 @@ export class LayerBgShow extends ModuleCore {
|
|
|
6
6
|
this.on(this.EVENTS.LAYER_BG.SHOW, this.onBgShow);
|
|
7
7
|
};
|
|
8
8
|
onBgShow = async ({ name, layer, transition, duration, args = {}, hideOldBgsOnShow = true } = {}) => {
|
|
9
|
-
const clonedArgs =
|
|
9
|
+
const clonedArgs = structuredClone(args);
|
|
10
10
|
const shouldHideOldImages = hideOldBgsOnShow || clonedArgs.hideOldBgsOnShow;
|
|
11
11
|
const id = clonedArgs.id || crypto.randomUUID();
|
|
12
12
|
const oldChildsId = shouldHideOldImages
|
package/dist/modules/staff.js
CHANGED
|
@@ -7,7 +7,7 @@ export class LayerBgStaff extends ModuleCore {
|
|
|
7
7
|
this.on(this.EVENTS.LAYER_BG.SRC_GET, this.onBgGetSrc);
|
|
8
8
|
};
|
|
9
9
|
onBgGetSrc = async ({ name = "", args = {} } = {}) => {
|
|
10
|
-
const clonedArgs =
|
|
10
|
+
const clonedArgs = structuredClone(args);
|
|
11
11
|
const injections = (await this.emitReals(this.EVENTS.LAYER_BG.ARGS_INJECT, { args: clonedArgs }));
|
|
12
12
|
const { overlays } = applyArgsInjections(clonedArgs, injections);
|
|
13
13
|
return overlays ? this.getBgSrcOverlays(name, overlays) : this.getBgSrcOne(name);
|
package/dist/modules/state.js
CHANGED
|
@@ -24,8 +24,8 @@ export class LayerBgState extends ModuleCore {
|
|
|
24
24
|
this.state.bgs = this.state.bgs.filter((e) => e.id !== id);
|
|
25
25
|
};
|
|
26
26
|
onStateSet = async (payload) => {
|
|
27
|
-
const clonedStateOld =
|
|
28
|
-
const clonedStateNew =
|
|
27
|
+
const clonedStateOld = structuredClone(this.state);
|
|
28
|
+
const clonedStateNew = structuredClone(this.getStateSlice(payload));
|
|
29
29
|
await this.preloadState(clonedStateNew);
|
|
30
30
|
const oldBgsByLayer = clonedStateOld.bgs.reduce(this.getBgsByLayerFromState, {});
|
|
31
31
|
const newBgsByLayer = clonedStateNew.bgs.reduce(this.getBgsByLayerFromState, {});
|
|
@@ -60,10 +60,10 @@ export class LayerBgState extends ModuleCore {
|
|
|
60
60
|
this.shared.viewForceAnimationSources.rm(`${this.name}.clear`);
|
|
61
61
|
};
|
|
62
62
|
preloadState = (state) => Promise.all(state.bgs.map(this.emitBgSrcGet));
|
|
63
|
-
cloneBgAndChangeWithNewId = async (bg, id) => this.emitEventWithBg({ ...(
|
|
64
|
-
cloneBgAndChange = async (bg) => this.emitEventWithBg(
|
|
65
|
-
cloneBgAndHide = async (bg) => this.emitEventWithBg(
|
|
66
|
-
cloneBgAndShow = async (bg) => this.emitEventWithBg(
|
|
63
|
+
cloneBgAndChangeWithNewId = async (bg, id) => this.emitEventWithBg({ ...structuredClone(bg), id }, this.emitBgChange);
|
|
64
|
+
cloneBgAndChange = async (bg) => this.emitEventWithBg(structuredClone(bg), this.emitBgChange);
|
|
65
|
+
cloneBgAndHide = async (bg) => this.emitEventWithBg(structuredClone(bg), this.emitBgHide);
|
|
66
|
+
cloneBgAndShow = async (bg) => this.emitEventWithBg(structuredClone(bg), this.emitBgShow);
|
|
67
67
|
emitEventWithBg = (bg, cb) => cb(bg);
|
|
68
68
|
emitBgSrcGet = (bg) => this.emit(this.EVENTS.LAYER_BG.SRC_GET, bg);
|
|
69
69
|
emitBgChange = (bg) => this.emit(this.EVENTS.LAYER_BG.CHANGE, bg);
|
package/package.json
CHANGED
package/src/modules/change.ts
CHANGED
|
@@ -19,7 +19,7 @@ export class LayerBgChange extends ModuleCore<BgPluginEvents, BgPluginConstants,
|
|
|
19
19
|
|
|
20
20
|
if (!realId) return;
|
|
21
21
|
|
|
22
|
-
const clonedArgs =
|
|
22
|
+
const clonedArgs = structuredClone(args);
|
|
23
23
|
|
|
24
24
|
const src = await this.emitOne(this.EVENTS.LAYER_BG.SRC_GET, { name, layer, args: clonedArgs });
|
|
25
25
|
|
package/src/modules/show.ts
CHANGED
|
@@ -14,7 +14,7 @@ export class LayerBgShow extends ModuleCore<BgPluginEvents, BgPluginConstants, B
|
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
onBgShow = async ({ name, layer, transition, duration, args = {}, hideOldBgsOnShow = true }: BgShowPayload = {}) => {
|
|
17
|
-
const clonedArgs =
|
|
17
|
+
const clonedArgs = structuredClone(args);
|
|
18
18
|
|
|
19
19
|
const shouldHideOldImages = hideOldBgsOnShow || clonedArgs.hideOldBgsOnShow;
|
|
20
20
|
|
package/src/modules/staff.ts
CHANGED
|
@@ -15,7 +15,7 @@ export class LayerBgStaff extends ModuleCore<BgPluginEvents, BgPluginConstants,
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
onBgGetSrc = async ({ name = "", args = {} }: BgSrcGetPayload = {}) => {
|
|
18
|
-
const clonedArgs =
|
|
18
|
+
const clonedArgs = structuredClone(args);
|
|
19
19
|
const injections = (await this.emitReals(this.EVENTS.LAYER_BG.ARGS_INJECT, { args: clonedArgs })) as BgArgsInject[];
|
|
20
20
|
const { overlays } = applyArgsInjections(clonedArgs, injections);
|
|
21
21
|
|
package/src/modules/state.ts
CHANGED
|
@@ -37,8 +37,8 @@ export class LayerBgState extends ModuleCore<BgPluginEvents, BgPluginConstants,
|
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
onStateSet = async (payload: ModuleGlobalStateRegistry) => {
|
|
40
|
-
const clonedStateOld =
|
|
41
|
-
const clonedStateNew =
|
|
40
|
+
const clonedStateOld = structuredClone(this.state);
|
|
41
|
+
const clonedStateNew = structuredClone(this.getStateSlice(payload));
|
|
42
42
|
|
|
43
43
|
await this.preloadState(clonedStateNew);
|
|
44
44
|
|
|
@@ -87,13 +87,13 @@ export class LayerBgState extends ModuleCore<BgPluginEvents, BgPluginConstants,
|
|
|
87
87
|
|
|
88
88
|
preloadState = (state: BgState) => Promise.all(state.bgs.map(this.emitBgSrcGet));
|
|
89
89
|
|
|
90
|
-
cloneBgAndChangeWithNewId = async (bg: BgRecord, id: string) => this.emitEventWithBg({ ...(
|
|
90
|
+
cloneBgAndChangeWithNewId = async (bg: BgRecord, id: string) => this.emitEventWithBg({ ...structuredClone(bg), id }, this.emitBgChange);
|
|
91
91
|
|
|
92
|
-
cloneBgAndChange = async (bg: BgRecord) => this.emitEventWithBg(
|
|
92
|
+
cloneBgAndChange = async (bg: BgRecord) => this.emitEventWithBg(structuredClone(bg), this.emitBgChange);
|
|
93
93
|
|
|
94
|
-
cloneBgAndHide = async (bg: BgRecord) => this.emitEventWithBg(
|
|
94
|
+
cloneBgAndHide = async (bg: BgRecord) => this.emitEventWithBg(structuredClone(bg), this.emitBgHide);
|
|
95
95
|
|
|
96
|
-
cloneBgAndShow = async (bg: BgRecord) => this.emitEventWithBg(
|
|
96
|
+
cloneBgAndShow = async (bg: BgRecord) => this.emitEventWithBg(structuredClone(bg), this.emitBgShow);
|
|
97
97
|
|
|
98
98
|
emitEventWithBg = (bg: BgRecord, cb: (bg: BgRecord) => unknown) => cb(bg);
|
|
99
99
|
|