@vnejs/plugins.settings.textsize 0.1.9 → 0.1.11

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 CHANGED
@@ -1 +1 @@
1
- import "@vnejs/plugins.settings.textsize.contract";
1
+ import "@vnejs/contracts.settings.textsize";
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import "@vnejs/plugins.settings.textsize.contract";
1
+ import "@vnejs/contracts.settings.textsize";
2
2
  import { regPlugin } from "@vnejs/shared";
3
- import { PLUGIN_NAME, SETTINGS_KEYS } from "@vnejs/plugins.settings.textsize.contract";
3
+ import { PLUGIN_NAME, SETTINGS_KEYS } from "@vnejs/contracts.settings.textsize";
4
4
  import { TextSize } from "./modules/size.js";
5
5
  regPlugin(PLUGIN_NAME, { settings: SETTINGS_KEYS }, [TextSize]);
package/dist/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
2
- import type { PluginName, SettingsKeys } from "@vnejs/plugins.settings.textsize.contract";
2
+ import type { PluginName, SettingsKeys } from "@vnejs/contracts.settings.textsize";
3
3
  export type TextSizePluginEvents = ModuleCoreEvents;
4
4
  export type TextSizePluginConstants = ModuleCoreConstants;
5
5
  export type TextSizePluginSettings = ModuleCoreSettings & Record<PluginName, SettingsKeys>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.settings.textsize",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "tsconfig.json"
19
19
  ],
20
20
  "scripts": {
21
- "test": "echo \"Error: no test specified\" && exit 1",
21
+ "test": "npx @vnejs/monorepo test",
22
22
  "build": "npx @vnejs/monorepo package",
23
23
  "publish:major:plugin": "npm run publish:major",
24
24
  "publish:minor:plugin": "npm run publish:minor",
@@ -30,13 +30,15 @@
30
30
  "author": "",
31
31
  "license": "ISC",
32
32
  "dependencies": {
33
- "@vnejs/plugins.settings.textsize.contract": "~0.1.0"
33
+ "@vnejs/contracts.settings.textsize": "~0.1.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@vnejs/module.core": "~0.1.0",
37
37
  "@vnejs/shared": "~0.1.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@vnejs/configs.ts-common": "~0.1.0"
40
+ "@vnejs/configs.ts-common": "~0.1.0",
41
+ "@vnejs/configs.vitest": "~0.1.0",
42
+ "@vnejs/test-utils": "~0.1.0"
41
43
  }
42
44
  }
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
- import "@vnejs/plugins.settings.textsize.contract";
1
+ import "@vnejs/contracts.settings.textsize";
2
2
 
3
3
  import { regPlugin } from "@vnejs/shared";
4
- import { PLUGIN_NAME, SETTINGS_KEYS } from "@vnejs/plugins.settings.textsize.contract";
4
+ import { PLUGIN_NAME, SETTINGS_KEYS } from "@vnejs/contracts.settings.textsize";
5
5
 
6
6
  import { TextSize } from "./modules/size.js";
7
7
 
@@ -0,0 +1,18 @@
1
+ import { PLUGIN_NAME, SETTINGS_KEYS } from "@vnejs/contracts.settings.textsize";
2
+ import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin } from "@vnejs/test-utils";
3
+
4
+ export const registerTextSizePluginVne = () => {
5
+ registerCoreVne();
6
+ registerVnePlugin(PLUGIN_NAME, { settings: SETTINGS_KEYS });
7
+ };
8
+
9
+ export const createTextSizeTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
10
+ ModuleClass: T,
11
+ options: Parameters<typeof baseCreateTestModule>[1] = {},
12
+ ) =>
13
+ baseCreateTestModule(ModuleClass, {
14
+ shared: { settings: { [SETTINGS_KEYS.VALUE]: 1 }, ...(options.shared as Record<string, unknown>) },
15
+ ...options,
16
+ });
17
+
18
+ export { PLUGIN_NAME, SETTINGS_KEYS };
@@ -0,0 +1,29 @@
1
+ import { beforeEach, describe, expect, it } from "vitest";
2
+
3
+ import { SUBSCRIBE_EVENTS as SETTINGS_EVENTS } from "@vnejs/contracts.core.settings";
4
+
5
+ import { TextSize } from "../modules/size.js";
6
+ import { createTextSizeTestModule, registerTextSizePluginVne, SETTINGS_KEYS } from "./setup.js";
7
+
8
+ describe("TextSize", () => {
9
+ beforeEach(() => {
10
+ registerTextSizePluginVne();
11
+ document.documentElement.style.removeProperty("--vne-text-size-multiplicator");
12
+ });
13
+
14
+ it("init sets default text size multiplier", async () => {
15
+ const { module } = createTextSizeTestModule(TextSize, { subscribe: false });
16
+
17
+ await (module as TextSize).init();
18
+
19
+ expect(document.documentElement.style.getPropertyValue("--vne-text-size-multiplicator")).toBe("1");
20
+ });
21
+
22
+ it("SETTINGS.CHANGED updates css variable", async () => {
23
+ const { observer } = createTextSizeTestModule(TextSize);
24
+
25
+ await observer.emit(SETTINGS_EVENTS.CHANGED, { name: SETTINGS_KEYS.VALUE, value: 1.5 });
26
+
27
+ expect(document.documentElement.style.getPropertyValue("--vne-text-size-multiplicator")).toBe("1.5");
28
+ });
29
+ });
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { ModuleCoreConstants, ModuleCoreEvents, ModuleCoreParams, ModuleCoreSettings } from "@vnejs/module.core";
2
- import type { PluginName, SettingsKeys } from "@vnejs/plugins.settings.textsize.contract";
2
+ import type { PluginName, SettingsKeys } from "@vnejs/contracts.settings.textsize";
3
3
 
4
4
  export type TextSizePluginEvents = ModuleCoreEvents;
5
5
 
package/tsconfig.json CHANGED
@@ -5,5 +5,5 @@
5
5
  "outDir": "dist"
6
6
  },
7
7
  "include": ["src/**/*.ts"],
8
- "exclude": ["dist", "node_modules"]
8
+ "exclude": ["dist", "node_modules", "src/tests"]
9
9
  }