@vnejs/bridge.plugins.settings.potato.plugins.audio 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.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -0
- package/dist/modules/bridge_plugin_potato_plugin_audio.d.ts +8 -0
- package/dist/modules/bridge_plugin_potato_plugin_audio.js +8 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.js +1 -0
- package/package.json +42 -4
- package/src/index.ts +9 -0
- package/src/modules/bridge_plugin_potato_plugin_audio.ts +14 -0
- package/src/tests/potato.audio.test.ts +25 -0
- package/src/tests/setup.ts +32 -0
- package/src/types.ts +10 -0
- package/tsconfig.json +9 -0
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@vnejs/contracts.audio";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "@vnejs/contracts.audio";
|
|
2
|
+
import { regPlugin } from "@vnejs/registry";
|
|
3
|
+
import { BridgePluginPotatoPluginAudio } from "./modules/bridge_plugin_potato_plugin_audio.js";
|
|
4
|
+
const PLUGIN_NAME = "BRIDGE_PLUGIN_POTATO_PLUGIN_AUDIO";
|
|
5
|
+
regPlugin(PLUGIN_NAME, {}, [BridgePluginPotatoPluginAudio]);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
2
|
+
import type { PotatoEmitPayload } from "@vnejs/contracts.settings.potato";
|
|
3
|
+
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
|
|
4
|
+
export declare class BridgePluginPotatoPluginAudio extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
|
|
5
|
+
name: string;
|
|
6
|
+
subscribe: () => void;
|
|
7
|
+
onPotatoEmit: ({ value }?: PotatoEmitPayload) => undefined;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
2
|
+
export class BridgePluginPotatoPluginAudio extends ModuleCore {
|
|
3
|
+
name = "bridge_plugin_potato_plugin_audio";
|
|
4
|
+
subscribe = () => {
|
|
5
|
+
this.on(this.EVENTS.POTATO.EMIT, this.onPotatoEmit);
|
|
6
|
+
};
|
|
7
|
+
onPotatoEmit = ({ value } = {}) => void this.shared.audioNoSmoothSources.set(this.CONST.POTATO.SOURCE, Boolean(value));
|
|
8
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
|
|
2
|
+
import type { Constants as PotatoConstants, PluginName as PotatoPluginName, SubscribeEvents as PotatoSubscribeEvents } from "@vnejs/contracts.settings.potato";
|
|
3
|
+
export type PluginEvents = ModuleCoreEvents & Record<PotatoPluginName, PotatoSubscribeEvents>;
|
|
4
|
+
export type PluginConstants = ModuleCoreConstants & Record<PotatoPluginName, PotatoConstants>;
|
|
5
|
+
export type PluginSettings = ModuleCoreSettings;
|
|
6
|
+
export type PluginParams = ModuleCoreParams;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/bridge.plugins.settings.potato.plugins.audio",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
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.audio": "~0.2.0",
|
|
35
|
+
"@vnejs/contracts.settings.potato": "~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
|
+
"@vnejs/sources-set": "~0.2.0"
|
|
43
|
+
}
|
|
44
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import "@vnejs/contracts.audio";
|
|
2
|
+
|
|
3
|
+
import { regPlugin } from "@vnejs/registry";
|
|
4
|
+
|
|
5
|
+
import { BridgePluginPotatoPluginAudio } from "./modules/bridge_plugin_potato_plugin_audio.js";
|
|
6
|
+
|
|
7
|
+
const PLUGIN_NAME = "BRIDGE_PLUGIN_POTATO_PLUGIN_AUDIO";
|
|
8
|
+
|
|
9
|
+
regPlugin(PLUGIN_NAME, {}, [BridgePluginPotatoPluginAudio]);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
2
|
+
import type { PotatoEmitPayload } from "@vnejs/contracts.settings.potato";
|
|
3
|
+
|
|
4
|
+
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
|
|
5
|
+
|
|
6
|
+
export class BridgePluginPotatoPluginAudio extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
|
|
7
|
+
name = "bridge_plugin_potato_plugin_audio";
|
|
8
|
+
|
|
9
|
+
subscribe = () => {
|
|
10
|
+
this.on(this.EVENTS.POTATO.EMIT, this.onPotatoEmit);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
onPotatoEmit = ({ value }: PotatoEmitPayload = {}) => void this.shared.audioNoSmoothSources.set(this.CONST.POTATO.SOURCE, Boolean(value));
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { BridgePluginPotatoPluginAudio } from "../modules/bridge_plugin_potato_plugin_audio.js";
|
|
4
|
+
import { createCompatibilityTestModule, POTATO_CONST, POTATO_EVENTS, registerCompatibilityVne } from "./setup.js";
|
|
5
|
+
|
|
6
|
+
describe("BridgePluginPotatoPluginAudio", () => {
|
|
7
|
+
beforeEach(() => registerCompatibilityVne());
|
|
8
|
+
|
|
9
|
+
it("POTATO.EMIT with true sets disable source", async () => {
|
|
10
|
+
const { observer, shared } = createCompatibilityTestModule(BridgePluginPotatoPluginAudio);
|
|
11
|
+
|
|
12
|
+
await observer.emit(POTATO_EVENTS.EMIT, { value: true });
|
|
13
|
+
|
|
14
|
+
expect(shared.audioNoSmoothSources!.has(POTATO_CONST.SOURCE)).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("POTATO.EMIT with false clears disable source", async () => {
|
|
18
|
+
const { observer, shared } = createCompatibilityTestModule(BridgePluginPotatoPluginAudio);
|
|
19
|
+
|
|
20
|
+
await observer.emit(POTATO_EVENTS.EMIT, { value: true });
|
|
21
|
+
await observer.emit(POTATO_EVENTS.EMIT, { value: false });
|
|
22
|
+
|
|
23
|
+
expect(shared.audioNoSmoothSources!.has(POTATO_CONST.SOURCE)).toBe(false);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import "@vnejs/contracts.audio";
|
|
2
|
+
import {
|
|
3
|
+
CONSTANTS as POTATO_CONST,
|
|
4
|
+
PLUGIN_NAME as POTATO,
|
|
5
|
+
SETTINGS_KEYS as POTATO_SETTINGS,
|
|
6
|
+
SUBSCRIBE_EVENTS as POTATO_EVENTS,
|
|
7
|
+
} from "@vnejs/contracts.settings.potato";
|
|
8
|
+
import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin } from "@vnejs/test-utils";
|
|
9
|
+
import { SourcesSet } from "@vnejs/sources-set";
|
|
10
|
+
|
|
11
|
+
export const registerCompatibilityVne = () => {
|
|
12
|
+
registerCoreVne();
|
|
13
|
+
registerVnePlugin(POTATO, { constants: POTATO_CONST, events: POTATO_EVENTS, settings: POTATO_SETTINGS });
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const createCompatibilityTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
|
|
17
|
+
ModuleClass: T,
|
|
18
|
+
options: Parameters<typeof baseCreateTestModule>[1] = {},
|
|
19
|
+
) =>
|
|
20
|
+
baseCreateTestModule(ModuleClass, {
|
|
21
|
+
shared: {
|
|
22
|
+
settings: { [POTATO_SETTINGS.ENABLED]: false },
|
|
23
|
+
textProcessSkipSources: new SourcesSet(),
|
|
24
|
+
audioNoSmoothSources: new SourcesSet(),
|
|
25
|
+
mediaNoTimeoutSources: new SourcesSet(),
|
|
26
|
+
viewForceAnimationSources: new SourcesSet(),
|
|
27
|
+
...(options.shared ?? {}),
|
|
28
|
+
},
|
|
29
|
+
...options,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export { POTATO_CONST, POTATO_EVENTS };
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
|
|
2
|
+
import type { Constants as PotatoConstants, PluginName as PotatoPluginName, SubscribeEvents as PotatoSubscribeEvents } from "@vnejs/contracts.settings.potato";
|
|
3
|
+
|
|
4
|
+
export type PluginEvents = ModuleCoreEvents & Record<PotatoPluginName, PotatoSubscribeEvents>;
|
|
5
|
+
|
|
6
|
+
export type PluginConstants = ModuleCoreConstants & Record<PotatoPluginName, PotatoConstants>;
|
|
7
|
+
|
|
8
|
+
export type PluginSettings = ModuleCoreSettings;
|
|
9
|
+
|
|
10
|
+
export type PluginParams = ModuleCoreParams;
|
package/tsconfig.json
ADDED
package/README.md
DELETED