@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.
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ import { regPlugin } from "@vnejs/shared";
2
+ import { PLUGIN_NAME, SETTINGS_KEYS } from "@vnejs/plugins.settings.textsize.contract";
3
+ import { TextSize } from "./modules/size.js";
4
+ regPlugin(PLUGIN_NAME, { settings: SETTINGS_KEYS }, [TextSize]);
@@ -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
+ }
@@ -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,4 @@
1
+ export type SettingsChangedPayload = {
2
+ name?: string;
3
+ value?: unknown;
4
+ };
@@ -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.1",
4
- "main": "index.js",
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": "npm version major && npm publish --access public",
11
- "publish:minor": "npm version minor && npm publish --access public",
12
- "publish:patch": "npm version patch && npm publish --access public"
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
- "description": ""
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,6 @@
1
+ import { regPlugin } from "@vnejs/shared";
2
+ import { PLUGIN_NAME, SETTINGS_KEYS } from "@vnejs/plugins.settings.textsize.contract";
3
+
4
+ import { TextSize } from "./modules/size.js";
5
+
6
+ regPlugin(PLUGIN_NAME, { settings: SETTINGS_KEYS }, [TextSize]);
@@ -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;
@@ -0,0 +1,4 @@
1
+ export type SettingsChangedPayload = {
2
+ name?: string;
3
+ value?: unknown;
4
+ };
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"]
9
+ }
package/const/settings.js DELETED
@@ -1,3 +0,0 @@
1
- export const SETTINGS_KEYS = {
2
- VALUE: "vne:textsize:value",
3
- };
package/index.js DELETED
@@ -1,7 +0,0 @@
1
- import { regPlugin } from "@vnejs/shared";
2
-
3
- import { SETTINGS_KEYS } from "./const/settings";
4
-
5
- import { TextSize } from "./modules/size";
6
-
7
- regPlugin("TEXTSIZE", { settings: SETTINGS_KEYS }, [TextSize]);
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
- }