@flowgram.ai/free-layout-core 0.4.19 → 0.5.0

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.
package/dist/index.d.mts CHANGED
@@ -2,10 +2,10 @@ import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData
2
2
  export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, useRefresh, useService } from '@flowgram.ai/core';
3
3
  import { NodeFormProps } from '@flowgram.ai/node';
4
4
  import { FlowOperationBaseService, FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document';
5
- import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowNodeEntity, g as WorkflowPortEntity, h as WorkflowLineEntity, O as OnDragLineEnd, i as LineRenderType, j as WorkflowLineRenderContribution, k as LinePosition, l as LineCenterPoint, m as WorkflowJSON } from './workflow-node-entity-DtPEYn6-.mjs';
6
- export { X as HoverPosition, F as LINE_HOVER_DISTANCE, x as LineColor, y as LineColors, w as LinePoint, v as LinePointLocation, u as LineType, C as NodesDragEndEvent, B as NodesDragStartEvent, D as NodesDraggingEvent, P as POINT_RADIUS, K as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, Y as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, _ as WorkflowDocumentOptionsDefault, Z as WorkflowDocumentProvider, V as WorkflowEntityHoverable, H as WorkflowLineEntityOpts, I as WorkflowLineInfo, G as WorkflowLinePortInfo, z as WorkflowLineRenderContributionFactory, J as WorkflowLineUIState, T as WorkflowNodeLines, U as WorkflowNodeLinesData, t as WorkflowNodeMeta, S as WorkflowNodePortsData, M as WorkflowPort, R as WorkflowPortEntityOpts, n as WorkflowPortType, Q as WorkflowPorts, A as WorkflowSubCanvas, q as domReactToBounds, o as getPortEntityId, E as onDragLineEndParams } from './workflow-node-entity-DtPEYn6-.mjs';
5
+ import { W as WorkflowJSON, L as LineCenterPoint, a as WorkflowDocument, b as WorkflowNodeEntity, c as WorkflowHoverService, d as WorkflowLinesManager, e as WorkflowSelectService, f as WorkflowDocumentOptions, g as LineEventProps, N as NodesDragEvent, h as WorkflowNodeJSON, i as WorkflowPortEntity, j as WorkflowLineEntity, O as OnDragLineEnd, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-node-entity-lKu00Aj4.mjs';
6
+ export { X as HoverPosition, F as LINE_HOVER_DISTANCE, x as LineColor, y as LineColors, w as LinePoint, v as LinePointLocation, u as LineType, C as NodesDragEndEvent, B as NodesDragStartEvent, D as NodesDraggingEvent, P as POINT_RADIUS, K as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, Y as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, _ as WorkflowDocumentOptionsDefault, Z as WorkflowDocumentProvider, V as WorkflowEntityHoverable, H as WorkflowLineEntityOpts, I as WorkflowLineInfo, G as WorkflowLinePortInfo, z as WorkflowLineRenderContributionFactory, J as WorkflowLineUIState, T as WorkflowNodeLines, U as WorkflowNodeLinesData, t as WorkflowNodeMeta, S as WorkflowNodePortsData, M as WorkflowPort, R as WorkflowPortEntityOpts, n as WorkflowPortType, Q as WorkflowPorts, A as WorkflowSubCanvas, q as domReactToBounds, o as getPortEntityId, E as onDragLineEndParams } from './workflow-node-entity-lKu00Aj4.mjs';
7
7
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
8
- import { DisposableCollection, IPoint, Disposable, Rectangle } from '@flowgram.ai/utils';
8
+ import { IPoint, Rectangle, DisposableCollection, Disposable } from '@flowgram.ai/utils';
9
9
  export { compose, composeAsync, delay } from '@flowgram.ai/utils';
10
10
  export { URLParams } from './typings/index.mjs';
11
11
  import React$1 from 'react';
@@ -29,6 +29,45 @@ declare enum WorkflowCommands {
29
29
  REDO = "REDO"
30
30
  }
31
31
 
32
+ /**
33
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
34
+ * SPDX-License-Identifier: MIT
35
+ */
36
+
37
+ declare const buildGroupJSON: (json: WorkflowJSON) => WorkflowJSON;
38
+
39
+ /**
40
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
41
+ * SPDX-License-Identifier: MIT
42
+ */
43
+
44
+ declare function getLineCenter(from: IPoint, to: IPoint, bbox: Rectangle, linePadding: number): LineCenterPoint;
45
+
46
+ /**
47
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
48
+ * SPDX-License-Identifier: MIT
49
+ */
50
+ declare function nanoid(n?: number): string;
51
+
52
+ /**
53
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
54
+ * SPDX-License-Identifier: MIT
55
+ */
56
+
57
+ declare const fitView: (doc: WorkflowDocument, playgroundConfig: PlaygroundConfigEntity, easing?: boolean) => Promise<void>;
58
+
59
+ /**
60
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
61
+ * SPDX-License-Identifier: MIT
62
+ */
63
+
64
+ /**
65
+ * 获取没有碰撞的位置
66
+ * 距离很小时,xy 各偏移 30
67
+ * @param position
68
+ */
69
+ declare function getAntiOverlapPosition(doc: WorkflowDocument, position: IPoint, containerNode?: WorkflowNodeEntity): IPoint;
70
+
32
71
  declare class WorkflowDragService {
33
72
  protected playgroundConfig: PlaygroundConfigEntity;
34
73
  protected hoverService: WorkflowHoverService;
@@ -113,7 +152,7 @@ declare class WorkflowDragService {
113
152
  private updateDropNode;
114
153
  private clearDrop;
115
154
  private setLineColor;
116
- private handleDragOnNode;
155
+ private checkDraggingPort;
117
156
  /**
118
157
  * 容器内子节点总体位置重置为0
119
158
  */
@@ -124,13 +163,14 @@ declare class WorkflowDragService {
124
163
  * @param opts
125
164
  * @param event
126
165
  */
127
- startDrawingLine(fromPort: WorkflowPortEntity, event: {
166
+ startDrawingLine(port: WorkflowPortEntity, event: {
128
167
  clientX: number;
129
168
  clientY: number;
130
169
  }, originLine?: WorkflowLineEntity): Promise<{
131
170
  dragSuccess?: boolean;
132
171
  newLine?: WorkflowLineEntity;
133
172
  }>;
173
+ private updateDrawingLine;
134
174
  /**
135
175
  * 重新连接线条
136
176
  * @param line
@@ -365,45 +405,6 @@ declare function useWorkflowDocument(): WorkflowDocument;
365
405
  */
366
406
  declare function usePlaygroundReadonlyState(listenChange?: boolean): boolean;
367
407
 
368
- /**
369
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
370
- * SPDX-License-Identifier: MIT
371
- */
372
-
373
- declare const buildGroupJSON: (json: WorkflowJSON) => WorkflowJSON;
374
-
375
- /**
376
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
377
- * SPDX-License-Identifier: MIT
378
- */
379
-
380
- declare function getLineCenter(from: IPoint, to: IPoint, bbox: Rectangle, linePadding: number): LineCenterPoint;
381
-
382
- /**
383
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
384
- * SPDX-License-Identifier: MIT
385
- */
386
- declare function nanoid(n?: number): string;
387
-
388
- /**
389
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
390
- * SPDX-License-Identifier: MIT
391
- */
392
-
393
- declare const fitView: (doc: WorkflowDocument, playgroundConfig: PlaygroundConfigEntity, easing?: boolean) => Promise<void>;
394
-
395
- /**
396
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
397
- * SPDX-License-Identifier: MIT
398
- */
399
-
400
- /**
401
- * 获取没有碰撞的位置
402
- * 距离很小时,xy 各偏移 30
403
- * @param position
404
- */
405
- declare function getAntiOverlapPosition(doc: WorkflowDocument, position: IPoint, containerNode?: WorkflowNodeEntity): IPoint;
406
-
407
408
  /**
408
409
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
409
410
  * SPDX-License-Identifier: MIT
package/dist/index.d.ts CHANGED
@@ -2,10 +2,10 @@ import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData
2
2
  export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, useRefresh, useService } from '@flowgram.ai/core';
3
3
  import { NodeFormProps } from '@flowgram.ai/node';
4
4
  import { FlowOperationBaseService, FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document';
5
- import { W as WorkflowHoverService, a as WorkflowDocument, b as WorkflowLinesManager, c as WorkflowSelectService, d as WorkflowDocumentOptions, L as LineEventProps, N as NodesDragEvent, e as WorkflowNodeJSON, f as WorkflowNodeEntity, g as WorkflowPortEntity, h as WorkflowLineEntity, O as OnDragLineEnd, i as LineRenderType, j as WorkflowLineRenderContribution, k as LinePosition, l as LineCenterPoint, m as WorkflowJSON } from './workflow-node-entity-GyY_PHY6.js';
6
- export { X as HoverPosition, F as LINE_HOVER_DISTANCE, x as LineColor, y as LineColors, w as LinePoint, v as LinePointLocation, u as LineType, C as NodesDragEndEvent, B as NodesDragStartEvent, D as NodesDraggingEvent, P as POINT_RADIUS, K as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, Y as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, _ as WorkflowDocumentOptionsDefault, Z as WorkflowDocumentProvider, V as WorkflowEntityHoverable, H as WorkflowLineEntityOpts, I as WorkflowLineInfo, G as WorkflowLinePortInfo, z as WorkflowLineRenderContributionFactory, J as WorkflowLineUIState, T as WorkflowNodeLines, U as WorkflowNodeLinesData, t as WorkflowNodeMeta, S as WorkflowNodePortsData, M as WorkflowPort, R as WorkflowPortEntityOpts, n as WorkflowPortType, Q as WorkflowPorts, A as WorkflowSubCanvas, q as domReactToBounds, o as getPortEntityId, E as onDragLineEndParams } from './workflow-node-entity-GyY_PHY6.js';
5
+ import { W as WorkflowJSON, L as LineCenterPoint, a as WorkflowDocument, b as WorkflowNodeEntity, c as WorkflowHoverService, d as WorkflowLinesManager, e as WorkflowSelectService, f as WorkflowDocumentOptions, g as LineEventProps, N as NodesDragEvent, h as WorkflowNodeJSON, i as WorkflowPortEntity, j as WorkflowLineEntity, O as OnDragLineEnd, k as LineRenderType, l as WorkflowLineRenderContribution, m as LinePosition } from './workflow-node-entity-Cnte2phX.js';
6
+ export { X as HoverPosition, F as LINE_HOVER_DISTANCE, x as LineColor, y as LineColors, w as LinePoint, v as LinePointLocation, u as LineType, C as NodesDragEndEvent, B as NodesDragStartEvent, D as NodesDraggingEvent, P as POINT_RADIUS, K as PORT_SIZE, p as WORKFLOW_LINE_ENTITY, Y as WorkfloEntityHoverable, s as WorkflowContentChangeEvent, r as WorkflowContentChangeType, _ as WorkflowDocumentOptionsDefault, Z as WorkflowDocumentProvider, V as WorkflowEntityHoverable, H as WorkflowLineEntityOpts, I as WorkflowLineInfo, G as WorkflowLinePortInfo, z as WorkflowLineRenderContributionFactory, J as WorkflowLineUIState, T as WorkflowNodeLines, U as WorkflowNodeLinesData, t as WorkflowNodeMeta, S as WorkflowNodePortsData, M as WorkflowPort, R as WorkflowPortEntityOpts, n as WorkflowPortType, Q as WorkflowPorts, A as WorkflowSubCanvas, q as domReactToBounds, o as getPortEntityId, E as onDragLineEndParams } from './workflow-node-entity-Cnte2phX.js';
7
7
  import * as _flowgram_ai_utils from '@flowgram.ai/utils';
8
- import { DisposableCollection, IPoint, Disposable, Rectangle } from '@flowgram.ai/utils';
8
+ import { IPoint, Rectangle, DisposableCollection, Disposable } from '@flowgram.ai/utils';
9
9
  export { compose, composeAsync, delay } from '@flowgram.ai/utils';
10
10
  export { URLParams } from './typings/index.js';
11
11
  import React$1 from 'react';
@@ -29,6 +29,45 @@ declare enum WorkflowCommands {
29
29
  REDO = "REDO"
30
30
  }
31
31
 
32
+ /**
33
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
34
+ * SPDX-License-Identifier: MIT
35
+ */
36
+
37
+ declare const buildGroupJSON: (json: WorkflowJSON) => WorkflowJSON;
38
+
39
+ /**
40
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
41
+ * SPDX-License-Identifier: MIT
42
+ */
43
+
44
+ declare function getLineCenter(from: IPoint, to: IPoint, bbox: Rectangle, linePadding: number): LineCenterPoint;
45
+
46
+ /**
47
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
48
+ * SPDX-License-Identifier: MIT
49
+ */
50
+ declare function nanoid(n?: number): string;
51
+
52
+ /**
53
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
54
+ * SPDX-License-Identifier: MIT
55
+ */
56
+
57
+ declare const fitView: (doc: WorkflowDocument, playgroundConfig: PlaygroundConfigEntity, easing?: boolean) => Promise<void>;
58
+
59
+ /**
60
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
61
+ * SPDX-License-Identifier: MIT
62
+ */
63
+
64
+ /**
65
+ * 获取没有碰撞的位置
66
+ * 距离很小时,xy 各偏移 30
67
+ * @param position
68
+ */
69
+ declare function getAntiOverlapPosition(doc: WorkflowDocument, position: IPoint, containerNode?: WorkflowNodeEntity): IPoint;
70
+
32
71
  declare class WorkflowDragService {
33
72
  protected playgroundConfig: PlaygroundConfigEntity;
34
73
  protected hoverService: WorkflowHoverService;
@@ -113,7 +152,7 @@ declare class WorkflowDragService {
113
152
  private updateDropNode;
114
153
  private clearDrop;
115
154
  private setLineColor;
116
- private handleDragOnNode;
155
+ private checkDraggingPort;
117
156
  /**
118
157
  * 容器内子节点总体位置重置为0
119
158
  */
@@ -124,13 +163,14 @@ declare class WorkflowDragService {
124
163
  * @param opts
125
164
  * @param event
126
165
  */
127
- startDrawingLine(fromPort: WorkflowPortEntity, event: {
166
+ startDrawingLine(port: WorkflowPortEntity, event: {
128
167
  clientX: number;
129
168
  clientY: number;
130
169
  }, originLine?: WorkflowLineEntity): Promise<{
131
170
  dragSuccess?: boolean;
132
171
  newLine?: WorkflowLineEntity;
133
172
  }>;
173
+ private updateDrawingLine;
134
174
  /**
135
175
  * 重新连接线条
136
176
  * @param line
@@ -365,45 +405,6 @@ declare function useWorkflowDocument(): WorkflowDocument;
365
405
  */
366
406
  declare function usePlaygroundReadonlyState(listenChange?: boolean): boolean;
367
407
 
368
- /**
369
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
370
- * SPDX-License-Identifier: MIT
371
- */
372
-
373
- declare const buildGroupJSON: (json: WorkflowJSON) => WorkflowJSON;
374
-
375
- /**
376
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
377
- * SPDX-License-Identifier: MIT
378
- */
379
-
380
- declare function getLineCenter(from: IPoint, to: IPoint, bbox: Rectangle, linePadding: number): LineCenterPoint;
381
-
382
- /**
383
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
384
- * SPDX-License-Identifier: MIT
385
- */
386
- declare function nanoid(n?: number): string;
387
-
388
- /**
389
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
390
- * SPDX-License-Identifier: MIT
391
- */
392
-
393
- declare const fitView: (doc: WorkflowDocument, playgroundConfig: PlaygroundConfigEntity, easing?: boolean) => Promise<void>;
394
-
395
- /**
396
- * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
397
- * SPDX-License-Identifier: MIT
398
- */
399
-
400
- /**
401
- * 获取没有碰撞的位置
402
- * 距离很小时,xy 各偏移 30
403
- * @param position
404
- */
405
- declare function getAntiOverlapPosition(doc: WorkflowDocument, position: IPoint, containerNode?: WorkflowNodeEntity): IPoint;
406
-
407
408
  /**
408
409
  * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
409
410
  * SPDX-License-Identifier: MIT