@vnejs/plugins.controllers.common.cursor 0.0.0-stage → 0.2.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.
@@ -0,0 +1 @@
1
+ import "@vnejs/contracts.controllers.common.cursor";
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ import "@vnejs/contracts.controllers.common.cursor";
2
+ import { regPlugin } from "@vnejs/registry";
3
+ import { PLUGIN_NAME } from "@vnejs/contracts.controllers.common.cursor";
4
+ import { CursorViewController } from "./modules/controller.js";
5
+ import { CursorViewControllerSync } from "./modules/controller.sync.js";
6
+ import { CursorView } from "./modules/view.js";
7
+ regPlugin(PLUGIN_NAME, {}, [CursorViewController, CursorViewControllerSync, CursorView]);
@@ -0,0 +1,13 @@
1
+ import { ModuleController } from "@vnejs/module.components";
2
+ import type { CursorViewPluginConstants, CursorViewPluginEvents, CursorViewPluginParams, CursorViewPluginSettings } from "../types.js";
3
+ import type { CursorViewPluginState } from "../types.js";
4
+ export declare class CursorViewController extends ModuleController<CursorViewPluginEvents, CursorViewPluginConstants, CursorViewPluginSettings, CursorViewPluginParams, CursorViewPluginState> {
5
+ name: string;
6
+ EVENT_UPDATE_VIEW: "vne:cursor:update";
7
+ EVENT_UPDATE_STATE: "vne:cursor:update_state";
8
+ EVENT_UPDATE_FAST: "vne:cursor:update_fast";
9
+ EVENT_UPDATE_FORCE: "vne:cursor:update_force";
10
+ EVENT_SHOW: "vne:cursor:show";
11
+ EVENT_HIDE: "vne:cursor:hide";
12
+ SHOULD_CLEAR_STATE_ON_CLEANUP: boolean;
13
+ }
@@ -0,0 +1,11 @@
1
+ import { ModuleController } from "@vnejs/module.components";
2
+ export class CursorViewController extends ModuleController {
3
+ name = "cursor.view.controller";
4
+ EVENT_UPDATE_VIEW = this.EVENTS.CURSOR.UPDATE;
5
+ EVENT_UPDATE_STATE = this.EVENTS.CURSOR.UPDATE_STATE;
6
+ EVENT_UPDATE_FAST = this.EVENTS.CURSOR.UPDATE_FAST;
7
+ EVENT_UPDATE_FORCE = this.EVENTS.CURSOR.UPDATE_FORCE;
8
+ EVENT_SHOW = this.EVENTS.CURSOR.SHOW;
9
+ EVENT_HIDE = this.EVENTS.CURSOR.HIDE;
10
+ SHOULD_CLEAR_STATE_ON_CLEANUP = false;
11
+ }
@@ -0,0 +1,12 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ import type { CursorViewSetPayload } from "@vnejs/contracts.controls.cursor";
3
+ import type { CursorViewPluginConstants, CursorViewPluginEvents, CursorViewPluginParams, CursorViewPluginSettings } from "../types.js";
4
+ export declare class CursorViewControllerSync extends ModuleCore<CursorViewPluginEvents, CursorViewPluginConstants, CursorViewPluginSettings, CursorViewPluginParams> {
5
+ name: string;
6
+ subscribe: () => void;
7
+ onMoved: () => Promise<void>;
8
+ onViewSet: ({ view }?: CursorViewSetPayload) => Promise<void>;
9
+ onMemoryCleared: () => "" | Promise<void>;
10
+ loadIconMedia: (view: string, type: string) => Promise<HTMLImageElement>;
11
+ changeView: (view?: string) => Promise<void>;
12
+ }
@@ -0,0 +1,30 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+ export class CursorViewControllerSync extends ModuleCore {
3
+ name = "cursor.view.controller.sync";
4
+ subscribe = () => {
5
+ this.on(this.EVENTS.CURSOR.MOVED, this.onMoved);
6
+ this.on(this.EVENTS.CURSOR.VIEW_SET, this.onViewSet);
7
+ this.on(this.EVENTS.MEMORY.CLEARED, this.onMemoryCleared);
8
+ };
9
+ onMoved = async () => {
10
+ await this.emit(this.EVENTS.CURSOR.UPDATE_STATE, { x: this.globalState.cursor.x, y: this.globalState.cursor.y });
11
+ await this.emit(this.EVENTS.CURSOR.UPDATE_FAST);
12
+ };
13
+ onViewSet = async ({ view } = {}) => {
14
+ await this.emit(this.EVENTS.CURSOR.UPDATE_STATE, { view });
15
+ return this.changeView(view);
16
+ };
17
+ onMemoryCleared = () => this.globalState.cursor.view && this.changeView(this.globalState.cursor.view);
18
+ loadIconMedia = (view, type) => this.emitOne(this.EVENTS.MEDIA.LOAD, {
19
+ type: this.CONST.MEDIA.TYPES.IMAGE,
20
+ priority: this.CONST.MEDIA.PRIORITIES.HIGH,
21
+ quality: this.shared.settings[this.SETTINGS.LAYER.QUALITY],
22
+ name: `cursor/${view}/${type}`,
23
+ mediaType: "icons",
24
+ });
25
+ changeView = async (view = "") => {
26
+ const [mediaDefault, mediaHover] = await Promise.all([this.loadIconMedia(view, "default"), this.loadIconMedia(view, "pointer")]);
27
+ await this.emit(this.EVENTS.CURSOR.UPDATE_STATE, { srcDefault: mediaDefault.src, srcPointer: mediaHover.src });
28
+ await this.emit(this.EVENTS.CURSOR.UPDATE_FAST);
29
+ };
30
+ }
@@ -0,0 +1,8 @@
1
+ import { ModuleView } from "@vnejs/module.components";
2
+ import type { CursorViewPluginConstants, CursorViewPluginEvents, CursorViewPluginParams, CursorViewPluginSettings } from "../types.js";
3
+ import type { CursorViewPluginState } from "../types.js";
4
+ export declare class CursorView extends ModuleView<CursorViewPluginEvents, CursorViewPluginConstants, CursorViewPluginSettings, CursorViewPluginParams, CursorViewPluginState> {
5
+ name: string;
6
+ EVENT_UPDATE_VIEW: "vne:cursor:update";
7
+ renderFunc: import("@vnejs/module.components").ViewRenderFunc<CursorViewPluginState>;
8
+ }
@@ -0,0 +1,7 @@
1
+ import { ModuleView } from "@vnejs/module.components";
2
+ import { render } from "../view/index.js";
3
+ export class CursorView extends ModuleView {
4
+ name = "cursor.view";
5
+ EVENT_UPDATE_VIEW = this.EVENTS.CURSOR.UPDATE;
6
+ renderFunc = render;
7
+ }
@@ -0,0 +1,16 @@
1
+ import type { ModuleComponentsConstants, ModuleComponentsEvents, ModuleComponentsParams, ModuleComponentsSettings } from "@vnejs/module.components";
2
+ import type { PluginName as CursorPluginName, SubscribeEvents as CursorSubscribeEvents } from "@vnejs/contracts.controls.cursor";
3
+ import type { PluginName as MemoryPluginName, SubscribeEvents as MemorySubscribeEvents } from "@vnejs/contracts.core.memory";
4
+ export type CursorViewPluginEvents = ModuleComponentsEvents & Record<CursorPluginName, CursorSubscribeEvents> & Record<MemoryPluginName, MemorySubscribeEvents>;
5
+ export type CursorViewPluginConstants = ModuleComponentsConstants;
6
+ export type CursorViewPluginSettings = ModuleComponentsSettings;
7
+ export type CursorViewPluginParams = ModuleComponentsParams;
8
+ export type CursorViewPluginState = {
9
+ isShow: boolean;
10
+ isForce: boolean;
11
+ x?: number;
12
+ y?: number;
13
+ view?: string;
14
+ srcDefault?: string;
15
+ srcPointer?: string;
16
+ };
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { ViewRenderFunc } from "@vnejs/module.components";
2
+ import type { CursorViewPluginState } from "../types.js";
3
+ export declare const render: ViewRenderFunc<CursorViewPluginState>;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Cursor, createRenderFunc, useStoreState } from "@vnejs/uis.react";
3
+ const CursorViewComponent = ({ store, onMount }) => {
4
+ const { isShow = false, x = 0, y = 0, srcDefault = "", srcPointer = "" } = useStoreState(store, onMount);
5
+ return (_jsx(Cursor, { isShow: isShow, forceX: x, forceY: y, srcDefault: srcDefault, srcPointer: srcPointer }));
6
+ };
7
+ export const render = createRenderFunc(CursorViewComponent);
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@vnejs/plugins.controllers.common.cursor",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.2.11",
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
+ ],
20
+ "scripts": {
21
+ "test": "npx @vnejs/monorepo test",
22
+ "build": "npx @vnejs/monorepo package",
23
+ "publish:major:plugin": "npm run publish:major",
24
+ "publish:minor:plugin": "npm run publish:minor",
25
+ "publish:patch:plugin": "npm run 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"
29
+ },
30
+ "author": "",
31
+ "license": "ISC",
32
+ "dependencies": {
33
+ "@vnejs/contracts.controllers.common.cursor": "~0.2.0"
34
+ },
35
+ "peerDependencies": {
36
+ "@vnejs/module.components": "~0.2.0",
37
+ "@vnejs/contracts.controls.cursor": "~0.2.0",
38
+ "@vnejs/registry": "~0.2.0",
39
+ "@vnejs/uis.react": "~0.2.0"
40
+ },
41
+ "devDependencies": {
42
+ "@vnejs/configs.ts-common": "~0.2.0",
43
+ "@vnejs/configs.vitest": "~0.2.0",
44
+ "@vnejs/test-utils": "~0.2.0",
45
+ "@vnejs/contracts.canvas.layer": "~0.2.0",
46
+ "@vnejs/contracts.controls.cursor": "~0.2.0",
47
+ "@vnejs/contracts.controllers.common.cursor": "~0.2.0",
48
+ "@vnejs/module.components": "~0.2.0",
49
+ "@vnejs/registry": "~0.2.0",
50
+ "@vnejs/sources-set": "~0.2.0",
51
+ "@vnejs/uis.react": "~0.2.0"
52
+ }
53
+ }
package/src/index.ts ADDED
@@ -0,0 +1,11 @@
1
+ import "@vnejs/contracts.controllers.common.cursor";
2
+
3
+ import { regPlugin } from "@vnejs/registry";
4
+
5
+ import { PLUGIN_NAME } from "@vnejs/contracts.controllers.common.cursor";
6
+
7
+ import { CursorViewController } from "./modules/controller.js";
8
+ import { CursorViewControllerSync } from "./modules/controller.sync.js";
9
+ import { CursorView } from "./modules/view.js";
10
+
11
+ regPlugin(PLUGIN_NAME, {}, [CursorViewController, CursorViewControllerSync, CursorView]);
@@ -0,0 +1,46 @@
1
+ import { ModuleCore } from "@vnejs/module.core";
2
+
3
+ import type { CursorViewSetPayload } from "@vnejs/contracts.controls.cursor";
4
+ import type { MediaLoadPayload } from "@vnejs/contracts.core.media";
5
+
6
+ import type { CursorViewPluginConstants, CursorViewPluginEvents, CursorViewPluginParams, CursorViewPluginSettings } from "../types.js";
7
+ import type { CursorViewPluginState } from "../types.js";
8
+
9
+ export class CursorViewControllerSync extends ModuleCore<CursorViewPluginEvents, CursorViewPluginConstants, CursorViewPluginSettings, CursorViewPluginParams> {
10
+ name = "cursor.view.controller.sync";
11
+
12
+ subscribe = () => {
13
+ this.on(this.EVENTS.CURSOR.MOVED, this.onMoved);
14
+ this.on(this.EVENTS.CURSOR.VIEW_SET, this.onViewSet);
15
+ this.on(this.EVENTS.MEMORY.CLEARED, this.onMemoryCleared);
16
+ };
17
+
18
+ onMoved = async () => {
19
+ await this.emit(this.EVENTS.CURSOR.UPDATE_STATE, { x: this.globalState.cursor.x, y: this.globalState.cursor.y });
20
+ await this.emit(this.EVENTS.CURSOR.UPDATE_FAST);
21
+ };
22
+
23
+ onViewSet = async ({ view }: CursorViewSetPayload = {}) => {
24
+ await this.emit(this.EVENTS.CURSOR.UPDATE_STATE, { view });
25
+
26
+ return this.changeView(view);
27
+ };
28
+
29
+ onMemoryCleared = () => this.globalState.cursor.view && this.changeView(this.globalState.cursor.view);
30
+
31
+ loadIconMedia = (view: string, type: string) =>
32
+ this.emitOne(this.EVENTS.MEDIA.LOAD, {
33
+ type: this.CONST.MEDIA.TYPES.IMAGE,
34
+ priority: this.CONST.MEDIA.PRIORITIES.HIGH,
35
+ quality: this.shared.settings[this.SETTINGS.LAYER.QUALITY],
36
+ name: `cursor/${view}/${type}`,
37
+ mediaType: "icons",
38
+ } satisfies MediaLoadPayload) as Promise<HTMLImageElement>;
39
+
40
+ changeView = async (view = "") => {
41
+ const [mediaDefault, mediaHover] = await Promise.all([this.loadIconMedia(view, "default"), this.loadIconMedia(view, "pointer")]);
42
+
43
+ await this.emit(this.EVENTS.CURSOR.UPDATE_STATE, { srcDefault: mediaDefault.src, srcPointer: mediaHover.src });
44
+ await this.emit(this.EVENTS.CURSOR.UPDATE_FAST);
45
+ };
46
+ }
@@ -0,0 +1,22 @@
1
+ import { ModuleController } from "@vnejs/module.components";
2
+
3
+ import type { CursorViewPluginConstants, CursorViewPluginEvents, CursorViewPluginParams, CursorViewPluginSettings } from "../types.js";
4
+ import type { CursorViewPluginState } from "../types.js";
5
+ export class CursorViewController extends ModuleController<
6
+ CursorViewPluginEvents,
7
+ CursorViewPluginConstants,
8
+ CursorViewPluginSettings,
9
+ CursorViewPluginParams,
10
+ CursorViewPluginState
11
+ > {
12
+ name = "cursor.view.controller";
13
+
14
+ EVENT_UPDATE_VIEW = this.EVENTS.CURSOR.UPDATE;
15
+ EVENT_UPDATE_STATE = this.EVENTS.CURSOR.UPDATE_STATE;
16
+ EVENT_UPDATE_FAST = this.EVENTS.CURSOR.UPDATE_FAST;
17
+ EVENT_UPDATE_FORCE = this.EVENTS.CURSOR.UPDATE_FORCE;
18
+ EVENT_SHOW = this.EVENTS.CURSOR.SHOW;
19
+ EVENT_HIDE = this.EVENTS.CURSOR.HIDE;
20
+
21
+ SHOULD_CLEAR_STATE_ON_CLEANUP = false;
22
+ }
@@ -0,0 +1,19 @@
1
+ import { ModuleView } from "@vnejs/module.components";
2
+
3
+ import type { CursorViewPluginConstants, CursorViewPluginEvents, CursorViewPluginParams, CursorViewPluginSettings } from "../types.js";
4
+ import type { CursorViewPluginState } from "../types.js";
5
+
6
+ import { render } from "../view/index.js";
7
+ export class CursorView extends ModuleView<
8
+ CursorViewPluginEvents,
9
+ CursorViewPluginConstants,
10
+ CursorViewPluginSettings,
11
+ CursorViewPluginParams,
12
+ CursorViewPluginState
13
+ > {
14
+ name = "cursor.view";
15
+
16
+ EVENT_UPDATE_VIEW = this.EVENTS.CURSOR.UPDATE;
17
+
18
+ renderFunc = render;
19
+ }
@@ -0,0 +1,49 @@
1
+ import { beforeEach, describe, expect, it } from "vitest";
2
+
3
+ import { spyEvent } from "@vnejs/test-utils";
4
+
5
+ import { SUBSCRIBE_EVENTS as MEMORY_EVENTS } from "@vnejs/contracts.core.memory";
6
+
7
+ import { CursorViewControllerSync } from "../modules/controller.sync.js";
8
+
9
+ import { createCursorTestModule, CURSOR_EVENTS, registerCursorPluginVne } from "./setup.js";
10
+
11
+ describe("CursorViewControllerSync", () => {
12
+ beforeEach(() => {
13
+ registerCursorPluginVne();
14
+ });
15
+
16
+ it("VIEW_SET emits UPDATE_STATE and loads icon media", async () => {
17
+ const { observer } = createCursorTestModule(CursorViewControllerSync);
18
+ const updateState = spyEvent(observer, CURSOR_EVENTS.UPDATE_STATE);
19
+ const updateFast = spyEvent(observer, CURSOR_EVENTS.UPDATE_FAST);
20
+
21
+ await observer.emit(CURSOR_EVENTS.VIEW_SET, { view: "hand" });
22
+
23
+ expect(updateState).toHaveBeenCalledWith({ view: "hand" });
24
+ expect(updateState).toHaveBeenCalledWith({ srcDefault: "cursor.png", srcPointer: "cursor.png" });
25
+ expect(updateFast).toHaveBeenCalled();
26
+ });
27
+
28
+ it("MOVED syncs position from globalState", async () => {
29
+ const { observer } = createCursorTestModule(CursorViewControllerSync);
30
+ const updateState = spyEvent(observer, CURSOR_EVENTS.UPDATE_STATE);
31
+ const updateFast = spyEvent(observer, CURSOR_EVENTS.UPDATE_FAST);
32
+
33
+ await observer.emit(CURSOR_EVENTS.MOVED);
34
+
35
+ expect(updateState).toHaveBeenCalledWith({ x: 100, y: 200 });
36
+ expect(updateFast).toHaveBeenCalledOnce();
37
+ });
38
+
39
+ it("MEMORY.CLEARED reloads current controller view", async () => {
40
+ const { observer } = createCursorTestModule(CursorViewControllerSync, {
41
+ state: { cursor: { view: "hand" } },
42
+ });
43
+ const updateState = spyEvent(observer, CURSOR_EVENTS.UPDATE_STATE);
44
+
45
+ await observer.emit(MEMORY_EVENTS.CLEARED);
46
+
47
+ expect(updateState).toHaveBeenCalledWith({ srcDefault: "cursor.png", srcPointer: "cursor.png" });
48
+ });
49
+ });
@@ -0,0 +1,29 @@
1
+ import { beforeEach, describe, expect, it } from "vitest";
2
+
3
+ import { CursorViewController } from "../modules/controller.js";
4
+
5
+ import { createCursorTestModule, CURSOR_EVENTS, registerCursorPluginVne } from "./setup.js";
6
+
7
+ describe("CursorViewController", () => {
8
+ beforeEach(() => {
9
+ registerCursorPluginVne();
10
+ });
11
+
12
+ it("SHOW sets isShow true", async () => {
13
+ const { module, observer } = createCursorTestModule(CursorViewController);
14
+
15
+ await observer.emit(CURSOR_EVENTS.SHOW);
16
+
17
+ expect((module as CursorViewController).state.isShow).toBe(true);
18
+ });
19
+
20
+ it("HIDE sets isShow false", async () => {
21
+ const { module, observer } = createCursorTestModule(CursorViewController, {
22
+ state: { "cursor.view.controller": { isShow: true } },
23
+ });
24
+
25
+ await observer.emit(CURSOR_EVENTS.HIDE);
26
+
27
+ expect((module as CursorViewController).state.isShow).toBe(false);
28
+ });
29
+ });
@@ -0,0 +1,42 @@
1
+ import { SourcesSet } from "@vnejs/sources-set";
2
+ import { createTestModule as baseCreateTestModule, registerCoreVne, registerVnePlugin, stubEvent, stubSilentEvent } from "@vnejs/test-utils";
3
+
4
+ import { CONSTANTS as LAYER_CONST, PLUGIN_NAME as LAYER, SETTINGS_KEYS as LAYER_SETTINGS } from "@vnejs/contracts.canvas.layer";
5
+ import { PLUGIN_NAME } from "@vnejs/contracts.controllers.common.cursor";
6
+ import { PLUGIN_NAME as CURSOR, SUBSCRIBE_EVENTS as CURSOR_EVENTS } from "@vnejs/contracts.controls.cursor";
7
+ import { SUBSCRIBE_EVENTS as MEDIA_EVENTS } from "@vnejs/contracts.core.media";
8
+
9
+ export const registerCursorPluginVne = () => {
10
+ registerCoreVne();
11
+ registerVnePlugin(CURSOR, { events: CURSOR_EVENTS });
12
+ registerVnePlugin(LAYER, { constants: LAYER_CONST, settings: LAYER_SETTINGS });
13
+ registerVnePlugin(PLUGIN_NAME, {});
14
+ };
15
+
16
+ export const createCursorTestModule = <T extends Parameters<typeof baseCreateTestModule>[0]>(
17
+ ModuleClass: T,
18
+ options: Parameters<typeof baseCreateTestModule>[1] = {},
19
+ ) => {
20
+ const result = baseCreateTestModule(ModuleClass, {
21
+ state: {
22
+ "cursor": { x: 100, y: 200 },
23
+ "cursor.view.controller": { view: "", srcDefault: "", srcPointer: "", x: 0, y: 0, isShow: false },
24
+ ...(options.state ?? {}),
25
+ },
26
+ shared: {
27
+ settings: { [LAYER_SETTINGS.QUALITY]: LAYER_CONST.QUALITIES.FHD },
28
+ viewForceAnimationSources: new SourcesSet(),
29
+ ...(options.shared ?? {}),
30
+ },
31
+ ...options,
32
+ });
33
+
34
+ stubEvent(result.observer, MEDIA_EVENTS.LOAD, () => ({ src: "cursor.png" }));
35
+ stubSilentEvent(result.observer, CURSOR_EVENTS.UPDATE);
36
+ stubSilentEvent(result.observer, CURSOR_EVENTS.SHOW);
37
+ stubSilentEvent(result.observer, CURSOR_EVENTS.HIDE);
38
+
39
+ return result;
40
+ };
41
+
42
+ export { CURSOR_EVENTS, PLUGIN_NAME };
package/src/types.ts ADDED
@@ -0,0 +1,22 @@
1
+ import type { ModuleComponentsConstants, ModuleComponentsEvents, ModuleComponentsParams, ModuleComponentsSettings } from "@vnejs/module.components";
2
+
3
+ import type { PluginName as CursorPluginName, SubscribeEvents as CursorSubscribeEvents } from "@vnejs/contracts.controls.cursor";
4
+ import type { PluginName as MemoryPluginName, SubscribeEvents as MemorySubscribeEvents } from "@vnejs/contracts.core.memory";
5
+
6
+ export type CursorViewPluginEvents = ModuleComponentsEvents & Record<CursorPluginName, CursorSubscribeEvents> & Record<MemoryPluginName, MemorySubscribeEvents>;
7
+
8
+ export type CursorViewPluginConstants = ModuleComponentsConstants;
9
+
10
+ export type CursorViewPluginSettings = ModuleComponentsSettings;
11
+
12
+ export type CursorViewPluginParams = ModuleComponentsParams;
13
+
14
+ export type CursorViewPluginState = {
15
+ isShow: boolean;
16
+ isForce: boolean;
17
+ x?: number;
18
+ y?: number;
19
+ view?: string;
20
+ srcDefault?: string;
21
+ srcPointer?: string;
22
+ };
@@ -0,0 +1,31 @@
1
+ import type { ViewRenderFunc } from "@vnejs/module.components";
2
+
3
+ import { Cursor, createRenderFunc, useStoreState } from "@vnejs/uis.react";
4
+
5
+ import type { ReactComponentProps } from "@vnejs/uis.react";
6
+
7
+ import type { CursorViewPluginConstants, CursorViewPluginEvents, CursorViewPluginParams, CursorViewPluginSettings } from "../types.js";
8
+ import type { CursorViewPluginState } from "../types.js";
9
+ type CursorViewComponentProps = ReactComponentProps<
10
+ CursorViewPluginEvents,
11
+ CursorViewPluginConstants,
12
+ CursorViewPluginSettings,
13
+ CursorViewPluginParams,
14
+ CursorViewPluginState
15
+ >;
16
+
17
+ const CursorViewComponent = ({ store, onMount }: CursorViewComponentProps) => {
18
+ const { isShow = false, x = 0, y = 0, srcDefault = "", srcPointer = "" } = useStoreState<CursorViewPluginState>(store, onMount);
19
+
20
+ return (
21
+ <Cursor
22
+ isShow={isShow}
23
+ forceX={x}
24
+ forceY={y}
25
+ srcDefault={srcDefault}
26
+ srcPointer={srcPointer}
27
+ />
28
+ );
29
+ };
30
+
31
+ export const render: ViewRenderFunc<CursorViewPluginState> = createRenderFunc(CursorViewComponent);
package/tsconfig.json ADDED
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "@vnejs/configs.ts-common/tsconfig.json",
3
+ "compilerOptions": {
4
+ "rootDir": "src",
5
+ "outDir": "dist",
6
+ "jsx": "react-jsx"
7
+ },
8
+ "include": ["src/**/*.ts", "src/**/*.tsx"],
9
+ "exclude": ["dist", "node_modules", "src/tests"]
10
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.