@vnejs/plugins.text.wall 0.1.4 → 0.1.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.
- package/dist/modules/wall.d.ts +2 -1
- package/dist/modules/wall.js +5 -2
- package/package.json +1 -1
- package/src/modules/wall.ts +7 -2
package/dist/modules/wall.d.ts
CHANGED
|
@@ -6,13 +6,14 @@ import type { LineExecHandlerArg } from "@vnejs/module.core";
|
|
|
6
6
|
import type { TextWallPluginConstants, TextWallPluginEvents, TextWallPluginParams, TextWallPluginSettings } from "../types.js";
|
|
7
7
|
export declare class TextWall extends ModuleCore<TextWallPluginEvents, TextWallPluginConstants, TextWallPluginSettings, TextWallPluginParams, ModuleGlobalStateTextWall> {
|
|
8
8
|
name: string;
|
|
9
|
+
isSetStateInProcess: boolean;
|
|
9
10
|
subscribe: () => void;
|
|
10
11
|
init: () => Promise<[unknown[] | undefined, unknown[] | undefined]>;
|
|
11
12
|
emitWallChanged: () => Promise<unknown[]> | undefined;
|
|
12
13
|
onLineExec: ({ line }?: LineExecHandlerArg) => Promise<void>;
|
|
13
14
|
onTextEmitBefore: ({ isExtend }?: TextEmitBeforePayload) => Promise<void>;
|
|
14
15
|
onTextRecalc: () => Promise<unknown[] | undefined>;
|
|
15
|
-
onStateSet: (payload: ModuleGlobalStateRegistry) => Promise<
|
|
16
|
+
onStateSet: (payload: ModuleGlobalStateRegistry) => Promise<void>;
|
|
16
17
|
onStateClear: () => Promise<unknown[] | undefined>;
|
|
17
18
|
getRealText: (text: string, args: Record<string, unknown>) => Promise<string>;
|
|
18
19
|
recalcWallObjToken: (wallObj: WallElement) => Promise<{
|
package/dist/modules/wall.js
CHANGED
|
@@ -3,6 +3,7 @@ import { tokenizeExecLine, tokenizeText } from "@vnejs/helpers";
|
|
|
3
3
|
import { getTextSpeakerInfo } from "@vnejs/contracts.text";
|
|
4
4
|
export class TextWall extends ModuleCore {
|
|
5
5
|
name = "text.wall";
|
|
6
|
+
isSetStateInProcess = false;
|
|
6
7
|
subscribe = () => {
|
|
7
8
|
this.on(this.EVENTS.TEXT.RECALC, this.onTextRecalc);
|
|
8
9
|
this.on(this.EVENTS.STATE.CLEAR, this.onStateClear);
|
|
@@ -25,7 +26,7 @@ export class TextWall extends ModuleCore {
|
|
|
25
26
|
this.emitNext();
|
|
26
27
|
};
|
|
27
28
|
onTextEmitBefore = async ({ isExtend = false } = {}) => {
|
|
28
|
-
if (isExtend || !this.state.isStarted)
|
|
29
|
+
if (isExtend || !this.state.isStarted || this.isSetStateInProcess)
|
|
29
30
|
return;
|
|
30
31
|
if (this.state.shouldSkip)
|
|
31
32
|
return this.updateState({ shouldSkip: false });
|
|
@@ -45,8 +46,10 @@ export class TextWall extends ModuleCore {
|
|
|
45
46
|
return this.emitWallChanged();
|
|
46
47
|
};
|
|
47
48
|
onStateSet = async (payload) => {
|
|
49
|
+
this.isSetStateInProcess = true;
|
|
48
50
|
await this.onSetStateClone(payload);
|
|
49
|
-
|
|
51
|
+
await this.emitWallChanged();
|
|
52
|
+
this.isSetStateInProcess = false;
|
|
50
53
|
};
|
|
51
54
|
onStateClear = async () => {
|
|
52
55
|
this.setDefaultState();
|
package/package.json
CHANGED
package/src/modules/wall.ts
CHANGED
|
@@ -18,6 +18,8 @@ export class TextWall extends ModuleCore<
|
|
|
18
18
|
> {
|
|
19
19
|
name = "text.wall";
|
|
20
20
|
|
|
21
|
+
isSetStateInProcess = false;
|
|
22
|
+
|
|
21
23
|
subscribe = () => {
|
|
22
24
|
this.on(this.EVENTS.TEXT.RECALC, this.onTextRecalc);
|
|
23
25
|
|
|
@@ -46,7 +48,7 @@ export class TextWall extends ModuleCore<
|
|
|
46
48
|
};
|
|
47
49
|
|
|
48
50
|
onTextEmitBefore = async ({ isExtend = false }: TextEmitBeforePayload = {}) => {
|
|
49
|
-
if (isExtend || !this.state.isStarted) return;
|
|
51
|
+
if (isExtend || !this.state.isStarted || this.isSetStateInProcess) return;
|
|
50
52
|
if (this.state.shouldSkip) return this.updateState({ shouldSkip: false });
|
|
51
53
|
|
|
52
54
|
const { texts, tokens, uid } = this.globalState.text;
|
|
@@ -71,9 +73,12 @@ export class TextWall extends ModuleCore<
|
|
|
71
73
|
};
|
|
72
74
|
|
|
73
75
|
onStateSet = async (payload: ModuleGlobalStateRegistry) => {
|
|
76
|
+
this.isSetStateInProcess = true;
|
|
77
|
+
|
|
74
78
|
await this.onSetStateClone(payload);
|
|
79
|
+
await this.emitWallChanged();
|
|
75
80
|
|
|
76
|
-
|
|
81
|
+
this.isSetStateInProcess = false;
|
|
77
82
|
};
|
|
78
83
|
|
|
79
84
|
onStateClear = async () => {
|