@vnejs/bridge.plugins.text.smooth.plugins.scenario.fastforward 0.0.0-stage → 0.2.5
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_text_smooth_plugin_fastforward.d.ts +8 -0
- package/dist/modules/bridge_plugin_text_smooth_plugin_fastforward.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_text_smooth_plugin_fastforward.ts +15 -0
- package/src/tests/scenario.fastforward.test.ts +25 -0
- package/src/tests/setup.ts +47 -0
- package/src/types.ts +14 -0
- package/tsconfig.json +9 -0
- package/README.md +0 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@vnejs/contracts.text.smooth";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "@vnejs/contracts.text.smooth";
|
|
2
|
+
import { regPlugin } from "@vnejs/registry";
|
|
3
|
+
import { BridgePluginTextSmoothPluginFastforward } from "./modules/bridge_plugin_text_smooth_plugin_fastforward.js";
|
|
4
|
+
const PLUGIN_NAME = "BRIDGE_PLUGIN_TEXT_SMOOTH_PLUGIN_FASTFORWARD";
|
|
5
|
+
regPlugin(PLUGIN_NAME, {}, [BridgePluginTextSmoothPluginFastforward]);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
2
|
+
import type { FastforwardChangedPayload } from "@vnejs/contracts.scenario.fastforward";
|
|
3
|
+
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
|
|
4
|
+
export declare class BridgePluginTextSmoothPluginFastforward extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
|
|
5
|
+
name: string;
|
|
6
|
+
subscribe: () => void;
|
|
7
|
+
onFastforwardChanged: ({ value }?: FastforwardChangedPayload) => undefined;
|
|
8
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
2
|
+
export class BridgePluginTextSmoothPluginFastforward extends ModuleCore {
|
|
3
|
+
name = "bridge_plugin_text_smooth_plugin_fastforward";
|
|
4
|
+
subscribe = () => {
|
|
5
|
+
this.on(this.EVENTS.FASTFORWARD.CHANGED, this.onFastforwardChanged);
|
|
6
|
+
};
|
|
7
|
+
onFastforwardChanged = ({ value } = {}) => void this.shared.textProcessSkipSources.set(this.CONST.FASTFORWARD.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 FastforwardConstants, PluginName as FastforwardPluginName, SubscribeEvents as FastforwardSubscribeEvents } from "@vnejs/contracts.scenario.fastforward";
|
|
3
|
+
export type PluginEvents = ModuleCoreEvents & Record<FastforwardPluginName, FastforwardSubscribeEvents>;
|
|
4
|
+
export type PluginConstants = ModuleCoreConstants & Record<FastforwardPluginName, FastforwardConstants>;
|
|
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.text.smooth.plugins.scenario.fastforward",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.5",
|
|
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.scenario.fastforward": "~0.2.0",
|
|
35
|
+
"@vnejs/contracts.text.smooth": "~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.text.smooth";
|
|
2
|
+
|
|
3
|
+
import { regPlugin } from "@vnejs/registry";
|
|
4
|
+
|
|
5
|
+
import { BridgePluginTextSmoothPluginFastforward } from "./modules/bridge_plugin_text_smooth_plugin_fastforward.js";
|
|
6
|
+
|
|
7
|
+
const PLUGIN_NAME = "BRIDGE_PLUGIN_TEXT_SMOOTH_PLUGIN_FASTFORWARD";
|
|
8
|
+
|
|
9
|
+
regPlugin(PLUGIN_NAME, {}, [BridgePluginTextSmoothPluginFastforward]);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ModuleCore } from "@vnejs/module.core";
|
|
2
|
+
import type { FastforwardChangedPayload } from "@vnejs/contracts.scenario.fastforward";
|
|
3
|
+
|
|
4
|
+
import type { PluginConstants, PluginEvents, PluginParams, PluginSettings } from "../types.js";
|
|
5
|
+
|
|
6
|
+
export class BridgePluginTextSmoothPluginFastforward extends ModuleCore<PluginEvents, PluginConstants, PluginSettings, PluginParams> {
|
|
7
|
+
name = "bridge_plugin_text_smooth_plugin_fastforward";
|
|
8
|
+
|
|
9
|
+
subscribe = () => {
|
|
10
|
+
this.on(this.EVENTS.FASTFORWARD.CHANGED, this.onFastforwardChanged);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
onFastforwardChanged = ({ value }: FastforwardChangedPayload = {}) =>
|
|
14
|
+
void this.shared.textProcessSkipSources.set(this.CONST.FASTFORWARD.SOURCE, Boolean(value));
|
|
15
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { beforeEach, describe, expect, it } from "vitest";
|
|
2
|
+
|
|
3
|
+
import { BridgePluginTextSmoothPluginFastforward } from "../modules/bridge_plugin_text_smooth_plugin_fastforward.js";
|
|
4
|
+
import { createCompatibilityTestModule, FASTFORWARD_CONST, FASTFORWARD_EVENTS, registerCompatibilityVne } from "./setup.js";
|
|
5
|
+
|
|
6
|
+
describe("BridgePluginTextSmoothPluginFastforward", () => {
|
|
7
|
+
beforeEach(() => registerCompatibilityVne());
|
|
8
|
+
|
|
9
|
+
it("FASTFORWARD.CHANGED with true sets disable source", async () => {
|
|
10
|
+
const { observer, shared } = createCompatibilityTestModule(BridgePluginTextSmoothPluginFastforward);
|
|
11
|
+
|
|
12
|
+
await observer.emit(FASTFORWARD_EVENTS.CHANGED, { value: true });
|
|
13
|
+
|
|
14
|
+
expect(shared.textProcessSkipSources!.has(FASTFORWARD_CONST.SOURCE)).toBe(true);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("FASTFORWARD.CHANGED with false clears disable source", async () => {
|
|
18
|
+
const { observer, shared } = createCompatibilityTestModule(BridgePluginTextSmoothPluginFastforward);
|
|
19
|
+
|
|
20
|
+
await observer.emit(FASTFORWARD_EVENTS.CHANGED, { value: true });
|
|
21
|
+
await observer.emit(FASTFORWARD_EVENTS.CHANGED, { value: false });
|
|
22
|
+
|
|
23
|
+
expect(shared.textProcessSkipSources!.has(FASTFORWARD_CONST.SOURCE)).toBe(false);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import "@vnejs/contracts.text.smooth";
|
|
2
|
+
import {
|
|
3
|
+
CONSTANTS as FASTFORWARD_CONST,
|
|
4
|
+
PARAMS as FASTFORWARD_PARAMS,
|
|
5
|
+
PLUGIN_NAME as FASTFORWARD,
|
|
6
|
+
SETTINGS_KEYS as FASTFORWARD_SETTINGS,
|
|
7
|
+
SUBSCRIBE_EVENTS as FASTFORWARD_EVENTS,
|
|
8
|
+
} from "@vnejs/contracts.scenario.fastforward";
|
|
9
|
+
import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin } from "@vnejs/test-utils";
|
|
10
|
+
import { SourcesSet } from "@vnejs/sources-set";
|
|
11
|
+
|
|
12
|
+
export const registerCompatibilityVne = () => {
|
|
13
|
+
registerCoreVne();
|
|
14
|
+
registerVnePlugin(FASTFORWARD, {
|
|
15
|
+
constants: FASTFORWARD_CONST,
|
|
16
|
+
events: FASTFORWARD_EVENTS,
|
|
17
|
+
params: FASTFORWARD_PARAMS,
|
|
18
|
+
settings: FASTFORWARD_SETTINGS,
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const createCompatibilityTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
|
|
23
|
+
ModuleClass: T,
|
|
24
|
+
options: Parameters<typeof baseCreateTestModule>[1] = {},
|
|
25
|
+
) =>
|
|
26
|
+
baseCreateTestModule(ModuleClass, {
|
|
27
|
+
shared: {
|
|
28
|
+
settings: {
|
|
29
|
+
[FASTFORWARD_SETTINGS.ENABLED]: true,
|
|
30
|
+
[FASTFORWARD_SETTINGS.DELAY]: FASTFORWARD_PARAMS.DEFAULT_DELAY,
|
|
31
|
+
},
|
|
32
|
+
isFastforwardOn: false,
|
|
33
|
+
fastforwardStorage: new Set<string>(),
|
|
34
|
+
voiceLang: "",
|
|
35
|
+
voiceDisableSources: new SourcesSet(),
|
|
36
|
+
mediaNoTimeoutSources: new SourcesSet(),
|
|
37
|
+
viewForceAnimationSources: new SourcesSet(),
|
|
38
|
+
textProcessSkipSources: new SourcesSet(),
|
|
39
|
+
autosaveDisableSources: new SourcesSet(),
|
|
40
|
+
pauseDisableSources: new SourcesSet(),
|
|
41
|
+
audioNoSmoothSources: new SourcesSet(),
|
|
42
|
+
...(options.shared ?? {}),
|
|
43
|
+
},
|
|
44
|
+
...options,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export { FASTFORWARD_CONST, FASTFORWARD_EVENTS };
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
|
|
2
|
+
import type {
|
|
3
|
+
Constants as FastforwardConstants,
|
|
4
|
+
PluginName as FastforwardPluginName,
|
|
5
|
+
SubscribeEvents as FastforwardSubscribeEvents,
|
|
6
|
+
} from "@vnejs/contracts.scenario.fastforward";
|
|
7
|
+
|
|
8
|
+
export type PluginEvents = ModuleCoreEvents & Record<FastforwardPluginName, FastforwardSubscribeEvents>;
|
|
9
|
+
|
|
10
|
+
export type PluginConstants = ModuleCoreConstants & Record<FastforwardPluginName, FastforwardConstants>;
|
|
11
|
+
|
|
12
|
+
export type PluginSettings = ModuleCoreSettings;
|
|
13
|
+
|
|
14
|
+
export type PluginParams = ModuleCoreParams;
|
package/tsconfig.json
ADDED
package/README.md
DELETED