@flowgram.ai/free-layout-core 0.1.0-alpha.35 → 0.1.0-alpha.36

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
- export { L as LineCenterPoint, y as LineColor, z as LineColors, g as LineEventProps, x as LinePoint, w as LinePointLocation, m as LinePosition, k as LineRenderType, v as LineType, D as NodesDragEndEvent, N as NodesDragEvent, C as NodesDragStartEvent, E as NodesDraggingEvent, O as OnDragLineEnd, t as WorkflowContentChangeEvent, s as WorkflowContentChangeType, W as WorkflowJSON, l as WorkflowLineRenderContribution, A as WorkflowLineRenderContributionFactory, h as WorkflowNodeJSON, u as WorkflowNodeMeta, B as WorkflowSubCanvas, F as onDragLineEndParams } from '../workflow-node-entity-C6bFzfXc.mjs';
1
+ export { L as LineCenterPoint, y as LineColor, z as LineColors, g as LineEventProps, x as LinePoint, w as LinePointLocation, m as LinePosition, k as LineRenderType, v as LineType, D as NodesDragEndEvent, N as NodesDragEvent, C as NodesDragStartEvent, E as NodesDraggingEvent, O as OnDragLineEnd, t as WorkflowContentChangeEvent, s as WorkflowContentChangeType, W as WorkflowJSON, l as WorkflowLineRenderContribution, A as WorkflowLineRenderContributionFactory, h as WorkflowNodeJSON, u as WorkflowNodeMeta, B as WorkflowSubCanvas, F as onDragLineEndParams } from '../workflow-node-entity-DcXjib68.mjs';
2
2
  export { WorkflowEdgeJSON } from './workflow-edge.mjs';
3
3
  export { WorkflowNodeFormMeta, WorkflowNodeRegistry, WorkflowNodeRenderProps } from './workflow-registry.mjs';
4
4
  export { NodePostionUpdateEvent, WorkflowOperationBaseService } from './workflow-operation.mjs';
@@ -1,4 +1,4 @@
1
- export { L as LineCenterPoint, y as LineColor, z as LineColors, g as LineEventProps, x as LinePoint, w as LinePointLocation, m as LinePosition, k as LineRenderType, v as LineType, D as NodesDragEndEvent, N as NodesDragEvent, C as NodesDragStartEvent, E as NodesDraggingEvent, O as OnDragLineEnd, t as WorkflowContentChangeEvent, s as WorkflowContentChangeType, W as WorkflowJSON, l as WorkflowLineRenderContribution, A as WorkflowLineRenderContributionFactory, h as WorkflowNodeJSON, u as WorkflowNodeMeta, B as WorkflowSubCanvas, F as onDragLineEndParams } from '../workflow-node-entity-03Q7Fvv6.js';
1
+ export { L as LineCenterPoint, y as LineColor, z as LineColors, g as LineEventProps, x as LinePoint, w as LinePointLocation, m as LinePosition, k as LineRenderType, v as LineType, D as NodesDragEndEvent, N as NodesDragEvent, C as NodesDragStartEvent, E as NodesDraggingEvent, O as OnDragLineEnd, t as WorkflowContentChangeEvent, s as WorkflowContentChangeType, W as WorkflowJSON, l as WorkflowLineRenderContribution, A as WorkflowLineRenderContributionFactory, h as WorkflowNodeJSON, u as WorkflowNodeMeta, B as WorkflowSubCanvas, F as onDragLineEndParams } from '../workflow-node-entity-_7O7-wJE.js';
2
2
  export { WorkflowEdgeJSON } from './workflow-edge.js';
3
3
  export { WorkflowNodeFormMeta, WorkflowNodeRegistry, WorkflowNodeRenderProps } from './workflow-registry.js';
4
4
  export { NodePostionUpdateEvent, WorkflowOperationBaseService } from './workflow-operation.js';
@@ -2,6 +2,6 @@ import 'react';
2
2
  import '@flowgram.ai/utils';
