@vnejs/compatibility.text-with-audio.voice 0.2.0 → 0.2.2

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.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from
7
7
  type CompatState = {
8
8
  currentName: string;
9
9
  };
10
- export declare class CompatibilityTextVoice extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams, CompatState> {
10
+ export declare class CompatibilityTextWithAudioVoice extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams, CompatState> {
11
11
  name: string;
12
12
  subscribe: () => void;
13
13
  init: () => Promise<[unknown[] | undefined, unknown[] | undefined]>;
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import { ModuleCore } from "@vnejs/module.core";
5
5
  import { SETTINGS_KEYS as VOICE_SETTINGS_KEYS } from "@vnejs/contracts.audio.voice";
6
6
  import { regModule } from "@vnejs/shared";
7
7
  import { resolveVoicePath } from "./utils/voice.js";
8
- export class CompatibilityTextVoice extends ModuleCore {
8
+ export class CompatibilityTextWithAudioVoice extends ModuleCore {
9
9
  name = "compatibility.text-with-audio.voice";
10
10
  subscribe = () => {
11
11
  this.on(this.EVENTS.TEXT.EMIT, this.onTextEmit);
@@ -53,7 +53,7 @@ export class CompatibilityTextVoice extends ModuleCore {
53
53
  };
54
54
  getDefaultState = () => ({ currentName: "" });
55
55
  getVoiceFromPayload = ({ args = {}, isExtend = false, texts = [] } = {}) => {
56
- const lineArgs = isExtend && texts.length ? texts[texts.length - 1]?.args ?? {} : args;
56
+ const lineArgs = isExtend && texts.length ? (texts[texts.length - 1]?.args ?? {}) : args;
57
57
  return this.getVoiceArg(lineArgs);
58
58
  };
59
59
  getVoiceArg = (args = {}) => {
@@ -62,4 +62,4 @@ export class CompatibilityTextVoice extends ModuleCore {
62
62
  };
63
63
  getVoiceVolume = () => this.shared.settings[VOICE_SETTINGS_KEYS.VOLUME] ?? 100;
64
64
  }
65
- regModule(CompatibilityTextVoice);
65
+ regModule(CompatibilityTextWithAudioVoice);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/compatibility.text-with-audio.voice",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -14,7 +14,7 @@ type CompatState = {
14
14
  currentName: string;
15
15
  };
16
16
 
17
- export class CompatibilityTextVoice extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams, CompatState> {
17
+ export class CompatibilityTextWithAudioVoice extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams, CompatState> {
18
18
  name = "compatibility.text-with-audio.voice";
19
19
 
20
20
  subscribe = () => {
@@ -82,7 +82,7 @@ export class CompatibilityTextVoice extends ModuleCore<PluginEvents, PluginConst
82
82
  getDefaultState = (): CompatState => ({ currentName: "" });
83
83
 
84
84
  getVoiceFromPayload = ({ args = {}, isExtend = false, texts = [] }: TextEmitPayload = {}) => {
85
- const lineArgs = isExtend && texts.length ? texts[texts.length - 1]?.args ?? {} : args;
85
+ const lineArgs = isExtend && texts.length ? (texts[texts.length - 1]?.args ?? {}) : args;
86
86
 
87
87
  return this.getVoiceArg(lineArgs);
88
88
  };
@@ -96,4 +96,4 @@ export class CompatibilityTextVoice extends ModuleCore<PluginEvents, PluginConst
96
96
  getVoiceVolume = () => (this.shared.settings[VOICE_SETTINGS_KEYS.VOLUME] as number | undefined) ?? 100;
97
97
  }
98
98
 
99
- regModule(CompatibilityTextVoice);
99
+ regModule(CompatibilityTextWithAudioVoice);
@@ -4,14 +4,14 @@ import { spyEvent } from "@vnejs/test-utils";
4
4
 
5
5
  import { SourcesSet } from "@vnejs/sources-set";
6
6
 
7
- import { CompatibilityTextVoice } from "../index.js";
7
+ import { CompatibilityTextWithAudioVoice } from "../index.js";
8
8
  import { AUDIO_EVENTS, createCompatibilityTestModule, registerCompatibilityVne, TEXT_EVENTS, VOICE_CONST } from "./setup.js";
9
9
 
10
- describe("CompatibilityTextVoice", () => {
10
+ describe("CompatibilityTextWithAudioVoice", () => {
11
11
  beforeEach(() => registerCompatibilityVne());
12
12
 
13
13
  it("TEXT.EMIT with voice plays on voice layer", async () => {
14
- const { observer } = createCompatibilityTestModule(CompatibilityTextVoice);
14
+ const { observer } = createCompatibilityTestModule(CompatibilityTextWithAudioVoice);
15
15
  const play = spyEvent(observer, AUDIO_EVENTS.PLAY);
16
16
 
17
17
  await observer.emit(TEXT_EVENTS.EMIT, { args: { voice: "line1" } });
@@ -24,7 +24,7 @@ describe("CompatibilityTextVoice", () => {
24
24
  const disableSources = new SourcesSet();
25
25
  disableSources.set("blocker", true);
26
26
 
27
- const { observer } = createCompatibilityTestModule(CompatibilityTextVoice, {
27
+ const { observer } = createCompatibilityTestModule(CompatibilityTextWithAudioVoice, {
28
28
  shared: { voiceDisableSources: disableSources },
29
29
  });
30
30
  const play = spyEvent(observer, AUDIO_EVENTS.PLAY);
@@ -1,6 +1,12 @@
1
1
  import { SUBSCRIBE_EVENTS as AUDIO_EVENTS, PLUGIN_NAME as AUDIO } from "@vnejs/contracts.audio";
2
2
  import { CONSTANTS as VOICE_CONST, PARAMS as VOICE_PARAMS, PLUGIN_NAME as VOICE, SETTINGS_KEYS as VOICE_SETTINGS } from "@vnejs/contracts.audio.voice";
3
- import { CONSTANTS as TEXT_CONST, PARAMS as TEXT_PARAMS, PLUGIN_NAME as TEXT, SETTINGS_KEYS as TEXT_SETTINGS, SUBSCRIBE_EVENTS as TEXT_EVENTS } from "@vnejs/contracts.text";
3
+ import {
4
+ CONSTANTS as TEXT_CONST,
5
+ PARAMS as TEXT_PARAMS,
6
+ PLUGIN_NAME as TEXT,
7
+ SETTINGS_KEYS as TEXT_SETTINGS,
8
+ SUBSCRIBE_EVENTS as TEXT_EVENTS,
9
+ } from "@vnejs/contracts.text";
4
10
  import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin } from "@vnejs/test-utils";
5
11
  import { SourcesSet } from "@vnejs/sources-set";
6
12
 
package/src/types.ts CHANGED
@@ -3,9 +3,7 @@ import type { Constants as AudioConstants, PluginName as AudioPluginName, Subscr
3
3
  import type { Constants as VoiceConstants, PluginName as VoicePluginName } from "@vnejs/contracts.audio.voice";
4
4
  import type { Constants as TextConstants, PluginName as TextPluginName, SubscribeEvents as TextSubscribeEvents } from "@vnejs/contracts.text";
5
5
 
6
- export type PluginEvents = ModuleCoreEvents &
7
- Record<TextPluginName, TextSubscribeEvents> &
8
- Record<AudioPluginName, AudioSubscribeEvents>;
6
+ export type PluginEvents = ModuleCoreEvents & Record<TextPluginName, TextSubscribeEvents> & Record<AudioPluginName, AudioSubscribeEvents>;
9
7
 
10
8
  export type PluginConstants = ModuleCoreConstants &
11
9
  Record<TextPluginName, TextConstants> &
package/tsconfig.json CHANGED
@@ -4,12 +4,6 @@
4
4
  "rootDir": "src",
5
5
  "outDir": "dist"
6
6
  },
7
- "include": [
8
- "src/**/*.ts"
9
- ],
10
- "exclude": [
11
- "dist",
12
- "node_modules",
13
- "src/tests"
14
- ]
7
+ "include": ["src/**/*.ts"],
8
+ "exclude": ["dist", "node_modules", "src/tests"]
15
9
  }