@vunk/graph 0.0.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.
Files changed (83) hide show
  1. package/api/index.d.ts +0 -0
  2. package/api/index.mjs +1 -0
  3. package/api/user/index.d.ts +3 -0
  4. package/api/user/index.mjs +18 -0
  5. package/api/user/types.d.ts +5 -0
  6. package/components/_plugin-vue_export-helper.mjs +9 -0
  7. package/components/context-menu/index.css +1 -0
  8. package/components/context-menu/index.d.ts +2 -0
  9. package/components/context-menu/index.mjs +1797 -0
  10. package/components/graph/index.css +5 -0
  11. package/components/graph/index.d.ts +6 -0
  12. package/components/graph/index.mjs +110 -0
  13. package/components/graph/src/ctx.d.ts +12 -0
  14. package/components/graph/src/index.vue.d.ts +74 -0
  15. package/components/graph/src/types.d.ts +7 -0
  16. package/components/graph/src/useGraph.d.ts +3 -0
  17. package/components/graph/src/useSigma.d.ts +3 -0
  18. package/components/graph-view-ui/index.css +8 -0
  19. package/components/graph-view-ui/index.d.ts +4 -0
  20. package/components/graph-view-ui/index.mjs +81 -0
  21. package/components/graph-view-ui/src/ctx.d.ts +11 -0
  22. package/components/graph-view-ui/src/index.vue.d.ts +17 -0
  23. package/components/graph-view-ui/src/types.d.ts +1 -0
  24. package/components/hover-edge/index.d.ts +4 -0
  25. package/components/hover-edge/index.mjs +179 -0
  26. package/components/hover-edge/src/ctx.d.ts +42 -0
  27. package/components/hover-edge/src/index.vue.d.ts +194 -0
  28. package/components/hover-edge/src/types.d.ts +4 -0
  29. package/components/hover-highlight/index.d.ts +4 -0
  30. package/components/hover-highlight/index.mjs +133 -0
  31. package/components/hover-highlight/src/ctx.d.ts +33 -0
  32. package/components/hover-highlight/src/index.vue.d.ts +45 -0
  33. package/components/hover-highlight/src/types.d.ts +1 -0
  34. package/components/hover-node/index.d.ts +4 -0
  35. package/components/hover-node/index.mjs +146 -0
  36. package/components/hover-node/src/ctx.d.ts +35 -0
  37. package/components/hover-node/src/index.vue.d.ts +148 -0
  38. package/components/hover-node/src/types.d.ts +4 -0
  39. package/components/label/index.css +30 -0
  40. package/components/label/index.d.ts +6 -0
  41. package/components/label/index.mjs +145 -0
  42. package/components/label/src/core.d.ts +5 -0
  43. package/components/label/src/ctx.d.ts +24 -0
  44. package/components/label/src/index.vue.d.ts +33 -0
  45. package/components/label/src/types.d.ts +1 -0
  46. package/components/label/src/view.vue.d.ts +28 -0
  47. package/components/layout-forceatlas2/index.d.ts +5 -0
  48. package/components/layout-forceatlas2/index.mjs +1617 -0
  49. package/components/layout-forceatlas2/src/ctx.d.ts +9 -0
  50. package/components/layout-forceatlas2/src/index.vue.d.ts +14 -0
  51. package/components/layout-forceatlas2/src/types.d.ts +1 -0
  52. package/components/layout-forceatlas2/src/use.d.ts +16 -0
  53. package/components/link-guide/index.css +9 -0
  54. package/components/link-guide/index.d.ts +4 -0
  55. package/components/link-guide/index.mjs +118 -0
  56. package/components/link-guide/src/ctx.d.ts +11 -0
  57. package/components/link-guide/src/index.vue.d.ts +27 -0
  58. package/components/link-guide/src/types.d.ts +1 -0
  59. package/components/popup/index.css +32 -0
  60. package/components/popup/index.d.ts +5 -0
  61. package/components/popup/index.mjs +136 -0
  62. package/components/popup/src/core.d.ts +24 -0
  63. package/components/popup/src/ctx.d.ts +16 -0
  64. package/components/popup/src/index.vue.d.ts +73 -0
  65. package/components/popup/src/provider.vue.d.ts +46 -0
  66. package/components/popup/src/types.d.ts +1 -0
  67. package/components/search/index.d.ts +4 -0
  68. package/components/search/index.mjs +218 -0
  69. package/components/search/src/ctx.d.ts +53 -0
  70. package/components/search/src/index.vue.d.ts +83 -0
  71. package/components/search/src/types.d.ts +16 -0
  72. package/composables/index.d.ts +1 -0
  73. package/composables/index.mjs +1 -0
  74. package/index.css +90 -0
  75. package/index.d.ts +10 -0
  76. package/index.esm.js +10 -0
  77. package/package.json +108 -0
  78. package/shared/graph/index.d.ts +17 -0
  79. package/shared/graph/index.mjs +19 -0
  80. package/shared/index.d.ts +0 -0
  81. package/shared/index.mjs +1 -0
  82. package/stores/index.d.ts +0 -0
  83. package/stores/index.mjs +1 -0