3
3
  import '@flowgram.ai/document';
4
4
  import '@flowgram.ai/core';
5
- export { g as LineEventProps, D as NodesDragEndEvent, N as NodesDragEvent, C as NodesDragStartEvent, E as NodesDraggingEvent, O as OnDragLineEnd, F as onDragLineEndParams } from '../workflow-node-entity-C6bFzfXc.mjs';
5
+ export { g as LineEventProps, D as NodesDragEndEvent, N as NodesDragEvent, C as NodesDragStartEvent, E as NodesDraggingEvent, O as OnDragLineEnd, F as onDragLineEndParams } from '../workflow-node-entity-DcXjib68.mjs';
6
6
  import '@flowgram.ai/form-core';
7
7
  import './workflow-edge.mjs';
@@ -2,6 +2,6 @@ import 'react';
2
2
  import '@flowgram.ai/utils';
3
3
  import '@flowgram.ai/document';
4
4
  import '@flowgram.ai/core';
5
- export { g as LineEventProps, D as NodesDragEndEvent, N as NodesDragEvent, C as NodesDragStartEvent, E as NodesDraggingEvent, O as OnDragLineEnd, F as onDragLineEndParams } from '../workflow-node-entity-03Q7Fvv6.js';
5
+ export { g as LineEventProps, D as NodesDragEndEvent, N as NodesDragEvent, C as NodesDragStartEvent, E as NodesDraggingEvent, O as OnDragLineEnd, F as onDragLineEndParams } from '../workflow-node-entity-_7O7-wJE.js';
6
6
  import '@flowgram.ai/form-core';
7
7
  import './workflow-edge.js';
@@ -1,4 +1,4 @@
1
- export { t as WorkflowContentChangeEvent, s as WorkflowContentChangeType, W as WorkflowJSON } from '../workflow-node-entity-C6bFzfXc.mjs';
1
+ export { t as WorkflowContentChangeEvent, s as WorkflowContentChangeType, W as WorkflowJSON } from '../workflow-node-entity-DcXjib68.mjs';
2
2
  import './workflow-edge.mjs';
3
3
  import '@flowgram.ai/document';
4
4
  import '@flowgram.ai/core';
@@ -1,4 +1,4 @@
1
- export { t as WorkflowContentChangeEvent, s as WorkflowContentChangeType, W as WorkflowJSON } from '../workflow-node-entity-03Q7Fvv6.js';
1
+ export { t as WorkflowContentChangeEvent, s as WorkflowContentChangeType, W as WorkflowJSON } from '../workflow-node-entity-_7O7-wJE.js';
2
2
  import './workflow-edge.js';
3
3
  import '@flowgram.ai/document';
4
4
  import '@flowgram.ai/core';
@@ -1,5 +1,5 @@
1
1
  import '@flowgram.ai/utils';
2
- export { L as LineCenterPoint, y as LineColor, z as LineColors, x as LinePoint, w as LinePointLocation, m as LinePosition, k as LineRenderType, v as LineType, l as WorkflowLineRenderContribution, A as WorkflowLineRenderContributionFactory } from '../workflow-node-entity-C6bFzfXc.mjs';
2
+ export { L as LineCenterPoint, y as LineColor, z as LineColors, x as LinePoint, w as LinePointLocation, m as LinePosition, k as LineRenderType, v as LineType, l as WorkflowLineRenderContribution, A as WorkflowLineRenderContributionFactory } from '../workflow-node-entity-DcXjib68.mjs';
3
3
  import '@flowgram.ai/document';
4
4
  import '@flowgram.ai/core';
5
5
  import 'react';
@@ -1,5 +1,5 @@
1
1
  import '@flowgram.ai/utils';
