@knotx/core 0.3.1 → 0.3.3

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.
@@ -1,4 +1,4 @@
1
1
  import 'jsonschema';
2
2
  import 'rxjs';
3
- export { C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CpyG0nWq.cjs';
3
+ export { C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CEEdZ7QA.cjs';
4
4
  import '@knotx/data';
@@ -1,4 +1,4 @@
1
1
  import 'jsonschema';
2
2
  import 'rxjs';
3
- export { C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CpyG0nWq.mjs';
3
+ export { C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CEEdZ7QA.mjs';
4
4
  import '@knotx/data';
@@ -1,4 +1,4 @@
1
1
  import 'jsonschema';
2
2
  import 'rxjs';
3
- export { C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CpyG0nWq.js';
3
+ export { C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CEEdZ7QA.js';
4
4
  import '@knotx/data';
package/dist/index.cjs CHANGED
@@ -27,7 +27,9 @@ var InteractionPriority = /* @__PURE__ */ ((InteractionPriority2) => {
27
27
  InteractionPriority2[InteractionPriority2["HoverTooltip"] = 1e3] = "HoverTooltip";
28
28
  InteractionPriority2[InteractionPriority2["CanvasPan"] = 900] = "CanvasPan";
29
29
  InteractionPriority2[InteractionPriority2["CanvasZoom"] = 800] = "CanvasZoom";
30
- InteractionPriority2[InteractionPriority2["MultiTouchGesture"] = 700] = "MultiTouchGesture";
30
+ InteractionPriority2[InteractionPriority2["CanvasContextMenu"] = 700] = "CanvasContextMenu";
31
+ InteractionPriority2[InteractionPriority2["CanvasClick"] = 600] = "CanvasClick";
32
+ InteractionPriority2[InteractionPriority2["MultiTouchGesture"] = 500] = "MultiTouchGesture";
31
33
  return InteractionPriority2;
32
34
  })(InteractionPriority || {});
33
35
  class InteractionManager {
@@ -37,23 +39,15 @@ class InteractionManager {
37
39
  /**
38
40
  * 获取当前活动的交互
39
41
  */
40
- get activeInteraction() {
42
+ get active() {
41
43
  return Array.from(this.interactions.values()).find((interaction) => interaction.active);
42
44
  }
43
45
  /**
44
46
  * 检查是否可以交互
45
- * @param pluginId 插件ID
46
- * @param type 交互类型
47
- * @param autoStartPriority 自动启动优先级
48
- * @returns 是否可以交互
49
47
  */
50
- canInteract(pluginId, type, autoStartPriority) {
48
+ canInteract(priority) {
51
49
  var _a, _b;
52
- const interaction = this.interactions.get(pluginId + type);
53
- if (!interaction && autoStartPriority) {
54
- this.startInteraction(pluginId, type, autoStartPriority);
55
- }
56
- return (_b = (_a = this.interactions.get(pluginId + type)) == null ? void 0 : _a.active) != null ? _b : false;
50
+ return Boolean(priority >= ((_b = (_a = this.active) == null ? void 0 : _a.priority) != null ? _b : 0));
57
51
  }
58
52
  /**
59
53
  * 启动交互
@@ -62,11 +56,11 @@ class InteractionManager {
62
56
  * @param priority 优先级
63
57
  * @returns 取消交互的函数
64
58
  */
65
- startInteraction(pluginId, type, priority) {
59
+ start(pluginId, type, priority) {
66
60
  this.interactions.set(pluginId + type, { pluginId, type, priority });
67
61
  this.updateActive();
68
62
  return () => {
69
- this.endInteraction(pluginId, type);
63
+ this.end(pluginId, type);
70
64
  };
71
65
  }
72
66
  /**
@@ -74,9 +68,14 @@ class InteractionManager {
74
68
  * @param pluginId 插件ID
75
69
  * @param type 交互类型
76
70
  */
77
- endInteraction(pluginId, type) {
78
- this.interactions.delete(pluginId + type);
79
- this.updateActive();
71
+ end(pluginId, type) {
72
+ const interaction = this.interactions.get(pluginId + type);
73
+ requestAnimationFrame(() => {
74
+ if (this.interactions.get(pluginId + type) === interaction) {
75
+ this.interactions.delete(pluginId + type);
76
+ this.updateActive();
77
+ }
78
+ });
80
79
  }
81
80
  updateActive() {
82
81
  const activeInteraction = Array.from(this.interactions.values()).reduce((acc, interaction) => {
@@ -159,7 +158,7 @@ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !==
159
158
  class Engine {
160
159
  constructor(options) {
161
160
  __publicField$2(this, "runtime");
162
- __publicField$2(this, "interactionManager", new InteractionManager());
161
+ __publicField$2(this, "interaction", new InteractionManager());
163
162
  __publicField$2(this, "nodesManager");
164
163
  __publicField$2(this, "edgesManager");
165
164
  __publicField$2(this, "container$", new rxjs.BehaviorSubject(null));
@@ -388,15 +387,6 @@ class Engine {
388
387
  this.edgeRenderers$.next(edgeRenderers2);
389
388
  };
390
389
  }
391
- canInteract(pluginId, type, autoStartPriority) {
392
- return this.interactionManager.canInteract(pluginId, type, autoStartPriority);
393
- }
394
- startInteraction(pluginId, type, priority) {
395
- this.interactionManager.startInteraction(pluginId, type, priority);
396
- }
397
- endInteraction(pluginId, type) {
398
- this.interactionManager.endInteraction(pluginId, type);
399
- }
400
390
  listPlugins() {
401
391
  return Array.from(this.plugins$.value.values()).map((plugin) => ({
402
392
  name: plugin.name,
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as Engine } from './shared/core.CpyG0nWq.cjs';
2
- export { D as BasePlugin, y as CallToolMethod, C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, x as EngineOptions, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, A as Interaction, B as InteractionManager, z as InteractionPriority, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CpyG0nWq.cjs';
1
+ import { E as Engine } from './shared/core.CEEdZ7QA.cjs';
2
+ export { D as BasePlugin, y as CallToolMethod, C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, x as EngineOptions, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, A as Interaction, B as InteractionManager, z as InteractionPriority, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CEEdZ7QA.cjs';
3
3
  import { RenderType, IPlugin, LayerComponent } from '@knotx/core';
4
4
  import { BehaviorSubject } from 'rxjs';
5
5
  export * from '@knotx/data';
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as Engine } from './shared/core.CpyG0nWq.mjs';
2
- export { D as BasePlugin, y as CallToolMethod, C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, x as EngineOptions, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, A as Interaction, B as InteractionManager, z as InteractionPriority, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CpyG0nWq.mjs';
1
+ import { E as Engine } from './shared/core.CEEdZ7QA.mjs';
2
+ export { D as BasePlugin, y as CallToolMethod, C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, x as EngineOptions, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, A as Interaction, B as InteractionManager, z as InteractionPriority, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CEEdZ7QA.mjs';
3
3
  import { RenderType, IPlugin, LayerComponent } from '@knotx/core';
4
4
  import { BehaviorSubject } from 'rxjs';
5
5
  export * from '@knotx/data';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as Engine } from './shared/core.CpyG0nWq.js';
2
- export { D as BasePlugin, y as CallToolMethod, C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, x as EngineOptions, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, A as Interaction, B as InteractionManager, z as InteractionPriority, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CpyG0nWq.js';
1
+ import { E as Engine } from './shared/core.CEEdZ7QA.js';
2
+ export { D as BasePlugin, y as CallToolMethod, C as Container, d as Edge, t as EdgeOperation, r as EdgeOperationPipe, v as EdgeOperatorFunction, e as EdgeProps, g as EdgeRenderType, x as EngineOptions, n as EngineTools, H as HorizontalAlignment, w as IEngineRuntime, i as IPlugin, o as IPluginInfo, I as IRecord, p as IToolInfo, A as Interaction, B as InteractionManager, z as InteractionPriority, L as Layer, h as LayerComponent, b as Node, a as NodeMeasured, s as NodeOperation, q as NodeOperationPipe, u as NodeOperatorFunction, N as NodePosition, c as NodeProps, f as NodeRenderType, j as Plugin, k as PluginConfigs, l as PluginData, m as PluginTools, P as Position, R as RenderType, V as VerticalAlignment } from './shared/core.CEEdZ7QA.js';
3
3
  import { RenderType, IPlugin, LayerComponent } from '@knotx/core';
4
4
  import { BehaviorSubject } from 'rxjs';
5
5
  export * from '@knotx/data';
package/dist/index.js CHANGED
@@ -27,7 +27,9 @@ var InteractionPriority = /* @__PURE__ */ ((InteractionPriority2) => {
27
27
  InteractionPriority2[InteractionPriority2["HoverTooltip"] = 1e3] = "HoverTooltip";
28
28
  InteractionPriority2[InteractionPriority2["CanvasPan"] = 900] = "CanvasPan";
29
29
  InteractionPriority2[InteractionPriority2["CanvasZoom"] = 800] = "CanvasZoom";
30
- InteractionPriority2[InteractionPriority2["MultiTouchGesture"] = 700] = "MultiTouchGesture";
30
+ InteractionPriority2[InteractionPriority2["CanvasContextMenu"] = 700] = "CanvasContextMenu";
31
+ InteractionPriority2[InteractionPriority2["CanvasClick"] = 600] = "CanvasClick";
32
+ InteractionPriority2[InteractionPriority2["MultiTouchGesture"] = 500] = "MultiTouchGesture";
31
33
  return InteractionPriority2;
32
34
  })(InteractionPriority || {});
33
35
  class InteractionManager {
@@ -37,23 +39,15 @@ class InteractionManager {
37
39
  /**
38
40
  * 获取当前活动的交互
39
41
  */
40
- get activeInteraction() {
42
+ get active() {
41
43
  return Array.from(this.interactions.values()).find((interaction) => interaction.active);
42
44
  }
43
45
  /**
44
46
  * 检查是否可以交互
45
- * @param pluginId 插件ID
46
- * @param type 交互类型
47
- * @param autoStartPriority 自动启动优先级
48
- * @returns 是否可以交互
49
47
  */
50
- canInteract(pluginId, type, autoStartPriority) {
48
+ canInteract(priority) {
51
49
  var _a, _b;
52
- const interaction = this.interactions.get(pluginId + type);
53
- if (!interaction && autoStartPriority) {
54
- this.startInteraction(pluginId, type, autoStartPriority);
55
- }
56
- return (_b = (_a = this.interactions.get(pluginId + type)) == null ? void 0 : _a.active) != null ? _b : false;
50
+ return Boolean(priority >= ((_b = (_a = this.active) == null ? void 0 : _a.priority) != null ? _b : 0));
57
51
  }
58
52
  /**
59
53
  * 启动交互
@@ -62,11 +56,11 @@ class InteractionManager {
62
56
  * @param priority 优先级
63
57
  * @returns 取消交互的函数
64
58
  */
65
- startInteraction(pluginId, type, priority) {
59
+ start(pluginId, type, priority) {
66
60
  this.interactions.set(pluginId + type, { pluginId, type, priority });
67
61
  this.updateActive();
68
62
  return () => {
69
- this.endInteraction(pluginId, type);
63
+ this.end(pluginId, type);
70
64
  };
71
65
  }
72
66
  /**
@@ -74,9 +68,14 @@ class InteractionManager {
74
68
  * @param pluginId 插件ID
75
69
  * @param type 交互类型
76
70
  */
77
- endInteraction(pluginId, type) {
78
- this.interactions.delete(pluginId + type);
79
- this.updateActive();
71
+ end(pluginId, type) {
72
+ const interaction = this.interactions.get(pluginId + type);
73
+ requestAnimationFrame(() => {
74
+ if (this.interactions.get(pluginId + type) === interaction) {
75
+ this.interactions.delete(pluginId + type);
76
+ this.updateActive();
77
+ }
78
+ });
80
79
  }
81
80
  updateActive() {
82
81
  const activeInteraction = Array.from(this.interactions.values()).reduce((acc, interaction) => {
@@ -159,7 +158,7 @@ var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !==
159
158
  class Engine {
160
159
  constructor(options) {
161
160
  __publicField$2(this, "runtime");
162
- __publicField$2(this, "interactionManager", new InteractionManager());
161
+ __publicField$2(this, "interaction", new InteractionManager());
163
162
  __publicField$2(this, "nodesManager");
164
163
  __publicField$2(this, "edgesManager");
165
164
  __publicField$2(this, "container$", new BehaviorSubject(null));
@@ -388,15 +387,6 @@ class Engine {
388
387
  this.edgeRenderers$.next(edgeRenderers2);
389
388
  };
390
389
  }
391
- canInteract(pluginId, type, autoStartPriority) {
392
- return this.interactionManager.canInteract(pluginId, type, autoStartPriority);
393
- }
394
- startInteraction(pluginId, type, priority) {
395
- this.interactionManager.startInteraction(pluginId, type, priority);
396
- }
397
- endInteraction(pluginId, type) {
398
- this.interactionManager.endInteraction(pluginId, type);
399
- }
400
390
  listPlugins() {
401
391
  return Array.from(this.plugins$.value.values()).map((plugin) => ({
402
392
  name: plugin.name,
@@ -37,8 +37,12 @@ declare enum InteractionPriority {
37
37
  CanvasPan = 900,
38
38
  /** 画布缩放(滚轮或双指) */
39
39
  CanvasZoom = 800,
40
+ /** 画布上下文菜单 */
41
+ CanvasContextMenu = 700,
42
+ /** 画布点击 */
43
+ CanvasClick = 600,
40
44
  /** 多指手势(如三指滑动) */
41
- MultiTouchGesture = 700
45
+ MultiTouchGesture = 500
42
46
  }
43
47
  interface Interaction {
44
48
  pluginId: string;
@@ -54,15 +58,11 @@ declare class InteractionManager {
54
58
  /**
55
59
  * 获取当前活动的交互
56
60
  */
57
- get activeInteraction(): Interaction | undefined;
61
+ get active(): Interaction | undefined;
58
62
  /**
59
63
  * 检查是否可以交互
60
- * @param pluginId 插件ID
61
- * @param type 交互类型
62
- * @param autoStartPriority 自动启动优先级
63
- * @returns 是否可以交互
64
64
  */
65
- canInteract(pluginId: string, type: string, autoStartPriority?: InteractionPriority): boolean;
65
+ canInteract(priority: InteractionPriority): boolean;
66
66
  /**
67
67
  * 启动交互
68
68
  * @param pluginId 插件ID
@@ -70,13 +70,13 @@ declare class InteractionManager {
70
70
  * @param priority 优先级
71
71
  * @returns 取消交互的函数
72
72
  */
73
- startInteraction(pluginId: string, type: string, priority: InteractionPriority): () => void;
73
+ start(pluginId: string, type: string, priority: InteractionPriority): () => void;
74
74
  /**
75
75
  * 结束交互
76
76
  * @param pluginId 插件ID
77
77
  * @param type 交互类型
78
78
  */
79
- endInteraction(pluginId: string, type: string): void;
79
+ end(pluginId: string, type: string): void;
80
80
  private updateActive;
81
81
  }
82
82
 
@@ -104,7 +104,7 @@ interface CallToolMethod {
104
104
  }
105
105
  declare class Engine<TRenderType extends RenderType = RenderType, TNode extends IRecord = IRecord, TEdge extends IRecord = IRecord> {
106
106
  readonly runtime: IEngineRuntime;
107
- readonly interactionManager: InteractionManager;
107
+ readonly interaction: InteractionManager;
108
108
  readonly nodesManager: DataManager<Node<TNode>>;
109
109
  readonly edgesManager: DataManager<Edge<TEdge>>;
110
110
  private container$;
@@ -165,9 +165,6 @@ declare class Engine<TRenderType extends RenderType = RenderType, TNode extends
165
165
  resetPluginTool<T extends keyof PluginTools>(pluginName: T): void;
166
166
  registerNodeRenderer(type: string, renderer: NodeRenderType): () => void;
167
167
  registerEdgeRenderer(type: string, renderer: EdgeRenderType): (() => void);
168
- canInteract(pluginId: string, type: string, autoStartPriority?: InteractionPriority): boolean;
169
- startInteraction(pluginId: string, type: string, priority: InteractionPriority): void;
170
- endInteraction(pluginId: string, type: string): void;
171
168
  listPlugins(): IPluginInfo[];
172
169
  listPluginTools({ pluginName }: {
173
170
  pluginName: string;
@@ -37,8 +37,12 @@ declare enum InteractionPriority {
37
37
  CanvasPan = 900,
38
38
  /** 画布缩放(滚轮或双指) */
39
39
  CanvasZoom = 800,
40
+ /** 画布上下文菜单 */
41
+ CanvasContextMenu = 700,
42
+ /** 画布点击 */
43
+ CanvasClick = 600,
40
44
  /** 多指手势(如三指滑动) */
41
- MultiTouchGesture = 700
45
+ MultiTouchGesture = 500
42
46
  }
43
47
  interface Interaction {
44
48
  pluginId: string;
@@ -54,15 +58,11 @@ declare class InteractionManager {
54
58
  /**
55
59
  * 获取当前活动的交互
56
60
  */
57
- get activeInteraction(): Interaction | undefined;
61
+ get active(): Interaction | undefined;
58
62
  /**
59
63
  * 检查是否可以交互
60
- * @param pluginId 插件ID
61
- * @param type 交互类型
62
- * @param autoStartPriority 自动启动优先级
63
- * @returns 是否可以交互
64
64
  */
65
- canInteract(pluginId: string, type: string, autoStartPriority?: InteractionPriority): boolean;
65
+ canInteract(priority: InteractionPriority): boolean;
66
66
  /**
67
67
  * 启动交互
68
68
  * @param pluginId 插件ID
@@ -70,13 +70,13 @@ declare class InteractionManager {
70
70
  * @param priority 优先级
71
71
  * @returns 取消交互的函数
72
72
  */
73
- startInteraction(pluginId: string, type: string, priority: InteractionPriority): () => void;
73
+ start(pluginId: string, type: string, priority: InteractionPriority): () => void;
74
74
  /**
75
75
  * 结束交互
76
76
  * @param pluginId 插件ID
77
77
  * @param type 交互类型
78
78
  */
79
- endInteraction(pluginId: string, type: string): void;
79
+ end(pluginId: string, type: string): void;
80
80
  private updateActive;
81
81
  }
82
82
 
@@ -104,7 +104,7 @@ interface CallToolMethod {
104
104
  }
105
105
  declare class Engine<TRenderType extends RenderType = RenderType, TNode extends IRecord = IRecord, TEdge extends IRecord = IRecord> {
106
106
  readonly runtime: IEngineRuntime;
107
- readonly interactionManager: InteractionManager;
107
+ readonly interaction: InteractionManager;
108
108
  readonly nodesManager: DataManager<Node<TNode>>;
109
109
  readonly edgesManager: DataManager<Edge<TEdge>>;
110
110
  private container$;
@@ -165,9 +165,6 @@ declare class Engine<TRenderType extends RenderType = RenderType, TNode extends
165
165
  resetPluginTool<T extends keyof PluginTools>(pluginName: T): void;
166
166
  registerNodeRenderer(type: string, renderer: NodeRenderType): () => void;
167
167
  registerEdgeRenderer(type: string, renderer: EdgeRenderType): (() => void);
168
- canInteract(pluginId: string, type: string, autoStartPriority?: InteractionPriority): boolean;
169
- startInteraction(pluginId: string, type: string, priority: InteractionPriority): void;
170
- endInteraction(pluginId: string, type: string): void;
171
168
  listPlugins(): IPluginInfo[];
172
169
  listPluginTools({ pluginName }: {
173
170
  pluginName: string;
@@ -37,8 +37,12 @@ declare enum InteractionPriority {
37
37
  CanvasPan = 900,
38
38
  /** 画布缩放(滚轮或双指) */
39
39
  CanvasZoom = 800,
40
+ /** 画布上下文菜单 */
41
+ CanvasContextMenu = 700,
42
+ /** 画布点击 */
43
+ CanvasClick = 600,
40
44
  /** 多指手势(如三指滑动) */
41
- MultiTouchGesture = 700
45
+ MultiTouchGesture = 500
42
46
  }
43
47
  interface Interaction {
44
48
  pluginId: string;
@@ -54,15 +58,11 @@ declare class InteractionManager {
54
58
  /**
55
59
  * 获取当前活动的交互
56
60
  */
57
- get activeInteraction(): Interaction | undefined;
61
+ get active(): Interaction | undefined;
58
62
  /**
59
63
  * 检查是否可以交互
60
- * @param pluginId 插件ID
61
- * @param type 交互类型
62
- * @param autoStartPriority 自动启动优先级
63
- * @returns 是否可以交互
64
64
  */
65
- canInteract(pluginId: string, type: string, autoStartPriority?: InteractionPriority): boolean;
65
+ canInteract(priority: InteractionPriority): boolean;
66
66
  /**
67
67
  * 启动交互
68
68
  * @param pluginId 插件ID
@@ -70,13 +70,13 @@ declare class InteractionManager {
70
70
  * @param priority 优先级
71
71
  * @returns 取消交互的函数
72
72
  */
73
- startInteraction(pluginId: string, type: string, priority: InteractionPriority): () => void;
73
+ start(pluginId: string, type: string, priority: InteractionPriority): () => void;
74
74
  /**
75
75
  * 结束交互
76
76
  * @param pluginId 插件ID
77
77
  * @param type 交互类型
78
78
  */
79
- endInteraction(pluginId: string, type: string): void;
79
+ end(pluginId: string, type: string): void;
80
80
  private updateActive;
81
81
  }
82
82
 
@@ -104,7 +104,7 @@ interface CallToolMethod {
104
104
  }
105
105
  declare class Engine<TRenderType extends RenderType = RenderType, TNode extends IRecord = IRecord, TEdge extends IRecord = IRecord> {
106
106
  readonly runtime: IEngineRuntime;
107
- readonly interactionManager: InteractionManager;
107
+ readonly interaction: InteractionManager;
108
108
  readonly nodesManager: DataManager<Node<TNode>>;
109
109
  readonly edgesManager: DataManager<Edge<TEdge>>;
110
110
  private container$;
@@ -165,9 +165,6 @@ declare class Engine<TRenderType extends RenderType = RenderType, TNode extends
165
165
  resetPluginTool<T extends keyof PluginTools>(pluginName: T): void;
166
166
  registerNodeRenderer(type: string, renderer: NodeRenderType): () => void;
167
167
  registerEdgeRenderer(type: string, renderer: EdgeRenderType): (() => void);
168
- canInteract(pluginId: string, type: string, autoStartPriority?: InteractionPriority): boolean;
169
- startInteraction(pluginId: string, type: string, priority: InteractionPriority): void;
170
- endInteraction(pluginId: string, type: string): void;
171
168
  listPlugins(): IPluginInfo[];
172
169
  listPluginTools({ pluginName }: {
173
170
  pluginName: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@knotx/core",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Core for Knotx",
5
5
  "author": "boenfu",
6
6
  "license": "MIT",
@@ -46,14 +46,14 @@
46
46
  "jsonschema": "^1.5.0",
47
47
  "lodash-es": "^4.17.21",
48
48
  "rxjs": "^7.8.1",
49
- "@knotx/data": "0.3.1",
50
- "@knotx/utils": "0.3.1"
49
+ "@knotx/data": "0.3.3",
50
+ "@knotx/utils": "0.3.3"
51
51
  },
52
52
  "devDependencies": {
53
53
  "@types/lodash-es": "^4.17.12",
54
- "@knotx/build-config": "0.3.1",
55
- "@knotx/eslint-config": "0.3.1",
56
- "@knotx/typescript-config": "0.3.1"
54
+ "@knotx/build-config": "0.3.3",
55
+ "@knotx/eslint-config": "0.3.3",
56
+ "@knotx/typescript-config": "0.3.3"
57
57
  },
58
58
  "scripts": {
59
59
  "build": "unbuild",