@vnejs/bridge.plugins.text.plugins.canvas.child.bg.speak 0.0.0-stage → 0.2.4

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.
@@ -0,0 +1,2 @@
1
+ import "@vnejs/contracts.canvas.child.bg.speak";
2
+ import "@vnejs/contracts.text";
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ import "@vnejs/contracts.canvas.child.bg.speak";
2
+ import "@vnejs/contracts.text";
3
+ import { regPlugin } from "@vnejs/registry";
4
+ import { BridgePluginTextPluginLayerBgSpeak } from "./modules/bridge_plugin_text_plugin_layer_bg_speak.js";
5
+ const PLUGIN_NAME = "BRIDGE_PLUGIN_TEXT_PLUGIN_LAYER_BG_SPEAK";
6
+ regPlugin(PLUGIN_NAME, {}, [BridgePluginTextPluginLayerBgSpeak]);
@@ -0,0 +1,13 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ import type { TextEmitPayload } from "@vnejs/contracts.text";
3
+ import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
4
+ export declare class BridgePluginTextPluginLayerBgSpeak extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
5
+ name: string;
6
+ sourceArg: {
7
+ source: "text";
8
+ };
9
+ subscribe: () => void;
10
+ onTextEmit: ({ speaker }?: TextEmitPayload) => Promise<void>;
11
+ onTextEmitProcess: () => Promise<import("@vnejs/registry").EmitResults<"vne:layer_bg_speak:push">> | undefined;
12
+ onTextEmitEnd: () => Promise<import("@vnejs/registry").EmitResults<"vne:layer_bg_speak:pop">> | undefined;
13
+ }
@@ -0,0 +1,16 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ export class BridgePluginTextPluginLayerBgSpeak extends ModuleCore {
3
+ name = "bridge_plugin_text_plugin_layer_bg_speak";
4
+ sourceArg = { source: this.CONST.TEXT.SOURCE };
5
+ subscribe = () => {
6
+ this.on(this.EVENTS.TEXT.EMIT, this.onTextEmit);
7
+ this.on(this.EVENTS.TEXT.EMIT_PROCESS, this.onTextEmitProcess);
8
+ this.on(this.EVENTS.TEXT.EMIT_END, this.onTextEmitEnd);
9
+ };
10
+ onTextEmit = async ({ speaker = "" } = {}) => {
11
+ if (speaker)
12
+ await this.emit(this.EVENTS.LAYER_BG_SPEAK.SPEAKER, { speaker });
13
+ };
14
+ onTextEmitProcess = () => this.emit(this.EVENTS.LAYER_BG_SPEAK.PUSH, this.sourceArg);
15
+ onTextEmitEnd = () => this.emit(this.EVENTS.LAYER_BG_SPEAK.POP, this.sourceArg);
16
+ }
@@ -0,0 +1,7 @@
1
+ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
2
+ import type { PluginName as BgSpeakPluginName, SubscribeEvents as BgSpeakSubscribeEvents } from "@vnejs/contracts.canvas.child.bg.speak";
3
+ import type { Constants as TextConstants, PluginName as TextPluginName, SubscribeEvents as TextSubscribeEvents } from "@vnejs/contracts.text";
4
+ export type PluginEvents = ModuleCoreEvents & Record<BgSpeakPluginName, BgSpeakSubscribeEvents> & Record<TextPluginName, TextSubscribeEvents>;
5
+ export type PluginConstants = ModuleCoreConstants & Record<TextPluginName, TextConstants>;
6
+ export type PluginSettings = ModuleCoreSettings;
7
+ export type PluginParams = ModuleCoreParams;
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,43 @@
1
1
  {
2
2
  "name": "@vnejs/bridge.plugins.text.plugins.canvas.child.bg.speak",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.4",
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": "npx @vnejs/monorepo test",
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/module.core": "~0.2.0",
34
+ "@vnejs/contracts.canvas.child.bg.speak": "~0.2.0",
35
+ "@vnejs/contracts.text": "~0.2.0",
36
+ "@vnejs/registry": "~0.2.0"
37
+ },
38
+ "devDependencies": {
39
+ "@vnejs/configs.ts-common": "~0.2.0",
40
+ "@vnejs/configs.vitest": "~0.2.0",
41
+ "@vnejs/test-utils": "~0.2.0"
42
+ }
43
+ }
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ import "@vnejs/contracts.canvas.child.bg.speak";
2
+ import "@vnejs/contracts.text";
3
+
4
+ import { regPlugin } from "@vnejs/registry";
5
+
6
+ import { BridgePluginTextPluginLayerBgSpeak } from "./modules/bridge_plugin_text_plugin_layer_bg_speak.js";
7
+
8
+ const PLUGIN_NAME = "BRIDGE_PLUGIN_TEXT_PLUGIN_LAYER_BG_SPEAK";
9
+
10
+ regPlugin(PLUGIN_NAME, {}, [BridgePluginTextPluginLayerBgSpeak]);
@@ -0,0 +1,24 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ import type { TextEmitPayload } from "@vnejs/contracts.text";
3
+
4
+ import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
5
+
6
+ export class BridgePluginTextPluginLayerBgSpeak extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
7
+ name = "bridge_plugin_text_plugin_layer_bg_speak";
8
+
9
+ sourceArg = { source: this.CONST.TEXT.SOURCE };
10
+
11
+ subscribe = () => {
12
+ this.on(this.EVENTS.TEXT.EMIT, this.onTextEmit);
13
+ this.on(this.EVENTS.TEXT.EMIT_PROCESS, this.onTextEmitProcess);
14
+ this.on(this.EVENTS.TEXT.EMIT_END, this.onTextEmitEnd);
15
+ };
16
+
17
+ onTextEmit = async ({ speaker = "" }: TextEmitPayload = {}) => {
18
+ if (speaker) await this.emit(this.EVENTS.LAYER_BG_SPEAK.SPEAKER, { speaker });
19
+ };
20
+
21
+ onTextEmitProcess = () => this.emit(this.EVENTS.LAYER_BG_SPEAK.PUSH, this.sourceArg);
22
+
23
+ onTextEmitEnd = () => this.emit(this.EVENTS.LAYER_BG_SPEAK.POP, this.sourceArg);
24
+ }
@@ -0,0 +1,32 @@
1
+ import { beforeEach, describe, expect, it, vi } from "vitest";
2
+
3
+ import { spyEvent } from "@vnejs/test-utils";
4
+
5
+ import { BridgePluginTextPluginLayerBgSpeak } from "../modules/bridge_plugin_text_plugin_layer_bg_speak.js";
6
+ import { createCompatibilityTestModule, LAYER_EVENTS, registerCompatibilityVne, TEXT_CONST, TEXT_EVENTS } from "./setup.js";
7
+
8
+ describe("BridgePluginTextPluginLayerBgSpeak", () => {
9
+ beforeEach(() => registerCompatibilityVne());
10
+
11
+ it("TEXT.EMIT with speaker emits LAYER_BG_SPEAK.SPEAKER", async () => {
12
+ const { observer } = createCompatibilityTestModule(BridgePluginTextPluginLayerBgSpeak);
13
+ const speaker = spyEvent(observer, LAYER_EVENTS.SPEAKER);
14
+
15
+ await observer.emit(TEXT_EVENTS.EMIT, { speaker: "hero" });
16
+
17
+ expect(speaker).toHaveBeenCalledOnce();
18
+ expect(speaker).toHaveBeenCalledWith({ speaker: "hero" });
19
+ });
20
+
21
+ it("TEXT.EMIT_PROCESS and EMIT_END push and pop text source", async () => {
22
+ const { observer } = createCompatibilityTestModule(BridgePluginTextPluginLayerBgSpeak);
23
+ const push = spyEvent(observer, LAYER_EVENTS.PUSH);
24
+ const pop = spyEvent(observer, LAYER_EVENTS.POP);
25
+
26
+ await observer.emit(TEXT_EVENTS.EMIT_PROCESS);
27
+ await observer.emit(TEXT_EVENTS.EMIT_END);
28
+
29
+ expect(push).toHaveBeenCalledWith({ source: TEXT_CONST.SOURCE });
30
+ expect(pop).toHaveBeenCalledWith({ source: TEXT_CONST.SOURCE });
31
+ });
32
+ });
@@ -0,0 +1,22 @@
1
+ import { CONSTANTS as LAYER_CONST, SUBSCRIBE_EVENTS as LAYER_EVENTS, PLUGIN_NAME as LAYER } from "@vnejs/contracts.canvas.child.bg.speak";
2
+ import {
3
+ CONSTANTS as TEXT_CONST,
4
+ PARAMS as TEXT_PARAMS,
5
+ PLUGIN_NAME as TEXT,
6
+ SETTINGS_KEYS as TEXT_SETTINGS,
7
+ SUBSCRIBE_EVENTS as TEXT_EVENTS,
8
+ } from "@vnejs/contracts.text";
9
+ import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin } from "@vnejs/test-utils";
10
+
11
+ export const registerCompatibilityVne = () => {
12
+ registerCoreVne();
13
+ registerVnePlugin(TEXT, { constants: TEXT_CONST, events: TEXT_EVENTS, params: TEXT_PARAMS, settings: TEXT_SETTINGS });
14
+ registerVnePlugin(LAYER, { constants: LAYER_CONST, events: LAYER_EVENTS });
15
+ };
16
+
17
+ export const createCompatibilityTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
18
+ ModuleClass: T,
19
+ options: Parameters<typeof baseCreateTestModule>[1] = {},
20
+ ) => baseCreateTestModule(ModuleClass, options);
21
+
22
+ export { LAYER_EVENTS, TEXT_CONST, TEXT_EVENTS };
package/src/types.ts ADDED
@@ -0,0 +1,11 @@
1
+ import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
2
+ import type { PluginName as BgSpeakPluginName, SubscribeEvents as BgSpeakSubscribeEvents } from "@vnejs/contracts.canvas.child.bg.speak";
3
+ import type { Constants as TextConstants, PluginName as TextPluginName, SubscribeEvents as TextSubscribeEvents } from "@vnejs/contracts.text";
4
+
5
+ export type PluginEvents = ModuleCoreEvents & Record<BgSpeakPluginName, BgSpeakSubscribeEvents> & Record<TextPluginName, TextSubscribeEvents>;
6
+
7
+ export type PluginConstants = ModuleCoreConstants & Record<TextPluginName, TextConstants>;
8
+
9
+ export type PluginSettings = ModuleCoreSettings;
10
+
11
+ export type PluginParams = ModuleCoreParams;
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "extends": "@vnejs/configs.ts-common/tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "dist"
6
+ },
7
+ "include": ["src/**/*.ts"],
8
+ "exclude": ["dist", "node_modules", "src/tests"]
9
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.