2
- export { L as LineCenterPoint, y as LineColor, z as LineColors, x as LinePoint, w as LinePointLocation, m as LinePosition, k as LineRenderType, v as LineType, l as WorkflowLineRenderContribution, A as WorkflowLineRenderContributionFactory } from '../workflow-node-entity-03Q7Fvv6.js';
2
+ export { L as LineCenterPoint, y as LineColor, z as LineColors, x as LinePoint, w as LinePointLocation, m as LinePosition, k as LineRenderType, v as LineType, l as WorkflowLineRenderContribution, A as WorkflowLineRenderContributionFactory } from '../workflow-node-entity-_7O7-wJE.js';
3
3
  import '@flowgram.ai/document';
4
4
  import '@flowgram.ai/core';
5
5
  import 'react';
@@ -1,6 +1,6 @@
1
1
  import '@flowgram.ai/utils';
2
2
  import '@flowgram.ai/document';
3
- export { h as WorkflowNodeJSON, u as WorkflowNodeMeta } from '../workflow-node-entity-C6bFzfXc.mjs';
3
+ export { h as WorkflowNodeJSON, u as WorkflowNodeMeta } from '../workflow-node-entity-DcXjib68.mjs';
4
4
  import './workflow-edge.mjs';
5
5
  import '@flowgram.ai/core';
6
6
  import 'react';
@@ -1,6 +1,6 @@
1
1
  import '@flowgram.ai/utils';
2
2
  import '@flowgram.ai/document';
3
- export { h as WorkflowNodeJSON, u as WorkflowNodeMeta } from '../workflow-node-entity-03Q7Fvv6.js';
3
+ export { h as WorkflowNodeJSON, u as WorkflowNodeMeta } from '../workflow-node-entity-_7O7-wJE.js';
4
4
  import './workflow-edge.js';
5
5
  import '@flowgram.ai/core';
6
6
  import 'react';
@@ -1,6 +1,6 @@
1
1
  import { IPoint, Event } from '@flowgram.ai/utils';
2
2
  import { FlowNodeEntity, FlowOperationBaseService, FlowNodeEntityOrId } from '@flowgram.ai/document';
3
- import { W as WorkflowJSON } from '../workflow-node-entity-C6bFzfXc.mjs';
3
+ import { W as WorkflowJSON } from '../workflow-node-entity-DcXjib68.mjs';
4
4
  import '@flowgram.ai/core';
5
5
  import 'react';
6
6
  import '@flowgram.ai/form-core';
@@ -1,6 +1,6 @@
1
1
  import { IPoint, Event } from '@flowgram.ai/utils';
2
2
  import { FlowNodeEntity, FlowOperationBaseService, FlowNodeEntityOrId } from '@flowgram.ai/document';
3
- import { W as WorkflowJSON } from '../workflow-node-entity-03Q7Fvv6.js';
3
+ import { W as WorkflowJSON } from '../workflow-node-entity-_7O7-wJE.js';
4
4
  import '@flowgram.ai/core';
5
5
  import 'react';
6
6
  import '@flowgram.ai/form-core';
@@ -1,7 +1,7 @@
1
1
  import { FormMeta } from '@flowgram.ai/node';
2
2
  import { FormMetaOrFormMetaGenerator } from '@flowgram.ai/form-core';
3
3
  import { FlowNodeRegistry } from '@flowgram.ai/document';
4
- import { u as WorkflowNodeMeta, i as WorkflowPortEntity, d as WorkflowLinesManager, b as WorkflowNodeEntity } from '../workflow-node-entity-C6bFzfXc.mjs';
4
+ import { u as WorkflowNodeMeta, i as WorkflowPortEntity, d as WorkflowLinesManager, b as WorkflowNodeEntity } from '../workflow-node-entity-DcXjib68.mjs';
5
5
  import '@flowgram.ai/core';
6
6
  import '@flowgram.ai/utils';
7
7
  import 'react';
@@ -1,7 +1,7 @@
1
1
  import { FormMeta } from '@flowgram.ai/node';
2
2
  import { FormMetaOrFormMetaGenerator } from '@flowgram.ai/form-core';
3
3
  import { FlowNodeRegistry } from '@flowgram.ai/document';
