@vnejs/plugins.text.smooth 0.2.3 → 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.
- package/dist/modules/cycle.d.ts +5 -5
- package/dist/modules/cycle.js +10 -10
- package/dist/modules/emit.end.d.ts +2 -2
- package/dist/modules/init.d.ts +1 -0
- package/dist/modules/init.js +1 -0
- package/package.json +1 -1
- package/src/modules/cycle.ts +13 -15
- package/src/modules/emit.end.ts +1 -1
- package/src/modules/init.ts +2 -0
- package/dist/utils/smooth.d.ts +0 -3
- package/dist/utils/smooth.js +0 -1
- package/src/utils/smooth.ts +0 -3
package/dist/modules/cycle.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ export declare class TextSmoothCycle extends ModuleCore<TextSmoothPluginEvents,
|
|
|
6
6
|
name: string;
|
|
7
7
|
textUpdateRaf: number | null;
|
|
8
8
|
subscribe: () => void;
|
|
9
|
-
setup: () => Promise<
|
|
10
|
-
getSmoothState: () => import("@vnejs/contracts.text.smooth").ModuleGlobalStateTextSmooth;
|
|
9
|
+
setup: () => Promise<import("@vnejs/shared").EmitResults<"vne:settings:init">> | undefined;
|
|
11
10
|
onSmooth: ({ tokensVisible }?: TextSmoothPayload) => Promise<void>;
|
|
12
|
-
|
|
13
|
-
createUpdateTextFunc: (tokens?: TextSmoothPayload["tokens"]) => Promise<void | unknown[]>;
|
|
11
|
+
onCancel: () => Promise<import("@vnejs/shared").EmitResults<"vne:text:smooth_done">> | undefined;
|
|
14
12
|
cancelRaf: () => void;
|
|
15
|
-
|
|
13
|
+
getSmoothState: () => import("@vnejs/contracts.text.smooth").ModuleGlobalStateTextSmooth;
|
|
14
|
+
setUpdateTextRaf: (tokens?: TextSmoothPayload["tokens"]) => void;
|
|
15
|
+
createUpdateTextFunc: (tokens?: TextSmoothPayload["tokens"]) => Promise<void | import("@vnejs/shared").EmitResults<"vne:text:smooth_done">>;
|
|
16
16
|
}
|
package/dist/modules/cycle.js
CHANGED
|
@@ -12,7 +12,6 @@ export class TextSmoothCycle extends ModuleCore {
|
|
|
12
12
|
name: this.SETTINGS.TEXT_SMOOTH.TOKEN_RENDER_SPEED,
|
|
13
13
|
value: this.PARAMS.TEXT_SMOOTH.DEFAULT_TOKEN_RENDER_SPEED,
|
|
14
14
|
});
|
|
15
|
-
getSmoothState = () => this.globalState["text.smooth"];
|
|
16
15
|
onSmooth = async ({ tokensVisible = 0 } = {}) => {
|
|
17
16
|
const { tokens = [], uid = "" } = this.globalState.text;
|
|
18
17
|
const smoothState = this.getSmoothState();
|
|
@@ -22,6 +21,16 @@ export class TextSmoothCycle extends ModuleCore {
|
|
|
22
21
|
this.setState({ lastTs: new Date().getTime() });
|
|
23
22
|
this.setUpdateTextRaf(tokens);
|
|
24
23
|
};
|
|
24
|
+
onCancel = () => {
|
|
25
|
+
this.cancelRaf();
|
|
26
|
+
return this.emit(this.EVENTS.TEXT_SMOOTH.DONE);
|
|
27
|
+
};
|
|
28
|
+
cancelRaf = () => {
|
|
29
|
+
if (this.textUpdateRaf !== null)
|
|
30
|
+
cancelAnimationFrame(this.textUpdateRaf);
|
|
31
|
+
this.textUpdateRaf = null;
|
|
32
|
+
};
|
|
33
|
+
getSmoothState = () => this.globalState["text.smooth"];
|
|
25
34
|
setUpdateTextRaf = (tokens = []) => {
|
|
26
35
|
this.textUpdateRaf = requestAnimationFrame(() => void this.createUpdateTextFunc(tokens));
|
|
27
36
|
};
|
|
@@ -48,13 +57,4 @@ export class TextSmoothCycle extends ModuleCore {
|
|
|
48
57
|
this.updateState({ lastTs: ts - (diff % delayForOneChar) });
|
|
49
58
|
return this.setUpdateTextRaf(tokens);
|
|
50
59
|
};
|
|
51
|
-
cancelRaf = () => {
|
|
52
|
-
if (this.textUpdateRaf !== null)
|
|
53
|
-
cancelAnimationFrame(this.textUpdateRaf);
|
|
54
|
-
this.textUpdateRaf = null;
|
|
55
|
-
};
|
|
56
|
-
onCancel = () => {
|
|
57
|
-
this.cancelRaf();
|
|
58
|
-
return this.emit(this.EVENTS.TEXT_SMOOTH.DONE);
|
|
59
|
-
};
|
|
60
60
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ModuleCore } from "@vnejs/module.core";
|
|
2
|
+
import type { TextEmitEndPayload } from "@vnejs/contracts.text";
|
|
2
3
|
import type { TextSmoothPluginConstants, TextSmoothPluginEvents, TextSmoothPluginParams, TextSmoothPluginSettings } from "../types.js";
|
|
3
|
-
import type { TextEmitEndPayload } from "../utils/smooth.js";
|
|
4
4
|
export declare class TextSmoothEmitEnd extends ModuleCore<TextSmoothPluginEvents, TextSmoothPluginConstants, TextSmoothPluginSettings, TextSmoothPluginParams> {
|
|
5
5
|
name: string;
|
|
6
6
|
subscribe: () => void;
|
|
7
7
|
onTextEmitEnd: ({ isForced }?: TextEmitEndPayload) => Promise<void>;
|
|
8
|
-
onTextRecalcDone: () => Promise<
|
|
8
|
+
onTextRecalcDone: () => Promise<import("@vnejs/shared").EmitResults<"vne:text:smooth_changed"> | undefined>;
|
|
9
9
|
}
|
package/dist/modules/init.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ import { ModuleCore } from "@vnejs/module.core";
|
|
|
2
2
|
import type { TextSmoothPluginConstants, TextSmoothPluginEvents, TextSmoothPluginParams, TextSmoothPluginSettings } from "../types.js";
|
|
3
3
|
export declare class TextSmoothInit extends ModuleCore<TextSmoothPluginEvents, TextSmoothPluginConstants, TextSmoothPluginSettings, TextSmoothPluginParams> {
|
|
4
4
|
name: string;
|
|
5
|
+
isDestroyAfterStart: boolean;
|
|
5
6
|
postinject: () => void;
|
|
6
7
|
}
|
package/dist/modules/init.js
CHANGED
package/package.json
CHANGED
package/src/modules/cycle.ts
CHANGED
|
@@ -30,8 +30,6 @@ export class TextSmoothCycle extends ModuleCore<
|
|
|
30
30
|
value: this.PARAMS.TEXT_SMOOTH.DEFAULT_TOKEN_RENDER_SPEED,
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
getSmoothState = () => this.globalState["text.smooth"];
|
|
34
|
-
|
|
35
33
|
onSmooth = async ({ tokensVisible = 0 }: TextSmoothPayload = {}) => {
|
|
36
34
|
const { tokens = [], uid = "" } = this.globalState.text;
|
|
37
35
|
const smoothState = this.getSmoothState();
|
|
@@ -45,10 +43,22 @@ export class TextSmoothCycle extends ModuleCore<
|
|
|
45
43
|
this.setUpdateTextRaf(tokens);
|
|
46
44
|
};
|
|
47
45
|
|
|
46
|
+
onCancel = () => {
|
|
47
|
+
this.cancelRaf();
|
|
48
|
+
|
|
49
|
+
return this.emit(this.EVENTS.TEXT_SMOOTH.DONE);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
cancelRaf = () => {
|
|
53
|
+
if (this.textUpdateRaf !== null) cancelAnimationFrame(this.textUpdateRaf);
|
|
54
|
+
|
|
55
|
+
this.textUpdateRaf = null;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
getSmoothState = () => this.globalState["text.smooth"];
|
|
48
59
|
setUpdateTextRaf = (tokens: TextSmoothPayload["tokens"] = []) => {
|
|
49
60
|
this.textUpdateRaf = requestAnimationFrame(() => void this.createUpdateTextFunc(tokens));
|
|
50
61
|
};
|
|
51
|
-
|
|
52
62
|
createUpdateTextFunc = async (tokens: TextSmoothPayload["tokens"] = []) => {
|
|
53
63
|
const { lastTs = 0 } = this.state;
|
|
54
64
|
|
|
@@ -83,16 +93,4 @@ export class TextSmoothCycle extends ModuleCore<
|
|
|
83
93
|
|
|
84
94
|
return this.setUpdateTextRaf(tokens);
|
|
85
95
|
};
|
|
86
|
-
|
|
87
|
-
cancelRaf = () => {
|
|
88
|
-
if (this.textUpdateRaf !== null) cancelAnimationFrame(this.textUpdateRaf);
|
|
89
|
-
|
|
90
|
-
this.textUpdateRaf = null;
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
onCancel = () => {
|
|
94
|
-
this.cancelRaf();
|
|
95
|
-
|
|
96
|
-
return this.emit(this.EVENTS.TEXT_SMOOTH.DONE);
|
|
97
|
-
};
|
|
98
96
|
}
|
package/src/modules/emit.end.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModuleCore } from "@vnejs/module.core";
|
|
2
|
+
import type { TextEmitEndPayload } from "@vnejs/contracts.text";
|
|
2
3
|
|
|
3
4
|
import type { TextSmoothPluginConstants, TextSmoothPluginEvents, TextSmoothPluginParams, TextSmoothPluginSettings } from "../types.js";
|
|
4
|
-
import type { TextEmitEndPayload } from "../utils/smooth.js";
|
|
5
5
|
|
|
6
6
|
export class TextSmoothEmitEnd extends ModuleCore<TextSmoothPluginEvents, TextSmoothPluginConstants, TextSmoothPluginSettings, TextSmoothPluginParams> {
|
|
7
7
|
name = "text.smooth.emit.end";
|
package/src/modules/init.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { TextSmoothPluginConstants, TextSmoothPluginEvents, TextSmoothPlugi
|
|
|
5
5
|
export class TextSmoothInit extends ModuleCore<TextSmoothPluginEvents, TextSmoothPluginConstants, TextSmoothPluginSettings, TextSmoothPluginParams> {
|
|
6
6
|
name = "text.smooth.init";
|
|
7
7
|
|
|
8
|
+
isDestroyAfterStart = true;
|
|
9
|
+
|
|
8
10
|
postinject = () => {
|
|
9
11
|
this.shared.isTextSmoothInProcess = false;
|
|
10
12
|
};
|
package/dist/utils/smooth.d.ts
DELETED
package/dist/utils/smooth.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/src/utils/smooth.ts
DELETED