@vnejs/plugins.settings.textsize 0.1.1 → 0.1.2
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 +4 -0
- package/dist/modules/size.d.ts +10 -0
- package/dist/modules/size.js +13 -0
- package/dist/types.d.ts +7 -0
- package/dist/types.js +1 -0
- package/dist/utils/settings.d.ts +4 -0
- package/dist/utils/settings.js +1 -0
- package/package.json +32 -6
- package/src/index.ts +6 -0
- package/src/modules/size.ts +22 -0
- package/src/types.ts +11 -0
- package/src/utils/settings.ts +4 -0
- package/tsconfig.json +9 -0
- package/const/settings.js +0 -3
- package/index.js +0 -7
- package/modules/size.js +0 -19
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Module } from "@vnejs/module";
|
|
2
|
+
import type { TextSizePluginConstants, TextSizePluginEvents, TextSizePluginParams, TextSizePluginSettings } from "../types.js";
|
|
3
|
+
import type { SettingsChangedPayload } from "../utils/settings.js";
|
|
4
|
+
export declare class TextSize extends Module<TextSizePluginEvents, TextSizePluginConstants, TextSizePluginSettings, TextSizePluginParams> {
|
|
5
|
+
name: string;
|
|
6
|
+
subscribe: () => void;
|
|
7
|
+
init: () => Promise<void>;
|
|
8
|
+
onSettingChange: ({ name, value }?: SettingsChangedPayload) => false | void;
|
|
9
|
+
setTextSize: (value: number) => void;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Module } from "@vnejs/module";
|
|
2
|
+
export class TextSize extends Module {
|
|
3
|
+
name = "textsize";
|
|
4
|
+
subscribe = () => {
|
|
5
|
+
this.on(this.EVENTS.SETTINGS.CHANGED, this.onSettingChange);
|
|
6
|
+
};
|
|
7
|
+
init = async () => {
|
|
8
|
+
await this.emit(this.EVENTS.SETTINGS.INIT, { name: this.SETTINGS.TEXTSIZE.VALUE, value: 1 });
|
|
9
|
+
this.setTextSize(this.shared.settings[this.SETTINGS.TEXTSIZE.VALUE]);
|
|
10
|
+
};
|
|
11
|
+
onSettingChange = ({ name, value } = {}) => name === this.SETTINGS.TEXTSIZE.VALUE && this.setTextSize(value);
|
|
12
|
+
setTextSize = (value) => document.documentElement.style.setProperty("--vne-text-size-multiplicator", String(value));
|
|
13
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
|
|
2
|
+
import type { PluginName as SettingsPluginName, SubscribeEvents as SettingsSubscribeEvents } from "@vnejs/plugins.core.settings.contract";
|
|
3
|
+
import type { PluginName, SettingsKeys } from "@vnejs/plugins.settings.textsize.contract";
|
|
4
|
+
export type TextSizePluginEvents = VnePluginEventsMapRegistry & Record<SettingsPluginName, SettingsSubscribeEvents>;
|
|
5
|
+
export type TextSizePluginConstants = VnePluginConstantsMapRegistry;
|
|
6
|
+
export type TextSizePluginSettings = VnePluginSettingsMapRegistry & Record<PluginName, SettingsKeys>;
|
|
7
|
+
export type TextSizePluginParams = VnePluginParamsMapRegistry;
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,17 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vnejs/plugins.settings.textsize",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"
|
|
3
|
+
"version": "0.1.2",
|
|
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
|
+
],
|
|
5
20
|
"scripts": {
|
|
6
21
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
22
|
+
"build": "npx @vnejs/monorepo package",
|
|
7
23
|
"publish:major:plugin": "npm run publish:major",
|
|
8
24
|
"publish:minor:plugin": "npm run publish:minor",
|
|
9
25
|
"publish:patch:plugin": "npm run publish:patch",
|
|
10
|
-
"publish:major": "
|
|
11
|
-
"publish:minor": "
|
|
12
|
-
"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"
|
|
13
29
|
},
|
|
14
30
|
"author": "",
|
|
15
31
|
"license": "ISC",
|
|
16
|
-
"
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@vnejs/plugins.settings.textsize.contract": "~0.0.1"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@vnejs/module": "~0.0.1",
|
|
37
|
+
"@vnejs/plugins.core.settings.contract": "~0.0.1",
|
|
38
|
+
"@vnejs/shared": "~0.0.9"
|
|
39
|
+
},
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@vnejs/configs.ts-common": "~0.0.1"
|
|
42
|
+
}
|
|
17
43
|
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Module } from "@vnejs/module";
|
|
2
|
+
|
|
3
|
+
import type { TextSizePluginConstants, TextSizePluginEvents, TextSizePluginParams, TextSizePluginSettings } from "../types.js";
|
|
4
|
+
import type { SettingsChangedPayload } from "../utils/settings.js";
|
|
5
|
+
|
|
6
|
+
export class TextSize extends Module<TextSizePluginEvents, TextSizePluginConstants, TextSizePluginSettings, TextSizePluginParams> {
|
|
7
|
+
name = "textsize";
|
|
8
|
+
|
|
9
|
+
subscribe = () => {
|
|
10
|
+
this.on(this.EVENTS.SETTINGS.CHANGED, this.onSettingChange);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
init = async () => {
|
|
14
|
+
await this.emit(this.EVENTS.SETTINGS.INIT, { name: this.SETTINGS.TEXTSIZE.VALUE, value: 1 });
|
|
15
|
+
|
|
16
|
+
this.setTextSize(this.shared.settings[this.SETTINGS.TEXTSIZE.VALUE]);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
onSettingChange = ({ name, value }: SettingsChangedPayload = {}) => name === this.SETTINGS.TEXTSIZE.VALUE && this.setTextSize(value as number);
|
|
20
|
+
|
|
21
|
+
setTextSize = (value: number) => document.documentElement.style.setProperty("--vne-text-size-multiplicator", String(value));
|
|
22
|
+
}
|
package/src/types.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { VnePluginConstantsMapRegistry, VnePluginEventsMapRegistry, VnePluginParamsMapRegistry, VnePluginSettingsMapRegistry } from "@vnejs/shared";
|
|
2
|
+
import type { PluginName as SettingsPluginName, SubscribeEvents as SettingsSubscribeEvents } from "@vnejs/plugins.core.settings.contract";
|
|
3
|
+
import type { PluginName, SettingsKeys } from "@vnejs/plugins.settings.textsize.contract";
|
|
4
|
+
|
|
5
|
+
export type TextSizePluginEvents = VnePluginEventsMapRegistry & Record<SettingsPluginName, SettingsSubscribeEvents>;
|
|
6
|
+
|
|
7
|
+
export type TextSizePluginConstants = VnePluginConstantsMapRegistry;
|
|
8
|
+
|
|
9
|
+
export type TextSizePluginSettings = VnePluginSettingsMapRegistry & Record<PluginName, SettingsKeys>;
|
|
10
|
+
|
|
11
|
+
export type TextSizePluginParams = VnePluginParamsMapRegistry;
|
package/tsconfig.json
ADDED
package/const/settings.js
DELETED
package/index.js
DELETED
package/modules/size.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Module } from "@vnejs/module";
|
|
2
|
-
|
|
3
|
-
export class TextSize extends Module {
|
|
4
|
-
name = "textsize";
|
|
5
|
-
|
|
6
|
-
subscribe = () => {
|
|
7
|
-
this.on(this.EVENTS.SETTINGS.CHANGED, this.onSettingChange);
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
init = async () => {
|
|
11
|
-
await this.emit(this.EVENTS.SETTINGS.INIT, { name: this.SETTINGS.TEXTSIZE.VALUE, value: 1 });
|
|
12
|
-
|
|
13
|
-
this.setTextSize(this.shared.settings[this.SETTINGS.TEXTSIZE.VALUE]);
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
onSettingChange = ({ name, value }) => name === this.SETTINGS.TEXTSIZE.VALUE && this.setTextSize(value);
|
|
17
|
-
|
|
18
|
-
setTextSize = (value) => document.documentElement.style.setProperty(`--vne-text-size-multiplicator`, value);
|
|
19
|
-
}
|