4
- import { u as WorkflowNodeMeta, i as WorkflowPortEntity, d as WorkflowLinesManager, b as WorkflowNodeEntity } from '../workflow-node-entity-03Q7Fvv6.js';
4
+ import { u as WorkflowNodeMeta, i as WorkflowPortEntity, d as WorkflowLinesManager, b as WorkflowNodeEntity } from '../workflow-node-entity-_7O7-wJE.js';
5
5
  import '@flowgram.ai/core';
6
6
  import '@flowgram.ai/utils';
7
7
  import 'react';
@@ -1,4 +1,4 @@
1
- export { B as WorkflowSubCanvas } from '../workflow-node-entity-C6bFzfXc.mjs';
1
+ export { B as WorkflowSubCanvas } from '../workflow-node-entity-DcXjib68.mjs';
2
2
  import '@flowgram.ai/document';
3
3
  import '@flowgram.ai/core';
4
4
  import '@flowgram.ai/utils';
@@ -1,4 +1,4 @@
1
- export { B as WorkflowSubCanvas } from '../workflow-node-entity-03Q7Fvv6.js';
1
+ export { B as WorkflowSubCanvas } from '../workflow-node-entity-_7O7-wJE.js';
2
2
  import '@flowgram.ai/document';
3
3
  import '@flowgram.ai/core';
4
4
  import '@flowgram.ai/utils';
