@vnejs/contracts.controls.cursor 0.1.1

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,11 @@
1
+ export declare const SUBSCRIBE_EVENTS: {
2
+ readonly SHOW: "vne:cursor:show";
3
+ readonly HIDE: "vne:cursor:hide";
4
+ readonly UPDATE: "vne:cursor:update";
5
+ readonly CLICK: "vne:cursor:click";
6
+ readonly VIEW_SET: "vne:cursor:view_set";
7
+ readonly MOVE: "vne:cursor:move";
8
+ readonly MOVED: "vne:cursor:moved";
9
+ readonly SHIFT: "vne:cursor:shift";
10
+ };
11
+ export type SubscribeEvents = typeof SUBSCRIBE_EVENTS;
package/dist/events.js ADDED
@@ -0,0 +1,10 @@
1
+ export const SUBSCRIBE_EVENTS = {
2
+ SHOW: "vne:cursor:show",
3
+ HIDE: "vne:cursor:hide",
4
+ UPDATE: "vne:cursor:update",
5
+ CLICK: "vne:cursor:click",
6
+ VIEW_SET: "vne:cursor:view_set",
7
+ MOVE: "vne:cursor:move",
8
+ MOVED: "vne:cursor:moved",
9
+ SHIFT: "vne:cursor:shift",
10
+ };
@@ -0,0 +1,36 @@
1
+ import "@vnejs/module";
2
+ import "@vnejs/contracts.core.settings";
3
+ import "@vnejs/shared";
4
+ import { SUBSCRIBE_EVENTS } from "./events.js";
5
+ import type { ModuleGlobalStateCursor } from "./module-global-state.js";
6
+ import { PARAMS } from "./params.js";
7
+ import { SETTINGS_KEYS } from "./settings.js";
8
+ export declare const PLUGIN_NAME: "CURSOR";
9
+ export type PluginName = typeof PLUGIN_NAME;
10
+ export type { ModuleGlobalStateCursor } from "./module-global-state.js";
11
+ export { SUBSCRIBE_EVENTS };
12
+ export type { SubscribeEvents } from "./events.js";
13
+ export { PARAMS };
14
+ export type { Params } from "./params.js";
15
+ export { SETTINGS_KEYS };
16
+ export type { SettingsKeys } from "./settings.js";
17
+ type CursorShiftSpeedSettingKey = (typeof SETTINGS_KEYS)["SHIFT_SPEED"];
18
+ type CursorShiftReverseXSettingKey = (typeof SETTINGS_KEYS)["SHIFT_REVERSE_X"];
19
+ type CursorShiftReverseYSettingKey = (typeof SETTINGS_KEYS)["SHIFT_REVERSE_Y"];
20
+ declare module "@vnejs/module" {
21
+ interface ModuleGlobalState {
22
+ cursor: ModuleGlobalStateCursor;
23
+ }
24
+ }
25
+ declare module "@vnejs/contracts.core.settings" {
26
+ interface ModuleSharedSettings extends Record<CursorShiftSpeedSettingKey, number>, Record<CursorShiftReverseXSettingKey, boolean>, Record<CursorShiftReverseYSettingKey, boolean> {
27
+ }
28
+ }
29
+ declare module "@vnejs/shared" {
30
+ interface VnePluginEventsMap extends Record<typeof PLUGIN_NAME, typeof SUBSCRIBE_EVENTS> {
31
+ }
32
+ interface VnePluginParamsMap extends Record<typeof PLUGIN_NAME, typeof PARAMS> {
33
+ }
34
+ interface VnePluginSettingsMap extends Record<typeof PLUGIN_NAME, typeof SETTINGS_KEYS> {
35
+ }
36
+ }
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import "@vnejs/module";
2
+ import "@vnejs/contracts.core.settings";
3
+ import "@vnejs/shared";
4
+ import { SUBSCRIBE_EVENTS } from "./events.js";
5
+ import { PARAMS } from "./params.js";
6
+ import { SETTINGS_KEYS } from "./settings.js";
7
+ export const PLUGIN_NAME = "CURSOR";
8
+ export { SUBSCRIBE_EVENTS };
9
+ export { PARAMS };
10
+ export { SETTINGS_KEYS };
@@ -0,0 +1,6 @@
1
+ export type ModuleGlobalStateCursor = {
2
+ view: string;
3
+ x: number;
4
+ y: number;
5
+ };
6
+ export declare const DEFAULT_MODULE_GLOBAL_STATE_CURSOR: ModuleGlobalStateCursor;
@@ -0,0 +1,6 @@
1
+ import { PARAMS } from "./params.js";
2
+ export const DEFAULT_MODULE_GLOBAL_STATE_CURSOR = {
3
+ view: PARAMS.DEFAULT_VIEW,
4
+ x: 0,
5
+ y: 0,
6
+ };
@@ -0,0 +1,16 @@
1
+ import type { Widen } from "@vnejs/shared";
2
+ export declare const DEFAULT_VIEW: "default";
3
+ export declare const DEFAULT_SHIFT_SPEED: 1;
4
+ export declare const DEFAULT_SHIFT_REVERSE_X: false;
5
+ export declare const DEFAULT_SHIFT_REVERSE_Y: false;
6
+ export declare const BASE_SHIFT_SPEED: 16;
7
+ declare const PARAMS_DEFAULT: {
8
+ DEFAULT_VIEW: "default";
9
+ DEFAULT_SHIFT_SPEED: 1;
10
+ DEFAULT_SHIFT_REVERSE_X: false;
11
+ DEFAULT_SHIFT_REVERSE_Y: false;
12
+ BASE_SHIFT_SPEED: 16;
13
+ };
14
+ export type Params = Widen<typeof PARAMS_DEFAULT>;
15
+ export declare const PARAMS: Params;
16
+ export {};
package/dist/params.js ADDED
@@ -0,0 +1,13 @@
1
+ export const DEFAULT_VIEW = "default";
2
+ export const DEFAULT_SHIFT_SPEED = 1;
3
+ export const DEFAULT_SHIFT_REVERSE_X = false;
4
+ export const DEFAULT_SHIFT_REVERSE_Y = false;
5
+ export const BASE_SHIFT_SPEED = 16;
6
+ const PARAMS_DEFAULT = {
7
+ DEFAULT_VIEW,
8
+ DEFAULT_SHIFT_SPEED,
9
+ DEFAULT_SHIFT_REVERSE_X,
10
+ DEFAULT_SHIFT_REVERSE_Y,
11
+ BASE_SHIFT_SPEED,
12
+ };
13
+ export const PARAMS = PARAMS_DEFAULT;
@@ -0,0 +1,6 @@
1
+ export declare const SETTINGS_KEYS: {
2
+ readonly SHIFT_SPEED: "vne:cursor:shift_speed";
3
+ readonly SHIFT_REVERSE_Y: "vne:cursor:shift_reverse_y";
4
+ readonly SHIFT_REVERSE_X: "vne:cursor:shift_reverse_x";
5
+ };
6
+ export type SettingsKeys = typeof SETTINGS_KEYS;
@@ -0,0 +1,5 @@
1
+ export const SETTINGS_KEYS = {
2
+ SHIFT_SPEED: "vne:cursor:shift_speed",
3
+ SHIFT_REVERSE_Y: "vne:cursor:shift_reverse_y",
4
+ SHIFT_REVERSE_X: "vne:cursor:shift_reverse_x",
5
+ };
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@vnejs/contracts.controls.cursor",
3
+ "version": "0.1.1",
4
+ "description": "Contracts for @vnejs/plugins.controls.cursor",
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
+ "build": "npx @vnejs/monorepo package",
22
+ "publish:major": "npx @vnejs/monorepo publish major --access public",
23
+ "publish:minor": "npx @vnejs/monorepo publish minor --access public",
24
+ "publish:patch": "npx @vnejs/monorepo publish patch --access public"
25
+ },
26
+ "author": "",
27
+ "license": "ISC",
28
+ "peerDependencies": {
29
+ "@vnejs/module": "~0.1.0",
30
+ "@vnejs/contracts.core.settings": "~0.1.0",
31
+ "@vnejs/shared": "~0.1.0"
32
+ },
33
+ "devDependencies": {
34
+ "@vnejs/configs.ts-common": "~0.1.0"
35
+ }
36
+ }
package/src/events.ts ADDED
@@ -0,0 +1,15 @@
1
+ export const SUBSCRIBE_EVENTS = {
2
+ SHOW: "vne:cursor:show",
3
+ HIDE: "vne:cursor:hide",
4
+ UPDATE: "vne:cursor:update",
5
+
6
+ CLICK: "vne:cursor:click",
7
+
8
+ VIEW_SET: "vne:cursor:view_set",
9
+
10
+ MOVE: "vne:cursor:move",
11
+ MOVED: "vne:cursor:moved",
12
+ SHIFT: "vne:cursor:shift",
13
+ } as const;
14
+
15
+ export type SubscribeEvents = typeof SUBSCRIBE_EVENTS;
package/src/index.ts ADDED
@@ -0,0 +1,44 @@
1
+ import "@vnejs/module";
2
+ import "@vnejs/contracts.core.settings";
3
+ import "@vnejs/shared";
4
+
5
+ import { SUBSCRIBE_EVENTS } from "./events.js";
6
+ import type { ModuleGlobalStateCursor } from "./module-global-state.js";
7
+ import { PARAMS } from "./params.js";
8
+ import { SETTINGS_KEYS } from "./settings.js";
9
+
10
+ export const PLUGIN_NAME = "CURSOR" as const;
11
+ export type PluginName = typeof PLUGIN_NAME;
12
+
13
+ export type { ModuleGlobalStateCursor } from "./module-global-state.js";
14
+ export { SUBSCRIBE_EVENTS };
15
+ export type { SubscribeEvents } from "./events.js";
16
+ export { PARAMS };
17
+ export type { Params } from "./params.js";
18
+ export { SETTINGS_KEYS };
19
+ export type { SettingsKeys } from "./settings.js";
20
+
21
+ type CursorShiftSpeedSettingKey = (typeof SETTINGS_KEYS)["SHIFT_SPEED"];
22
+ type CursorShiftReverseXSettingKey = (typeof SETTINGS_KEYS)["SHIFT_REVERSE_X"];
23
+ type CursorShiftReverseYSettingKey = (typeof SETTINGS_KEYS)["SHIFT_REVERSE_Y"];
24
+
25
+ declare module "@vnejs/module" {
26
+ interface ModuleGlobalState {
27
+ cursor: ModuleGlobalStateCursor;
28
+ }
29
+ }
30
+
31
+ declare module "@vnejs/contracts.core.settings" {
32
+ interface ModuleSharedSettings
33
+ extends Record<CursorShiftSpeedSettingKey, number>,
34
+ Record<CursorShiftReverseXSettingKey, boolean>,
35
+ Record<CursorShiftReverseYSettingKey, boolean> {}
36
+ }
37
+
38
+ declare module "@vnejs/shared" {
39
+ interface VnePluginEventsMap extends Record<typeof PLUGIN_NAME, typeof SUBSCRIBE_EVENTS> {}
40
+
41
+ interface VnePluginParamsMap extends Record<typeof PLUGIN_NAME, typeof PARAMS> {}
42
+
43
+ interface VnePluginSettingsMap extends Record<typeof PLUGIN_NAME, typeof SETTINGS_KEYS> {}
44
+ }
@@ -0,0 +1,13 @@
1
+ import { PARAMS } from "./params.js";
2
+
3
+ export type ModuleGlobalStateCursor = {
4
+ view: string;
5
+ x: number;
6
+ y: number;
7
+ };
8
+
9
+ export const DEFAULT_MODULE_GLOBAL_STATE_CURSOR: ModuleGlobalStateCursor = {
10
+ view: PARAMS.DEFAULT_VIEW,
11
+ x: 0,
12
+ y: 0,
13
+ };
package/src/params.ts ADDED
@@ -0,0 +1,18 @@
1
+ import type { Widen } from "@vnejs/shared";
2
+
3
+ export const DEFAULT_VIEW = "default" as const;
4
+ export const DEFAULT_SHIFT_SPEED = 1 as const;
5
+ export const DEFAULT_SHIFT_REVERSE_X = false as const;
6
+ export const DEFAULT_SHIFT_REVERSE_Y = false as const;
7
+ export const BASE_SHIFT_SPEED = 16 as const;
8
+
9
+ const PARAMS_DEFAULT = {
10
+ DEFAULT_VIEW,
11
+ DEFAULT_SHIFT_SPEED,
12
+ DEFAULT_SHIFT_REVERSE_X,
13
+ DEFAULT_SHIFT_REVERSE_Y,
14
+ BASE_SHIFT_SPEED,
15
+ };
16
+
17
+ export type Params = Widen<typeof PARAMS_DEFAULT>;
18
+ export const PARAMS: Params = PARAMS_DEFAULT;
@@ -0,0 +1,7 @@
1
+ export const SETTINGS_KEYS = {
2
+ SHIFT_SPEED: "vne:cursor:shift_speed",
3
+ SHIFT_REVERSE_Y: "vne:cursor:shift_reverse_y",
4
+ SHIFT_REVERSE_X: "vne:cursor:shift_reverse_x",
5
+ } as const;
6
+
7
+ export type SettingsKeys = typeof SETTINGS_KEYS;
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
+ }