@@ -0,0 +1,194 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ contextMenu: {
3
+ type: BooleanConstructor;
4
+ default: boolean;
5
+ };
6
+ modelValue: {
7
+ type: StringConstructor;
8
+ default: string;
9
+ };
10
+ leaveDelay: {
11
+ type: NumberConstructor;
12
+ default: number;
13
+ };
14
+ enterDelay: {
15
+ type: NumberConstructor;
16
+ default: number;
17
+ };
18
+ activeColor: {
19
+ type: StringConstructor;
20
+ default: string;
21
+ };
22
+ }>, {
23
+ props: import("@vue/shared").LooseRequired<Readonly<import("vue").ExtractPropTypes<{
24
+ contextMenu: {
25
+ type: BooleanConstructor;
26
+ default: boolean;
27
+ };
28
+ modelValue: {
29
+ type: StringConstructor;
30
+ default: string;
31
+ };
32
+ leaveDelay: {
33
+ type: NumberConstructor;
34
+ default: number;
35
+ };
36
+ enterDelay: {
37
+ type: NumberConstructor;
38
+ default: number;
39
+ };
40
+ activeColor: {
41
+ type: StringConstructor;
42
+ default: string;
43
+ };
44
+ }>> & Readonly<{
45
+ onRightClick?: ((e: import("./types").RightClickEvent) => any) | undefined;
46
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
47
+ }> & {}>;
48
+ emit: ((event: "rightClick", e: import("./types").RightClickEvent) => void) & ((event: "update:modelValue", ...args: any[]) => void);
49
+ sigma: import("sigma").default<import("graphology-types").Attributes, import("graphology-types").Attributes, import("graphology-types").Attributes>;
50
+ graph: import("graphology").default<import("graphology-types").Attributes, import("graphology-types").Attributes, import("graphology-types").Attributes>;
51
+ contextmenuState: {
52
+ edge: string;
53
+ show: boolean;
54
+ options: {
55
+ x: number;
56
+ y: number;
57
+ };
58
+ };
59
+ oldNodeReducer: any;
60
+ oldEdgeReducer: any;
61
+ isApplied: boolean;
62
+ enterTimer: any;
63
+ leaveTimer: any;
64
+ enterHandler: ({ edge }: {
65
+ edge: string;
66
+ }) => void;
67
+ leaveHandler: () => void;
68
+ rightClickHandler: ({ event }: any) => void;
69
+ changeContextmenuShow: (show: boolean) => void;
70
+ readonly ContextMenu: {
71
+ new (...args: any[]): import("vue").CreateComponentPublicInstanceWithMixins<Readonly<import("vue").ExtractPropTypes<{
72
+ options: {
73
+ type: import("vue").PropType<import("@vunk/graph/components/context-menu").MenuOptions>;
74
+ default: null;
75
+ };
76
+ show: {
77
+ type: BooleanConstructor;
78
+ default: boolean;
79
+ };
80
+ }>> & {
81
+ onClose?: ((...args: any[]) => any) | undefined;
82
+ "onUpdate:show"?: ((...args: any[]) => any) | undefined;
83
+ }, {
84
+ closeMenu: () => void;
85
+ isClosed: () => boolean;
86
+ getMenuRef: () => import("@vunk/graph/components/context-menu").ContextSubMenuInstance | undefined;
87
+ getMenuDimensions: () => {
88
+ width: number;
89
+ height: number;
90
+ };
91
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
92
+ close: (...args: any[]) => void;
93
+ "update:show": (...args: any[]) => void;
94
+ }, import("vue").PublicProps, {
95
+ options: import("@vunk/graph/components/context-menu").MenuOptions;
96
+ show: boolean;
97
+ }, true, {}, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, {}, any, import("vue").ComponentProvideOptions, {
98
+ P: {};
99
+ B: {};
100
+ D: {};
101
+ C: {};
102
+ M: {};
103
+ Defaults: {};
104
+ }, Readonly<import("vue").ExtractPropTypes<{
105
+ options: {
106
+ type: import("vue").PropType<import("@vunk/graph/components/context-menu").MenuOptions>;
107
+ default: null;
108
+ };
109
+ show: {
110
+ type: BooleanConstructor;
111
+ default: boolean;
112
+ };
113
+ }>> & {
114
+ onClose?: ((...args: any[]) => any) | undefined;
115
+ "onUpdate:show"?: ((...args: any[]) => any) | undefined;
116
+ }, {
117
+ closeMenu: () => void;
118
+ isClosed: () => boolean;
119
+ getMenuRef: () => import("@vunk/graph/components/context-menu").ContextSubMenuInstance | undefined;
120
+ getMenuDimensions: () => {
121
+ width: number;
122
+ height: number;
123
+ };
124
+ }, {}, {}, {}, {
125
+ options: import("@vunk/graph/components/context-menu").MenuOptions;
126
+ show: boolean;
127
+ }>;
128
+ __isFragment?: never;
129
+ __isTeleport?: never;
130
+ __isSuspense?: never;
131
+ } & import("vue").ComponentOptionsBase<Readonly<import("vue").ExtractPropTypes<{
132
+ options: {
133
+ type: import("vue").PropType<import("@vunk/graph/components/context-menu").MenuOptions>;
134
+ default: null;
135
+ };
136
+ show: {
137
+ type: BooleanConstructor;
138
+ default: boolean;
139
+ };
140
+ }>> & {
141
+ onClose?: ((...args: any[]) => any) | undefined;
142
+ "onUpdate:show"?: ((...args: any[]) => any) | undefined;
143
+ }, {
144
+ closeMenu: () => void;
145
+ isClosed: () => boolean;
146
+ getMenuRef: () => import("@vunk/graph/components/context-menu").ContextSubMenuInstance | undefined;
147
+ getMenuDimensions: () => {
148
+ width: number;
149
+ height: number;
150
+ };
151
+ }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
152
+ close: (...args: any[]) => void;
153
+ "update:show": (...args: any[]) => void;
154
+ }, string, {
155
+ options: import("@vunk/graph/components/context-menu").MenuOptions;
156
+ show: boolean;
157
+ }, {}, string, {}, import("vue").GlobalComponents, import("vue").GlobalDirectives, string, import("vue").ComponentProvideOptions> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & (new () => {
158
+ $slots: Partial<Record<number, (_: any) => any>>;
159
+ });
160
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
161
+ 'update:modelValue': null;
162
+ rightClick: (e: import("./types").RightClickEvent) => import("./types").RightClickEvent;
163
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
164
+ contextMenu: {
165
+ type: BooleanConstructor;
166
+ default: boolean;
167
+ };
168
+ modelValue: {
169
+ type: StringConstructor;
170
+ default: string;
171
+ };
172
+ leaveDelay: {
173
+ type: NumberConstructor;
174
+ default: number;
175
+ };
176
+ enterDelay: {
177
+ type: NumberConstructor;
178
+ default: number;
179
+ };
180
+ activeColor: {
181
+ type: StringConstructor;
182
+ default: string;
183
+ };
184
+ }>> & Readonly<{
185
+ onRightClick?: ((e: import("./types").RightClickEvent) => any) | undefined;
186
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
187
+ }>, {
188
+ contextMenu: boolean;
189
+ modelValue: string;
190
+ leaveDelay: number;
191
+ enterDelay: number;
192
+ activeColor: string;
193
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
194
+ export default _default;
@@ -0,0 +1,4 @@
1
+ export interface RightClickEvent {
2
+ edge: string;
3
+ original: MouseEvent;
4
+ }
@@ -0,0 +1,4 @@
1
+ import VkHoverHighlight from './src/index.vue';
2
+ export * as __VkHoverHighlight from './src/types';
3
+ export { VkHoverHighlight, };
4
+ export default VkHoverHighlight;
@@ -0,0 +1,133 @@
1
+ import { useSigma } from '@vunk/graph/composables';
2
+ import { defineComponent, watch, onMounted, onUnmounted, renderSlot } from 'vue';
3
+ import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
4
+
5
+ const props = {
6
+ /**
7
+ * 当前高亮的节点 ID。支持 v-model。
8
+ */
9
+ modelValue: {
10
+ type: String,
11
+ default: ""
12
+ },
13
+ /**
14
+ * 鼠标悬浮触发高亮的延迟时间 (ms)
15
+ */
16
+ delay: {
17
+ type: Number,
18
+ default: 500
19
+ },
20
+ /**
21
+ * 非高亮节点在淡出时的颜色(通常为带透明度的背景色)
22
+ */
23
+ nodeFadeColor: {
24
+ type: String,
25
+ default: "rgba(0, 0, 0, 0.1)"
26
+ },
27
+ /**
28
+ * 非高亮边在淡出时的颜色
29
+ */
30
+ edgeFadeColor: {
31
+ type: String,
32
+ default: "rgba(0, 0, 0, 0.05)"
33
+ }
34
+ };
35
+ const emits = {
36
+ "update:modelValue": null
37
+ };
38
+
39
+ var _sfc_main = defineComponent({
40
+ name: "VkHoverHighlight",
41
+ props,
42
+ emits,
43
+ setup(props2, { emit }) {
44
+ const sigma = useSigma();
45
+ const graph = sigma.getGraph();
46
+ let oldNodeReducer = null;
47
+ let oldEdgeReducer = null;
48
+ let isApplied = false;
49
+ watch(() => props2.modelValue, (nodeId) => {
50
+ if (nodeId) {
51
+ if (!isApplied) {
52
+ oldNodeReducer = sigma.getSetting("nodeReducer");
53
+ oldEdgeReducer = sigma.getSetting("edgeReducer");
54
+ isApplied = true;
55
+ }
56
+ const hoveredColor = sigma.getNodeDisplayData(nodeId)?.color || "";
57
+ sigma.setSetting("nodeReducer", (node, data) => {
58
+ const baseData = oldNodeReducer ? oldNodeReducer(node, data) : data;
59
+ if (node === nodeId) {
60
+ return { ...baseData, zIndex: 3 };
61
+ }
62
+ if (graph.hasEdge(node, nodeId) || graph.hasEdge(nodeId, node)) {
63
+ return { ...baseData, zIndex: 2 };
64
+ }
65
+ return {
66
+ ...baseData,
67
+ zIndex: 0,
68
+ label: "",
69
+ color: props2.nodeFadeColor,
70
+ highlighted: false
71
+ };
72
+ });
73
+ sigma.setSetting("edgeReducer", (edge, data) => {
74
+ const baseData = oldEdgeReducer ? oldEdgeReducer(edge, data) : data;
75
+ if (graph.hasExtremity(edge, nodeId)) {
76
+ return { ...baseData, color: hoveredColor, zIndex: 10 };
77
+ }
78
+ return {
79
+ ...baseData,
80
+ color: props2.edgeFadeColor,
81
+ label: "",
82
+ zIndex: 0
83
+ };
84
+ });
85
+ } else {
86
+ if (isApplied) {
87
+ sigma.setSetting("nodeReducer", oldNodeReducer);
88
+ sigma.setSetting("edgeReducer", oldEdgeReducer);
89
+ isApplied = false;
90
+ }
91
+ }
92
+ });
93
+ let timer = null;
94
+ const enterHandler = ({ node }) => {
95
+ timer = setTimeout(() => {
96
+ emit("update:modelValue", node);
97
+ }, props2.delay);
98
+ };
99
+ const leaveHandler = () => {
100
+ clearTimeout(timer);
101
+ emit("update:modelValue", "");
102
+ };
103
+ onMounted(() => {
104
+ sigma.on("enterNode", enterHandler);
105
+ sigma.on("leaveNode", leaveHandler);
106
+ });
107
+ onUnmounted(() => {
108
+ clearTimeout(timer);
109
+ sigma.off("enterNode", enterHandler);
110
+ sigma.off("leaveNode", leaveHandler);
111
+ if (isApplied) {
112
+ sigma.setSetting("nodeReducer", oldNodeReducer);
113
+ sigma.setSetting("edgeReducer", oldEdgeReducer);
114
+ }
115
+ });
116
+ return {};
117
+ }
118
+ });
119
+
120
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
121
+ return renderSlot(_ctx.$slots, "default");
122
+ }
123
+ var VkHoverHighlight = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
124
+
125
+ var types = /*#__PURE__*/Object.freeze({
126
+ __proto__: null
127
+ });
128
+
129
+ VkHoverHighlight.install = (app) => {
130
+ app.component(VkHoverHighlight.name || "VkHoverHighlight", VkHoverHighlight);
131
+ };
132
+
133
+ export { VkHoverHighlight, types as __VkHoverHighlight, VkHoverHighlight as default };
@@ -0,0 +1,33 @@
1
+ export declare const props: {
2
+ /**
3
+ * 当前高亮的节点 ID。支持 v-model。
4
+ */
5
+ modelValue: {
6
+ type: StringConstructor;
7
+ default: string;
8
+ };
9
+ /**
10
+ * 鼠标悬浮触发高亮的延迟时间 (ms)
11
+ */
12
+ delay: {
13
+ type: NumberConstructor;
14
+ default: number;
15
+ };
16
+ /**
17
+ * 非高亮节点在淡出时的颜色(通常为带透明度的背景色)
18
+ */
19
+ nodeFadeColor: {
20
+ type: StringConstructor;
21
+ default: string;
22
+ };
23
+ /**
24
+ * 非高亮边在淡出时的颜色
25
+ */
26
+ edgeFadeColor: {
27
+ type: StringConstructor;
28
+ default: string;
29
+ };
30
+ };
31
+ export declare const emits: {
32
+ 'update:modelValue': null;
33
+ };
@@ -0,0 +1,45 @@
1
+ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
2
+ modelValue: {
3
+ type: StringConstructor;
4
+ default: string;
5
+ };
6
+ delay: {
7
+ type: NumberConstructor;
8
+ default: number;
9
+ };
10
+ nodeFadeColor: {
11
+ type: StringConstructor;
12
+ default: string;
13
+ };
14
+ edgeFadeColor: {
15
+ type: StringConstructor;
16
+ default: string;
17
+ };
18
+ }>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
19
+ 'update:modelValue': null;
20
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
21
+ modelValue: {
22
+ type: StringConstructor;
23
+ default: string;
24
+ };
25
+ delay: {
26
+ type: NumberConstructor;
27
+ default: number;
28
+ };
29
+ nodeFadeColor: {
30
+ type: StringConstructor;
31
+ default: string;
32
+ };
33
+ edgeFadeColor: {
34
+ type: StringConstructor;
35
+ default: string;
36
+ };
37
+ }>> & Readonly<{
38
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
39
+ }>, {
40
+ modelValue: string;
41
+ delay: number;
42
+ nodeFadeColor: string;
43
+ edgeFadeColor: string;
44
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
45
+ export default _default;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ import VkHoverNode from './src/index.vue';
2
+ export * as __VkHoverNode from './src/types';
3
+ export { VkHoverNode, };
4
+ export default VkHoverNode;
@@ -0,0 +1,146 @@
1
+ import { ContextMenu } from '@vunk/graph/components/context-menu';
2
+ import { useSigma } from '@vunk/graph/composables';
3
+ import { defineComponent, reactive, onMounted, onBeforeUnmount, resolveComponent, createBlock, createCommentVNode, openBlock, withCtx, renderSlot } from 'vue';
4
+ import { _ as _export_sfc } from '../_plugin-vue_export-helper.mjs';
5
+
6
+ const props = {
7
+ /**
8
+ * 是否启用右键菜单功能
9
+ */
10
+ contextMenu: {
11
+ type: Boolean,
12
+ default: false
13
+ },
14
+ /**
15
+ * 当前悬浮的节点 ID。支持 v-model。
16
+ */
17
+ modelValue: {
18
+ type: String,
19
+ default: ""
20
+ },
21
+ /**
22
+ * 移除时的延迟时间 (ms)
23
+ */
24
+ leaveDelay: {
25
+ type: Number,
26
+ default: 100
27
+ },
28
+ /**
29
+ * 进入时的延迟时间 (ms)
30
+ */
31
+ enterDelay: {
32
+ type: Number,
33
+ default: 0
34
+ }
35
+ };
36
+ const emits = {
37
+ "update:modelValue": null,
38
+ "rightClick": (e) => e
39
+ };
40
+
41
+ var _sfc_main = defineComponent({
42
+ name: "VkHoverNode",
43
+ components: {
44
+ ContextMenu
45
+ },
46
+ props,
47
+ emits,
48
+ setup(props2, { emit }) {
49
+ const sigma = useSigma();
50
+ const contextmenuState = reactive({
51
+ node: "",
52
+ show: false,
53
+ options: {
54
+ x: 0,
55
+ y: 0
56
+ }
57
+ });
58
+ let enterTimer = null;
59
+ let leaveTimer = null;
60
+ const enterHandler = ({ node }) => {
61
+ clearTimeout(leaveTimer);
62
+ enterTimer = setTimeout(() => {
63
+ emit("update:modelValue", node);
64
+ }, props2.enterDelay);
65
+ };
66
+ const leaveHandler = () => {
67
+ clearTimeout(enterTimer);
68
+ leaveTimer = setTimeout(() => {
69
+ if (props2.contextMenu && contextmenuState.show)
70
+ return;
71
+ emit("update:modelValue", "");
72
+ }, props2.leaveDelay);
73
+ };
74
+ onMounted(() => {
75
+ sigma.on("enterNode", enterHandler);
76
+ sigma.on("leaveNode", leaveHandler);
77
+ });
78
+ onBeforeUnmount(() => {
79
+ clearTimeout(enterTimer);
80
+ clearTimeout(leaveTimer);
81
+ sigma.off("enterNode", enterHandler);
82
+ sigma.off("leaveNode", leaveHandler);
83
+ });
84
+ onMounted(() => {
85
+ sigma.on("rightClickNode", rightClickHandler);
86
+ sigma.on("rightClickStage", rightClickHandler);
87
+ });
88
+ onBeforeUnmount(() => {
89
+ sigma.off("rightClickNode", rightClickHandler);
90
+ sigma.off("rightClickStage", rightClickHandler);
91
+ });
92
+ function rightClickHandler({ event }) {
93
+ if (props2.modelValue) {
94
+ const { original } = event;
95
+ original.preventDefault();
96
+ contextmenuState.show = true;
97
+ contextmenuState.node = props2.modelValue;
98
+ contextmenuState.options.x = original.x;
99
+ contextmenuState.options.y = original.y;
100
+ emit("rightClick", {
101
+ node: props2.modelValue,
102
+ original
103
+ });
104
+ }
105
+ }
106
+ function changeContextmenuShow(show) {
107
+ !show && leaveHandler();
108
+ }
109
+ return {
110
+ changeContextmenuShow,
111
+ contextmenuState
112
+ };
113
+ }
114
+ });
115
+
116
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
117
+ const _component_ContextMenu = resolveComponent("ContextMenu");
118
+ return _ctx.contextMenu ? (openBlock(), createBlock(_component_ContextMenu, {
119
+ key: 0,
120
+ show: _ctx.contextmenuState.show,
121
+ "onUpdate:show": [
122
+ _cache[0] || (_cache[0] = ($event) => _ctx.contextmenuState.show = $event),
123
+ _ctx.changeContextmenuShow
124
+ ],
125
+ options: _ctx.contextmenuState.options
126
+ }, {
127
+ default: withCtx(() => [
128
+ renderSlot(_ctx.$slots, "default", {
129
+ node: _ctx.contextmenuState.node
130
+ })
131
+ ]),
132
+ _: 3
133
+ /* FORWARDED */
134
+ }, 8, ["show", "options", "onUpdate:show"])) : createCommentVNode("v-if", true);
135
+ }
136
+ var VkHoverNode = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
137
+
138
+ var types = /*#__PURE__*/Object.freeze({
139
+ __proto__: null
140
+ });
141
+
142
+ VkHoverNode.install = (app) => {
143
+ app.component(VkHoverNode.name || "VkHoverNode", VkHoverNode);
144
+ };
145
+
146
+ export { VkHoverNode, types as __VkHoverNode, VkHoverNode as default };
@@ -0,0 +1,35 @@
1
+ import type { RightClickEvent } from './types';
2
+ export declare const props: {
3
+ /**
4
+ * 是否启用右键菜单功能
5
+ */
6
+ contextMenu: {
7
+ type: BooleanConstructor;
8
+ default: boolean;
9
+ };
10
+ /**
11
+ * 当前悬浮的节点 ID。支持 v-model。
12
+ */
13
+ modelValue: {
14
+ type: StringConstructor;
15
+ default: string;
16
+ };
17
+ /**
18
+ * 移除时的延迟时间 (ms)
19
+ */
20
+ leaveDelay: {
21
+ type: NumberConstructor;
22
+ default: number;
23
+ };
24
+ /**
25
+ * 进入时的延迟时间 (ms)
26
+ */
27
+ enterDelay: {
28
+ type: NumberConstructor;
29
+ default: number;
30
+ };
31
+ };
32
+ export declare const emits: {
33
+ 'update:modelValue': null;
34
+ rightClick: (e: RightClickEvent) => RightClickEvent;
35
+ };