@vnejs/plugins.text.smooth 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/index.js +2 -2
- package/dist/modules/cycle.d.ts +2 -2
- package/dist/modules/cycle.js +1 -1
- package/dist/modules/init.d.ts +1 -1
- package/dist/modules/init.js +1 -1
- package/dist/modules/{state.d.ts → smooth.d.ts} +1 -1
- package/dist/modules/{state.js → smooth.js} +1 -1
- package/package.json +1 -1
- package/src/index.ts +2 -2
- package/src/modules/cycle.ts +2 -2
- package/src/modules/init.ts +1 -1
- package/src/modules/{state.ts → smooth.ts} +1 -1
- package/src/tests/init.test.ts +7 -7
package/dist/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import { TextSmoothCycle } from "./modules/cycle.js";
|
|
|
6
6
|
import { TextSmoothEmitEnd } from "./modules/emit.end.js";
|
|
7
7
|
import { TextSmoothInit } from "./modules/init.js";
|
|
8
8
|
import { TextSmoothProcess } from "./modules/process.js";
|
|
9
|
-
import {
|
|
9
|
+
import { TextSmooth } from "./modules/smooth.js";
|
|
10
10
|
regPlugin(PLUGIN_NAME, { constants: CONSTANTS, events: SUBSCRIBE_EVENTS, settings: SETTINGS_KEYS, params: PARAMS }, [
|
|
11
11
|
TextSmoothInit,
|
|
12
|
-
|
|
12
|
+
TextSmooth,
|
|
13
13
|
TextSmoothProcess,
|
|
14
14
|
TextSmoothCycle,
|
|
15
15
|
TextSmoothEmitEnd,
|
package/dist/modules/cycle.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ModuleCore } from "@vnejs/module.core";
|
|
2
2
|
import type { TextSmoothPayload } from "@vnejs/contracts.text.smooth";
|
|
3
3
|
import type { TextSmoothPluginConstants, TextSmoothPluginEvents, TextSmoothPluginParams, TextSmoothPluginSettings } from "../types.js";
|
|
4
|
-
import type { TextSmoothCycleState } from "./
|
|
4
|
+
import type { TextSmoothCycleState } from "./smooth.js";
|
|
5
5
|
export declare class TextSmoothCycle extends ModuleCore<TextSmoothPluginEvents, TextSmoothPluginConstants, TextSmoothPluginSettings, TextSmoothPluginParams, TextSmoothCycleState> {
|
|
6
6
|
name: string;
|
|
7
7
|
textUpdateRaf: number | null;
|
|
8
8
|
subscribe: () => void;
|
|
9
|
-
|
|
9
|
+
setup: () => Promise<unknown[]> | undefined;
|
|
10
10
|
getSmoothState: () => import("@vnejs/contracts.text.smooth").ModuleGlobalStateTextSmooth;
|
|
11
11
|
onSmooth: ({ tokensVisible }?: TextSmoothPayload) => Promise<void>;
|
|
12
12
|
setUpdateTextRaf: (tokens?: TextSmoothPayload["tokens"]) => void;
|
package/dist/modules/cycle.js
CHANGED
|
@@ -8,7 +8,7 @@ export class TextSmoothCycle extends ModuleCore {
|
|
|
8
8
|
this.on(this.EVENTS.TEXT.EMIT_END, this.cancelRaf);
|
|
9
9
|
this.on(this.EVENTS.STATE.CLEAR, this.cancelRaf);
|
|
10
10
|
};
|
|
11
|
-
|
|
11
|
+
setup = () => this.emit(this.EVENTS.SETTINGS.INIT, {
|
|
12
12
|
name: this.SETTINGS.TEXT_SMOOTH.TOKEN_RENDER_SPEED,
|
|
13
13
|
value: this.PARAMS.TEXT_SMOOTH.DEFAULT_TOKEN_RENDER_SPEED,
|
|
14
14
|
});
|
package/dist/modules/init.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ 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
|
-
|
|
5
|
+
postinject: () => void;
|
|
6
6
|
}
|
package/dist/modules/init.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ModuleCore } from "@vnejs/module.core";
|
|
2
2
|
import type { ModuleGlobalStateTextSmooth } from "@vnejs/contracts.text.smooth";
|
|
3
3
|
import type { TextSmoothPluginConstants, TextSmoothPluginEvents, TextSmoothPluginParams, TextSmoothPluginSettings } from "../types.js";
|
|
4
|
-
export declare class
|
|
4
|
+
export declare class TextSmooth extends ModuleCore<TextSmoothPluginEvents, TextSmoothPluginConstants, TextSmoothPluginSettings, TextSmoothPluginParams, ModuleGlobalStateTextSmooth> {
|
|
5
5
|
name: string;
|
|
6
6
|
subscribe: () => void;
|
|
7
7
|
onStateClear: () => void;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -8,11 +8,11 @@ import { TextSmoothCycle } from "./modules/cycle.js";
|
|
|
8
8
|
import { TextSmoothEmitEnd } from "./modules/emit.end.js";
|
|
9
9
|
import { TextSmoothInit } from "./modules/init.js";
|
|
10
10
|
import { TextSmoothProcess } from "./modules/process.js";
|
|
11
|
-
import {
|
|
11
|
+
import { TextSmooth } from "./modules/smooth.js";
|
|
12
12
|
|
|
13
13
|
regPlugin(PLUGIN_NAME, { constants: CONSTANTS, events: SUBSCRIBE_EVENTS, settings: SETTINGS_KEYS, params: PARAMS }, [
|
|
14
14
|
TextSmoothInit,
|
|
15
|
-
|
|
15
|
+
TextSmooth,
|
|
16
16
|
TextSmoothProcess,
|
|
17
17
|
TextSmoothCycle,
|
|
18
18
|
TextSmoothEmitEnd,
|
package/src/modules/cycle.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ModuleCore } from "@vnejs/module.core";
|
|
|
2
2
|
import type { TextSmoothPayload } from "@vnejs/contracts.text.smooth";
|
|
3
3
|
|
|
4
4
|
import type { TextSmoothPluginConstants, TextSmoothPluginEvents, TextSmoothPluginParams, TextSmoothPluginSettings } from "../types.js";
|
|
5
|
-
import type { TextSmoothCycleState } from "./
|
|
5
|
+
import type { TextSmoothCycleState } from "./smooth.js";
|
|
6
6
|
|
|
7
7
|
export class TextSmoothCycle extends ModuleCore<
|
|
8
8
|
TextSmoothPluginEvents,
|
|
@@ -24,7 +24,7 @@ export class TextSmoothCycle extends ModuleCore<
|
|
|
24
24
|
this.on(this.EVENTS.STATE.CLEAR, this.cancelRaf);
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
setup = () =>
|
|
28
28
|
this.emit(this.EVENTS.SETTINGS.INIT, {
|
|
29
29
|
name: this.SETTINGS.TEXT_SMOOTH.TOKEN_RENDER_SPEED,
|
|
30
30
|
value: this.PARAMS.TEXT_SMOOTH.DEFAULT_TOKEN_RENDER_SPEED,
|
package/src/modules/init.ts
CHANGED
|
@@ -5,7 +5,7 @@ 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
|
-
|
|
8
|
+
postinject = () => {
|
|
9
9
|
this.shared.isTextSmoothInProcess = false;
|
|
10
10
|
};
|
|
11
11
|
}
|
|
@@ -3,7 +3,7 @@ import type { ModuleGlobalStateTextSmooth } from "@vnejs/contracts.text.smooth";
|
|
|
3
3
|
|
|
4
4
|
import type { TextSmoothPluginConstants, TextSmoothPluginEvents, TextSmoothPluginParams, TextSmoothPluginSettings } from "../types.js";
|
|
5
5
|
|
|
6
|
-
export class
|
|
6
|
+
export class TextSmooth extends ModuleCore<
|
|
7
7
|
TextSmoothPluginEvents,
|
|
8
8
|
TextSmoothPluginConstants,
|
|
9
9
|
TextSmoothPluginSettings,
|
package/src/tests/init.test.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it } from "vitest";
|
|
2
2
|
|
|
3
3
|
import { TextSmoothInit } from "../modules/init.js";
|
|
4
|
-
import {
|
|
4
|
+
import { TextSmooth } from "../modules/smooth.js";
|
|
5
5
|
import { createTextSmoothTestModule, registerTextSmoothPluginVne } from "./setup.js";
|
|
6
6
|
|
|
7
7
|
describe("TextSmoothInit", () => {
|
|
@@ -9,29 +9,29 @@ describe("TextSmoothInit", () => {
|
|
|
9
9
|
registerTextSmoothPluginVne();
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
it("
|
|
12
|
+
it("postinject resets isTextSmoothInProcess flag", () => {
|
|
13
13
|
const { module, shared } = createTextSmoothTestModule(TextSmoothInit, { subscribe: false });
|
|
14
14
|
|
|
15
15
|
shared.isTextSmoothInProcess = true;
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
(module as TextSmoothInit).postinject!();
|
|
18
18
|
|
|
19
19
|
expect(shared.isTextSmoothInProcess).toBe(false);
|
|
20
20
|
});
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
describe("
|
|
23
|
+
describe("TextSmooth", () => {
|
|
24
24
|
beforeEach(() => {
|
|
25
25
|
registerTextSmoothPluginVne();
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
it("STATE.CLEAR resets smooth state", async () => {
|
|
29
|
-
const { module, observer } = createTextSmoothTestModule(
|
|
29
|
+
const { module, observer } = createTextSmoothTestModule(TextSmooth);
|
|
30
30
|
|
|
31
|
-
(module as
|
|
31
|
+
(module as TextSmooth).setState({ tokensVisible: 5, tokensLength: 10, uid: "abc" });
|
|
32
32
|
|
|
33
33
|
await observer.emit("vne:state:clear");
|
|
34
34
|
|
|
35
|
-
expect((module as
|
|
35
|
+
expect((module as TextSmooth).state).toEqual({ tokensVisible: 0, tokensLength: 0, uid: "" });
|
|
36
36
|
});
|
|
37
37
|
});
|