@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 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 { TextSmoothState } from "./modules/state.js";
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
- TextSmoothState,
12
+ TextSmooth,
13
13
  TextSmoothProcess,
14
14
  TextSmoothCycle,
15
15
  TextSmoothEmitEnd,
@@ -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 "./state.js";
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
- init: () => Promise<unknown[]> | undefined;
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;
@@ -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
- init = () => this.emit(this.EVENTS.SETTINGS.INIT, {
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
  });
@@ -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
- init: () => void;
5
+ postinject: () => void;
6
6
  }
@@ -1,7 +1,7 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
2
  export class TextSmoothInit extends ModuleCore {
3
3
  name = "text.smooth.init";
4
- init = () => {
4
+ postinject = () => {
5
5
  this.shared.isTextSmoothInProcess = false;
6
6
  };
7
7
  }
@@ -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 TextSmoothState extends ModuleCore<TextSmoothPluginEvents, TextSmoothPluginConstants, TextSmoothPluginSettings, TextSmoothPluginParams, ModuleGlobalStateTextSmooth> {
4
+ export declare class TextSmooth extends ModuleCore<TextSmoothPluginEvents, TextSmoothPluginConstants, TextSmoothPluginSettings, TextSmoothPluginParams, ModuleGlobalStateTextSmooth> {
5
5
  name: string;
6
6
  subscribe: () => void;
7
7
  onStateClear: () => void;
@@ -1,5 +1,5 @@
1
1
  import { ModuleCore } from "@vnejs/module.core";
2
- export class TextSmoothState extends ModuleCore {
2
+ export class TextSmooth extends ModuleCore {
3
3
  name = "text.smooth";
4
4
  subscribe = () => {
5
5
  this.on(this.EVENTS.STATE.CLEAR, this.onStateClear);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.text.smooth",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
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 { TextSmoothState } from "./modules/state.js";
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
- TextSmoothState,
15
+ TextSmooth,
16
16
  TextSmoothProcess,
17
17
  TextSmoothCycle,
18
18
  TextSmoothEmitEnd,
@@ -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 "./state.js";
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
- init = () =>
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,
@@ -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
- init = () => {
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 TextSmoothState extends ModuleCore<
6
+ export class TextSmooth extends ModuleCore<
7
7
  TextSmoothPluginEvents,
8
8
  TextSmoothPluginConstants,
9
9
  TextSmoothPluginSettings,
@@ -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 { TextSmoothState } from "../modules/state.js";
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("init resets isTextSmoothInProcess flag", async () => {
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
- await (module as TextSmoothInit).init();
17
+ (module as TextSmoothInit).postinject!();
18
18
 
19
19
  expect(shared.isTextSmoothInProcess).toBe(false);
20
20
  });
21
21
  });
22
22
 
23
- describe("TextSmoothState", () => {
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(TextSmoothState);
29
+ const { module, observer } = createTextSmoothTestModule(TextSmooth);
30
30
 
31
- (module as TextSmoothState).setState({ tokensVisible: 5, tokensLength: 10, uid: "abc" });
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 TextSmoothState).state).toEqual({ tokensVisible: 0, tokensLength: 0, uid: "" });
35
+ expect((module as TextSmooth).state).toEqual({ tokensVisible: 0, tokensLength: 0, uid: "" });
36
36
  });
37
37
  });