@vnejs/plugins.settings.potato 0.1.6 → 0.1.8
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 -1
- package/dist/index.js +3 -2
- package/dist/modules/potato.d.ts +4 -3
- package/dist/modules/potato.js +7 -10
- package/dist/types.d.ts +3 -4
- package/dist/types.js +0 -1
- package/package.json +1 -2
- package/src/index.ts +4 -2
- package/src/modules/potato.ts +11 -11
- package/src/types.ts +10 -4
- package/dist/utils/settings.d.ts +0 -4
- package/dist/utils/settings.js +0 -1
- package/src/utils/settings.ts +0 -4
package/dist/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import "@vnejs/plugins.settings.potato.contract";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import "@vnejs/plugins.settings.potato.contract";
|
|
1
2
|
import { regPlugin } from "@vnejs/shared";
|
|
2
|
-
import { PLUGIN_NAME, SETTINGS_KEYS } from "@vnejs/plugins.settings.potato.contract";
|
|
3
|
+
import { CONSTANTS, PLUGIN_NAME, SETTINGS_KEYS, SUBSCRIBE_EVENTS } from "@vnejs/plugins.settings.potato.contract";
|
|
3
4
|
import { Potato } from "./modules/potato.js";
|
|
4
|
-
regPlugin(PLUGIN_NAME, { settings: SETTINGS_KEYS }, [Potato]);
|
|
5
|
+
regPlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS, settings: SETTINGS_KEYS, constants: CONSTANTS }, [Potato]);
|
package/dist/modules/potato.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Module } from "@vnejs/module";
|
|
2
|
+
import type { SettingsChangedResult } from "@vnejs/plugins.core.settings.contract";
|
|
3
|
+
import type { PotatoEmitPayload } from "@vnejs/plugins.settings.potato.contract";
|
|
2
4
|
import type { PotatoPluginConstants, PotatoPluginEvents, PotatoPluginParams, PotatoPluginSettings } from "../types.js";
|
|
3
|
-
import type { SettingsChangedPayload } from "../utils/settings.js";
|
|
4
5
|
export declare class Potato extends Module<PotatoPluginEvents, PotatoPluginConstants, PotatoPluginSettings, PotatoPluginParams> {
|
|
5
6
|
name: string;
|
|
6
7
|
styleElement?: HTMLStyleElement;
|
|
7
8
|
subscribe: () => void;
|
|
8
9
|
init: () => Promise<void>;
|
|
9
|
-
onSettingChange: ({ name, value }
|
|
10
|
-
|
|
10
|
+
onSettingChange: ({ name, value }: SettingsChangedResult) => false | Promise<unknown[]> | undefined;
|
|
11
|
+
onPotatoEmit: ({ value }?: PotatoEmitPayload) => void;
|
|
11
12
|
notPotato: (e: string) => boolean;
|
|
12
13
|
}
|
package/dist/modules/potato.js
CHANGED
|
@@ -3,30 +3,27 @@ export class Potato extends Module {
|
|
|
3
3
|
name = "potato";
|
|
4
4
|
styleElement;
|
|
5
5
|
subscribe = () => {
|
|
6
|
+
this.on(this.EVENTS.POTATO.EMIT, this.onPotatoEmit);
|
|
6
7
|
this.on(this.EVENTS.SETTINGS.CHANGED, this.onSettingChange);
|
|
7
8
|
};
|
|
8
9
|
init = async () => {
|
|
9
10
|
await this.emit(this.EVENTS.SETTINGS.INIT, { name: this.SETTINGS.POTATO.ENABLED, value: false });
|
|
10
11
|
this.styleElement = document.createElement("style");
|
|
11
12
|
this.styleElement.innerHTML = "*{transition:none!important}";
|
|
12
|
-
this.shared.settings[this.SETTINGS.POTATO.ENABLED] && this.
|
|
13
|
+
this.shared.settings[this.SETTINGS.POTATO.ENABLED] && this.emit(this.EVENTS.POTATO.EMIT, { value: true });
|
|
13
14
|
};
|
|
14
|
-
onSettingChange = ({ name, value }
|
|
15
|
-
|
|
15
|
+
onSettingChange = ({ name, value }) => name === this.SETTINGS.POTATO.ENABLED && this.emit(this.EVENTS.POTATO.EMIT, { value: Boolean(value) });
|
|
16
|
+
onPotatoEmit = ({ value } = {}) => {
|
|
16
17
|
if (value) {
|
|
17
|
-
this.shared.
|
|
18
|
-
this.shared.
|
|
19
|
-
this.shared.textNoAnimationSources.push(this.name);
|
|
20
|
-
this.shared.viewForceAnimationSources.push(this.name);
|
|
18
|
+
this.shared.mediaNoTimeoutSources.push(this.CONST.POTATO.SOURCE);
|
|
19
|
+
this.shared.viewForceAnimationSources.push(this.CONST.POTATO.SOURCE);
|
|
21
20
|
this.styleElement && document.head.appendChild(this.styleElement);
|
|
22
21
|
}
|
|
23
22
|
else {
|
|
24
|
-
this.shared.audioNoSmoothSources = this.shared.audioNoSmoothSources.filter(this.notPotato);
|
|
25
23
|
this.shared.mediaNoTimeoutSources = this.shared.mediaNoTimeoutSources.filter(this.notPotato);
|
|
26
|
-
this.shared.textNoAnimationSources = this.shared.textNoAnimationSources.filter(this.notPotato);
|
|
27
24
|
this.shared.viewForceAnimationSources = this.shared.viewForceAnimationSources.filter(this.notPotato);
|
|
28
25
|
this.styleElement?.isConnected && document.head.removeChild(this.styleElement);
|
|
29
26
|
}
|
|
30
27
|
};
|
|
31
|
-
notPotato = (e) => e !== this.
|
|
28
|
+
notPotato = (e) => e !== this.CONST.POTATO.SOURCE;
|
|
32
29
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import "@vnejs/plugins.audio.contract";
|
|
2
1
|
import "@vnejs/plugins.core.components.contract";
|
|
3
2
|
import "@vnejs/plugins.core.media.contract";
|
|
4
3
|
import "@vnejs/plugins.settings.potato.contract";
|
|
5
4
|
import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
|
|
6
5
|
import type { PluginName as SettingsPluginName, SubscribeEvents as SettingsSubscribeEvents } from "@vnejs/plugins.core.settings.contract";
|
|
7
|
-
import type { PluginName, SettingsKeys } from "@vnejs/plugins.settings.potato.contract";
|
|
8
|
-
export type PotatoPluginEvents = VnePluginEventsMapRegistry & Record<SettingsPluginName, SettingsSubscribeEvents>;
|
|
9
|
-
export type PotatoPluginConstants = VnePluginConstantsMapRegistry
|
|
6
|
+
import type { Constants as PotatoConstants, PluginName, SettingsKeys, SubscribeEvents as PotatoSubscribeEvents } from "@vnejs/plugins.settings.potato.contract";
|
|
7
|
+
export type PotatoPluginEvents = VnePluginEventsMapRegistry & Record<SettingsPluginName, SettingsSubscribeEvents> & Record<PluginName, PotatoSubscribeEvents>;
|
|
8
|
+
export type PotatoPluginConstants = VnePluginConstantsMapRegistry & Record<PluginName, PotatoConstants>;
|
|
10
9
|
export type PotatoPluginSettings = VnePluginSettingsMapRegistry & Record<PluginName, SettingsKeys>;
|
|
11
10
|
export type PotatoPluginParams = VnePluginParamsMapRegistry;
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/plugins.settings.potato",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -34,7 +34,6 @@
|
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@vnejs/module": "~0.0.1",
|
|
37
|
-
"@vnejs/plugins.audio.contract": "~0.0.1",
|
|
38
37
|
"@vnejs/plugins.core.components.contract": "~0.0.1",
|
|
39
38
|
"@vnejs/plugins.core.media.contract": "~0.0.1",
|
|
40
39
|
"@vnejs/plugins.core.settings.contract": "~0.0.1",
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import "@vnejs/plugins.settings.potato.contract";
|
|
2
|
+
|
|
1
3
|
import { regPlugin } from "@vnejs/shared";
|
|
2
|
-
import { PLUGIN_NAME, SETTINGS_KEYS } from "@vnejs/plugins.settings.potato.contract";
|
|
4
|
+
import { CONSTANTS, PLUGIN_NAME, SETTINGS_KEYS, SUBSCRIBE_EVENTS } from "@vnejs/plugins.settings.potato.contract";
|
|
3
5
|
|
|
4
6
|
import { Potato } from "./modules/potato.js";
|
|
5
7
|
|
|
6
|
-
regPlugin(PLUGIN_NAME, { settings: SETTINGS_KEYS }, [Potato]);
|
|
8
|
+
regPlugin(PLUGIN_NAME, { events: SUBSCRIBE_EVENTS, settings: SETTINGS_KEYS, constants: CONSTANTS }, [Potato]);
|
package/src/modules/potato.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { Module } from "@vnejs/module";
|
|
2
|
+
import type { SettingsChangedResult } from "@vnejs/plugins.core.settings.contract";
|
|
3
|
+
import type { PotatoEmitPayload } from "@vnejs/plugins.settings.potato.contract";
|
|
2
4
|
|
|
3
5
|
import type { PotatoPluginConstants, PotatoPluginEvents, PotatoPluginParams, PotatoPluginSettings } from "../types.js";
|
|
4
|
-
import type { SettingsChangedPayload } from "../utils/settings.js";
|
|
5
6
|
|
|
6
7
|
export class Potato extends Module<PotatoPluginEvents, PotatoPluginConstants, PotatoPluginSettings, PotatoPluginParams> {
|
|
7
8
|
name = "potato";
|
|
@@ -9,6 +10,8 @@ export class Potato extends Module<PotatoPluginEvents, PotatoPluginConstants, Po
|
|
|
9
10
|
styleElement?: HTMLStyleElement;
|
|
10
11
|
|
|
11
12
|
subscribe = () => {
|
|
13
|
+
this.on(this.EVENTS.POTATO.EMIT, this.onPotatoEmit);
|
|
14
|
+
|
|
12
15
|
this.on(this.EVENTS.SETTINGS.CHANGED, this.onSettingChange);
|
|
13
16
|
};
|
|
14
17
|
|
|
@@ -18,26 +21,23 @@ export class Potato extends Module<PotatoPluginEvents, PotatoPluginConstants, Po
|
|
|
18
21
|
this.styleElement = document.createElement("style");
|
|
19
22
|
this.styleElement.innerHTML = "*{transition:none!important}";
|
|
20
23
|
|
|
21
|
-
this.shared.settings[this.SETTINGS.POTATO.ENABLED] && this.
|
|
24
|
+
this.shared.settings[this.SETTINGS.POTATO.ENABLED] && this.emit(this.EVENTS.POTATO.EMIT, { value: true } satisfies PotatoEmitPayload);
|
|
22
25
|
};
|
|
23
26
|
|
|
24
|
-
onSettingChange = ({ name, value }:
|
|
27
|
+
onSettingChange = ({ name, value }: SettingsChangedResult) =>
|
|
28
|
+
name === this.SETTINGS.POTATO.ENABLED && this.emit(this.EVENTS.POTATO.EMIT, { value: Boolean(value) } satisfies PotatoEmitPayload);
|
|
25
29
|
|
|
26
|
-
|
|
30
|
+
onPotatoEmit = ({ value }: PotatoEmitPayload = {}) => {
|
|
27
31
|
if (value) {
|
|
28
|
-
this.shared.
|
|
29
|
-
this.shared.
|
|
30
|
-
this.shared.textNoAnimationSources.push(this.name);
|
|
31
|
-
this.shared.viewForceAnimationSources.push(this.name);
|
|
32
|
+
this.shared.mediaNoTimeoutSources.push(this.CONST.POTATO.SOURCE);
|
|
33
|
+
this.shared.viewForceAnimationSources.push(this.CONST.POTATO.SOURCE);
|
|
32
34
|
this.styleElement && document.head.appendChild(this.styleElement);
|
|
33
35
|
} else {
|
|
34
|
-
this.shared.audioNoSmoothSources = this.shared.audioNoSmoothSources.filter(this.notPotato);
|
|
35
36
|
this.shared.mediaNoTimeoutSources = this.shared.mediaNoTimeoutSources.filter(this.notPotato);
|
|
36
|
-
this.shared.textNoAnimationSources = this.shared.textNoAnimationSources.filter(this.notPotato);
|
|
37
37
|
this.shared.viewForceAnimationSources = this.shared.viewForceAnimationSources.filter(this.notPotato);
|
|
38
38
|
this.styleElement?.isConnected && document.head.removeChild(this.styleElement);
|
|
39
39
|
}
|
|
40
40
|
};
|
|
41
41
|
|
|
42
|
-
notPotato = (e: string) => e !== this.
|
|
42
|
+
notPotato = (e: string) => e !== this.CONST.POTATO.SOURCE;
|
|
43
43
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,15 +1,21 @@
|
|
|
1
|
-
import "@vnejs/plugins.audio.contract";
|
|
2
1
|
import "@vnejs/plugins.core.components.contract";
|
|
3
2
|
import "@vnejs/plugins.core.media.contract";
|
|
4
3
|
import "@vnejs/plugins.settings.potato.contract";
|
|
5
4
|
|
|
6
5
|
import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
|
|
7
6
|
import type { PluginName as SettingsPluginName, SubscribeEvents as SettingsSubscribeEvents } from "@vnejs/plugins.core.settings.contract";
|
|
8
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
Constants as PotatoConstants,
|
|
9
|
+
PluginName,
|
|
10
|
+
SettingsKeys,
|
|
11
|
+
SubscribeEvents as PotatoSubscribeEvents,
|
|
12
|
+
} from "@vnejs/plugins.settings.potato.contract";
|
|
9
13
|
|
|
10
|
-
export type PotatoPluginEvents = VnePluginEventsMapRegistry &
|
|
14
|
+
export type PotatoPluginEvents = VnePluginEventsMapRegistry &
|
|
15
|
+
Record<SettingsPluginName, SettingsSubscribeEvents> &
|
|
16
|
+
Record<PluginName, PotatoSubscribeEvents>;
|
|
11
17
|
|
|
12
|
-
export type PotatoPluginConstants = VnePluginConstantsMapRegistry
|
|
18
|
+
export type PotatoPluginConstants = VnePluginConstantsMapRegistry & Record<PluginName, PotatoConstants>;
|
|
13
19
|
|
|
14
20
|
export type PotatoPluginSettings = VnePluginSettingsMapRegistry & Record<PluginName, SettingsKeys>;
|
|
15
21
|
|
package/dist/utils/settings.d.ts
DELETED
package/dist/utils/settings.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/src/utils/settings.ts
DELETED