@flowgram.ai/free-container-plugin 1.0.1 → 1.0.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.
package/dist/esm/index.js CHANGED
@@ -339,7 +339,7 @@ var NodeIntoContainerService = class {
339
339
  canDropToContainer(params) {
340
340
  const { dragNode, dropNode } = params;
341
341
  const isDropContainer = dropNode?.getNodeMeta().isContainer;
342
- if (!dropNode || !isDropContainer || this.isParent(dragNode, dropNode)) {
342
+ if (!dropNode || !isDropContainer || this.isParent(dragNode, dropNode) || this.isParent(dropNode, dragNode)) {
343
343
  return false;
344
344
  }
345
345
  if (dragNode.flowNodeType === FlowNodeBaseType2.GROUP && dropNode.flowNodeType !== FlowNodeBaseType2.GROUP) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/node-into-container/constant.ts","../../src/node-into-container/service.ts","../../src/utils/next-frame.ts","../../src/utils/is-container.ts","../../src/utils/get-container-transforms.ts","../../src/utils/get-collision-transform.ts","../../src/utils/is-rect-intersects.ts","../../src/utils/is-point-in-rect.ts","../../src/utils/adjust-sub-node-position.ts","../../src/utils/index.ts","../../src/node-into-container/plugin.tsx","../../src/sub-canvas/hooks/use-node-size.ts","../../src/sub-canvas/hooks/use-sync-node-render-size.ts","../../src/sub-canvas/components/background/index.tsx","../../src/sub-canvas/components/background/style.ts","../../src/sub-canvas/components/border/index.tsx","../../src/sub-canvas/components/border/style.ts","../../src/sub-canvas/components/render/index.tsx","../../src/sub-canvas/components/render/style.ts","../../src/sub-canvas/components/tips/index.tsx","../../src/sub-canvas/components/tips/use-control.ts","../../src/sub-canvas/components/tips/global-store.ts","../../src/sub-canvas/components/tips/style.ts","../../src/sub-canvas/components/tips/is-mac-os.ts","../../src/sub-canvas/components/tips/icon-close.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum NodeIntoContainerType {\n In = 'in',\n Out = 'out',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion -- no need */\nimport { throttle } from 'lodash-es';\nimport { inject, injectable } from 'inversify';\nimport { type Disposable, DisposableCollection, Emitter } from '@flowgram.ai/utils';\nimport {\n type NodesDragEvent,\n WorkflowDocument,\n WorkflowDragService,\n WorkflowLinesManager,\n type WorkflowNodeEntity,\n WorkflowNodeMeta,\n WorkflowOperationBaseService,\n WorkflowSelectService,\n} from '@flowgram.ai/free-layout-core';\nimport { HistoryService } from '@flowgram.ai/free-history-plugin';\nimport { FlowNodeRenderData, FlowNodeBaseType } from '@flowgram.ai/document';\nimport { PlaygroundConfigEntity, TransformData } from '@flowgram.ai/core';\n\nimport type { NodeIntoContainerEvent, NodeIntoContainerState } from './type';\nimport { NodeIntoContainerType } from './constant';\nimport { ContainerUtils } from '../utils';\n\n@injectable()\nexport class NodeIntoContainerService {\n public state: NodeIntoContainerState;\n\n @inject(WorkflowDragService)\n private dragService: WorkflowDragService;\n\n @inject(WorkflowDocument)\n private document: WorkflowDocument;\n\n @inject(PlaygroundConfigEntity)\n private playgroundConfig: PlaygroundConfigEntity;\n\n @inject(WorkflowOperationBaseService)\n private operationService: WorkflowOperationBaseService;\n\n @inject(WorkflowLinesManager)\n private linesManager: WorkflowLinesManager;\n\n @inject(HistoryService) private historyService: HistoryService;\n\n @inject(WorkflowSelectService) private selectService: WorkflowSelectService;\n\n private emitter = new Emitter<NodeIntoContainerEvent>();\n\n private toDispose = new DisposableCollection();\n\n public readonly on = this.emitter.event;\n\n public init(): void {\n this.initState();\n this.toDispose.push(this.emitter);\n }\n\n public ready(): void {\n this.toDispose.push(this.listenDragToContainer());\n }\n\n public dispose(): void {\n this.initState();\n this.toDispose.dispose();\n }\n\n /** 将节点移出容器 */\n public async moveOutContainer(params: { node: WorkflowNodeEntity }): Promise<void> {\n const { node } = params;\n const parentNode = node.parent;\n const containerNode = parentNode?.parent;\n const nodeJSON = this.document.toNodeJSON(node);\n if (\n !parentNode ||\n !containerNode ||\n !ContainerUtils.isContainer(parentNode) ||\n !nodeJSON.meta?.position\n ) {\n return;\n }\n const parentTransform = parentNode.getData<TransformData>(TransformData);\n this.operationService.moveNode(node, {\n parent: containerNode,\n });\n await ContainerUtils.nextFrame();\n parentTransform.fireChange();\n this.operationService.updateNodePosition(node, {\n x: parentTransform.position.x + nodeJSON.meta!.position!.x,\n y: parentTransform.position.y + nodeJSON.meta!.position!.y,\n });\n this.emitter.fire({\n type: NodeIntoContainerType.Out,\n node,\n sourceContainer: parentNode,\n targetContainer: containerNode,\n });\n }\n\n /** 能否将节点移出容器 */\n public canMoveOutContainer(node: WorkflowNodeEntity): boolean {\n const parentNode = node.parent;\n const containerNode = parentNode?.parent;\n if (!parentNode || !containerNode || !ContainerUtils.isContainer(parentNode)) {\n return false;\n }\n const canDrop = this.dragService.canDropToNode({\n dragNodeType: node.flowNodeType,\n dragNode: node,\n dropNodeType: containerNode?.flowNodeType,\n dropNode: containerNode,\n });\n if (!canDrop.allowDrop) {\n return false;\n }\n return true;\n }\n\n /** 移除节点所有非法连线 */\n public async clearInvalidLines(params: {\n dragNode?: WorkflowNodeEntity;\n sourceParent?: WorkflowNodeEntity;\n }): Promise<void> {\n const { dragNode, sourceParent } = params;\n if (!dragNode) {\n return;\n }\n if (dragNode.parent === sourceParent) {\n // 容器节点未改变\n return;\n }\n if (\n dragNode.parent?.flowNodeType === FlowNodeBaseType.GROUP ||\n sourceParent?.flowNodeType === FlowNodeBaseType.GROUP\n ) {\n // 移入移出 group 节点无需删除节点\n return;\n }\n await this.removeNodeLines(dragNode);\n }\n\n /** 移除节点连线 */\n public async removeNodeLines(node: WorkflowNodeEntity): Promise<void> {\n const lines = this.linesManager.getAllLines();\n lines.forEach((line) => {\n if (line.from?.id !== node.id && line.to?.id !== node.id) {\n return;\n }\n line.dispose();\n });\n await ContainerUtils.nextFrame();\n }\n\n /** 初始化状态 */\n private initState(): void {\n this.state = {\n isDraggingNode: false,\n isSkipEvent: false,\n transforms: undefined,\n dragNode: undefined,\n dropNode: undefined,\n sourceParent: undefined,\n };\n }\n\n /** 监听节点拖拽 */\n private listenDragToContainer(): Disposable {\n const draggingNode = (e: NodesDragEvent) => this.draggingNode(e);\n const throttledDraggingNode = throttle(draggingNode, 200); // 200ms触发一次计算\n return this.dragService.onNodesDrag(async (event) => {\n if (this.selectService.selectedNodes.length !== 1) {\n return;\n }\n if (event.type === 'onDragStart') {\n if (this.state.isSkipEvent) {\n // 拖出容器后重新进入\n this.state.isSkipEvent = false;\n return;\n }\n this.historyService.startTransaction(); // 开始合并历史记录\n this.state.isDraggingNode = true;\n this.state.transforms = ContainerUtils.getContainerTransforms(this.document.getAllNodes());\n this.state.dragNode = this.selectService.selectedNodes[0];\n this.state.dropNode = undefined;\n this.state.sourceParent = this.state.dragNode?.parent;\n await this.dragOutContainer(event); // 检查是否需拖出容器\n }\n if (event.type === 'onDragging') {\n throttledDraggingNode(event);\n }\n if (event.type === 'onDragEnd') {\n if (this.state.isSkipEvent) {\n // 拖出容器情况下需跳过本次事件\n return;\n }\n throttledDraggingNode.cancel();\n draggingNode(event); // 直接触发一次计算,防止延迟\n await this.dropNodeToContainer(); // 放置节点\n await this.clearInvalidLines({\n dragNode: this.state.dragNode,\n sourceParent: this.state.sourceParent,\n }); // 清除非法线条\n this.setDropNode(undefined);\n this.initState(); // 重置状态\n this.historyService.endTransaction(); // 结束合并历史记录\n }\n });\n }\n\n /** 监听节点拖拽出容器 */\n private async dragOutContainer(event: NodesDragEvent): Promise<void> {\n const { dragNode } = this.state;\n const activated = event.triggerEvent.metaKey || event.triggerEvent.ctrlKey;\n if (\n !activated || // 必须按住指定按键\n !dragNode || // 必须有一个节点\n !this.canMoveOutContainer(dragNode) // 需要能被移出容器\n ) {\n return;\n }\n this.moveOutContainer({ node: dragNode });\n this.state.isSkipEvent = true;\n event.dragger.stop(event.dragEvent.clientX, event.dragEvent.clientY);\n await ContainerUtils.nextFrame();\n this.dragService.startDragSelectedNodes(event.triggerEvent);\n }\n\n /** 设置放置节点高亮 */\n private setDropNode(dropNode?: WorkflowNodeEntity) {\n if (this.state.dropNode === dropNode) {\n return;\n }\n if (this.state.dropNode) {\n // 清除上一个节点高亮\n const renderData = this.state.dropNode.getData(FlowNodeRenderData);\n const renderDom = renderData.node?.children?.[0] as HTMLElement;\n if (renderDom) {\n renderDom.classList.remove('selected');\n }\n }\n this.state.dropNode = dropNode;\n if (!dropNode) {\n return;\n }\n // 设置当前节点高亮\n const renderData = dropNode.getData(FlowNodeRenderData);\n const renderDom = renderData.node?.children?.[0] as HTMLElement;\n if (renderDom) {\n renderDom.classList.add('selected');\n }\n }\n\n /** 放置节点到容器 */\n private async dropNodeToContainer(): Promise<void> {\n const { dropNode, dragNode, isDraggingNode } = this.state;\n if (!isDraggingNode || !dragNode || !dropNode) {\n return;\n }\n return await this.moveIntoContainer({\n node: dragNode,\n containerNode: dropNode,\n });\n }\n\n /** 拖拽节点 */\n private draggingNode(nodeDragEvent: NodesDragEvent): void {\n const { dragNode, isDraggingNode, transforms = [] } = this.state;\n if (!isDraggingNode || !dragNode || !transforms?.length) {\n return this.setDropNode(undefined);\n }\n const mousePos = this.playgroundConfig.getPosFromMouseEvent(nodeDragEvent.dragEvent);\n const availableTransforms = transforms.filter(\n (transform) => transform.entity.id !== dragNode.id\n );\n const collisionTransform = ContainerUtils.getCollisionTransform({\n targetPoint: mousePos,\n transforms: availableTransforms,\n document: this.document,\n });\n const dropNode = collisionTransform?.entity;\n const canDrop = this.canDropToContainer({\n dragNode,\n dropNode,\n });\n if (!canDrop) {\n return this.setDropNode(undefined);\n }\n return this.setDropNode(dropNode);\n }\n\n /** 判断能否将节点拖入容器 */\n protected canDropToContainer(params: {\n dragNode: WorkflowNodeEntity;\n dropNode?: WorkflowNodeEntity;\n }): boolean {\n const { dragNode, dropNode } = params;\n const isDropContainer = dropNode?.getNodeMeta<WorkflowNodeMeta>().isContainer;\n if (!dropNode || !isDropContainer || this.isParent(dragNode, dropNode)) {\n return false;\n }\n if (\n dragNode.flowNodeType === FlowNodeBaseType.GROUP &&\n dropNode.flowNodeType !== FlowNodeBaseType.GROUP\n ) {\n // 禁止将 group 节点拖入非 group 节点(由于目前不支持多节点拖入容器,无法计算有效线条,因此进行屏蔽)\n return false;\n }\n const canDrop = this.dragService.canDropToNode({\n dragNodeType: dragNode.flowNodeType,\n dropNodeType: dropNode?.flowNodeType,\n dragNode,\n dropNode,\n });\n if (!canDrop.allowDrop) {\n return false;\n }\n return true;\n }\n\n /** 判断一个节点是否为另一个节点的父节点(向上查找直到根节点) */\n private isParent(node: WorkflowNodeEntity, parent: WorkflowNodeEntity): boolean {\n let current = node.parent;\n while (current) {\n if (current.id === parent.id) {\n return true;\n }\n current = current.parent;\n }\n return false;\n }\n\n /** 将节点移入容器 */\n private async moveIntoContainer(params: {\n node: WorkflowNodeEntity;\n containerNode: WorkflowNodeEntity;\n }): Promise<void> {\n const { node, containerNode } = params;\n const parentNode = node.parent;\n\n this.operationService.moveNode(node, {\n parent: containerNode,\n });\n\n const containerPadding = this.document.layout.getPadding(containerNode);\n const position = ContainerUtils.adjustSubNodePosition({\n targetNode: node,\n containerNode,\n containerPadding,\n });\n\n this.operationService.updateNodePosition(node, position);\n\n await ContainerUtils.nextFrame();\n\n this.emitter.fire({\n type: NodeIntoContainerType.In,\n node,\n sourceContainer: parentNode,\n targetContainer: containerNode,\n });\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const nextFrame = async (): Promise<void> => {\n await new Promise((resolve) => requestAnimationFrame(resolve));\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowNodeEntity, WorkflowNodeMeta } from '@flowgram.ai/free-layout-core';\n\nexport const isContainer = (node?: WorkflowNodeEntity): boolean =>\n node?.getNodeMeta<WorkflowNodeMeta>().isContainer ?? false;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowNodeEntity } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nimport { isContainer } from './is-container';\n\n/** 获取容器节点transforms */\nexport const getContainerTransforms = (allNodes: WorkflowNodeEntity[]): FlowNodeTransformData[] =>\n allNodes\n .filter((node) => {\n if (node.originParent) {\n return node.getNodeMeta().selectable && node.originParent.getNodeMeta().selectable;\n }\n return node.getNodeMeta().selectable;\n })\n .filter((node) => isContainer(node))\n .sort((a, b) => {\n const aIndex = a.renderData.stackIndex;\n const bIndex = b.renderData.stackIndex;\n // 确保层级高的节点在前面\n return bIndex - aIndex;\n })\n .map((node) => node.transform);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PositionSchema, Rectangle } from '@flowgram.ai/utils';\nimport { WorkflowDocument } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nimport { isRectIntersects } from './is-rect-intersects';\nimport { isPointInRect } from './is-point-in-rect';\n\n/** 获取重叠位置 */\nexport const getCollisionTransform = (params: {\n transforms: FlowNodeTransformData[];\n targetRect?: Rectangle;\n targetPoint?: PositionSchema;\n withPadding?: boolean;\n document: WorkflowDocument;\n}): FlowNodeTransformData | undefined => {\n const { targetRect, targetPoint, transforms, withPadding = false, document } = params;\n const collisionTransform = transforms.find((transform) => {\n const { bounds, entity } = transform;\n const padding = withPadding ? document.layout.getPadding(entity) : { left: 0, right: 0 };\n const transformRect = new Rectangle(\n bounds.x + padding.left + padding.right,\n bounds.y,\n bounds.width,\n bounds.height\n );\n // 检测两个正方形是否相互碰撞\n if (targetRect) {\n return isRectIntersects(targetRect, transformRect);\n }\n if (targetPoint) {\n return isPointInRect(targetPoint, transformRect);\n }\n return false;\n });\n return collisionTransform;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Rectangle } from '@flowgram.ai/utils';\n\nexport const isRectIntersects = (rectA: Rectangle, rectB: Rectangle): boolean => {\n // 检查水平方向是否有重叠\n const hasHorizontalOverlap = rectA.right > rectB.left && rectA.left < rectB.right;\n // 检查垂直方向是否有重叠\n const hasVerticalOverlap = rectA.bottom > rectB.top && rectA.top < rectB.bottom;\n // 只有当水平和垂直方向都有重叠时,两个矩形才相交\n return hasHorizontalOverlap && hasVerticalOverlap;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PositionSchema, Rectangle } from '@flowgram.ai/utils';\n\nexport const isPointInRect = (point: PositionSchema, rect: Rectangle): boolean =>\n point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IPoint, PaddingSchema } from '@flowgram.ai/utils';\nimport { WorkflowNodeEntity } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeBaseType } from '@flowgram.ai/document';\n\n/**\n * 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标\n */\nexport const adjustSubNodePosition = (params: {\n targetNode: WorkflowNodeEntity;\n containerNode: WorkflowNodeEntity;\n containerPadding: PaddingSchema;\n}): IPoint => {\n const { targetNode, containerNode, containerPadding } = params;\n if (containerNode.flowNodeType === FlowNodeBaseType.ROOT) {\n return targetNode.transform.position;\n }\n const nodeWorldTransform = targetNode.transform.transform.worldTransform;\n const containerWorldTransform = containerNode.transform.transform.worldTransform;\n const nodePosition = {\n x: nodeWorldTransform.tx,\n y: nodeWorldTransform.ty,\n };\n const isParentEmpty = !containerNode.children || containerNode.children.length === 0;\n if (isParentEmpty) {\n // 确保空容器节点不偏移\n return {\n x: 0,\n y: containerPadding.top,\n };\n } else {\n return {\n x: nodePosition.x - containerWorldTransform.tx,\n y: nodePosition.y - containerWorldTransform.ty,\n };\n }\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { nextFrame } from './next-frame';\nimport { isContainer } from './is-container';\nimport { getContainerTransforms } from './get-container-transforms';\nimport { getCollisionTransform } from './get-collision-transform';\nimport { adjustSubNodePosition } from './adjust-sub-node-position';\n\nexport const ContainerUtils = {\n nextFrame,\n isContainer,\n adjustSubNodePosition,\n getContainerTransforms,\n getCollisionTransform,\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport type { WorkflowContainerPluginOptions } from './type';\nimport { NodeIntoContainerService } from '.';\n\nexport const createContainerNodePlugin = definePluginCreator<WorkflowContainerPluginOptions>({\n onBind: ({ bind }) => {\n bind(NodeIntoContainerService).toSelf().inSingletonScope();\n },\n onInit(ctx, options) {\n ctx.get(NodeIntoContainerService).init();\n },\n onReady(ctx, options) {\n if (options.disableNodeIntoContainer !== true) {\n ctx.get(NodeIntoContainerService).ready();\n }\n },\n onDispose(ctx) {\n ctx.get(NodeIntoContainerService).dispose();\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useState, useEffect } from 'react';\n\nimport {\n useCurrentEntity,\n WorkflowNodeMeta,\n WorkflowNodePortsData,\n} from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nexport interface NodeSize {\n width: number;\n height: number;\n}\n\nexport const useNodeSize = (): NodeSize | undefined => {\n const node = useCurrentEntity();\n const nodeMeta = node.getNodeMeta<WorkflowNodeMeta>();\n const { size = { width: 300, height: 200 }, isContainer } = nodeMeta;\n\n const transform = node.getData<FlowNodeTransformData>(FlowNodeTransformData);\n const [width, setWidth] = useState(size.width);\n const [height, setHeight] = useState(size.height);\n\n const updatePorts = () => {\n const portsData = node.getData<WorkflowNodePortsData>(WorkflowNodePortsData);\n portsData.updateDynamicPorts();\n };\n\n const updateSize = () => {\n // 无子节点时\n if (node.blocks.length === 0) {\n setWidth(size.width);\n setHeight(size.height);\n return;\n }\n // 存在子节点时,只监听宽高变化\n setWidth(transform.bounds.width);\n setHeight(transform.bounds.height);\n };\n\n useEffect(() => {\n const dispose = transform.onDataChange(() => {\n updateSize();\n updatePorts();\n });\n return () => dispose.dispose();\n }, [transform, width, height]);\n\n useEffect(() => {\n // 初始化触发一次\n updateSize();\n }, []);\n\n if (!isContainer) {\n return;\n }\n\n return {\n width,\n height,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useLayoutEffect } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\n\nimport { NodeSize } from './use-node-size';\n\nexport const useSyncNodeRenderSize = (nodeSize?: NodeSize) => {\n const node = useCurrentEntity();\n\n useLayoutEffect(() => {\n if (!nodeSize) {\n return;\n }\n node.renderData.node.style.width = nodeSize.width + 'px';\n node.renderData.node.style.height = nodeSize.height + 'px';\n }, [nodeSize?.width, nodeSize?.height]);\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { type FC } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\nimport { useService } from '@flowgram.ai/core';\nimport { BackgroundConfig, BackgroundLayerOptions } from '@flowgram.ai/background-plugin';\n\nimport { SubCanvasBackgroundStyle } from './style';\n\nexport const SubCanvasBackground: FC = () => {\n const node = useCurrentEntity();\n\n // 通过 inversify 获取背景配置,如果没有配置则使用默认值\n let backgroundConfig: BackgroundLayerOptions = {};\n try {\n backgroundConfig = useService<BackgroundLayerOptions>(BackgroundConfig);\n } catch (error) {\n // 如果 BackgroundConfig 没有注册,使用默认配置\n // 静默处理,使用默认配置\n }\n\n // 获取配置值,如果没有则使用默认值\n const gridSize = backgroundConfig.gridSize ?? 20;\n const dotSize = backgroundConfig.dotSize ?? 1;\n const dotColor = backgroundConfig.dotColor ?? '#eceeef';\n const dotOpacity = backgroundConfig.dotOpacity ?? 0.5;\n const backgroundColor = backgroundConfig.backgroundColor ?? '#f2f3f5';\n // 只有当 dotFillColor 被明确设置且与 dotColor 不同时才添加 fill 属性\n const dotFillColor =\n backgroundConfig.dotFillColor === dotColor ? '' : backgroundConfig.dotFillColor;\n\n // 生成唯一的 pattern ID\n const patternId = `sub-canvas-dot-pattern-${node.id}`;\n\n return (\n <SubCanvasBackgroundStyle\n className=\"sub-canvas-background\"\n data-flow-editor-selectable=\"true\"\n style={{ backgroundColor: backgroundColor }}\n >\n <svg width=\"100%\" height=\"100%\">\n <pattern id={patternId} width={gridSize} height={gridSize} patternUnits=\"userSpaceOnUse\">\n <circle\n cx={dotSize}\n cy={dotSize}\n r={dotSize}\n stroke={dotColor}\n fill={dotFillColor}\n fillOpacity={dotOpacity}\n />\n </pattern>\n <rect\n width=\"100%\"\n height=\"100%\"\n fill={`url(#${patternId})`}\n data-node-panel-container={node.id}\n />\n </svg>\n </SubCanvasBackgroundStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasBackgroundStyle = styled.div`\n width: 100%;\n height: 100%;\n inset: 56px 18px 18px;\n /* 背景色现在通过 style 属性动态设置 */\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { CSSProperties, ReactNode, type FC } from 'react';\n\nimport { SubCanvasBorderStyle } from './style';\n\ninterface ISubCanvasBorder {\n style?: CSSProperties;\n children?: ReactNode | ReactNode[];\n}\n\nexport const SubCanvasBorder: FC<ISubCanvasBorder> = ({ style, children }) => (\n <SubCanvasBorderStyle\n className=\"sub-canvas-border\"\n style={{\n ...style,\n }}\n >\n {children}\n </SubCanvasBorderStyle>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasBorderStyle = styled.div`\n pointer-events: none;\n\n position: relative;\n\n display: flex;\n align-items: center;\n\n width: 100%;\n height: 100%;\n\n background-color: transparent;\n border: 1px solid var(--coz-stroke-plus, rgba(6, 7, 9, 15%));\n border-color: var(--coz-bg-plus, rgb(249, 249, 249));\n border-style: solid;\n border-width: 8px;\n border-radius: 8px;\n\n &::before {\n content: '';\n\n position: absolute;\n z-index: 0;\n inset: -4px;\n\n background-color: transparent;\n border-color: var(--coz-bg-plus, rgb(249, 249, 249));\n border-style: solid;\n border-width: 4px;\n border-radius: 8px;\n }\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { CSSProperties, type FC } from 'react';\n\nimport { SubCanvasRenderStyle } from './style';\nimport { SubCanvasTips } from '../tips';\nimport { SubCanvasBorder } from '../border';\nimport { SubCanvasBackground } from '../background';\nimport { useNodeSize, useSyncNodeRenderSize } from '../../hooks';\n\ninterface ISubCanvasRender {\n offsetY?: number;\n className?: string;\n style?: CSSProperties;\n tipText?: string | React.ReactNode;\n}\n\nexport const SubCanvasRender: FC<ISubCanvasRender> = ({\n className,\n style,\n offsetY = 0,\n tipText,\n}) => {\n const nodeSize = useNodeSize();\n const nodeHeight = nodeSize?.height ?? 0;\n\n useSyncNodeRenderSize(nodeSize);\n\n return (\n <SubCanvasRenderStyle\n className={`sub-canvas-render ${className ?? ''}`}\n style={{\n height: nodeHeight + offsetY,\n ...style,\n }}\n data-flow-editor-selectable=\"true\"\n onDragStart={(e) => {\n e.stopPropagation();\n }}\n >\n <SubCanvasBorder>\n <SubCanvasBackground />\n <SubCanvasTips tipText={tipText} />\n </SubCanvasBorder>\n </SubCanvasRenderStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasRenderStyle = styled.div`\n width: 100%;\n height: 100%;\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React from 'react';\n\nimport { I18n } from '@flowgram.ai/i18n';\n\nimport { useControlTips } from './use-control';\nimport { SubCanvasTipsStyle } from './style';\nimport { isMacOS } from './is-mac-os';\nimport { IconClose } from './icon-close';\n\ninterface SubCanvasTipsProps {\n tipText?: string | React.ReactNode;\n neverRemindText?: string | React.ReactNode;\n}\n\nexport const SubCanvasTips = ({ tipText, neverRemindText }: SubCanvasTipsProps) => {\n const { visible, close, closeForever } = useControlTips();\n\n const displayContent =\n tipText || I18n.t('Hold {{key}} to drag node out', { key: isMacOS ? 'Cmd ⌘' : 'Ctrl' });\n\n if (!visible) {\n return null;\n }\n return (\n <SubCanvasTipsStyle className={'sub-canvas-tips'}>\n <div className=\"container\">\n <div className=\"content\">\n {typeof displayContent === 'string' ? (\n <p className=\"text\">{displayContent}</p>\n ) : (\n <div className=\"custom-content\">{displayContent}</div>\n )}\n <div\n className=\"space\"\n style={{\n width: 0,\n }}\n />\n </div>\n <div className=\"actions\">\n <p className=\"close-forever\" onClick={closeForever}>\n {neverRemindText || I18n.t('Never Remind')}\n </p>\n <div className=\"close\" onClick={close}>\n <IconClose />\n </div>\n </div>\n </div>\n </SubCanvasTipsStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\nimport { useService } from '@flowgram.ai/core';\n\nimport { NodeIntoContainerService, NodeIntoContainerType } from '../../../node-into-container';\nimport { TipsGlobalStore } from './global-store';\n\nexport const useControlTips = () => {\n const node = useCurrentEntity();\n const [visible, setVisible] = useState(false);\n const globalStore = TipsGlobalStore.instance;\n\n const nodeIntoContainerService = useService<NodeIntoContainerService>(NodeIntoContainerService);\n\n const show = useCallback(() => {\n if (globalStore.isClosed()) {\n return;\n }\n\n setVisible(true);\n }, [globalStore]);\n\n const close = useCallback(() => {\n globalStore.close();\n setVisible(false);\n }, [globalStore]);\n\n const closeForever = useCallback(() => {\n globalStore.closeForever();\n close();\n }, [close, globalStore]);\n\n useEffect(() => {\n // 监听移入\n const inDisposer = nodeIntoContainerService.on((e) => {\n if (e.type !== NodeIntoContainerType.In) {\n return;\n }\n if (e.targetContainer === node) {\n show();\n }\n });\n // 监听移出事件\n const outDisposer = nodeIntoContainerService.on((e) => {\n if (e.type !== NodeIntoContainerType.Out) {\n return;\n }\n if (e.sourceContainer === node && !node.blocks.length) {\n setVisible(false);\n }\n });\n return () => {\n inDisposer.dispose();\n outDisposer.dispose();\n };\n }, [nodeIntoContainerService, node, show, close, visible]);\n\n return {\n visible,\n close,\n closeForever,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/naming-convention -- no need */\n\nconst STORAGE_KEY = 'workflow-move-into-sub-canvas-tip-visible';\nconst STORAGE_VALUE = 'false';\n\nexport class TipsGlobalStore {\n private static _instance?: TipsGlobalStore;\n\n public static get instance(): TipsGlobalStore {\n if (!this._instance) {\n this._instance = new TipsGlobalStore();\n }\n return this._instance;\n }\n\n private closed = false;\n\n public isClosed(): boolean {\n return this.isCloseForever() || this.closed;\n }\n\n public close(): void {\n this.closed = true;\n }\n\n public isCloseForever(): boolean {\n return localStorage.getItem(STORAGE_KEY) === STORAGE_VALUE;\n }\n\n public closeForever(): void {\n localStorage.setItem(STORAGE_KEY, STORAGE_VALUE);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasTipsStyle = styled.div`\n pointer-events: auto;\n position: absolute;\n top: 0;\n\n width: 100%;\n height: 28px;\n\n .container {\n height: 100%;\n background-color: #e4e6f5;\n border-radius: 4px 4px 0 0;\n\n .content {\n overflow: hidden;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n width: 100%;\n height: 100%;\n\n .text {\n font-size: 14px;\n font-weight: 400;\n font-style: normal;\n line-height: 20px;\n color: rgba(15, 21, 40, 82%);\n text-overflow: ellipsis;\n }\n\n .custom-content {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n\n /* 为自定义内容提供默认样式,但允许覆盖 */\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n color: rgba(15, 21, 40, 82%);\n\n /* 确保自定义内容不会超出容器 */\n overflow: hidden;\n }\n\n .space {\n width: 128px;\n }\n }\n\n .actions {\n position: absolute;\n top: 0;\n right: 0;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n height: 28px;\n padding: 0 16px;\n\n .close-forever {\n cursor: pointer;\n\n padding: 0 3px;\n\n font-size: 12px;\n font-weight: 400;\n font-style: normal;\n line-height: 12px;\n color: rgba(32, 41, 69, 62%);\n }\n\n .close {\n display: flex;\n cursor: pointer;\n height: 100%;\n align-items: center;\n }\n }\n }\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const isMacOS = /(Macintosh|MacIntel|MacPPC|Mac68K|iPad)/.test(navigator.userAgent);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React from 'react';\n\nexport const IconClose = () => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0 0 16 16\">\n <path\n fill=\"#060709\"\n fillOpacity=\"0.5\"\n d=\"M12.13 12.128a.5.5 0 0 0 .001-.706L8.71 8l3.422-3.423a.5.5 0 0 0-.001-.705.5.5 0 0 0-.706-.002L8.002 7.293 4.579 3.87a.5.5 0 0 0-.705.002.5.5 0 0 0-.002.705L7.295 8l-3.423 3.422a.5.5 0 0 0 .002.706c.195.195.51.197.705.001l3.423-3.422 3.422 3.422c.196.196.51.194.706-.001\"\n ></path>\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;AAKO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,QAAK;AACL,EAAAA,uBAAA,SAAM;AAFI,SAAAA;AAAA,GAAA;;;ACCZ,SAAS,gBAAgB;AACzB,SAAS,QAAQ,kBAAkB;AACnC,SAA0B,sBAAsB,eAAe;AAC/D;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB,oBAAAC,yBAAwB;AACrD,SAAS,wBAAwB,qBAAqB;;;AChB/C,IAAM,YAAY,YAA2B;AAClD,QAAM,IAAI,QAAQ,CAAC,YAAY,sBAAsB,OAAO,CAAC;AAC/D;;;ACAO,IAAM,cAAc,CAAC,SAC1B,MAAM,YAA8B,EAAE,eAAe;;;ACGhD,IAAM,yBAAyB,CAAC,aACrC,SACG,OAAO,CAAC,SAAS;AAChB,MAAI,KAAK,cAAc;AACrB,WAAO,KAAK,YAAY,EAAE,cAAc,KAAK,aAAa,YAAY,EAAE;AAAA,EAC1E;AACA,SAAO,KAAK,YAAY,EAAE;AAC5B,CAAC,EACA,OAAO,CAAC,SAAS,YAAY,IAAI,CAAC,EAClC,KAAK,CAAC,GAAG,MAAM;AACd,QAAM,SAAS,EAAE,WAAW;AAC5B,QAAM,SAAS,EAAE,WAAW;AAE5B,SAAO,SAAS;AAClB,CAAC,EACA,IAAI,CAAC,SAAS,KAAK,SAAS;;;ACrBjC,SAAyB,iBAAiB;;;ACEnC,IAAM,mBAAmB,CAAC,OA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ElD,gBAAAA,OAAA;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO;AAAA,QACL,OAAO;AAAA,MACT;AAAA;AAAA,EACF,CACF,GACA,gBAAAA,OAAA,cAAC,SAAI,WAAU,aACb,gBAAAA,OAAA,cAAC,OAAE,WAAU,iBAAgB,SAAS,gBACnC,mBAAmB,KAAK,EAAE,cAAc,CAC3C,GACA,gBAAAA,OAAA,cAAC,SAAI,WAAU,SAAQ,SAAS,SAC9B,gBAAAA,OAAA,cAAC,eAAU,CACb,CACF,CACF,CACF;AAEJ;;;AFnCO,IAAM,kBAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AACF,MAAM;AACJ,QAAM,WAAW,YAAY;AAC7B,QAAM,aAAa,UAAU,UAAU;AAEvC,wBAAsB,QAAQ;AAE9B,SACE,gBAAAC,OAAA;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,qBAAqB,aAAa,EAAE;AAAA,MAC/C,OAAO;AAAA,QACL,QAAQ,aAAa;AAAA,QACrB,GAAG;AAAA,MACL;AAAA,MACA,+BAA4B;AAAA,MAC5B,aAAa,CAAC,MAAM;AAClB,UAAE,gBAAgB;AAAA,MACpB;AAAA;AAAA,IAEA,gBAAAA,OAAA,cAAC,uBACC,gBAAAA,OAAA,cAAC,yBAAoB,GACrB,gBAAAA,OAAA,cAAC,iBAAc,SAAkB,CACnC;AAAA,EACF;AAEJ;","names":["NodeIntoContainerType","FlowNodeBaseType","FlowNodeBaseType","renderData","renderDom","isContainer","useCurrentEntity","useCurrentEntity","useCurrentEntity","React","styled","React","React","styled","React","useEffect","useState","useCurrentEntity","useService","useCurrentEntity","useState","useService","useEffect","styled","React","React","React"]}
1
+ {"version":3,"sources":["../../src/node-into-container/constant.ts","../../src/node-into-container/service.ts","../../src/utils/next-frame.ts","../../src/utils/is-container.ts","../../src/utils/get-container-transforms.ts","../../src/utils/get-collision-transform.ts","../../src/utils/is-rect-intersects.ts","../../src/utils/is-point-in-rect.ts","../../src/utils/adjust-sub-node-position.ts","../../src/utils/index.ts","../../src/node-into-container/plugin.tsx","../../src/sub-canvas/hooks/use-node-size.ts","../../src/sub-canvas/hooks/use-sync-node-render-size.ts","../../src/sub-canvas/components/background/index.tsx","../../src/sub-canvas/components/background/style.ts","../../src/sub-canvas/components/border/index.tsx","../../src/sub-canvas/components/border/style.ts","../../src/sub-canvas/components/render/index.tsx","../../src/sub-canvas/components/render/style.ts","../../src/sub-canvas/components/tips/index.tsx","../../src/sub-canvas/components/tips/use-control.ts","../../src/sub-canvas/components/tips/global-store.ts","../../src/sub-canvas/components/tips/style.ts","../../src/sub-canvas/components/tips/is-mac-os.ts","../../src/sub-canvas/components/tips/icon-close.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum NodeIntoContainerType {\n In = 'in',\n Out = 'out',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion -- no need */\nimport { throttle } from 'lodash-es';\nimport { inject, injectable } from 'inversify';\nimport { type Disposable, DisposableCollection, Emitter } from '@flowgram.ai/utils';\nimport {\n type NodesDragEvent,\n WorkflowDocument,\n WorkflowDragService,\n WorkflowLinesManager,\n type WorkflowNodeEntity,\n WorkflowNodeMeta,\n WorkflowOperationBaseService,\n WorkflowSelectService,\n} from '@flowgram.ai/free-layout-core';\nimport { HistoryService } from '@flowgram.ai/free-history-plugin';\nimport { FlowNodeRenderData, FlowNodeBaseType } from '@flowgram.ai/document';\nimport { PlaygroundConfigEntity, TransformData } from '@flowgram.ai/core';\n\nimport type { NodeIntoContainerEvent, NodeIntoContainerState } from './type';\nimport { NodeIntoContainerType } from './constant';\nimport { ContainerUtils } from '../utils';\n\n@injectable()\nexport class NodeIntoContainerService {\n public state: NodeIntoContainerState;\n\n @inject(WorkflowDragService)\n private dragService: WorkflowDragService;\n\n @inject(WorkflowDocument)\n private document: WorkflowDocument;\n\n @inject(PlaygroundConfigEntity)\n private playgroundConfig: PlaygroundConfigEntity;\n\n @inject(WorkflowOperationBaseService)\n private operationService: WorkflowOperationBaseService;\n\n @inject(WorkflowLinesManager)\n private linesManager: WorkflowLinesManager;\n\n @inject(HistoryService) private historyService: HistoryService;\n\n @inject(WorkflowSelectService) private selectService: WorkflowSelectService;\n\n private emitter = new Emitter<NodeIntoContainerEvent>();\n\n private toDispose = new DisposableCollection();\n\n public readonly on = this.emitter.event;\n\n public init(): void {\n this.initState();\n this.toDispose.push(this.emitter);\n }\n\n public ready(): void {\n this.toDispose.push(this.listenDragToContainer());\n }\n\n public dispose(): void {\n this.initState();\n this.toDispose.dispose();\n }\n\n /** 将节点移出容器 */\n public async moveOutContainer(params: { node: WorkflowNodeEntity }): Promise<void> {\n const { node } = params;\n const parentNode = node.parent;\n const containerNode = parentNode?.parent;\n const nodeJSON = this.document.toNodeJSON(node);\n if (\n !parentNode ||\n !containerNode ||\n !ContainerUtils.isContainer(parentNode) ||\n !nodeJSON.meta?.position\n ) {\n return;\n }\n const parentTransform = parentNode.getData<TransformData>(TransformData);\n this.operationService.moveNode(node, {\n parent: containerNode,\n });\n await ContainerUtils.nextFrame();\n parentTransform.fireChange();\n this.operationService.updateNodePosition(node, {\n x: parentTransform.position.x + nodeJSON.meta!.position!.x,\n y: parentTransform.position.y + nodeJSON.meta!.position!.y,\n });\n this.emitter.fire({\n type: NodeIntoContainerType.Out,\n node,\n sourceContainer: parentNode,\n targetContainer: containerNode,\n });\n }\n\n /** 能否将节点移出容器 */\n public canMoveOutContainer(node: WorkflowNodeEntity): boolean {\n const parentNode = node.parent;\n const containerNode = parentNode?.parent;\n if (!parentNode || !containerNode || !ContainerUtils.isContainer(parentNode)) {\n return false;\n }\n const canDrop = this.dragService.canDropToNode({\n dragNodeType: node.flowNodeType,\n dragNode: node,\n dropNodeType: containerNode?.flowNodeType,\n dropNode: containerNode,\n });\n if (!canDrop.allowDrop) {\n return false;\n }\n return true;\n }\n\n /** 移除节点所有非法连线 */\n public async clearInvalidLines(params: {\n dragNode?: WorkflowNodeEntity;\n sourceParent?: WorkflowNodeEntity;\n }): Promise<void> {\n const { dragNode, sourceParent } = params;\n if (!dragNode) {\n return;\n }\n if (dragNode.parent === sourceParent) {\n // 容器节点未改变\n return;\n }\n if (\n dragNode.parent?.flowNodeType === FlowNodeBaseType.GROUP ||\n sourceParent?.flowNodeType === FlowNodeBaseType.GROUP\n ) {\n // 移入移出 group 节点无需删除节点\n return;\n }\n await this.removeNodeLines(dragNode);\n }\n\n /** 移除节点连线 */\n public async removeNodeLines(node: WorkflowNodeEntity): Promise<void> {\n const lines = this.linesManager.getAllLines();\n lines.forEach((line) => {\n if (line.from?.id !== node.id && line.to?.id !== node.id) {\n return;\n }\n line.dispose();\n });\n await ContainerUtils.nextFrame();\n }\n\n /** 初始化状态 */\n private initState(): void {\n this.state = {\n isDraggingNode: false,\n isSkipEvent: false,\n transforms: undefined,\n dragNode: undefined,\n dropNode: undefined,\n sourceParent: undefined,\n };\n }\n\n /** 监听节点拖拽 */\n private listenDragToContainer(): Disposable {\n const draggingNode = (e: NodesDragEvent) => this.draggingNode(e);\n const throttledDraggingNode = throttle(draggingNode, 200); // 200ms触发一次计算\n return this.dragService.onNodesDrag(async (event) => {\n if (this.selectService.selectedNodes.length !== 1) {\n return;\n }\n if (event.type === 'onDragStart') {\n if (this.state.isSkipEvent) {\n // 拖出容器后重新进入\n this.state.isSkipEvent = false;\n return;\n }\n this.historyService.startTransaction(); // 开始合并历史记录\n this.state.isDraggingNode = true;\n this.state.transforms = ContainerUtils.getContainerTransforms(this.document.getAllNodes());\n this.state.dragNode = this.selectService.selectedNodes[0];\n this.state.dropNode = undefined;\n this.state.sourceParent = this.state.dragNode?.parent;\n await this.dragOutContainer(event); // 检查是否需拖出容器\n }\n if (event.type === 'onDragging') {\n throttledDraggingNode(event);\n }\n if (event.type === 'onDragEnd') {\n if (this.state.isSkipEvent) {\n // 拖出容器情况下需跳过本次事件\n return;\n }\n throttledDraggingNode.cancel();\n draggingNode(event); // 直接触发一次计算,防止延迟\n await this.dropNodeToContainer(); // 放置节点\n await this.clearInvalidLines({\n dragNode: this.state.dragNode,\n sourceParent: this.state.sourceParent,\n }); // 清除非法线条\n this.setDropNode(undefined);\n this.initState(); // 重置状态\n this.historyService.endTransaction(); // 结束合并历史记录\n }\n });\n }\n\n /** 监听节点拖拽出容器 */\n private async dragOutContainer(event: NodesDragEvent): Promise<void> {\n const { dragNode } = this.state;\n const activated = event.triggerEvent.metaKey || event.triggerEvent.ctrlKey;\n if (\n !activated || // 必须按住指定按键\n !dragNode || // 必须有一个节点\n !this.canMoveOutContainer(dragNode) // 需要能被移出容器\n ) {\n return;\n }\n this.moveOutContainer({ node: dragNode });\n this.state.isSkipEvent = true;\n event.dragger.stop(event.dragEvent.clientX, event.dragEvent.clientY);\n await ContainerUtils.nextFrame();\n this.dragService.startDragSelectedNodes(event.triggerEvent);\n }\n\n /** 设置放置节点高亮 */\n private setDropNode(dropNode?: WorkflowNodeEntity) {\n if (this.state.dropNode === dropNode) {\n return;\n }\n if (this.state.dropNode) {\n // 清除上一个节点高亮\n const renderData = this.state.dropNode.getData(FlowNodeRenderData);\n const renderDom = renderData.node?.children?.[0] as HTMLElement;\n if (renderDom) {\n renderDom.classList.remove('selected');\n }\n }\n this.state.dropNode = dropNode;\n if (!dropNode) {\n return;\n }\n // 设置当前节点高亮\n const renderData = dropNode.getData(FlowNodeRenderData);\n const renderDom = renderData.node?.children?.[0] as HTMLElement;\n if (renderDom) {\n renderDom.classList.add('selected');\n }\n }\n\n /** 放置节点到容器 */\n private async dropNodeToContainer(): Promise<void> {\n const { dropNode, dragNode, isDraggingNode } = this.state;\n if (!isDraggingNode || !dragNode || !dropNode) {\n return;\n }\n return await this.moveIntoContainer({\n node: dragNode,\n containerNode: dropNode,\n });\n }\n\n /** 拖拽节点 */\n private draggingNode(nodeDragEvent: NodesDragEvent): void {\n const { dragNode, isDraggingNode, transforms = [] } = this.state;\n if (!isDraggingNode || !dragNode || !transforms?.length) {\n return this.setDropNode(undefined);\n }\n const mousePos = this.playgroundConfig.getPosFromMouseEvent(nodeDragEvent.dragEvent);\n const availableTransforms = transforms.filter(\n (transform) => transform.entity.id !== dragNode.id\n );\n const collisionTransform = ContainerUtils.getCollisionTransform({\n targetPoint: mousePos,\n transforms: availableTransforms,\n document: this.document,\n });\n const dropNode = collisionTransform?.entity;\n const canDrop = this.canDropToContainer({\n dragNode,\n dropNode,\n });\n if (!canDrop) {\n return this.setDropNode(undefined);\n }\n return this.setDropNode(dropNode);\n }\n\n /** 判断能否将节点拖入容器 */\n protected canDropToContainer(params: {\n dragNode: WorkflowNodeEntity;\n dropNode?: WorkflowNodeEntity;\n }): boolean {\n const { dragNode, dropNode } = params;\n const isDropContainer = dropNode?.getNodeMeta<WorkflowNodeMeta>().isContainer;\n if (\n !dropNode ||\n !isDropContainer ||\n this.isParent(dragNode, dropNode) ||\n this.isParent(dropNode, dragNode)\n ) {\n return false;\n }\n if (\n dragNode.flowNodeType === FlowNodeBaseType.GROUP &&\n dropNode.flowNodeType !== FlowNodeBaseType.GROUP\n ) {\n // 禁止将 group 节点拖入非 group 节点(由于目前不支持多节点拖入容器,无法计算有效线条,因此进行屏蔽)\n return false;\n }\n const canDrop = this.dragService.canDropToNode({\n dragNodeType: dragNode.flowNodeType,\n dropNodeType: dropNode?.flowNodeType,\n dragNode,\n dropNode,\n });\n if (!canDrop.allowDrop) {\n return false;\n }\n return true;\n }\n\n /** 判断一个节点是否为另一个节点的父节点(向上查找直到根节点) */\n private isParent(node: WorkflowNodeEntity, parent: WorkflowNodeEntity): boolean {\n let current = node.parent;\n while (current) {\n if (current.id === parent.id) {\n return true;\n }\n current = current.parent;\n }\n return false;\n }\n\n /** 将节点移入容器 */\n private async moveIntoContainer(params: {\n node: WorkflowNodeEntity;\n containerNode: WorkflowNodeEntity;\n }): Promise<void> {\n const { node, containerNode } = params;\n const parentNode = node.parent;\n\n this.operationService.moveNode(node, {\n parent: containerNode,\n });\n\n const containerPadding = this.document.layout.getPadding(containerNode);\n const position = ContainerUtils.adjustSubNodePosition({\n targetNode: node,\n containerNode,\n containerPadding,\n });\n\n this.operationService.updateNodePosition(node, position);\n\n await ContainerUtils.nextFrame();\n\n this.emitter.fire({\n type: NodeIntoContainerType.In,\n node,\n sourceContainer: parentNode,\n targetContainer: containerNode,\n });\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const nextFrame = async (): Promise<void> => {\n await new Promise((resolve) => requestAnimationFrame(resolve));\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowNodeEntity, WorkflowNodeMeta } from '@flowgram.ai/free-layout-core';\n\nexport const isContainer = (node?: WorkflowNodeEntity): boolean =>\n node?.getNodeMeta<WorkflowNodeMeta>().isContainer ?? false;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowNodeEntity } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nimport { isContainer } from './is-container';\n\n/** 获取容器节点transforms */\nexport const getContainerTransforms = (allNodes: WorkflowNodeEntity[]): FlowNodeTransformData[] =>\n allNodes\n .filter((node) => {\n if (node.originParent) {\n return node.getNodeMeta().selectable && node.originParent.getNodeMeta().selectable;\n }\n return node.getNodeMeta().selectable;\n })\n .filter((node) => isContainer(node))\n .sort((a, b) => {\n const aIndex = a.renderData.stackIndex;\n const bIndex = b.renderData.stackIndex;\n // 确保层级高的节点在前面\n return bIndex - aIndex;\n })\n .map((node) => node.transform);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PositionSchema, Rectangle } from '@flowgram.ai/utils';\nimport { WorkflowDocument } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nimport { isRectIntersects } from './is-rect-intersects';\nimport { isPointInRect } from './is-point-in-rect';\n\n/** 获取重叠位置 */\nexport const getCollisionTransform = (params: {\n transforms: FlowNodeTransformData[];\n targetRect?: Rectangle;\n targetPoint?: PositionSchema;\n withPadding?: boolean;\n document: WorkflowDocument;\n}): FlowNodeTransformData | undefined => {\n const { targetRect, targetPoint, transforms, withPadding = false, document } = params;\n const collisionTransform = transforms.find((transform) => {\n const { bounds, entity } = transform;\n const padding = withPadding ? document.layout.getPadding(entity) : { left: 0, right: 0 };\n const transformRect = new Rectangle(\n bounds.x + padding.left + padding.right,\n bounds.y,\n bounds.width,\n bounds.height\n );\n // 检测两个正方形是否相互碰撞\n if (targetRect) {\n return isRectIntersects(targetRect, transformRect);\n }\n if (targetPoint) {\n return isPointInRect(targetPoint, transformRect);\n }\n return false;\n });\n return collisionTransform;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Rectangle } from '@flowgram.ai/utils';\n\nexport const isRectIntersects = (rectA: Rectangle, rectB: Rectangle): boolean => {\n // 检查水平方向是否有重叠\n const hasHorizontalOverlap = rectA.right > rectB.left && rectA.left < rectB.right;\n // 检查垂直方向是否有重叠\n const hasVerticalOverlap = rectA.bottom > rectB.top && rectA.top < rectB.bottom;\n // 只有当水平和垂直方向都有重叠时,两个矩形才相交\n return hasHorizontalOverlap && hasVerticalOverlap;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PositionSchema, Rectangle } from '@flowgram.ai/utils';\n\nexport const isPointInRect = (point: PositionSchema, rect: Rectangle): boolean =>\n point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IPoint, PaddingSchema } from '@flowgram.ai/utils';\nimport { WorkflowNodeEntity } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeBaseType } from '@flowgram.ai/document';\n\n/**\n * 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标\n */\nexport const adjustSubNodePosition = (params: {\n targetNode: WorkflowNodeEntity;\n containerNode: WorkflowNodeEntity;\n containerPadding: PaddingSchema;\n}): IPoint => {\n const { targetNode, containerNode, containerPadding } = params;\n if (containerNode.flowNodeType === FlowNodeBaseType.ROOT) {\n return targetNode.transform.position;\n }\n const nodeWorldTransform = targetNode.transform.transform.worldTransform;\n const containerWorldTransform = containerNode.transform.transform.worldTransform;\n const nodePosition = {\n x: nodeWorldTransform.tx,\n y: nodeWorldTransform.ty,\n };\n const isParentEmpty = !containerNode.children || containerNode.children.length === 0;\n if (isParentEmpty) {\n // 确保空容器节点不偏移\n return {\n x: 0,\n y: containerPadding.top,\n };\n } else {\n return {\n x: nodePosition.x - containerWorldTransform.tx,\n y: nodePosition.y - containerWorldTransform.ty,\n };\n }\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { nextFrame } from './next-frame';\nimport { isContainer } from './is-container';\nimport { getContainerTransforms } from './get-container-transforms';\nimport { getCollisionTransform } from './get-collision-transform';\nimport { adjustSubNodePosition } from './adjust-sub-node-position';\n\nexport const ContainerUtils = {\n nextFrame,\n isContainer,\n adjustSubNodePosition,\n getContainerTransforms,\n getCollisionTransform,\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport type { WorkflowContainerPluginOptions } from './type';\nimport { NodeIntoContainerService } from '.';\n\nexport const createContainerNodePlugin = definePluginCreator<WorkflowContainerPluginOptions>({\n onBind: ({ bind }) => {\n bind(NodeIntoContainerService).toSelf().inSingletonScope();\n },\n onInit(ctx, options) {\n ctx.get(NodeIntoContainerService).init();\n },\n onReady(ctx, options) {\n if (options.disableNodeIntoContainer !== true) {\n ctx.get(NodeIntoContainerService).ready();\n }\n },\n onDispose(ctx) {\n ctx.get(NodeIntoContainerService).dispose();\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useState, useEffect } from 'react';\n\nimport {\n useCurrentEntity,\n WorkflowNodeMeta,\n WorkflowNodePortsData,\n} from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nexport interface NodeSize {\n width: number;\n height: number;\n}\n\nexport const useNodeSize = (): NodeSize | undefined => {\n const node = useCurrentEntity();\n const nodeMeta = node.getNodeMeta<WorkflowNodeMeta>();\n const { size = { width: 300, height: 200 }, isContainer } = nodeMeta;\n\n const transform = node.getData<FlowNodeTransformData>(FlowNodeTransformData);\n const [width, setWidth] = useState(size.width);\n const [height, setHeight] = useState(size.height);\n\n const updatePorts = () => {\n const portsData = node.getData<WorkflowNodePortsData>(WorkflowNodePortsData);\n portsData.updateDynamicPorts();\n };\n\n const updateSize = () => {\n // 无子节点时\n if (node.blocks.length === 0) {\n setWidth(size.width);\n setHeight(size.height);\n return;\n }\n // 存在子节点时,只监听宽高变化\n setWidth(transform.bounds.width);\n setHeight(transform.bounds.height);\n };\n\n useEffect(() => {\n const dispose = transform.onDataChange(() => {\n updateSize();\n updatePorts();\n });\n return () => dispose.dispose();\n }, [transform, width, height]);\n\n useEffect(() => {\n // 初始化触发一次\n updateSize();\n }, []);\n\n if (!isContainer) {\n return;\n }\n\n return {\n width,\n height,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useLayoutEffect } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\n\nimport { NodeSize } from './use-node-size';\n\nexport const useSyncNodeRenderSize = (nodeSize?: NodeSize) => {\n const node = useCurrentEntity();\n\n useLayoutEffect(() => {\n if (!nodeSize) {\n return;\n }\n node.renderData.node.style.width = nodeSize.width + 'px';\n node.renderData.node.style.height = nodeSize.height + 'px';\n }, [nodeSize?.width, nodeSize?.height]);\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { type FC } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\nimport { useService } from '@flowgram.ai/core';\nimport { BackgroundConfig, BackgroundLayerOptions } from '@flowgram.ai/background-plugin';\n\nimport { SubCanvasBackgroundStyle } from './style';\n\nexport const SubCanvasBackground: FC = () => {\n const node = useCurrentEntity();\n\n // 通过 inversify 获取背景配置,如果没有配置则使用默认值\n let backgroundConfig: BackgroundLayerOptions = {};\n try {\n backgroundConfig = useService<BackgroundLayerOptions>(BackgroundConfig);\n } catch (error) {\n // 如果 BackgroundConfig 没有注册,使用默认配置\n // 静默处理,使用默认配置\n }\n\n // 获取配置值,如果没有则使用默认值\n const gridSize = backgroundConfig.gridSize ?? 20;\n const dotSize = backgroundConfig.dotSize ?? 1;\n const dotColor = backgroundConfig.dotColor ?? '#eceeef';\n const dotOpacity = backgroundConfig.dotOpacity ?? 0.5;\n const backgroundColor = backgroundConfig.backgroundColor ?? '#f2f3f5';\n // 只有当 dotFillColor 被明确设置且与 dotColor 不同时才添加 fill 属性\n const dotFillColor =\n backgroundConfig.dotFillColor === dotColor ? '' : backgroundConfig.dotFillColor;\n\n // 生成唯一的 pattern ID\n const patternId = `sub-canvas-dot-pattern-${node.id}`;\n\n return (\n <SubCanvasBackgroundStyle\n className=\"sub-canvas-background\"\n data-flow-editor-selectable=\"true\"\n style={{ backgroundColor: backgroundColor }}\n >\n <svg width=\"100%\" height=\"100%\">\n <pattern id={patternId} width={gridSize} height={gridSize} patternUnits=\"userSpaceOnUse\">\n <circle\n cx={dotSize}\n cy={dotSize}\n r={dotSize}\n stroke={dotColor}\n fill={dotFillColor}\n fillOpacity={dotOpacity}\n />\n </pattern>\n <rect\n width=\"100%\"\n height=\"100%\"\n fill={`url(#${patternId})`}\n data-node-panel-container={node.id}\n />\n </svg>\n </SubCanvasBackgroundStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasBackgroundStyle = styled.div`\n width: 100%;\n height: 100%;\n inset: 56px 18px 18px;\n /* 背景色现在通过 style 属性动态设置 */\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { CSSProperties, ReactNode, type FC } from 'react';\n\nimport { SubCanvasBorderStyle } from './style';\n\ninterface ISubCanvasBorder {\n style?: CSSProperties;\n children?: ReactNode | ReactNode[];\n}\n\nexport const SubCanvasBorder: FC<ISubCanvasBorder> = ({ style, children }) => (\n <SubCanvasBorderStyle\n className=\"sub-canvas-border\"\n style={{\n ...style,\n }}\n >\n {children}\n </SubCanvasBorderStyle>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasBorderStyle = styled.div`\n pointer-events: none;\n\n position: relative;\n\n display: flex;\n align-items: center;\n\n width: 100%;\n height: 100%;\n\n background-color: transparent;\n border: 1px solid var(--coz-stroke-plus, rgba(6, 7, 9, 15%));\n border-color: var(--coz-bg-plus, rgb(249, 249, 249));\n border-style: solid;\n border-width: 8px;\n border-radius: 8px;\n\n &::before {\n content: '';\n\n position: absolute;\n z-index: 0;\n inset: -4px;\n\n background-color: transparent;\n border-color: var(--coz-bg-plus, rgb(249, 249, 249));\n border-style: solid;\n border-width: 4px;\n border-radius: 8px;\n }\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { CSSProperties, type FC } from 'react';\n\nimport { SubCanvasRenderStyle } from './style';\nimport { SubCanvasTips } from '../tips';\nimport { SubCanvasBorder } from '../border';\nimport { SubCanvasBackground } from '../background';\nimport { useNodeSize, useSyncNodeRenderSize } from '../../hooks';\n\ninterface ISubCanvasRender {\n offsetY?: number;\n className?: string;\n style?: CSSProperties;\n tipText?: string | React.ReactNode;\n}\n\nexport const SubCanvasRender: FC<ISubCanvasRender> = ({\n className,\n style,\n offsetY = 0,\n tipText,\n}) => {\n const nodeSize = useNodeSize();\n const nodeHeight = nodeSize?.height ?? 0;\n\n useSyncNodeRenderSize(nodeSize);\n\n return (\n <SubCanvasRenderStyle\n className={`sub-canvas-render ${className ?? ''}`}\n style={{\n height: nodeHeight + offsetY,\n ...style,\n }}\n data-flow-editor-selectable=\"true\"\n onDragStart={(e) => {\n e.stopPropagation();\n }}\n >\n <SubCanvasBorder>\n <SubCanvasBackground />\n <SubCanvasTips tipText={tipText} />\n </SubCanvasBorder>\n </SubCanvasRenderStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasRenderStyle = styled.div`\n width: 100%;\n height: 100%;\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React from 'react';\n\nimport { I18n } from '@flowgram.ai/i18n';\n\nimport { useControlTips } from './use-control';\nimport { SubCanvasTipsStyle } from './style';\nimport { isMacOS } from './is-mac-os';\nimport { IconClose } from './icon-close';\n\ninterface SubCanvasTipsProps {\n tipText?: string | React.ReactNode;\n neverRemindText?: string | React.ReactNode;\n}\n\nexport const SubCanvasTips = ({ tipText, neverRemindText }: SubCanvasTipsProps) => {\n const { visible, close, closeForever } = useControlTips();\n\n const displayContent =\n tipText || I18n.t('Hold {{key}} to drag node out', { key: isMacOS ? 'Cmd ⌘' : 'Ctrl' });\n\n if (!visible) {\n return null;\n }\n return (\n <SubCanvasTipsStyle className={'sub-canvas-tips'}>\n <div className=\"container\">\n <div className=\"content\">\n {typeof displayContent === 'string' ? (\n <p className=\"text\">{displayContent}</p>\n ) : (\n <div className=\"custom-content\">{displayContent}</div>\n )}\n <div\n className=\"space\"\n style={{\n width: 0,\n }}\n />\n </div>\n <div className=\"actions\">\n <p className=\"close-forever\" onClick={closeForever}>\n {neverRemindText || I18n.t('Never Remind')}\n </p>\n <div className=\"close\" onClick={close}>\n <IconClose />\n </div>\n </div>\n </div>\n </SubCanvasTipsStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\nimport { useService } from '@flowgram.ai/core';\n\nimport { NodeIntoContainerService, NodeIntoContainerType } from '../../../node-into-container';\nimport { TipsGlobalStore } from './global-store';\n\nexport const useControlTips = () => {\n const node = useCurrentEntity();\n const [visible, setVisible] = useState(false);\n const globalStore = TipsGlobalStore.instance;\n\n const nodeIntoContainerService = useService<NodeIntoContainerService>(NodeIntoContainerService);\n\n const show = useCallback(() => {\n if (globalStore.isClosed()) {\n return;\n }\n\n setVisible(true);\n }, [globalStore]);\n\n const close = useCallback(() => {\n globalStore.close();\n setVisible(false);\n }, [globalStore]);\n\n const closeForever = useCallback(() => {\n globalStore.closeForever();\n close();\n }, [close, globalStore]);\n\n useEffect(() => {\n // 监听移入\n const inDisposer = nodeIntoContainerService.on((e) => {\n if (e.type !== NodeIntoContainerType.In) {\n return;\n }\n if (e.targetContainer === node) {\n show();\n }\n });\n // 监听移出事件\n const outDisposer = nodeIntoContainerService.on((e) => {\n if (e.type !== NodeIntoContainerType.Out) {\n return;\n }\n if (e.sourceContainer === node && !node.blocks.length) {\n setVisible(false);\n }\n });\n return () => {\n inDisposer.dispose();\n outDisposer.dispose();\n };\n }, [nodeIntoContainerService, node, show, close, visible]);\n\n return {\n visible,\n close,\n closeForever,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/naming-convention -- no need */\n\nconst STORAGE_KEY = 'workflow-move-into-sub-canvas-tip-visible';\nconst STORAGE_VALUE = 'false';\n\nexport class TipsGlobalStore {\n private static _instance?: TipsGlobalStore;\n\n public static get instance(): TipsGlobalStore {\n if (!this._instance) {\n this._instance = new TipsGlobalStore();\n }\n return this._instance;\n }\n\n private closed = false;\n\n public isClosed(): boolean {\n return this.isCloseForever() || this.closed;\n }\n\n public close(): void {\n this.closed = true;\n }\n\n public isCloseForever(): boolean {\n return localStorage.getItem(STORAGE_KEY) === STORAGE_VALUE;\n }\n\n public closeForever(): void {\n localStorage.setItem(STORAGE_KEY, STORAGE_VALUE);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasTipsStyle = styled.div`\n pointer-events: auto;\n position: absolute;\n top: 0;\n\n width: 100%;\n height: 28px;\n\n .container {\n height: 100%;\n background-color: #e4e6f5;\n border-radius: 4px 4px 0 0;\n\n .content {\n overflow: hidden;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n width: 100%;\n height: 100%;\n\n .text {\n font-size: 14px;\n font-weight: 400;\n font-style: normal;\n line-height: 20px;\n color: rgba(15, 21, 40, 82%);\n text-overflow: ellipsis;\n }\n\n .custom-content {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n\n /* 为自定义内容提供默认样式,但允许覆盖 */\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n color: rgba(15, 21, 40, 82%);\n\n /* 确保自定义内容不会超出容器 */\n overflow: hidden;\n }\n\n .space {\n width: 128px;\n }\n }\n\n .actions {\n position: absolute;\n top: 0;\n right: 0;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n height: 28px;\n padding: 0 16px;\n\n .close-forever {\n cursor: pointer;\n\n padding: 0 3px;\n\n font-size: 12px;\n font-weight: 400;\n font-style: normal;\n line-height: 12px;\n color: rgba(32, 41, 69, 62%);\n }\n\n .close {\n display: flex;\n cursor: pointer;\n height: 100%;\n align-items: center;\n }\n }\n }\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const isMacOS = /(Macintosh|MacIntel|MacPPC|Mac68K|iPad)/.test(navigator.userAgent);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React from 'react';\n\nexport const IconClose = () => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0 0 16 16\">\n <path\n fill=\"#060709\"\n fillOpacity=\"0.5\"\n d=\"M12.13 12.128a.5.5 0 0 0 .001-.706L8.71 8l3.422-3.423a.5.5 0 0 0-.001-.705.5.5 0 0 0-.706-.002L8.002 7.293 4.579 3.87a.5.5 0 0 0-.705.002.5.5 0 0 0-.002.705L7.295 8l-3.423 3.422a.5.5 0 0 0 .002.706c.195.195.51.197.705.001l3.423-3.422 3.422 3.422c.196.196.51.194.706-.001\"\n ></path>\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;AAKO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,QAAK;AACL,EAAAA,uBAAA,SAAM;AAFI,SAAAA;AAAA,GAAA;;;ACCZ,SAAS,gBAAgB;AACzB,SAAS,QAAQ,kBAAkB;AACnC,SAA0B,sBAAsB,eAAe;AAC/D;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,EAGA;AAAA,EACA;AAAA,OACK;AACP,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB,oBAAAC,yBAAwB;AACrD,SAAS,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C,WAAW,qBAAqB,aAAa,EAAE;AAAA,MAC/C,OAAO;AAAA,QACL,QAAQ,aAAa;AAAA,QACrB,GAAG;AAAA,MACL;AAAA,MACA,+BAA4B;AAAA,MAC5B,aAAa,CAAC,MAAM;AAClB,UAAE,gBAAgB;AAAA,MACpB;AAAA;AAAA,IAEA,gBAAAA,OAAA,cAAC,uBACC,gBAAAA,OAAA,cAAC,yBAAoB,GACrB,gBAAAA,OAAA,cAAC,iBAAc,SAAkB,CACnC;AAAA,EACF;AAEJ;","names":["NodeIntoContainerType","FlowNodeBaseType","FlowNodeBaseType","renderData","renderDom","isContainer","useCurrentEntity","useCurrentEntity","useCurrentEntity","React","styled","React","React","styled","React","useEffect","useState","useCurrentEntity","useService","useCurrentEntity","useState","useService","useEffect","styled","React","React","React"]}
package/dist/index.js CHANGED
@@ -375,7 +375,7 @@ var NodeIntoContainerService = class {
375
375
  canDropToContainer(params) {
376
376
  const { dragNode, dropNode } = params;
377
377
  const isDropContainer = dropNode?.getNodeMeta().isContainer;
378
- if (!dropNode || !isDropContainer || this.isParent(dragNode, dropNode)) {
378
+ if (!dropNode || !isDropContainer || this.isParent(dragNode, dropNode) || this.isParent(dropNode, dragNode)) {
379
379
  return false;
380
380
  }
381
381
  if (dragNode.flowNodeType === import_document2.FlowNodeBaseType.GROUP && dropNode.flowNodeType !== import_document2.FlowNodeBaseType.GROUP) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/node-into-container/constant.ts","../src/node-into-container/service.ts","../src/utils/next-frame.ts","../src/utils/is-container.ts","../src/utils/get-container-transforms.ts","../src/utils/get-collision-transform.ts","../src/utils/is-rect-intersects.ts","../src/utils/is-point-in-rect.ts","../src/utils/adjust-sub-node-position.ts","../src/utils/index.ts","../src/node-into-container/plugin.tsx","../src/sub-canvas/hooks/use-node-size.ts","../src/sub-canvas/hooks/use-sync-node-render-size.ts","../src/sub-canvas/components/background/index.tsx","../src/sub-canvas/components/background/style.ts","../src/sub-canvas/components/border/index.tsx","../src/sub-canvas/components/border/style.ts","../src/sub-canvas/components/render/index.tsx","../src/sub-canvas/components/render/style.ts","../src/sub-canvas/components/tips/index.tsx","../src/sub-canvas/components/tips/use-control.ts","../src/sub-canvas/components/tips/global-store.ts","../src/sub-canvas/components/tips/style.ts","../src/sub-canvas/components/tips/is-mac-os.ts","../src/sub-canvas/components/tips/icon-close.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport * from './node-into-container';\nexport * from './sub-canvas';\nexport { ContainerUtils } from './utils';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum NodeIntoContainerType {\n In = 'in',\n Out = 'out',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion -- no need */\nimport { throttle } from 'lodash-es';\nimport { inject, injectable } from 'inversify';\nimport { type Disposable, DisposableCollection, Emitter } from '@flowgram.ai/utils';\nimport {\n type NodesDragEvent,\n WorkflowDocument,\n WorkflowDragService,\n WorkflowLinesManager,\n type WorkflowNodeEntity,\n WorkflowNodeMeta,\n WorkflowOperationBaseService,\n WorkflowSelectService,\n} from '@flowgram.ai/free-layout-core';\nimport { HistoryService } from '@flowgram.ai/free-history-plugin';\nimport { FlowNodeRenderData, FlowNodeBaseType } from '@flowgram.ai/document';\nimport { PlaygroundConfigEntity, TransformData } from '@flowgram.ai/core';\n\nimport type { NodeIntoContainerEvent, NodeIntoContainerState } from './type';\nimport { NodeIntoContainerType } from './constant';\nimport { ContainerUtils } from '../utils';\n\n@injectable()\nexport class NodeIntoContainerService {\n public state: NodeIntoContainerState;\n\n @inject(WorkflowDragService)\n private dragService: WorkflowDragService;\n\n @inject(WorkflowDocument)\n private document: WorkflowDocument;\n\n @inject(PlaygroundConfigEntity)\n private playgroundConfig: PlaygroundConfigEntity;\n\n @inject(WorkflowOperationBaseService)\n private operationService: WorkflowOperationBaseService;\n\n @inject(WorkflowLinesManager)\n private linesManager: WorkflowLinesManager;\n\n @inject(HistoryService) private historyService: HistoryService;\n\n @inject(WorkflowSelectService) private selectService: WorkflowSelectService;\n\n private emitter = new Emitter<NodeIntoContainerEvent>();\n\n private toDispose = new DisposableCollection();\n\n public readonly on = this.emitter.event;\n\n public init(): void {\n this.initState();\n this.toDispose.push(this.emitter);\n }\n\n public ready(): void {\n this.toDispose.push(this.listenDragToContainer());\n }\n\n public dispose(): void {\n this.initState();\n this.toDispose.dispose();\n }\n\n /** 将节点移出容器 */\n public async moveOutContainer(params: { node: WorkflowNodeEntity }): Promise<void> {\n const { node } = params;\n const parentNode = node.parent;\n const containerNode = parentNode?.parent;\n const nodeJSON = this.document.toNodeJSON(node);\n if (\n !parentNode ||\n !containerNode ||\n !ContainerUtils.isContainer(parentNode) ||\n !nodeJSON.meta?.position\n ) {\n return;\n }\n const parentTransform = parentNode.getData<TransformData>(TransformData);\n this.operationService.moveNode(node, {\n parent: containerNode,\n });\n await ContainerUtils.nextFrame();\n parentTransform.fireChange();\n this.operationService.updateNodePosition(node, {\n x: parentTransform.position.x + nodeJSON.meta!.position!.x,\n y: parentTransform.position.y + nodeJSON.meta!.position!.y,\n });\n this.emitter.fire({\n type: NodeIntoContainerType.Out,\n node,\n sourceContainer: parentNode,\n targetContainer: containerNode,\n });\n }\n\n /** 能否将节点移出容器 */\n public canMoveOutContainer(node: WorkflowNodeEntity): boolean {\n const parentNode = node.parent;\n const containerNode = parentNode?.parent;\n if (!parentNode || !containerNode || !ContainerUtils.isContainer(parentNode)) {\n return false;\n }\n const canDrop = this.dragService.canDropToNode({\n dragNodeType: node.flowNodeType,\n dragNode: node,\n dropNodeType: containerNode?.flowNodeType,\n dropNode: containerNode,\n });\n if (!canDrop.allowDrop) {\n return false;\n }\n return true;\n }\n\n /** 移除节点所有非法连线 */\n public async clearInvalidLines(params: {\n dragNode?: WorkflowNodeEntity;\n sourceParent?: WorkflowNodeEntity;\n }): Promise<void> {\n const { dragNode, sourceParent } = params;\n if (!dragNode) {\n return;\n }\n if (dragNode.parent === sourceParent) {\n // 容器节点未改变\n return;\n }\n if (\n dragNode.parent?.flowNodeType === FlowNodeBaseType.GROUP ||\n sourceParent?.flowNodeType === FlowNodeBaseType.GROUP\n ) {\n // 移入移出 group 节点无需删除节点\n return;\n }\n await this.removeNodeLines(dragNode);\n }\n\n /** 移除节点连线 */\n public async removeNodeLines(node: WorkflowNodeEntity): Promise<void> {\n const lines = this.linesManager.getAllLines();\n lines.forEach((line) => {\n if (line.from?.id !== node.id && line.to?.id !== node.id) {\n return;\n }\n line.dispose();\n });\n await ContainerUtils.nextFrame();\n }\n\n /** 初始化状态 */\n private initState(): void {\n this.state = {\n isDraggingNode: false,\n isSkipEvent: false,\n transforms: undefined,\n dragNode: undefined,\n dropNode: undefined,\n sourceParent: undefined,\n };\n }\n\n /** 监听节点拖拽 */\n private listenDragToContainer(): Disposable {\n const draggingNode = (e: NodesDragEvent) => this.draggingNode(e);\n const throttledDraggingNode = throttle(draggingNode, 200); // 200ms触发一次计算\n return this.dragService.onNodesDrag(async (event) => {\n if (this.selectService.selectedNodes.length !== 1) {\n return;\n }\n if (event.type === 'onDragStart') {\n if (this.state.isSkipEvent) {\n // 拖出容器后重新进入\n this.state.isSkipEvent = false;\n return;\n }\n this.historyService.startTransaction(); // 开始合并历史记录\n this.state.isDraggingNode = true;\n this.state.transforms = ContainerUtils.getContainerTransforms(this.document.getAllNodes());\n this.state.dragNode = this.selectService.selectedNodes[0];\n this.state.dropNode = undefined;\n this.state.sourceParent = this.state.dragNode?.parent;\n await this.dragOutContainer(event); // 检查是否需拖出容器\n }\n if (event.type === 'onDragging') {\n throttledDraggingNode(event);\n }\n if (event.type === 'onDragEnd') {\n if (this.state.isSkipEvent) {\n // 拖出容器情况下需跳过本次事件\n return;\n }\n throttledDraggingNode.cancel();\n draggingNode(event); // 直接触发一次计算,防止延迟\n await this.dropNodeToContainer(); // 放置节点\n await this.clearInvalidLines({\n dragNode: this.state.dragNode,\n sourceParent: this.state.sourceParent,\n }); // 清除非法线条\n this.setDropNode(undefined);\n this.initState(); // 重置状态\n this.historyService.endTransaction(); // 结束合并历史记录\n }\n });\n }\n\n /** 监听节点拖拽出容器 */\n private async dragOutContainer(event: NodesDragEvent): Promise<void> {\n const { dragNode } = this.state;\n const activated = event.triggerEvent.metaKey || event.triggerEvent.ctrlKey;\n if (\n !activated || // 必须按住指定按键\n !dragNode || // 必须有一个节点\n !this.canMoveOutContainer(dragNode) // 需要能被移出容器\n ) {\n return;\n }\n this.moveOutContainer({ node: dragNode });\n this.state.isSkipEvent = true;\n event.dragger.stop(event.dragEvent.clientX, event.dragEvent.clientY);\n await ContainerUtils.nextFrame();\n this.dragService.startDragSelectedNodes(event.triggerEvent);\n }\n\n /** 设置放置节点高亮 */\n private setDropNode(dropNode?: WorkflowNodeEntity) {\n if (this.state.dropNode === dropNode) {\n return;\n }\n if (this.state.dropNode) {\n // 清除上一个节点高亮\n const renderData = this.state.dropNode.getData(FlowNodeRenderData);\n const renderDom = renderData.node?.children?.[0] as HTMLElement;\n if (renderDom) {\n renderDom.classList.remove('selected');\n }\n }\n this.state.dropNode = dropNode;\n if (!dropNode) {\n return;\n }\n // 设置当前节点高亮\n const renderData = dropNode.getData(FlowNodeRenderData);\n const renderDom = renderData.node?.children?.[0] as HTMLElement;\n if (renderDom) {\n renderDom.classList.add('selected');\n }\n }\n\n /** 放置节点到容器 */\n private async dropNodeToContainer(): Promise<void> {\n const { dropNode, dragNode, isDraggingNode } = this.state;\n if (!isDraggingNode || !dragNode || !dropNode) {\n return;\n }\n return await this.moveIntoContainer({\n node: dragNode,\n containerNode: dropNode,\n });\n }\n\n /** 拖拽节点 */\n private draggingNode(nodeDragEvent: NodesDragEvent): void {\n const { dragNode, isDraggingNode, transforms = [] } = this.state;\n if (!isDraggingNode || !dragNode || !transforms?.length) {\n return this.setDropNode(undefined);\n }\n const mousePos = this.playgroundConfig.getPosFromMouseEvent(nodeDragEvent.dragEvent);\n const availableTransforms = transforms.filter(\n (transform) => transform.entity.id !== dragNode.id\n );\n const collisionTransform = ContainerUtils.getCollisionTransform({\n targetPoint: mousePos,\n transforms: availableTransforms,\n document: this.document,\n });\n const dropNode = collisionTransform?.entity;\n const canDrop = this.canDropToContainer({\n dragNode,\n dropNode,\n });\n if (!canDrop) {\n return this.setDropNode(undefined);\n }\n return this.setDropNode(dropNode);\n }\n\n /** 判断能否将节点拖入容器 */\n protected canDropToContainer(params: {\n dragNode: WorkflowNodeEntity;\n dropNode?: WorkflowNodeEntity;\n }): boolean {\n const { dragNode, dropNode } = params;\n const isDropContainer = dropNode?.getNodeMeta<WorkflowNodeMeta>().isContainer;\n if (!dropNode || !isDropContainer || this.isParent(dragNode, dropNode)) {\n return false;\n }\n if (\n dragNode.flowNodeType === FlowNodeBaseType.GROUP &&\n dropNode.flowNodeType !== FlowNodeBaseType.GROUP\n ) {\n // 禁止将 group 节点拖入非 group 节点(由于目前不支持多节点拖入容器,无法计算有效线条,因此进行屏蔽)\n return false;\n }\n const canDrop = this.dragService.canDropToNode({\n dragNodeType: dragNode.flowNodeType,\n dropNodeType: dropNode?.flowNodeType,\n dragNode,\n dropNode,\n });\n if (!canDrop.allowDrop) {\n return false;\n }\n return true;\n }\n\n /** 判断一个节点是否为另一个节点的父节点(向上查找直到根节点) */\n private isParent(node: WorkflowNodeEntity, parent: WorkflowNodeEntity): boolean {\n let current = node.parent;\n while (current) {\n if (current.id === parent.id) {\n return true;\n }\n current = current.parent;\n }\n return false;\n }\n\n /** 将节点移入容器 */\n private async moveIntoContainer(params: {\n node: WorkflowNodeEntity;\n containerNode: WorkflowNodeEntity;\n }): Promise<void> {\n const { node, containerNode } = params;\n const parentNode = node.parent;\n\n this.operationService.moveNode(node, {\n parent: containerNode,\n });\n\n const containerPadding = this.document.layout.getPadding(containerNode);\n const position = ContainerUtils.adjustSubNodePosition({\n targetNode: node,\n containerNode,\n containerPadding,\n });\n\n this.operationService.updateNodePosition(node, position);\n\n await ContainerUtils.nextFrame();\n\n this.emitter.fire({\n type: NodeIntoContainerType.In,\n node,\n sourceContainer: parentNode,\n targetContainer: containerNode,\n });\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const nextFrame = async (): Promise<void> => {\n await new Promise((resolve) => requestAnimationFrame(resolve));\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowNodeEntity, WorkflowNodeMeta } from '@flowgram.ai/free-layout-core';\n\nexport const isContainer = (node?: WorkflowNodeEntity): boolean =>\n node?.getNodeMeta<WorkflowNodeMeta>().isContainer ?? false;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowNodeEntity } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nimport { isContainer } from './is-container';\n\n/** 获取容器节点transforms */\nexport const getContainerTransforms = (allNodes: WorkflowNodeEntity[]): FlowNodeTransformData[] =>\n allNodes\n .filter((node) => {\n if (node.originParent) {\n return node.getNodeMeta().selectable && node.originParent.getNodeMeta().selectable;\n }\n return node.getNodeMeta().selectable;\n })\n .filter((node) => isContainer(node))\n .sort((a, b) => {\n const aIndex = a.renderData.stackIndex;\n const bIndex = b.renderData.stackIndex;\n // 确保层级高的节点在前面\n return bIndex - aIndex;\n })\n .map((node) => node.transform);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PositionSchema, Rectangle } from '@flowgram.ai/utils';\nimport { WorkflowDocument } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nimport { isRectIntersects } from './is-rect-intersects';\nimport { isPointInRect } from './is-point-in-rect';\n\n/** 获取重叠位置 */\nexport const getCollisionTransform = (params: {\n transforms: FlowNodeTransformData[];\n targetRect?: Rectangle;\n targetPoint?: PositionSchema;\n withPadding?: boolean;\n document: WorkflowDocument;\n}): FlowNodeTransformData | undefined => {\n const { targetRect, targetPoint, transforms, withPadding = false, document } = params;\n const collisionTransform = transforms.find((transform) => {\n const { bounds, entity } = transform;\n const padding = withPadding ? document.layout.getPadding(entity) : { left: 0, right: 0 };\n const transformRect = new Rectangle(\n bounds.x + padding.left + padding.right,\n bounds.y,\n bounds.width,\n bounds.height\n );\n // 检测两个正方形是否相互碰撞\n if (targetRect) {\n return isRectIntersects(targetRect, transformRect);\n }\n if (targetPoint) {\n return isPointInRect(targetPoint, transformRect);\n }\n return false;\n });\n return collisionTransform;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Rectangle } from '@flowgram.ai/utils';\n\nexport const isRectIntersects = (rectA: Rectangle, rectB: Rectangle): boolean => {\n // 检查水平方向是否有重叠\n const hasHorizontalOverlap = rectA.right > rectB.left && rectA.left < rectB.right;\n // 检查垂直方向是否有重叠\n const hasVerticalOverlap = rectA.bottom > rectB.top && rectA.top < rectB.bottom;\n // 只有当水平和垂直方向都有重叠时,两个矩形才相交\n return hasHorizontalOverlap && hasVerticalOverlap;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PositionSchema, Rectangle } from '@flowgram.ai/utils';\n\nexport const isPointInRect = (point: PositionSchema, rect: Rectangle): boolean =>\n point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IPoint, PaddingSchema } from '@flowgram.ai/utils';\nimport { WorkflowNodeEntity } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeBaseType } from '@flowgram.ai/document';\n\n/**\n * 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标\n */\nexport const adjustSubNodePosition = (params: {\n targetNode: WorkflowNodeEntity;\n containerNode: WorkflowNodeEntity;\n containerPadding: PaddingSchema;\n}): IPoint => {\n const { targetNode, containerNode, containerPadding } = params;\n if (containerNode.flowNodeType === FlowNodeBaseType.ROOT) {\n return targetNode.transform.position;\n }\n const nodeWorldTransform = targetNode.transform.transform.worldTransform;\n const containerWorldTransform = containerNode.transform.transform.worldTransform;\n const nodePosition = {\n x: nodeWorldTransform.tx,\n y: nodeWorldTransform.ty,\n };\n const isParentEmpty = !containerNode.children || containerNode.children.length === 0;\n if (isParentEmpty) {\n // 确保空容器节点不偏移\n return {\n x: 0,\n y: containerPadding.top,\n };\n } else {\n return {\n x: nodePosition.x - containerWorldTransform.tx,\n y: nodePosition.y - containerWorldTransform.ty,\n };\n }\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { nextFrame } from './next-frame';\nimport { isContainer } from './is-container';\nimport { getContainerTransforms } from './get-container-transforms';\nimport { getCollisionTransform } from './get-collision-transform';\nimport { adjustSubNodePosition } from './adjust-sub-node-position';\n\nexport const ContainerUtils = {\n nextFrame,\n isContainer,\n adjustSubNodePosition,\n getContainerTransforms,\n getCollisionTransform,\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport type { WorkflowContainerPluginOptions } from './type';\nimport { NodeIntoContainerService } from '.';\n\nexport const createContainerNodePlugin = definePluginCreator<WorkflowContainerPluginOptions>({\n onBind: ({ bind }) => {\n bind(NodeIntoContainerService).toSelf().inSingletonScope();\n },\n onInit(ctx, options) {\n ctx.get(NodeIntoContainerService).init();\n },\n onReady(ctx, options) {\n if (options.disableNodeIntoContainer !== true) {\n ctx.get(NodeIntoContainerService).ready();\n }\n },\n onDispose(ctx) {\n ctx.get(NodeIntoContainerService).dispose();\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useState, useEffect } from 'react';\n\nimport {\n useCurrentEntity,\n WorkflowNodeMeta,\n WorkflowNodePortsData,\n} from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nexport interface NodeSize {\n width: number;\n height: number;\n}\n\nexport const useNodeSize = (): NodeSize | undefined => {\n const node = useCurrentEntity();\n const nodeMeta = node.getNodeMeta<WorkflowNodeMeta>();\n const { size = { width: 300, height: 200 }, isContainer } = nodeMeta;\n\n const transform = node.getData<FlowNodeTransformData>(FlowNodeTransformData);\n const [width, setWidth] = useState(size.width);\n const [height, setHeight] = useState(size.height);\n\n const updatePorts = () => {\n const portsData = node.getData<WorkflowNodePortsData>(WorkflowNodePortsData);\n portsData.updateDynamicPorts();\n };\n\n const updateSize = () => {\n // 无子节点时\n if (node.blocks.length === 0) {\n setWidth(size.width);\n setHeight(size.height);\n return;\n }\n // 存在子节点时,只监听宽高变化\n setWidth(transform.bounds.width);\n setHeight(transform.bounds.height);\n };\n\n useEffect(() => {\n const dispose = transform.onDataChange(() => {\n updateSize();\n updatePorts();\n });\n return () => dispose.dispose();\n }, [transform, width, height]);\n\n useEffect(() => {\n // 初始化触发一次\n updateSize();\n }, []);\n\n if (!isContainer) {\n return;\n }\n\n return {\n width,\n height,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useLayoutEffect } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\n\nimport { NodeSize } from './use-node-size';\n\nexport const useSyncNodeRenderSize = (nodeSize?: NodeSize) => {\n const node = useCurrentEntity();\n\n useLayoutEffect(() => {\n if (!nodeSize) {\n return;\n }\n node.renderData.node.style.width = nodeSize.width + 'px';\n node.renderData.node.style.height = nodeSize.height + 'px';\n }, [nodeSize?.width, nodeSize?.height]);\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { type FC } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\nimport { useService } from '@flowgram.ai/core';\nimport { BackgroundConfig, BackgroundLayerOptions } from '@flowgram.ai/background-plugin';\n\nimport { SubCanvasBackgroundStyle } from './style';\n\nexport const SubCanvasBackground: FC = () => {\n const node = useCurrentEntity();\n\n // 通过 inversify 获取背景配置,如果没有配置则使用默认值\n let backgroundConfig: BackgroundLayerOptions = {};\n try {\n backgroundConfig = useService<BackgroundLayerOptions>(BackgroundConfig);\n } catch (error) {\n // 如果 BackgroundConfig 没有注册,使用默认配置\n // 静默处理,使用默认配置\n }\n\n // 获取配置值,如果没有则使用默认值\n const gridSize = backgroundConfig.gridSize ?? 20;\n const dotSize = backgroundConfig.dotSize ?? 1;\n const dotColor = backgroundConfig.dotColor ?? '#eceeef';\n const dotOpacity = backgroundConfig.dotOpacity ?? 0.5;\n const backgroundColor = backgroundConfig.backgroundColor ?? '#f2f3f5';\n // 只有当 dotFillColor 被明确设置且与 dotColor 不同时才添加 fill 属性\n const dotFillColor =\n backgroundConfig.dotFillColor === dotColor ? '' : backgroundConfig.dotFillColor;\n\n // 生成唯一的 pattern ID\n const patternId = `sub-canvas-dot-pattern-${node.id}`;\n\n return (\n <SubCanvasBackgroundStyle\n className=\"sub-canvas-background\"\n data-flow-editor-selectable=\"true\"\n style={{ backgroundColor: backgroundColor }}\n >\n <svg width=\"100%\" height=\"100%\">\n <pattern id={patternId} width={gridSize} height={gridSize} patternUnits=\"userSpaceOnUse\">\n <circle\n cx={dotSize}\n cy={dotSize}\n r={dotSize}\n stroke={dotColor}\n fill={dotFillColor}\n fillOpacity={dotOpacity}\n />\n </pattern>\n <rect\n width=\"100%\"\n height=\"100%\"\n fill={`url(#${patternId})`}\n data-node-panel-container={node.id}\n />\n </svg>\n </SubCanvasBackgroundStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasBackgroundStyle = styled.div`\n width: 100%;\n height: 100%;\n inset: 56px 18px 18px;\n /* 背景色现在通过 style 属性动态设置 */\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { CSSProperties, ReactNode, type FC } from 'react';\n\nimport { SubCanvasBorderStyle } from './style';\n\ninterface ISubCanvasBorder {\n style?: CSSProperties;\n children?: ReactNode | ReactNode[];\n}\n\nexport const SubCanvasBorder: FC<ISubCanvasBorder> = ({ style, children }) => (\n <SubCanvasBorderStyle\n className=\"sub-canvas-border\"\n style={{\n ...style,\n }}\n >\n {children}\n </SubCanvasBorderStyle>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasBorderStyle = styled.div`\n pointer-events: none;\n\n position: relative;\n\n display: flex;\n align-items: center;\n\n width: 100%;\n height: 100%;\n\n background-color: transparent;\n border: 1px solid var(--coz-stroke-plus, rgba(6, 7, 9, 15%));\n border-color: var(--coz-bg-plus, rgb(249, 249, 249));\n border-style: solid;\n border-width: 8px;\n border-radius: 8px;\n\n &::before {\n content: '';\n\n position: absolute;\n z-index: 0;\n inset: -4px;\n\n background-color: transparent;\n border-color: var(--coz-bg-plus, rgb(249, 249, 249));\n border-style: solid;\n border-width: 4px;\n border-radius: 8px;\n }\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { CSSProperties, type FC } from 'react';\n\nimport { SubCanvasRenderStyle } from './style';\nimport { SubCanvasTips } from '../tips';\nimport { SubCanvasBorder } from '../border';\nimport { SubCanvasBackground } from '../background';\nimport { useNodeSize, useSyncNodeRenderSize } from '../../hooks';\n\ninterface ISubCanvasRender {\n offsetY?: number;\n className?: string;\n style?: CSSProperties;\n tipText?: string | React.ReactNode;\n}\n\nexport const SubCanvasRender: FC<ISubCanvasRender> = ({\n className,\n style,\n offsetY = 0,\n tipText,\n}) => {\n const nodeSize = useNodeSize();\n const nodeHeight = nodeSize?.height ?? 0;\n\n useSyncNodeRenderSize(nodeSize);\n\n return (\n <SubCanvasRenderStyle\n className={`sub-canvas-render ${className ?? ''}`}\n style={{\n height: nodeHeight + offsetY,\n ...style,\n }}\n data-flow-editor-selectable=\"true\"\n onDragStart={(e) => {\n e.stopPropagation();\n }}\n >\n <SubCanvasBorder>\n <SubCanvasBackground />\n <SubCanvasTips tipText={tipText} />\n </SubCanvasBorder>\n </SubCanvasRenderStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasRenderStyle = styled.div`\n width: 100%;\n height: 100%;\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React from 'react';\n\nimport { I18n } from '@flowgram.ai/i18n';\n\nimport { useControlTips } from './use-control';\nimport { SubCanvasTipsStyle } from './style';\nimport { isMacOS } from './is-mac-os';\nimport { IconClose } from './icon-close';\n\ninterface SubCanvasTipsProps {\n tipText?: string | React.ReactNode;\n neverRemindText?: string | React.ReactNode;\n}\n\nexport const SubCanvasTips = ({ tipText, neverRemindText }: SubCanvasTipsProps) => {\n const { visible, close, closeForever } = useControlTips();\n\n const displayContent =\n tipText || I18n.t('Hold {{key}} to drag node out', { key: isMacOS ? 'Cmd ⌘' : 'Ctrl' });\n\n if (!visible) {\n return null;\n }\n return (\n <SubCanvasTipsStyle className={'sub-canvas-tips'}>\n <div className=\"container\">\n <div className=\"content\">\n {typeof displayContent === 'string' ? (\n <p className=\"text\">{displayContent}</p>\n ) : (\n <div className=\"custom-content\">{displayContent}</div>\n )}\n <div\n className=\"space\"\n style={{\n width: 0,\n }}\n />\n </div>\n <div className=\"actions\">\n <p className=\"close-forever\" onClick={closeForever}>\n {neverRemindText || I18n.t('Never Remind')}\n </p>\n <div className=\"close\" onClick={close}>\n <IconClose />\n </div>\n </div>\n </div>\n </SubCanvasTipsStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\nimport { useService } from '@flowgram.ai/core';\n\nimport { NodeIntoContainerService, NodeIntoContainerType } from '../../../node-into-container';\nimport { TipsGlobalStore } from './global-store';\n\nexport const useControlTips = () => {\n const node = useCurrentEntity();\n const [visible, setVisible] = useState(false);\n const globalStore = TipsGlobalStore.instance;\n\n const nodeIntoContainerService = useService<NodeIntoContainerService>(NodeIntoContainerService);\n\n const show = useCallback(() => {\n if (globalStore.isClosed()) {\n return;\n }\n\n setVisible(true);\n }, [globalStore]);\n\n const close = useCallback(() => {\n globalStore.close();\n setVisible(false);\n }, [globalStore]);\n\n const closeForever = useCallback(() => {\n globalStore.closeForever();\n close();\n }, [close, globalStore]);\n\n useEffect(() => {\n // 监听移入\n const inDisposer = nodeIntoContainerService.on((e) => {\n if (e.type !== NodeIntoContainerType.In) {\n return;\n }\n if (e.targetContainer === node) {\n show();\n }\n });\n // 监听移出事件\n const outDisposer = nodeIntoContainerService.on((e) => {\n if (e.type !== NodeIntoContainerType.Out) {\n return;\n }\n if (e.sourceContainer === node && !node.blocks.length) {\n setVisible(false);\n }\n });\n return () => {\n inDisposer.dispose();\n outDisposer.dispose();\n };\n }, [nodeIntoContainerService, node, show, close, visible]);\n\n return {\n visible,\n close,\n closeForever,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/naming-convention -- no need */\n\nconst STORAGE_KEY = 'workflow-move-into-sub-canvas-tip-visible';\nconst STORAGE_VALUE = 'false';\n\nexport class TipsGlobalStore {\n private static _instance?: TipsGlobalStore;\n\n public static get instance(): TipsGlobalStore {\n if (!this._instance) {\n this._instance = new TipsGlobalStore();\n }\n return this._instance;\n }\n\n private closed = false;\n\n public isClosed(): boolean {\n return this.isCloseForever() || this.closed;\n }\n\n public close(): void {\n this.closed = true;\n }\n\n public isCloseForever(): boolean {\n return localStorage.getItem(STORAGE_KEY) === STORAGE_VALUE;\n }\n\n public closeForever(): void {\n localStorage.setItem(STORAGE_KEY, STORAGE_VALUE);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasTipsStyle = styled.div`\n pointer-events: auto;\n position: absolute;\n top: 0;\n\n width: 100%;\n height: 28px;\n\n .container {\n height: 100%;\n background-color: #e4e6f5;\n border-radius: 4px 4px 0 0;\n\n .content {\n overflow: hidden;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n width: 100%;\n height: 100%;\n\n .text {\n font-size: 14px;\n font-weight: 400;\n font-style: normal;\n line-height: 20px;\n color: rgba(15, 21, 40, 82%);\n text-overflow: ellipsis;\n }\n\n .custom-content {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n\n /* 为自定义内容提供默认样式,但允许覆盖 */\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n color: rgba(15, 21, 40, 82%);\n\n /* 确保自定义内容不会超出容器 */\n overflow: hidden;\n }\n\n .space {\n width: 128px;\n }\n }\n\n .actions {\n position: absolute;\n top: 0;\n right: 0;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n height: 28px;\n padding: 0 16px;\n\n .close-forever {\n cursor: pointer;\n\n padding: 0 3px;\n\n font-size: 12px;\n font-weight: 400;\n font-style: normal;\n line-height: 12px;\n color: rgba(32, 41, 69, 62%);\n }\n\n .close {\n display: flex;\n cursor: pointer;\n height: 100%;\n align-items: center;\n }\n }\n }\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const isMacOS = /(Macintosh|MacIntel|MacPPC|Mac68K|iPad)/.test(navigator.userAgent);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React from 'react';\n\nexport const IconClose = () => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0 0 16 16\">\n <path\n fill=\"#060709\"\n fillOpacity=\"0.5\"\n d=\"M12.13 12.128a.5.5 0 0 0 .001-.706L8.71 8l3.422-3.423a.5.5 0 0 0-.001-.705.5.5 0 0 0-.706-.002L8.002 7.293 4.579 3.87a.5.5 0 0 0-.705.002.5.5 0 0 0-.002.705L7.295 8l-3.423 3.422a.5.5 0 0 0 .002.706c.195.195.51.197.705.001l3.423-3.422 3.422 3.422c.196.196.51.194.706-.001\"\n ></path>\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,QAAK;AACL,EAAAA,uBAAA,SAAM;AAFI,SAAAA;AAAA,GAAA;;;ACCZ,uBAAyB;AACzB,uBAAmC;AACnC,IAAAC,gBAA+D;AAC/D,8BASO;AACP,iCAA+B;AAC/B,IAAAC,mBAAqD;AACrD,kBAAsD;;;AChB/C,IAAM,YAAY,YAA2B;AAClD,QAAM,IAAI,QAAQ,CAAC,YAAY,sBAAsB,OAAO,CAAC;AAC/D;;;ACAO,IAA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AC5B,aAAa,CAAC,MAAM;AAClB,UAAE,gBAAgB;AAAA,MACpB;AAAA;AAAA,IAEA,8BAAAA,QAAA,cAAC,uBACC,8BAAAA,QAAA,cAAC,yBAAoB,GACrB,8BAAAA,QAAA,cAAC,iBAAc,SAAkB,CACnC;AAAA,EACF;AAEJ;","names":["NodeIntoContainerType","import_utils","import_document","renderData","renderDom","import_core","import_free_layout_core","import_document","isContainer","import_react","import_free_layout_core","import_react","import_free_layout_core","import_core","styled","React","import_react","import_styled_components","styled","React","import_react","import_styled_components","styled","import_react","import_react","import_free_layout_core","import_core","import_styled_components","styled","import_react","React","React","React"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/node-into-container/constant.ts","../src/node-into-container/service.ts","../src/utils/next-frame.ts","../src/utils/is-container.ts","../src/utils/get-container-transforms.ts","../src/utils/get-collision-transform.ts","../src/utils/is-rect-intersects.ts","../src/utils/is-point-in-rect.ts","../src/utils/adjust-sub-node-position.ts","../src/utils/index.ts","../src/node-into-container/plugin.tsx","../src/sub-canvas/hooks/use-node-size.ts","../src/sub-canvas/hooks/use-sync-node-render-size.ts","../src/sub-canvas/components/background/index.tsx","../src/sub-canvas/components/background/style.ts","../src/sub-canvas/components/border/index.tsx","../src/sub-canvas/components/border/style.ts","../src/sub-canvas/components/render/index.tsx","../src/sub-canvas/components/render/style.ts","../src/sub-canvas/components/tips/index.tsx","../src/sub-canvas/components/tips/use-control.ts","../src/sub-canvas/components/tips/global-store.ts","../src/sub-canvas/components/tips/style.ts","../src/sub-canvas/components/tips/is-mac-os.ts","../src/sub-canvas/components/tips/icon-close.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport * from './node-into-container';\nexport * from './sub-canvas';\nexport { ContainerUtils } from './utils';\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport enum NodeIntoContainerType {\n In = 'in',\n Out = 'out',\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/no-non-null-assertion -- no need */\nimport { throttle } from 'lodash-es';\nimport { inject, injectable } from 'inversify';\nimport { type Disposable, DisposableCollection, Emitter } from '@flowgram.ai/utils';\nimport {\n type NodesDragEvent,\n WorkflowDocument,\n WorkflowDragService,\n WorkflowLinesManager,\n type WorkflowNodeEntity,\n WorkflowNodeMeta,\n WorkflowOperationBaseService,\n WorkflowSelectService,\n} from '@flowgram.ai/free-layout-core';\nimport { HistoryService } from '@flowgram.ai/free-history-plugin';\nimport { FlowNodeRenderData, FlowNodeBaseType } from '@flowgram.ai/document';\nimport { PlaygroundConfigEntity, TransformData } from '@flowgram.ai/core';\n\nimport type { NodeIntoContainerEvent, NodeIntoContainerState } from './type';\nimport { NodeIntoContainerType } from './constant';\nimport { ContainerUtils } from '../utils';\n\n@injectable()\nexport class NodeIntoContainerService {\n public state: NodeIntoContainerState;\n\n @inject(WorkflowDragService)\n private dragService: WorkflowDragService;\n\n @inject(WorkflowDocument)\n private document: WorkflowDocument;\n\n @inject(PlaygroundConfigEntity)\n private playgroundConfig: PlaygroundConfigEntity;\n\n @inject(WorkflowOperationBaseService)\n private operationService: WorkflowOperationBaseService;\n\n @inject(WorkflowLinesManager)\n private linesManager: WorkflowLinesManager;\n\n @inject(HistoryService) private historyService: HistoryService;\n\n @inject(WorkflowSelectService) private selectService: WorkflowSelectService;\n\n private emitter = new Emitter<NodeIntoContainerEvent>();\n\n private toDispose = new DisposableCollection();\n\n public readonly on = this.emitter.event;\n\n public init(): void {\n this.initState();\n this.toDispose.push(this.emitter);\n }\n\n public ready(): void {\n this.toDispose.push(this.listenDragToContainer());\n }\n\n public dispose(): void {\n this.initState();\n this.toDispose.dispose();\n }\n\n /** 将节点移出容器 */\n public async moveOutContainer(params: { node: WorkflowNodeEntity }): Promise<void> {\n const { node } = params;\n const parentNode = node.parent;\n const containerNode = parentNode?.parent;\n const nodeJSON = this.document.toNodeJSON(node);\n if (\n !parentNode ||\n !containerNode ||\n !ContainerUtils.isContainer(parentNode) ||\n !nodeJSON.meta?.position\n ) {\n return;\n }\n const parentTransform = parentNode.getData<TransformData>(TransformData);\n this.operationService.moveNode(node, {\n parent: containerNode,\n });\n await ContainerUtils.nextFrame();\n parentTransform.fireChange();\n this.operationService.updateNodePosition(node, {\n x: parentTransform.position.x + nodeJSON.meta!.position!.x,\n y: parentTransform.position.y + nodeJSON.meta!.position!.y,\n });\n this.emitter.fire({\n type: NodeIntoContainerType.Out,\n node,\n sourceContainer: parentNode,\n targetContainer: containerNode,\n });\n }\n\n /** 能否将节点移出容器 */\n public canMoveOutContainer(node: WorkflowNodeEntity): boolean {\n const parentNode = node.parent;\n const containerNode = parentNode?.parent;\n if (!parentNode || !containerNode || !ContainerUtils.isContainer(parentNode)) {\n return false;\n }\n const canDrop = this.dragService.canDropToNode({\n dragNodeType: node.flowNodeType,\n dragNode: node,\n dropNodeType: containerNode?.flowNodeType,\n dropNode: containerNode,\n });\n if (!canDrop.allowDrop) {\n return false;\n }\n return true;\n }\n\n /** 移除节点所有非法连线 */\n public async clearInvalidLines(params: {\n dragNode?: WorkflowNodeEntity;\n sourceParent?: WorkflowNodeEntity;\n }): Promise<void> {\n const { dragNode, sourceParent } = params;\n if (!dragNode) {\n return;\n }\n if (dragNode.parent === sourceParent) {\n // 容器节点未改变\n return;\n }\n if (\n dragNode.parent?.flowNodeType === FlowNodeBaseType.GROUP ||\n sourceParent?.flowNodeType === FlowNodeBaseType.GROUP\n ) {\n // 移入移出 group 节点无需删除节点\n return;\n }\n await this.removeNodeLines(dragNode);\n }\n\n /** 移除节点连线 */\n public async removeNodeLines(node: WorkflowNodeEntity): Promise<void> {\n const lines = this.linesManager.getAllLines();\n lines.forEach((line) => {\n if (line.from?.id !== node.id && line.to?.id !== node.id) {\n return;\n }\n line.dispose();\n });\n await ContainerUtils.nextFrame();\n }\n\n /** 初始化状态 */\n private initState(): void {\n this.state = {\n isDraggingNode: false,\n isSkipEvent: false,\n transforms: undefined,\n dragNode: undefined,\n dropNode: undefined,\n sourceParent: undefined,\n };\n }\n\n /** 监听节点拖拽 */\n private listenDragToContainer(): Disposable {\n const draggingNode = (e: NodesDragEvent) => this.draggingNode(e);\n const throttledDraggingNode = throttle(draggingNode, 200); // 200ms触发一次计算\n return this.dragService.onNodesDrag(async (event) => {\n if (this.selectService.selectedNodes.length !== 1) {\n return;\n }\n if (event.type === 'onDragStart') {\n if (this.state.isSkipEvent) {\n // 拖出容器后重新进入\n this.state.isSkipEvent = false;\n return;\n }\n this.historyService.startTransaction(); // 开始合并历史记录\n this.state.isDraggingNode = true;\n this.state.transforms = ContainerUtils.getContainerTransforms(this.document.getAllNodes());\n this.state.dragNode = this.selectService.selectedNodes[0];\n this.state.dropNode = undefined;\n this.state.sourceParent = this.state.dragNode?.parent;\n await this.dragOutContainer(event); // 检查是否需拖出容器\n }\n if (event.type === 'onDragging') {\n throttledDraggingNode(event);\n }\n if (event.type === 'onDragEnd') {\n if (this.state.isSkipEvent) {\n // 拖出容器情况下需跳过本次事件\n return;\n }\n throttledDraggingNode.cancel();\n draggingNode(event); // 直接触发一次计算,防止延迟\n await this.dropNodeToContainer(); // 放置节点\n await this.clearInvalidLines({\n dragNode: this.state.dragNode,\n sourceParent: this.state.sourceParent,\n }); // 清除非法线条\n this.setDropNode(undefined);\n this.initState(); // 重置状态\n this.historyService.endTransaction(); // 结束合并历史记录\n }\n });\n }\n\n /** 监听节点拖拽出容器 */\n private async dragOutContainer(event: NodesDragEvent): Promise<void> {\n const { dragNode } = this.state;\n const activated = event.triggerEvent.metaKey || event.triggerEvent.ctrlKey;\n if (\n !activated || // 必须按住指定按键\n !dragNode || // 必须有一个节点\n !this.canMoveOutContainer(dragNode) // 需要能被移出容器\n ) {\n return;\n }\n this.moveOutContainer({ node: dragNode });\n this.state.isSkipEvent = true;\n event.dragger.stop(event.dragEvent.clientX, event.dragEvent.clientY);\n await ContainerUtils.nextFrame();\n this.dragService.startDragSelectedNodes(event.triggerEvent);\n }\n\n /** 设置放置节点高亮 */\n private setDropNode(dropNode?: WorkflowNodeEntity) {\n if (this.state.dropNode === dropNode) {\n return;\n }\n if (this.state.dropNode) {\n // 清除上一个节点高亮\n const renderData = this.state.dropNode.getData(FlowNodeRenderData);\n const renderDom = renderData.node?.children?.[0] as HTMLElement;\n if (renderDom) {\n renderDom.classList.remove('selected');\n }\n }\n this.state.dropNode = dropNode;\n if (!dropNode) {\n return;\n }\n // 设置当前节点高亮\n const renderData = dropNode.getData(FlowNodeRenderData);\n const renderDom = renderData.node?.children?.[0] as HTMLElement;\n if (renderDom) {\n renderDom.classList.add('selected');\n }\n }\n\n /** 放置节点到容器 */\n private async dropNodeToContainer(): Promise<void> {\n const { dropNode, dragNode, isDraggingNode } = this.state;\n if (!isDraggingNode || !dragNode || !dropNode) {\n return;\n }\n return await this.moveIntoContainer({\n node: dragNode,\n containerNode: dropNode,\n });\n }\n\n /** 拖拽节点 */\n private draggingNode(nodeDragEvent: NodesDragEvent): void {\n const { dragNode, isDraggingNode, transforms = [] } = this.state;\n if (!isDraggingNode || !dragNode || !transforms?.length) {\n return this.setDropNode(undefined);\n }\n const mousePos = this.playgroundConfig.getPosFromMouseEvent(nodeDragEvent.dragEvent);\n const availableTransforms = transforms.filter(\n (transform) => transform.entity.id !== dragNode.id\n );\n const collisionTransform = ContainerUtils.getCollisionTransform({\n targetPoint: mousePos,\n transforms: availableTransforms,\n document: this.document,\n });\n const dropNode = collisionTransform?.entity;\n const canDrop = this.canDropToContainer({\n dragNode,\n dropNode,\n });\n if (!canDrop) {\n return this.setDropNode(undefined);\n }\n return this.setDropNode(dropNode);\n }\n\n /** 判断能否将节点拖入容器 */\n protected canDropToContainer(params: {\n dragNode: WorkflowNodeEntity;\n dropNode?: WorkflowNodeEntity;\n }): boolean {\n const { dragNode, dropNode } = params;\n const isDropContainer = dropNode?.getNodeMeta<WorkflowNodeMeta>().isContainer;\n if (\n !dropNode ||\n !isDropContainer ||\n this.isParent(dragNode, dropNode) ||\n this.isParent(dropNode, dragNode)\n ) {\n return false;\n }\n if (\n dragNode.flowNodeType === FlowNodeBaseType.GROUP &&\n dropNode.flowNodeType !== FlowNodeBaseType.GROUP\n ) {\n // 禁止将 group 节点拖入非 group 节点(由于目前不支持多节点拖入容器,无法计算有效线条,因此进行屏蔽)\n return false;\n }\n const canDrop = this.dragService.canDropToNode({\n dragNodeType: dragNode.flowNodeType,\n dropNodeType: dropNode?.flowNodeType,\n dragNode,\n dropNode,\n });\n if (!canDrop.allowDrop) {\n return false;\n }\n return true;\n }\n\n /** 判断一个节点是否为另一个节点的父节点(向上查找直到根节点) */\n private isParent(node: WorkflowNodeEntity, parent: WorkflowNodeEntity): boolean {\n let current = node.parent;\n while (current) {\n if (current.id === parent.id) {\n return true;\n }\n current = current.parent;\n }\n return false;\n }\n\n /** 将节点移入容器 */\n private async moveIntoContainer(params: {\n node: WorkflowNodeEntity;\n containerNode: WorkflowNodeEntity;\n }): Promise<void> {\n const { node, containerNode } = params;\n const parentNode = node.parent;\n\n this.operationService.moveNode(node, {\n parent: containerNode,\n });\n\n const containerPadding = this.document.layout.getPadding(containerNode);\n const position = ContainerUtils.adjustSubNodePosition({\n targetNode: node,\n containerNode,\n containerPadding,\n });\n\n this.operationService.updateNodePosition(node, position);\n\n await ContainerUtils.nextFrame();\n\n this.emitter.fire({\n type: NodeIntoContainerType.In,\n node,\n sourceContainer: parentNode,\n targetContainer: containerNode,\n });\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const nextFrame = async (): Promise<void> => {\n await new Promise((resolve) => requestAnimationFrame(resolve));\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowNodeEntity, WorkflowNodeMeta } from '@flowgram.ai/free-layout-core';\n\nexport const isContainer = (node?: WorkflowNodeEntity): boolean =>\n node?.getNodeMeta<WorkflowNodeMeta>().isContainer ?? false;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { WorkflowNodeEntity } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nimport { isContainer } from './is-container';\n\n/** 获取容器节点transforms */\nexport const getContainerTransforms = (allNodes: WorkflowNodeEntity[]): FlowNodeTransformData[] =>\n allNodes\n .filter((node) => {\n if (node.originParent) {\n return node.getNodeMeta().selectable && node.originParent.getNodeMeta().selectable;\n }\n return node.getNodeMeta().selectable;\n })\n .filter((node) => isContainer(node))\n .sort((a, b) => {\n const aIndex = a.renderData.stackIndex;\n const bIndex = b.renderData.stackIndex;\n // 确保层级高的节点在前面\n return bIndex - aIndex;\n })\n .map((node) => node.transform);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PositionSchema, Rectangle } from '@flowgram.ai/utils';\nimport { WorkflowDocument } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nimport { isRectIntersects } from './is-rect-intersects';\nimport { isPointInRect } from './is-point-in-rect';\n\n/** 获取重叠位置 */\nexport const getCollisionTransform = (params: {\n transforms: FlowNodeTransformData[];\n targetRect?: Rectangle;\n targetPoint?: PositionSchema;\n withPadding?: boolean;\n document: WorkflowDocument;\n}): FlowNodeTransformData | undefined => {\n const { targetRect, targetPoint, transforms, withPadding = false, document } = params;\n const collisionTransform = transforms.find((transform) => {\n const { bounds, entity } = transform;\n const padding = withPadding ? document.layout.getPadding(entity) : { left: 0, right: 0 };\n const transformRect = new Rectangle(\n bounds.x + padding.left + padding.right,\n bounds.y,\n bounds.width,\n bounds.height\n );\n // 检测两个正方形是否相互碰撞\n if (targetRect) {\n return isRectIntersects(targetRect, transformRect);\n }\n if (targetPoint) {\n return isPointInRect(targetPoint, transformRect);\n }\n return false;\n });\n return collisionTransform;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { Rectangle } from '@flowgram.ai/utils';\n\nexport const isRectIntersects = (rectA: Rectangle, rectB: Rectangle): boolean => {\n // 检查水平方向是否有重叠\n const hasHorizontalOverlap = rectA.right > rectB.left && rectA.left < rectB.right;\n // 检查垂直方向是否有重叠\n const hasVerticalOverlap = rectA.bottom > rectB.top && rectA.top < rectB.bottom;\n // 只有当水平和垂直方向都有重叠时,两个矩形才相交\n return hasHorizontalOverlap && hasVerticalOverlap;\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { PositionSchema, Rectangle } from '@flowgram.ai/utils';\n\nexport const isPointInRect = (point: PositionSchema, rect: Rectangle): boolean =>\n point.x >= rect.left && point.x <= rect.right && point.y >= rect.top && point.y <= rect.bottom;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { IPoint, PaddingSchema } from '@flowgram.ai/utils';\nimport { WorkflowNodeEntity } from '@flowgram.ai/free-layout-core';\nimport { FlowNodeBaseType } from '@flowgram.ai/document';\n\n/**\n * 如果存在容器节点,且传入鼠标坐标,需要用容器的坐标减去传入的鼠标坐标\n */\nexport const adjustSubNodePosition = (params: {\n targetNode: WorkflowNodeEntity;\n containerNode: WorkflowNodeEntity;\n containerPadding: PaddingSchema;\n}): IPoint => {\n const { targetNode, containerNode, containerPadding } = params;\n if (containerNode.flowNodeType === FlowNodeBaseType.ROOT) {\n return targetNode.transform.position;\n }\n const nodeWorldTransform = targetNode.transform.transform.worldTransform;\n const containerWorldTransform = containerNode.transform.transform.worldTransform;\n const nodePosition = {\n x: nodeWorldTransform.tx,\n y: nodeWorldTransform.ty,\n };\n const isParentEmpty = !containerNode.children || containerNode.children.length === 0;\n if (isParentEmpty) {\n // 确保空容器节点不偏移\n return {\n x: 0,\n y: containerPadding.top,\n };\n } else {\n return {\n x: nodePosition.x - containerWorldTransform.tx,\n y: nodePosition.y - containerWorldTransform.ty,\n };\n }\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { nextFrame } from './next-frame';\nimport { isContainer } from './is-container';\nimport { getContainerTransforms } from './get-container-transforms';\nimport { getCollisionTransform } from './get-collision-transform';\nimport { adjustSubNodePosition } from './adjust-sub-node-position';\n\nexport const ContainerUtils = {\n nextFrame,\n isContainer,\n adjustSubNodePosition,\n getContainerTransforms,\n getCollisionTransform,\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { definePluginCreator } from '@flowgram.ai/core';\n\nimport type { WorkflowContainerPluginOptions } from './type';\nimport { NodeIntoContainerService } from '.';\n\nexport const createContainerNodePlugin = definePluginCreator<WorkflowContainerPluginOptions>({\n onBind: ({ bind }) => {\n bind(NodeIntoContainerService).toSelf().inSingletonScope();\n },\n onInit(ctx, options) {\n ctx.get(NodeIntoContainerService).init();\n },\n onReady(ctx, options) {\n if (options.disableNodeIntoContainer !== true) {\n ctx.get(NodeIntoContainerService).ready();\n }\n },\n onDispose(ctx) {\n ctx.get(NodeIntoContainerService).dispose();\n },\n});\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useState, useEffect } from 'react';\n\nimport {\n useCurrentEntity,\n WorkflowNodeMeta,\n WorkflowNodePortsData,\n} from '@flowgram.ai/free-layout-core';\nimport { FlowNodeTransformData } from '@flowgram.ai/document';\n\nexport interface NodeSize {\n width: number;\n height: number;\n}\n\nexport const useNodeSize = (): NodeSize | undefined => {\n const node = useCurrentEntity();\n const nodeMeta = node.getNodeMeta<WorkflowNodeMeta>();\n const { size = { width: 300, height: 200 }, isContainer } = nodeMeta;\n\n const transform = node.getData<FlowNodeTransformData>(FlowNodeTransformData);\n const [width, setWidth] = useState(size.width);\n const [height, setHeight] = useState(size.height);\n\n const updatePorts = () => {\n const portsData = node.getData<WorkflowNodePortsData>(WorkflowNodePortsData);\n portsData.updateDynamicPorts();\n };\n\n const updateSize = () => {\n // 无子节点时\n if (node.blocks.length === 0) {\n setWidth(size.width);\n setHeight(size.height);\n return;\n }\n // 存在子节点时,只监听宽高变化\n setWidth(transform.bounds.width);\n setHeight(transform.bounds.height);\n };\n\n useEffect(() => {\n const dispose = transform.onDataChange(() => {\n updateSize();\n updatePorts();\n });\n return () => dispose.dispose();\n }, [transform, width, height]);\n\n useEffect(() => {\n // 初始化触发一次\n updateSize();\n }, []);\n\n if (!isContainer) {\n return;\n }\n\n return {\n width,\n height,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useLayoutEffect } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\n\nimport { NodeSize } from './use-node-size';\n\nexport const useSyncNodeRenderSize = (nodeSize?: NodeSize) => {\n const node = useCurrentEntity();\n\n useLayoutEffect(() => {\n if (!nodeSize) {\n return;\n }\n node.renderData.node.style.width = nodeSize.width + 'px';\n node.renderData.node.style.height = nodeSize.height + 'px';\n }, [nodeSize?.width, nodeSize?.height]);\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { type FC } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\nimport { useService } from '@flowgram.ai/core';\nimport { BackgroundConfig, BackgroundLayerOptions } from '@flowgram.ai/background-plugin';\n\nimport { SubCanvasBackgroundStyle } from './style';\n\nexport const SubCanvasBackground: FC = () => {\n const node = useCurrentEntity();\n\n // 通过 inversify 获取背景配置,如果没有配置则使用默认值\n let backgroundConfig: BackgroundLayerOptions = {};\n try {\n backgroundConfig = useService<BackgroundLayerOptions>(BackgroundConfig);\n } catch (error) {\n // 如果 BackgroundConfig 没有注册,使用默认配置\n // 静默处理,使用默认配置\n }\n\n // 获取配置值,如果没有则使用默认值\n const gridSize = backgroundConfig.gridSize ?? 20;\n const dotSize = backgroundConfig.dotSize ?? 1;\n const dotColor = backgroundConfig.dotColor ?? '#eceeef';\n const dotOpacity = backgroundConfig.dotOpacity ?? 0.5;\n const backgroundColor = backgroundConfig.backgroundColor ?? '#f2f3f5';\n // 只有当 dotFillColor 被明确设置且与 dotColor 不同时才添加 fill 属性\n const dotFillColor =\n backgroundConfig.dotFillColor === dotColor ? '' : backgroundConfig.dotFillColor;\n\n // 生成唯一的 pattern ID\n const patternId = `sub-canvas-dot-pattern-${node.id}`;\n\n return (\n <SubCanvasBackgroundStyle\n className=\"sub-canvas-background\"\n data-flow-editor-selectable=\"true\"\n style={{ backgroundColor: backgroundColor }}\n >\n <svg width=\"100%\" height=\"100%\">\n <pattern id={patternId} width={gridSize} height={gridSize} patternUnits=\"userSpaceOnUse\">\n <circle\n cx={dotSize}\n cy={dotSize}\n r={dotSize}\n stroke={dotColor}\n fill={dotFillColor}\n fillOpacity={dotOpacity}\n />\n </pattern>\n <rect\n width=\"100%\"\n height=\"100%\"\n fill={`url(#${patternId})`}\n data-node-panel-container={node.id}\n />\n </svg>\n </SubCanvasBackgroundStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasBackgroundStyle = styled.div`\n width: 100%;\n height: 100%;\n inset: 56px 18px 18px;\n /* 背景色现在通过 style 属性动态设置 */\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { CSSProperties, ReactNode, type FC } from 'react';\n\nimport { SubCanvasBorderStyle } from './style';\n\ninterface ISubCanvasBorder {\n style?: CSSProperties;\n children?: ReactNode | ReactNode[];\n}\n\nexport const SubCanvasBorder: FC<ISubCanvasBorder> = ({ style, children }) => (\n <SubCanvasBorderStyle\n className=\"sub-canvas-border\"\n style={{\n ...style,\n }}\n >\n {children}\n </SubCanvasBorderStyle>\n);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasBorderStyle = styled.div`\n pointer-events: none;\n\n position: relative;\n\n display: flex;\n align-items: center;\n\n width: 100%;\n height: 100%;\n\n background-color: transparent;\n border: 1px solid var(--coz-stroke-plus, rgba(6, 7, 9, 15%));\n border-color: var(--coz-bg-plus, rgb(249, 249, 249));\n border-style: solid;\n border-width: 8px;\n border-radius: 8px;\n\n &::before {\n content: '';\n\n position: absolute;\n z-index: 0;\n inset: -4px;\n\n background-color: transparent;\n border-color: var(--coz-bg-plus, rgb(249, 249, 249));\n border-style: solid;\n border-width: 4px;\n border-radius: 8px;\n }\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React, { CSSProperties, type FC } from 'react';\n\nimport { SubCanvasRenderStyle } from './style';\nimport { SubCanvasTips } from '../tips';\nimport { SubCanvasBorder } from '../border';\nimport { SubCanvasBackground } from '../background';\nimport { useNodeSize, useSyncNodeRenderSize } from '../../hooks';\n\ninterface ISubCanvasRender {\n offsetY?: number;\n className?: string;\n style?: CSSProperties;\n tipText?: string | React.ReactNode;\n}\n\nexport const SubCanvasRender: FC<ISubCanvasRender> = ({\n className,\n style,\n offsetY = 0,\n tipText,\n}) => {\n const nodeSize = useNodeSize();\n const nodeHeight = nodeSize?.height ?? 0;\n\n useSyncNodeRenderSize(nodeSize);\n\n return (\n <SubCanvasRenderStyle\n className={`sub-canvas-render ${className ?? ''}`}\n style={{\n height: nodeHeight + offsetY,\n ...style,\n }}\n data-flow-editor-selectable=\"true\"\n onDragStart={(e) => {\n e.stopPropagation();\n }}\n >\n <SubCanvasBorder>\n <SubCanvasBackground />\n <SubCanvasTips tipText={tipText} />\n </SubCanvasBorder>\n </SubCanvasRenderStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasRenderStyle = styled.div`\n width: 100%;\n height: 100%;\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React from 'react';\n\nimport { I18n } from '@flowgram.ai/i18n';\n\nimport { useControlTips } from './use-control';\nimport { SubCanvasTipsStyle } from './style';\nimport { isMacOS } from './is-mac-os';\nimport { IconClose } from './icon-close';\n\ninterface SubCanvasTipsProps {\n tipText?: string | React.ReactNode;\n neverRemindText?: string | React.ReactNode;\n}\n\nexport const SubCanvasTips = ({ tipText, neverRemindText }: SubCanvasTipsProps) => {\n const { visible, close, closeForever } = useControlTips();\n\n const displayContent =\n tipText || I18n.t('Hold {{key}} to drag node out', { key: isMacOS ? 'Cmd ⌘' : 'Ctrl' });\n\n if (!visible) {\n return null;\n }\n return (\n <SubCanvasTipsStyle className={'sub-canvas-tips'}>\n <div className=\"container\">\n <div className=\"content\">\n {typeof displayContent === 'string' ? (\n <p className=\"text\">{displayContent}</p>\n ) : (\n <div className=\"custom-content\">{displayContent}</div>\n )}\n <div\n className=\"space\"\n style={{\n width: 0,\n }}\n />\n </div>\n <div className=\"actions\">\n <p className=\"close-forever\" onClick={closeForever}>\n {neverRemindText || I18n.t('Never Remind')}\n </p>\n <div className=\"close\" onClick={close}>\n <IconClose />\n </div>\n </div>\n </div>\n </SubCanvasTipsStyle>\n );\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { useCurrentEntity } from '@flowgram.ai/free-layout-core';\nimport { useService } from '@flowgram.ai/core';\n\nimport { NodeIntoContainerService, NodeIntoContainerType } from '../../../node-into-container';\nimport { TipsGlobalStore } from './global-store';\n\nexport const useControlTips = () => {\n const node = useCurrentEntity();\n const [visible, setVisible] = useState(false);\n const globalStore = TipsGlobalStore.instance;\n\n const nodeIntoContainerService = useService<NodeIntoContainerService>(NodeIntoContainerService);\n\n const show = useCallback(() => {\n if (globalStore.isClosed()) {\n return;\n }\n\n setVisible(true);\n }, [globalStore]);\n\n const close = useCallback(() => {\n globalStore.close();\n setVisible(false);\n }, [globalStore]);\n\n const closeForever = useCallback(() => {\n globalStore.closeForever();\n close();\n }, [close, globalStore]);\n\n useEffect(() => {\n // 监听移入\n const inDisposer = nodeIntoContainerService.on((e) => {\n if (e.type !== NodeIntoContainerType.In) {\n return;\n }\n if (e.targetContainer === node) {\n show();\n }\n });\n // 监听移出事件\n const outDisposer = nodeIntoContainerService.on((e) => {\n if (e.type !== NodeIntoContainerType.Out) {\n return;\n }\n if (e.sourceContainer === node && !node.blocks.length) {\n setVisible(false);\n }\n });\n return () => {\n inDisposer.dispose();\n outDisposer.dispose();\n };\n }, [nodeIntoContainerService, node, show, close, visible]);\n\n return {\n visible,\n close,\n closeForever,\n };\n};\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\n/* eslint-disable @typescript-eslint/naming-convention -- no need */\n\nconst STORAGE_KEY = 'workflow-move-into-sub-canvas-tip-visible';\nconst STORAGE_VALUE = 'false';\n\nexport class TipsGlobalStore {\n private static _instance?: TipsGlobalStore;\n\n public static get instance(): TipsGlobalStore {\n if (!this._instance) {\n this._instance = new TipsGlobalStore();\n }\n return this._instance;\n }\n\n private closed = false;\n\n public isClosed(): boolean {\n return this.isCloseForever() || this.closed;\n }\n\n public close(): void {\n this.closed = true;\n }\n\n public isCloseForever(): boolean {\n return localStorage.getItem(STORAGE_KEY) === STORAGE_VALUE;\n }\n\n public closeForever(): void {\n localStorage.setItem(STORAGE_KEY, STORAGE_VALUE);\n }\n}\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport styled from 'styled-components';\n\nexport const SubCanvasTipsStyle = styled.div`\n pointer-events: auto;\n position: absolute;\n top: 0;\n\n width: 100%;\n height: 28px;\n\n .container {\n height: 100%;\n background-color: #e4e6f5;\n border-radius: 4px 4px 0 0;\n\n .content {\n overflow: hidden;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n\n width: 100%;\n height: 100%;\n\n .text {\n font-size: 14px;\n font-weight: 400;\n font-style: normal;\n line-height: 20px;\n color: rgba(15, 21, 40, 82%);\n text-overflow: ellipsis;\n }\n\n .custom-content {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n height: 100%;\n\n /* 为自定义内容提供默认样式,但允许覆盖 */\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n color: rgba(15, 21, 40, 82%);\n\n /* 确保自定义内容不会超出容器 */\n overflow: hidden;\n }\n\n .space {\n width: 128px;\n }\n }\n\n .actions {\n position: absolute;\n top: 0;\n right: 0;\n\n display: flex;\n gap: 8px;\n align-items: center;\n\n height: 28px;\n padding: 0 16px;\n\n .close-forever {\n cursor: pointer;\n\n padding: 0 3px;\n\n font-size: 12px;\n font-weight: 400;\n font-style: normal;\n line-height: 12px;\n color: rgba(32, 41, 69, 62%);\n }\n\n .close {\n display: flex;\n cursor: pointer;\n height: 100%;\n align-items: center;\n }\n }\n }\n`;\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nexport const isMacOS = /(Macintosh|MacIntel|MacPPC|Mac68K|iPad)/.test(navigator.userAgent);\n","/**\n * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates\n * SPDX-License-Identifier: MIT\n */\n\nimport React from 'react';\n\nexport const IconClose = () => (\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" fill=\"none\" viewBox=\"0 0 16 16\">\n <path\n fill=\"#060709\"\n fillOpacity=\"0.5\"\n d=\"M12.13 12.128a.5.5 0 0 0 .001-.706L8.71 8l3.422-3.423a.5.5 0 0 0-.001-.705.5.5 0 0 0-.706-.002L8.002 7.293 4.579 3.87a.5.5 0 0 0-.705.002.5.5 0 0 0-.002.705L7.295 8l-3.423 3.422a.5.5 0 0 0 .002.706c.195.195.51.197.705.001l3.423-3.422 3.422 3.422c.196.196.51.194.706-.001\"\n ></path>\n </svg>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKO,IAAK,wBAAL,kBAAKA,2BAAL;AACL,EAAAA,uBAAA,QAAK;AACL,EAAAA,uBAAA,SAAM;AAFI,SAAAA;AAAA,GAAA;;;ACCZ,uBAAyB;AACzB,uBAAmC;AACnC,IAAAC,gBAA+D;AAC/D,8BASO;AACP,iCAA+B;AAC/B,IAAAC,mBAAqD;AACrD,kBAAsD;;;AChB/C,IAAM,YAAY,YAA2B;AAClD,QAAM,IAAI,QAAQ,CAAC,YAAY,sBAAsB,OAAO,CAAC;AAC/D;;;ACAO,IAAM,cAAc,CAAC,SAC1B,MAAM,YAA8B,EAAE,eAAe;;;ACGhD,IAAM,yBAAyB,CAAC,aACrC,SACG,OAAO,CAAC,SAAS;AAChB,MAAI,KAAK,cAAc;AACrB,WAAO,KAAK,YAAY,EAAE,cAAc,KAAK,aAAa,YAAY,EAAE;AAAA,EAC1E;AACA,SAAO,KAAK,YAAY,EAAE;AAC5B,CAAC,EACA,OAAO,CAAC,SAAS,YAAY,IAAI,CAAC,EAClC,KAAK,CAAC,GAAG,MAAM;AACd,QAAM,SAAS,EAAE,WAAW;AAC5B,QAAM,SAAS,EAAE,WAAW;AAE5B,SAAO,SAAS;AAClB,CAAC,EACA,IAAI,CAAC,SAAS,KAAK,SAAS;;;ACrBjC,mBAA0C;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C,OAAE,WAAU,UAAQ,cAAe,IAEpC,8BAAAA,QAAA,cAAC,SAAI,WAAU,oBAAkB,cAAe,GAElD,8BAAAA,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,WAAU;AAAA,MACV,OAAO;AAAA,QACL,OAAO;AAAA,MACT;AAAA;AAAA,EACF,CACF,GACA,8BAAAA,QAAA,cAAC,SAAI,WAAU,aACb,8BAAAA,QAAA,cAAC,OAAE,WAAU,iBAAgB,SAAS,gBACnC,mBAAmB,iBAAK,EAAE,cAAc,CAC3C,GACA,8BAAAA,QAAA,cAAC,SAAI,WAAU,SAAQ,SAAS,SAC9B,8BAAAA,QAAA,cAAC,eAAU,CACb,CACF,CACF,CACF;AAEJ;;;AFnCO,IAAM,kBAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AACF,MAAM;AACJ,QAAM,WAAW,YAAY;AAC7B,QAAM,aAAa,UAAU,UAAU;AAEvC,wBAAsB,QAAQ;AAE9B,SACE,8BAAAC,QAAA;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,qBAAqB,aAAa,EAAE;AAAA,MAC/C,OAAO;AAAA,QACL,QAAQ,aAAa;AAAA,QACrB,GAAG;AAAA,MACL;AAAA,MACA,+BAA4B;AAAA,MAC5B,aAAa,CAAC,MAAM;AAClB,UAAE,gBAAgB;AAAA,MACpB;AAAA;AAAA,IAEA,8BAAAA,QAAA,cAAC,uBACC,8BAAAA,QAAA,cAAC,yBAAoB,GACrB,8BAAAA,QAAA,cAAC,iBAAc,SAAkB,CACnC;AAAA,EACF;AAEJ;","names":["NodeIntoContainerType","import_utils","import_document","renderData","renderDom","import_core","import_free_layout_core","import_document","isContainer","import_react","import_free_layout_core","import_react","import_free_layout_core","import_core","styled","React","import_react","import_styled_components","styled","React","import_react","import_styled_components","styled","import_react","import_react","import_free_layout_core","import_core","import_styled_components","styled","import_react","React","React","React"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flowgram.ai/free-container-plugin",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "homepage": "https://flowgram.ai/",
5
5
  "repository": "https://github.com/bytedance/flowgram.ai",
6
6
  "license": "MIT",
@@ -19,13 +19,13 @@
19
19
  "inversify": "^6.0.1",
20
20
  "reflect-metadata": "~0.2.2",
21
21
  "lodash-es": "^4.17.21",
22
- "@flowgram.ai/core": "1.0.1",
23
- "@flowgram.ai/document": "1.0.1",
24
- "@flowgram.ai/free-layout-core": "1.0.1",
25
- "@flowgram.ai/free-history-plugin": "1.0.1",
26
- "@flowgram.ai/utils": "1.0.1",
27
- "@flowgram.ai/background-plugin": "1.0.1",
28
- "@flowgram.ai/i18n": "1.0.1"
22
+ "@flowgram.ai/free-history-plugin": "1.0.3",
23
+ "@flowgram.ai/core": "1.0.3",
24
+ "@flowgram.ai/free-layout-core": "1.0.3",
25
+ "@flowgram.ai/document": "1.0.3",
26
+ "@flowgram.ai/utils": "1.0.3",
27
+ "@flowgram.ai/i18n": "1.0.3",
28
+ "@flowgram.ai/background-plugin": "1.0.3"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/bezier-js": "4.1.3",
@@ -41,8 +41,8 @@
41
41
  "tsup": "^8.0.1",
42
42
  "typescript": "^5.8.3",
43
43
  "vitest": "^3.2.4",
44
- "@flowgram.ai/eslint-config": "1.0.1",
45
- "@flowgram.ai/ts-config": "1.0.1"
44
+ "@flowgram.ai/eslint-config": "1.0.3",
45
+ "@flowgram.ai/ts-config": "1.0.3"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "react": ">=16.8",