@vnejs/compatibility.autoread-with-audio.voice 0.1.1
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 +16 -0
- package/dist/index.js +19 -0
- package/dist/types.d.ts +8 -0
- package/dist/types.js +1 -0
- package/dist/utils/audio.d.ts +8 -0
- package/dist/utils/audio.js +1 -0
- package/package.json +42 -0
- package/src/index.ts +32 -0
- package/src/types.ts +17 -0
- package/src/utils/audio.ts +10 -0
- package/tsconfig.json +6 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "@vnejs/contracts.audio";
|
|
2
|
+
import "@vnejs/contracts.audio.voice";
|
|
3
|
+
import "@vnejs/contracts.scenario.autoread";
|
|
4
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
5
|
+
import type { AutoreadSourcePayload } from "@vnejs/contracts.scenario.autoread";
|
|
6
|
+
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "./types.js";
|
|
7
|
+
import type { AudioEndedPayload, AudioLayerNamePayload, AudioPlayPayload } from "./utils/audio.js";
|
|
8
|
+
export declare class CompatibilityAutoreadVoice extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
|
|
9
|
+
name: string;
|
|
10
|
+
sourceArg: AutoreadSourcePayload;
|
|
11
|
+
subscribe: () => void;
|
|
12
|
+
onAudioPlay: ({ layer }?: AudioPlayPayload) => false | Promise<unknown[]> | undefined;
|
|
13
|
+
onAudioStop: ({ layer }?: AudioLayerNamePayload) => false | Promise<unknown[]> | undefined;
|
|
14
|
+
onAudioEnded: ({ layer }?: AudioEndedPayload) => false | Promise<unknown[]> | undefined;
|
|
15
|
+
isVoiceLayer: (layer?: string) => layer is "voice";
|
|
16
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "@vnejs/contracts.audio";
|
|
2
|
+
import "@vnejs/contracts.audio.voice";
|
|
3
|
+
import "@vnejs/contracts.scenario.autoread";
|
|
4
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
5
|
+
import { regModule } from "@vnejs/shared";
|
|
6
|
+
export class CompatibilityAutoreadVoice extends ModuleCore {
|
|
7
|
+
name = "compatibility.autoread-with-audio.voice";
|
|
8
|
+
sourceArg = { source: this.CONST.VOICE.SOURCE };
|
|
9
|
+
subscribe = () => {
|
|
10
|
+
this.on(this.EVENTS.AUDIO.PLAY, this.onAudioPlay);
|
|
11
|
+
this.on(this.EVENTS.AUDIO.STOP, this.onAudioStop);
|
|
12
|
+
this.on(this.EVENTS.AUDIO.ENDED, this.onAudioEnded);
|
|
13
|
+
};
|
|
14
|
+
onAudioPlay = ({ layer } = {}) => this.isVoiceLayer(layer) && this.emit(this.EVENTS.AUTOREAD.PUSH, this.sourceArg);
|
|
15
|
+
onAudioStop = ({ layer } = {}) => this.isVoiceLayer(layer) && this.emit(this.EVENTS.AUTOREAD.POP, this.sourceArg);
|
|
16
|
+
onAudioEnded = ({ layer } = {}) => this.isVoiceLayer(layer) && this.emit(this.EVENTS.AUTOREAD.POP, this.sourceArg);
|
|
17
|
+
isVoiceLayer = (layer) => layer === this.CONST.VOICE.LAYER;
|
|
18
|
+
}
|
|
19
|
+
regModule(CompatibilityAutoreadVoice);
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
|
|
2
|
+
import type { Constants as AudioConstants, PluginName as AudioPluginName, SubscribeEvents as AudioSubscribeEvents } from "@vnejs/contracts.audio";
|
|
3
|
+
import type { Constants as VoiceConstants, PluginName as VoicePluginName } from "@vnejs/contracts.audio.voice";
|
|
4
|
+
import type { PluginName as AutoreadPluginName, SubscribeEvents as AutoreadSubscribeEvents } from "@vnejs/contracts.scenario.autoread";
|
|
5
|
+
export type PluginEvents = ModuleCoreEvents & Record<AudioPluginName, AudioSubscribeEvents> & Record<AutoreadPluginName, AutoreadSubscribeEvents>;
|
|
6
|
+
export type PluginConstants = ModuleCoreConstants & Record<AudioPluginName, AudioConstants> & Record<VoicePluginName, VoiceConstants>;
|
|
7
|
+
export type PluginSettings = ModuleCoreSettings;
|
|
8
|
+
export type PluginParams = ModuleCoreParams;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vnejs/compatibility.autoread-with-audio.voice",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js",
|
|
11
|
+
"require": "./dist/index.js",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"src",
|
|
18
|
+
"tsconfig.json"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"test": "echo \"Error: no test specified\" && exit 1",
|
|
22
|
+
"build": "npx @vnejs/monorepo package",
|
|
23
|
+
"publish:major:plugin": "npm run publish:major",
|
|
24
|
+
"publish:minor:plugin": "npm run publish:minor",
|
|
25
|
+
"publish:patch:plugin": "npm run publish:patch",
|
|
26
|
+
"publish:major": "npx @vnejs/monorepo publish major --access public",
|
|
27
|
+
"publish:minor": "npx @vnejs/monorepo publish minor --access public",
|
|
28
|
+
"publish:patch": "npx @vnejs/monorepo publish patch --access public"
|
|
29
|
+
},
|
|
30
|
+
"author": "",
|
|
31
|
+
"license": "ISC",
|
|
32
|
+
"peerDependencies": {
|
|
33
|
+
"@vnejs/contracts.audio": "~0.1.0",
|
|
34
|
+
"@vnejs/contracts.audio.voice": "~0.1.0",
|
|
35
|
+
"@vnejs/contracts.scenario.autoread": "~0.1.0",
|
|
36
|
+
"@vnejs/module.core": "~0.1.0",
|
|
37
|
+
"@vnejs/shared": "~0.1.0"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@vnejs/configs.ts-common": "~0.1.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "@vnejs/contracts.audio";
|
|
2
|
+
import "@vnejs/contracts.audio.voice";
|
|
3
|
+
import "@vnejs/contracts.scenario.autoread";
|
|
4
|
+
|
|
5
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
6
|
+
import type { AutoreadSourcePayload } from "@vnejs/contracts.scenario.autoread";
|
|
7
|
+
import { regModule } from "@vnejs/shared";
|
|
8
|
+
|
|
9
|
+
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "./types.js";
|
|
10
|
+
import type { AudioEndedPayload, AudioLayerNamePayload, AudioPlayPayload } from "./utils/audio.js";
|
|
11
|
+
|
|
12
|
+
export class CompatibilityAutoreadVoice extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
|
|
13
|
+
name = "compatibility.autoread-with-audio.voice";
|
|
14
|
+
|
|
15
|
+
sourceArg: AutoreadSourcePayload = { source: this.CONST.VOICE.SOURCE };
|
|
16
|
+
|
|
17
|
+
subscribe = () => {
|
|
18
|
+
this.on(this.EVENTS.AUDIO.PLAY, this.onAudioPlay);
|
|
19
|
+
this.on(this.EVENTS.AUDIO.STOP, this.onAudioStop);
|
|
20
|
+
this.on(this.EVENTS.AUDIO.ENDED, this.onAudioEnded);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
onAudioPlay = ({ layer }: AudioPlayPayload = {}) => this.isVoiceLayer(layer) && this.emit(this.EVENTS.AUTOREAD.PUSH, this.sourceArg);
|
|
24
|
+
|
|
25
|
+
onAudioStop = ({ layer }: AudioLayerNamePayload = {}) => this.isVoiceLayer(layer) && this.emit(this.EVENTS.AUTOREAD.POP, this.sourceArg);
|
|
26
|
+
|
|
27
|
+
onAudioEnded = ({ layer }: AudioEndedPayload = {}) => this.isVoiceLayer(layer) && this.emit(this.EVENTS.AUTOREAD.POP, this.sourceArg);
|
|
28
|
+
|
|
29
|
+
isVoiceLayer = (layer?: string) => layer === this.CONST.VOICE.LAYER;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
regModule(CompatibilityAutoreadVoice);
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
|
|
2
|
+
import type { Constants as AudioConstants, PluginName as AudioPluginName, SubscribeEvents as AudioSubscribeEvents } from "@vnejs/contracts.audio";
|
|
3
|
+
import type { Constants as VoiceConstants, PluginName as VoicePluginName } from "@vnejs/contracts.audio.voice";
|
|
4
|
+
import type {
|
|
5
|
+
PluginName as AutoreadPluginName,
|
|
6
|
+
SubscribeEvents as AutoreadSubscribeEvents,
|
|
7
|
+
} from "@vnejs/contracts.scenario.autoread";
|
|
8
|
+
|
|
9
|
+
export type PluginEvents = ModuleCoreEvents &
|
|
10
|
+
Record<AudioPluginName, AudioSubscribeEvents> &
|
|
11
|
+
Record<AutoreadPluginName, AutoreadSubscribeEvents>;
|
|
12
|
+
|
|
13
|
+
export type PluginConstants = ModuleCoreConstants & Record<AudioPluginName, AudioConstants> & Record<VoicePluginName, VoiceConstants>;
|
|
14
|
+
|
|
15
|
+
export type PluginSettings = ModuleCoreSettings;
|
|
16
|
+
|
|
17
|
+
export type PluginParams = ModuleCoreParams;
|