@@ -584,6 +584,11 @@ declare class WorkflowLinesManager {
584
584
  protected _lineType: LineRenderType;
585
585
  protected onAvailableLinesChangeEmitter: Emitter<WorkflowContentChangeEvent>;
586
586
  protected onForceUpdateEmitter: Emitter<void>;
587
+ private sortedNodesCache?;
588
+ private sortedNodesCacheVersion?;
589
+ private hoverNodesCache?;
590
+ private hoverNodesCacheVersion?;
591
+ private hoverNodesCacheActivatedID?;
587
592
  hoverService: WorkflowHoverService;
588
593
  selectService: WorkflowSelectService;
589
594
  protected readonly entityManager: EntityManager;
@@ -599,6 +604,7 @@ declare class WorkflowLinesManager {
599
604
  readonly contributionFactories: WorkflowLineRenderContributionFactory[];
600
605
  init(doc: WorkflowDocument): void;
601
606
  forceUpdate(): void;
607
+ invalidateSortedNodesCache(): void;
602
608
  get lineType(): LineRenderType;
603
609
  get lineColor(): LineColor;
604
610
  switchLineType(newType?: LineRenderType): LineRenderType;
@@ -649,6 +655,15 @@ declare class WorkflowLinesManager {
649
655
  * @param pos
650
656
  */
651
657
  getPortFromMousePos(pos: IPoint, portType?: WorkflowPortType): WorkflowPortEntity | undefined;
658
+ getPortsFromMousePos(pos: IPoint): {
659
+ input?: WorkflowPortEntity;
660
+ output?: WorkflowPortEntity;
661
+ };
662
+ getNodeAndPortFromMousePos(pos: IPoint, portType?: WorkflowPortType): {
663
+ node?: WorkflowNodeEntity;
664
+ port?: WorkflowPortEntity;
665
+ };
666
+ getHoverNodeFromMousePos(pos: IPoint): WorkflowNodeEntity | undefined;
652
667
  /**
653
668
  * 根据鼠标位置找到 node
654
669
  * @param pos - 鼠标位置
@@ -657,8 +672,14 @@ declare class WorkflowLinesManager {
657
672
  registerContribution(factory: WorkflowLineRenderContributionFactory): this;
658
673
  private registerData;
659
674
  private getSortedNodes;
660
- /** 获取鼠标坐标位置的所有节点(stackIndex 从小到大排序) */
661
- private getContainNodesFromMousePos;
675
+ private getHoveredPortFromSortedNodes;
676
+ private getHoveredPortsFromSortedNodes;
677
+ private findHoveredPort;
678
+ private filterCoveredPort;
679
+ private getTopNodeFromSortedNodes;
680
+ private getNodeHitInfoFromSortedNodes;
681
+ private getHoverNodes;
682
+ private isPointInBounds;
662
683
  private getNodeIndex;
663
684
  }
664
685
 
@@ -1019,8 +1040,12 @@ declare class WorkflowNodePortsData extends EntityData {
1019
1040
  protected _staticPorts: WorkflowPorts;
1020
1041
  /** 存储 port 实体的 id,用于判断 port 是否存在 */
1021
1042
  protected _portIDSet: Set<string>;
1043
+ protected _portDisposeIDSet: Set<string>;
1022
1044
  /** 上一次的 ports 数据,用于判断 ports 是否发生变化 */
1023
1045
  protected _prePorts: WorkflowPorts;
1046
+ protected _allPortsCache?: WorkflowPortEntity[];
1047
+ protected _inputPortsCache?: WorkflowPortEntity[];
1048
+ protected _outputPortsCache?: WorkflowPortEntity[];
1024
1049
  constructor(entity: WorkflowNodeEntity);
1025
1050
  getDefaultData(): any;
1026
1051
  /**
@@ -1080,6 +1105,7 @@ declare class WorkflowNodePortsData extends EntityData {
1080
1105
  * 拼接 port 实体的 id
1081
1106
  */
1082
1107
  protected getPortId(portType: WorkflowPortType, portKey?: string | number): string;
1108
+ protected clearPortsCache(): void;
1083
1109
  /**
1084
1110
  * 创建 port 实体
1085
1111
  */
@@ -584,6 +584,11 @@ declare class WorkflowLinesManager {
584
584
  protected _lineType: LineRenderType;
585
585
  protected onAvailableLinesChangeEmitter: Emitter<WorkflowContentChangeEvent>;
586
586
  protected onForceUpdateEmitter: Emitter<void>;
587
+ private sortedNodesCache?;
588
+ private sortedNodesCacheVersion?;
589
+ private hoverNodesCache?;
590
+ private hoverNodesCacheVersion?;
591
+ private hoverNodesCacheActivatedID?;
587
592
  hoverService: WorkflowHoverService;
588
593
  selectService: WorkflowSelectService;
589
594
  protected readonly entityManager: EntityManager;
@@ -599,6 +604,7 @@ declare class WorkflowLinesManager {
599
604
  readonly contributionFactories: WorkflowLineRenderContributionFactory[];
600
605
  init(doc: WorkflowDocument): void;
601
606
  forceUpdate(): void;
607
+ invalidateSortedNodesCache(): void;
602
608
  get lineType(): LineRenderType;
603
609
  get lineColor(): LineColor;
604
610
  switchLineType(newType?: LineRenderType): LineRenderType;
@@ -649,6 +655,15 @@ declare class WorkflowLinesManager {
649
655
  * @param pos
650
656
  */
651
657
  getPortFromMousePos(pos: IPoint, portType?: WorkflowPortType): WorkflowPortEntity | undefined;
658
+ getPortsFromMousePos(pos: IPoint): {
659
+ input?: WorkflowPortEntity;
660
+ output?: WorkflowPortEntity;
661
+ };
662
+ getNodeAndPortFromMousePos(pos: IPoint, portType?: WorkflowPortType): {
663
+ node?: WorkflowNodeEntity;
664
+ port?: WorkflowPortEntity;
665
+ };
666
+ getHoverNodeFromMousePos(pos: IPoint): WorkflowNodeEntity | undefined;
652
667
  /**
653
668
  * 根据鼠标位置找到 node
654
669
  * @param pos - 鼠标位置
@@ -657,8 +672,14 @@ declare class WorkflowLinesManager {
657
672
  registerContribution(factory: WorkflowLineRenderContributionFactory): this;
658
673
  private registerData;
659
674
  private getSortedNodes;
660
- /** 获取鼠标坐标位置的所有节点(stackIndex 从小到大排序) */
661
- private getContainNodesFromMousePos;
675
+ private getHoveredPortFromSortedNodes;
676
+ private getHoveredPortsFromSortedNodes;
677
+ private findHoveredPort;
678
+ private filterCoveredPort;
679
+ private getTopNodeFromSortedNodes;
680
+ private getNodeHitInfoFromSortedNodes;
681
+ private getHoverNodes;
682
+ private isPointInBounds;
662
683
  private getNodeIndex;
663
684
  }
664
685
 
@@ -1019,8 +1040,12 @@ declare class WorkflowNodePortsData extends EntityData {
1019
1040
  protected _staticPorts: WorkflowPorts;
1020
1041
  /** 存储 port 实体的 id,用于判断 port 是否存在 */
1021
1042
  protected _portIDSet: Set<string>;
1043
+ protected _portDisposeIDSet: Set<string>;
1022
1044
  /** 上一次的 ports 数据,用于判断 ports 是否发生变化 */
1023
1045
  protected _prePorts: WorkflowPorts;
1046
+ protected _allPortsCache?: WorkflowPortEntity[];
1047
+ protected _inputPortsCache?: WorkflowPortEntity[];
1048
+ protected _outputPortsCache?: WorkflowPortEntity[];
1024
1049
  constructor(entity: WorkflowNodeEntity);
1025
1050
  getDefaultData(): any;
1026
1051
  /**
@@ -1080,6 +1105,7 @@ declare class WorkflowNodePortsData extends EntityData {
1080
1105
  * 拼接 port 实体的 id
1081
1106
  */
1082
1107
  protected getPortId(portType: WorkflowPortType, portKey?: string | number): string;
1108
+ protected clearPortsCache(): void;
1083
1109
  /**
1084
1110
  * 创建 port 实体
1085
1111
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowgram.ai/free-layout-core",
3
- "version": "0.1.0-alpha.35",
3
+ "version": "0.1.0-alpha.36",
4
4
  "homepage": "https://flowgram.ai/",
5
5
  "repository": "https://github.com/bytedance/flowgram.ai",
6
6
  "license": "MIT",
@@ -34,12 +34,12 @@
34
34
  "reflect-metadata": "~0.2.2",
35
35
  "lodash-es": "^4.17.21",
36
36
  "nanoid": "^5.0.9",
37
- "@flowgram.ai/core": "0.1.0-alpha.35",
38
- "@flowgram.ai/form-core": "0.1.0-alpha.35",
39
- "@flowgram.ai/document": "0.1.0-alpha.35",
40
- "@flowgram.ai/node": "0.1.0-alpha.35",
41
- "@flowgram.ai/reactive": "0.1.0-alpha.35",
42
- "@flowgram.ai/utils": "0.1.0-alpha.35"
37
+ "@flowgram.ai/core": "0.1.0-alpha.36",
38
+ "@flowgram.ai/document": "0.1.0-alpha.36",
39
+ "@flowgram.ai/form-core": "0.1.0-alpha.36",
40
+ "@flowgram.ai/node": "0.1.0-alpha.36",
41
+ "@flowgram.ai/reactive": "0.1.0-alpha.36",
42
+ "@flowgram.ai/utils": "0.1.0-alpha.36"
43
43
  },
44
44
  "devDependencies": {
45
45
  "@testing-library/react": "^12",
@@ -53,8 +53,8 @@
53
53
  "tsup": "^8.0.1",
54
54
  "typescript": "^5.8.3",
55
55
  "vitest": "^3.2.4",
56
- "@flowgram.ai/eslint-config": "0.1.0-alpha.35",
57
- "@flowgram.ai/ts-config": "0.1.0-alpha.35"
56
+ "@flowgram.ai/eslint-config": "0.1.0-alpha.36",
57
+ "@flowgram.ai/ts-config": "0.1.0-alpha.36"
58
58
  },
59
59
  "peerDependencies": {
60
60
  "react": ">=16.8",