import { PlaygroundConfigEntity, CommandService, PlaygroundDragEvent, EntityData } from '@flowgram.ai/core'; export { bindConfigEntity, useConfigEntity, useEntities, useEntityDataFromContext, useEntityFromContext, useListenEvents, usePlayground, usePlaygroundContainer, usePlaygroundContext, useRefresh, useService } from '@flowgram.ai/core'; import { NodeFormProps } from '@flowgram.ai/node'; import { FlowNodeType, FlowOperationBaseServiceImpl, FlowNodeEntityOrId, FlowNodeEntity } from '@flowgram.ai/document'; 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-SVLYk05w.mjs'; export { Y as HoverPosition, G as LINE_HOVER_DISTANCE, y as LineColor, z as LineColors, x as LinePoint, w as LinePointLocation, v as LineType, D as NodesDragEndEvent, C as NodesDragStartEvent, E as NodesDraggingEvent, P as POINT_RADIUS, M as PORT_SIZE, q as WORKFLOW_LINE_ENTITY, Z as WorkfloEntityHoverable, t as WorkflowContentChangeEvent, s as WorkflowContentChangeType, $ as WorkflowDocumentOptionsDefault, _ as WorkflowDocumentProvider, X as WorkflowEntityHoverable, I as WorkflowLineEntityOpts, J as WorkflowLineInfo, H as WorkflowLinePortInfo, A as WorkflowLineRenderContributionFactory, K as WorkflowLineUIState, U as WorkflowNodeLines, V as WorkflowNodeLinesData, u as WorkflowNodeMeta, T as WorkflowNodePortsData, Q as WorkflowPort, S as WorkflowPortEntityOpts, n as WorkflowPortType, R as WorkflowPorts, B as WorkflowSubCanvas, r as domReactToBounds, p as getPortEntityId, o as getPortEntityIdByNodeId, F as onDragLineEndParams } from './workflow-node-entity-SVLYk05w.mjs'; import * as _flowgram_ai_utils from '@flowgram.ai/utils'; import { IPoint, Rectangle, DisposableCollection, Disposable } from '@flowgram.ai/utils'; export { compose, composeAsync, delay } from '@flowgram.ai/utils'; export { URLParams } from './typings/index.mjs'; import React$1 from 'react'; import { WorkflowOperationBaseService, NodePostionUpdateEvent } from './typings/workflow-operation.mjs'; import { ContainerModule } from 'inversify'; export { WorkflowEdgeJSON } from './typings/workflow-edge.mjs'; export { WorkflowNodeFormMeta, WorkflowNodeRegistry, WorkflowNodeRenderProps } from './typings/workflow-registry.mjs'; import '@flowgram.ai/form-core'; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare enum WorkflowCommands { DELETE_NODES = "DELETE_NODES", COPY_NODES = "COPY_NODES", PASTE_NODES = "PASTE_NODES", ZOOM_IN = "ZOOM_IN", ZOOM_OUT = "ZOOM_OUT", UNDO = "UNDO", REDO = "REDO" } /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare const buildGroupJSON: (json: WorkflowJSON) => WorkflowJSON; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare function getLineCenter(from: IPoint, to: IPoint, bbox: Rectangle, linePadding: number): LineCenterPoint; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare function nanoid(n?: number): string; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare const fitView: (doc: WorkflowDocument, playgroundConfig: PlaygroundConfigEntity, easing?: boolean) => Promise; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ /** * 获取没有碰撞的位置 * 距离很小时,xy 各偏移 30 * @param position */ declare function getAntiOverlapPosition(doc: WorkflowDocument, position: IPoint, containerNode?: WorkflowNodeEntity): IPoint; declare class WorkflowDragService { protected playgroundConfig: PlaygroundConfigEntity; protected hoverService: WorkflowHoverService; protected document: WorkflowDocument; protected linesManager: WorkflowLinesManager; protected commandService: CommandService; protected selectService: WorkflowSelectService; protected operationService: WorkflowOperationBaseService; readonly options: WorkflowDocumentOptions; private _onDragLineEventEmitter; readonly onDragLineEventChange: _flowgram_ai_utils.Event; isDragging: boolean; private _nodesDragEmitter; readonly onNodesDrag: _flowgram_ai_utils.Event; protected _toDispose: DisposableCollection; private _droppableTransforms; private _dropNode?; private posAdjusters; private _onDragLineEndCallbacks; init(): void; dispose(): void; /** * 拖拽选中节点 * @param triggerEvent */ startDragSelectedNodes(triggerEvent: MouseEvent | React$1.MouseEvent): Promise; /** * 通过拖入卡片添加 * @param type * @param event * @param data 节点数据 */ dropCard(type: string, event: { clientX: number; clientY: number; }, data?: Partial, parent?: WorkflowNodeEntity): Promise; /** * 拖拽卡片到画布 * 返回创建结果 * @param type * @param event */ startDragCard(type: string, event: React$1.MouseEvent, data: Partial, cloneNode?: (e: PlaygroundDragEvent) => HTMLDivElement): Promise; /** * 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标 */ adjustSubNodePosition(subNodeType?: string, containerNode?: WorkflowNodeEntity, mousePos?: IPoint): IPoint; /** * 注册位置调整 */ registerPosAdjuster(adjuster: (params: { selectedNodes: WorkflowNodeEntity[]; position: IPoint; }) => IPoint): { dispose: () => boolean; }; /** * 判断是否可以放置节点 */ canDropToNode(params: { dragNodeType?: FlowNodeType; dragNode?: WorkflowNodeEntity; dropNode?: WorkflowNodeEntity; dropNodeType?: FlowNodeType; }): { allowDrop: boolean; message?: string; dropNode?: WorkflowNodeEntity; }; /** * 获取拖拽偏移 */ private getDragPosOffset; private updateDroppableTransforms; /** 是否容器节点 */ private isContainer; /** * 获取节点整体位置 */ private getNodesPosition; private nodeSelectable; private updateDropNode; private clearDrop; private setLineColor; private checkDraggingPort; /** * 容器内子节点总体位置重置为0 */ private resetContainerInternalPosition; private childrenOfContainer; /** * 绘制线条 * @param opts * @param event */ startDrawingLine(port: WorkflowPortEntity, event: { clientX: number; clientY: number; }, originLine?: WorkflowLineEntity): Promise<{ dragSuccess?: boolean; newLine?: WorkflowLineEntity; }>; private updateDrawingLine; /** * 重新连接线条 * @param line * @param e */ resetLine(line: WorkflowLineEntity, e: MouseEvent): Promise; /** 线条拖拽结束 */ onDragLineEnd(callback: OnDragLineEnd): Disposable; /** 能否建立容器连线 */ private canBuildContainerLine; /** 获取最近的 port */ private getNearestPort; } type PositionMap = Record; /** * 重置布局服务 */ declare class WorkflowResetLayoutService { private _config; private _document; private _entityManager; private _resetLayoutEmitter; /** * reset layout事件 */ readonly onResetLayout: _flowgram_ai_utils.Event<{ nodeIds: string[]; positionMap: PositionMap; oldPositionMap: PositionMap; }>; private _toDispose; /** * 初始化 */ init(): void; /** * 触发重置布局 * @param nodeIds 节点id * @param positionMap 新布局数据 * @param oldPositionMap 老布局数据 */ fireResetLayout(nodeIds: string[], positionMap: PositionMap, oldPositionMap: PositionMap): void; /** * 根据数据重新布局 * @param positionMap * @returns */ layoutToPositions(nodeIds: string[], positionMap: PositionMap): Promise>; /** * 销毁 */ dispose(): void; } declare class WorkflowOperationBaseServiceImpl extends FlowOperationBaseServiceImpl implements WorkflowOperationBaseService { protected document: WorkflowDocument; linesManager: WorkflowLinesManager; private onNodePostionUpdateEmitter; readonly onNodePostionUpdate: _flowgram_ai_utils.Event; updateNodePosition(nodeOrId: FlowNodeEntityOrId, position: IPoint): void; fromJSON(json: WorkflowJSON): void; } /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ interface WorkflowLineRenderDataSchema { version: string; contributions: Map; position: LinePosition; } declare class WorkflowLineRenderData extends EntityData { static type: string; entity: WorkflowLineEntity; constructor(entity: WorkflowLineEntity); getDefaultData(): WorkflowLineRenderDataSchema; get renderVersion(): string; get position(): LinePosition; get path(): string; calcDistance(pos: IPoint): number; get bounds(): Rectangle; /** * 更新数据 * WARNING: 这个方法,必须在 requestAnimationFrame / useLayoutEffect 中调用,否则会引起浏览器强制重排 */ update(): void; private get lineType(); /** * 获取 center 位置 */ get center(): LineCenterPoint; /** * 更新版本 * WARNING: 这个方法,必须在 requestAnimationFrame / useLayoutEffect 中调用,否则会引起浏览器强制重排 */ private updatePosition; private get currentLine(); private syncContributions; private registerContribution; } /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ interface NodeRenderReturnType { id: string; type: string | number; /** * 当前节点 */ node: FlowNodeEntity; /** * 节点 data 数据 */ data: any; /** * 更新节点 data 数据 */ updateData: (newData: any) => void; /** * 节点选中 */ selected: boolean; /** * 节点激活 */ activated: boolean; /** * 节点展开 */ expanded: boolean; /** * 触发拖拽 * @param e */ startDrag: (e: React.MouseEvent) => void; /** * 当前节点的点位信息 */ ports: WorkflowPortEntity[]; /** * 删除节点 */ deleteNode: () => void; /** * 选中节点 * @param e */ selectNode: (e: React.MouseEvent) => void; /** * 全局 readonly 状态 */ readonly: boolean; /** * 拖拽线条的目标 node id */ linkingNodeId: string; /** * 节点 ref */ nodeRef: React.MutableRefObject; /** * 节点 focus 事件 */ onFocus: () => void; /** * 节点 blur 事件 */ onBlur: () => void; /** * 渲染表单,只有节点引擎开启才能使用 */ form: NodeFormProps | undefined; /** * 获取节点的扩展数据 */ getExtInfo(): T; /** * 更新节点的扩展数据 * @param extInfo */ updateExtInfo(extInfo: T, fullUpdate?: boolean): void; /** * 展开/收起节点 * @param expanded */ toggleExpand(): void; } /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare function useNodeRender(nodeFromProps?: WorkflowNodeEntity): NodeRenderReturnType; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ /** * 获取当前渲染的 dom 节点 */ declare function useCurrentDomNode(): HTMLDivElement; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ /** * 获取当前节点 */ declare function useCurrentEntity(): WorkflowNodeEntity; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare function useWorkflowDocument(): WorkflowDocument; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ /** * 获取 readonly 状态 */ declare function usePlaygroundReadonlyState(listenChange?: boolean): boolean; /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare enum EditorCursorState { GRAB = "GRAB", SELECT = "SELECT" } declare enum InteractiveType { /** 鼠标优先交互模式 */ MOUSE = "MOUSE", /** 触控板优先交互模式 */ PAD = "PAD" } /** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ declare const WorkflowDocumentContainerModule: ContainerModule; export { EditorCursorState, InteractiveType, LineCenterPoint, LineEventProps, LinePosition, LineRenderType, NodePostionUpdateEvent, type NodeRenderReturnType, NodesDragEvent, OnDragLineEnd, type PositionMap, WorkflowCommands, WorkflowDocument, WorkflowDocumentContainerModule, WorkflowDocumentOptions, WorkflowDragService, WorkflowHoverService, WorkflowJSON, WorkflowLineEntity, WorkflowLineRenderContribution, WorkflowLineRenderData, type WorkflowLineRenderDataSchema, WorkflowLinesManager, WorkflowNodeEntity, WorkflowNodeJSON, WorkflowOperationBaseService, WorkflowOperationBaseServiceImpl, WorkflowPortEntity, WorkflowResetLayoutService, WorkflowSelectService, buildGroupJSON, fitView, getAntiOverlapPosition, getLineCenter, nanoid, useCurrentDomNode, useCurrentEntity, useNodeRender, usePlaygroundReadonlyState, useWorkflowDocument };