@foresthubai/workflow-builder 0.4.3 → 0.4.5
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/LICENSE +661 -661
- package/NOTICE +16 -16
- package/README.md +110 -110
- package/dist/BuilderLayout.d.ts.map +1 -1
- package/dist/BuilderLayout.js +52 -61
- package/dist/BuilderLayout.js.map +1 -1
- package/dist/Canvas.d.ts.map +1 -1
- package/dist/Canvas.js +10 -3
- package/dist/Canvas.js.map +1 -1
- package/dist/CanvasEditor.d.ts.map +1 -1
- package/dist/CanvasEditor.js.map +1 -1
- package/dist/CanvasTabsToolbar.d.ts.map +1 -1
- package/dist/CanvasTabsToolbar.js +3 -0
- package/dist/CanvasTabsToolbar.js.map +1 -1
- package/dist/RightConfigPanel.d.ts.map +1 -1
- package/dist/RightConfigPanel.js +3 -0
- package/dist/RightConfigPanel.js.map +1 -1
- package/dist/WorkflowBuilder.d.ts +7 -13
- package/dist/WorkflowBuilder.d.ts.map +1 -1
- package/dist/WorkflowBuilder.js +25 -13
- package/dist/WorkflowBuilder.js.map +1 -1
- package/dist/cn.d.ts.map +1 -1
- package/dist/cn.js +3 -0
- package/dist/cn.js.map +1 -1
- package/dist/components/ui/add-button.d.ts.map +1 -1
- package/dist/components/ui/add-button.js +3 -0
- package/dist/components/ui/add-button.js.map +1 -1
- package/dist/components/ui/alert-dialog.d.ts.map +1 -1
- package/dist/components/ui/alert-dialog.js +3 -0
- package/dist/components/ui/alert-dialog.js.map +1 -1
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.js +3 -0
- package/dist/components/ui/alert.js.map +1 -1
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.js +3 -0
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/card.d.ts.map +1 -1
- package/dist/components/ui/card.js +3 -0
- package/dist/components/ui/card.js.map +1 -1
- package/dist/components/ui/checkbox.d.ts.map +1 -1
- package/dist/components/ui/checkbox.js +3 -0
- package/dist/components/ui/checkbox.js.map +1 -1
- package/dist/components/ui/collapsible.d.ts.map +1 -1
- package/dist/components/ui/collapsible.js +3 -0
- package/dist/components/ui/collapsible.js.map +1 -1
- package/dist/components/ui/command.d.ts +2 -2
- package/dist/components/ui/command.d.ts.map +1 -1
- package/dist/components/ui/command.js +3 -0
- package/dist/components/ui/command.js.map +1 -1
- package/dist/components/ui/delete-button.d.ts.map +1 -1
- package/dist/components/ui/delete-button.js +3 -0
- package/dist/components/ui/delete-button.js.map +1 -1
- package/dist/components/ui/dialog.d.ts.map +1 -1
- package/dist/components/ui/dialog.js +3 -0
- package/dist/components/ui/dialog.js.map +1 -1
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -1
- package/dist/components/ui/dropdown-menu.js +3 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -1
- package/dist/components/ui/input.d.ts +1 -1
- package/dist/components/ui/input.d.ts.map +1 -1
- package/dist/components/ui/input.js +3 -0
- package/dist/components/ui/input.js.map +1 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.js +3 -0
- package/dist/components/ui/label.js.map +1 -1
- package/dist/components/ui/readonly-banner.d.ts.map +1 -1
- package/dist/components/ui/readonly-banner.js +3 -0
- package/dist/components/ui/readonly-banner.js.map +1 -1
- package/dist/components/ui/resizable.d.ts +1 -1
- package/dist/components/ui/resizable.d.ts.map +1 -1
- package/dist/components/ui/resizable.js +3 -0
- package/dist/components/ui/resizable.js.map +1 -1
- package/dist/components/ui/scroll-area.d.ts.map +1 -1
- package/dist/components/ui/scroll-area.js +3 -0
- package/dist/components/ui/scroll-area.js.map +1 -1
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/components/ui/select.js +3 -0
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/separator.d.ts.map +1 -1
- package/dist/components/ui/separator.js +3 -0
- package/dist/components/ui/separator.js.map +1 -1
- package/dist/components/ui/switch.d.ts.map +1 -1
- package/dist/components/ui/switch.js +3 -0
- package/dist/components/ui/switch.js.map +1 -1
- package/dist/components/ui/textarea.d.ts +1 -1
- package/dist/components/ui/textarea.d.ts.map +1 -1
- package/dist/components/ui/textarea.js +3 -0
- package/dist/components/ui/textarea.js.map +1 -1
- package/dist/components/ui/toast.d.ts.map +1 -1
- package/dist/components/ui/toast.js +3 -0
- package/dist/components/ui/toast.js.map +1 -1
- package/dist/components/ui/toaster.d.ts.map +1 -1
- package/dist/components/ui/toaster.js +3 -0
- package/dist/components/ui/toaster.js.map +1 -1
- package/dist/components/ui/toggle-group.d.ts.map +1 -1
- package/dist/components/ui/toggle-group.js +3 -0
- package/dist/components/ui/toggle-group.js.map +1 -1
- package/dist/components/ui/toggle.d.ts.map +1 -1
- package/dist/components/ui/toggle.js +3 -0
- package/dist/components/ui/toggle.js.map +1 -1
- package/dist/components/ui/tooltip.d.ts.map +1 -1
- package/dist/components/ui/tooltip.js +3 -0
- package/dist/components/ui/tooltip.js.map +1 -1
- package/dist/dialogs/NodePickerDialog.d.ts.map +1 -1
- package/dist/dialogs/NodePickerDialog.js +3 -0
- package/dist/dialogs/NodePickerDialog.js.map +1 -1
- package/dist/dialogs/ValidationDialog.d.ts.map +1 -1
- package/dist/dialogs/ValidationDialog.js +3 -0
- package/dist/dialogs/ValidationDialog.js.map +1 -1
- package/dist/graph/BaseNode.d.ts.map +1 -1
- package/dist/graph/BaseNode.js +21 -16
- package/dist/graph/BaseNode.js.map +1 -1
- package/dist/graph/CustomEdge.d.ts.map +1 -1
- package/dist/graph/CustomEdge.js +4 -1
- package/dist/graph/CustomEdge.js.map +1 -1
- package/dist/graph/CustomNode.d.ts.map +1 -1
- package/dist/graph/CustomNode.js +3 -0
- package/dist/graph/CustomNode.js.map +1 -1
- package/dist/graph/FunctionCallNode.d.ts.map +1 -1
- package/dist/graph/FunctionCallNode.js.map +1 -1
- package/dist/graph/PortHandle.d.ts.map +1 -1
- package/dist/graph/PortHandle.js.map +1 -1
- package/dist/graph/reactFlowRegistry.d.ts.map +1 -1
- package/dist/graph/reactFlowRegistry.js +3 -0
- package/dist/graph/reactFlowRegistry.js.map +1 -1
- package/dist/hooks/use-toast.d.ts.map +1 -1
- package/dist/hooks/use-toast.js +3 -0
- package/dist/hooks/use-toast.js.map +1 -1
- package/dist/hooks/useAvailableVariables.d.ts.map +1 -1
- package/dist/hooks/useAvailableVariables.js +3 -0
- package/dist/hooks/useAvailableVariables.js.map +1 -1
- package/dist/hooks/useCanvasHistory.d.ts.map +1 -1
- package/dist/hooks/useCanvasHistory.js +3 -0
- package/dist/hooks/useCanvasHistory.js.map +1 -1
- package/dist/hooks/useCanvasTabs.d.ts.map +1 -1
- package/dist/hooks/useCanvasTabs.js +3 -0
- package/dist/hooks/useCanvasTabs.js.map +1 -1
- package/dist/hooks/useFunctionDiagnosticsSync.d.ts.map +1 -1
- package/dist/hooks/useFunctionDiagnosticsSync.js +3 -0
- package/dist/hooks/useFunctionDiagnosticsSync.js.map +1 -1
- package/dist/hooks/useFunctionRegistry.d.ts.map +1 -1
- package/dist/hooks/useFunctionRegistry.js +3 -0
- package/dist/hooks/useFunctionRegistry.js.map +1 -1
- package/dist/hooks/useFunctions.d.ts.map +1 -1
- package/dist/hooks/useFunctions.js +3 -0
- package/dist/hooks/useFunctions.js.map +1 -1
- package/dist/hooks/useGraph.d.ts.map +1 -1
- package/dist/hooks/useGraph.js +3 -0
- package/dist/hooks/useGraph.js.map +1 -1
- package/dist/hooks/useNodeDefinitions.d.ts.map +1 -1
- package/dist/hooks/useNodeDefinitions.js +3 -0
- package/dist/hooks/useNodeDefinitions.js.map +1 -1
- package/dist/hooks/useParamErrors.d.ts.map +1 -1
- package/dist/hooks/useParamErrors.js +3 -0
- package/dist/hooks/useParamErrors.js.map +1 -1
- package/dist/hooks/useResolvedTheme.d.ts.map +1 -1
- package/dist/hooks/useResolvedTheme.js +3 -0
- package/dist/hooks/useResolvedTheme.js.map +1 -1
- package/dist/hooks/useResourceDiagnosticsSync.d.ts.map +1 -1
- package/dist/hooks/useResourceDiagnosticsSync.js +3 -0
- package/dist/hooks/useResourceDiagnosticsSync.js.map +1 -1
- package/dist/hooks/useSuppressThemeTransition.d.ts.map +1 -1
- package/dist/hooks/useSuppressThemeTransition.js +3 -0
- package/dist/hooks/useSuppressThemeTransition.js.map +1 -1
- package/dist/hooks/useWorkflowSerialization.d.ts.map +1 -1
- package/dist/hooks/useWorkflowSerialization.js +3 -0
- package/dist/hooks/useWorkflowSerialization.js.map +1 -1
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +3 -0
- package/dist/i18n/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/inputs/ExpressionInput.d.ts.map +1 -1
- package/dist/inputs/ExpressionInput.js +3 -0
- package/dist/inputs/ExpressionInput.js.map +1 -1
- package/dist/inputs/ParameterEditor.d.ts.map +1 -1
- package/dist/inputs/ParameterEditor.js +3 -0
- package/dist/inputs/ParameterEditor.js.map +1 -1
- package/dist/inputs/PortSection.d.ts.map +1 -1
- package/dist/inputs/PortSection.js.map +1 -1
- package/dist/mode.d.ts +11 -0
- package/dist/mode.d.ts.map +1 -0
- package/dist/mode.js +8 -0
- package/dist/mode.js.map +1 -0
- package/dist/panels/BuilderSidebar.d.ts.map +1 -1
- package/dist/panels/BuilderSidebar.js +3 -0
- package/dist/panels/BuilderSidebar.js.map +1 -1
- package/dist/panels/ChannelConfigPanel.d.ts.map +1 -1
- package/dist/panels/ChannelConfigPanel.js +3 -0
- package/dist/panels/ChannelConfigPanel.js.map +1 -1
- package/dist/panels/ChannelsPanel.d.ts.map +1 -1
- package/dist/panels/ChannelsPanel.js +3 -0
- package/dist/panels/ChannelsPanel.js.map +1 -1
- package/dist/panels/DebugConsolePanel.d.ts.map +1 -1
- package/dist/panels/DebugConsolePanel.js +3 -0
- package/dist/panels/DebugConsolePanel.js.map +1 -1
- package/dist/panels/DebugContextPanel.d.ts.map +1 -1
- package/dist/panels/DebugContextPanel.js +3 -0
- package/dist/panels/DebugContextPanel.js.map +1 -1
- package/dist/panels/DebugExternalIOPanel.d.ts.map +1 -1
- package/dist/panels/DebugExternalIOPanel.js +3 -0
- package/dist/panels/DebugExternalIOPanel.js.map +1 -1
- package/dist/panels/DiagnosticsPanel.d.ts.map +1 -1
- package/dist/panels/DiagnosticsPanel.js +3 -0
- package/dist/panels/DiagnosticsPanel.js.map +1 -1
- package/dist/panels/EdgeConfigPanel.d.ts.map +1 -1
- package/dist/panels/EdgeConfigPanel.js +4 -1
- package/dist/panels/EdgeConfigPanel.js.map +1 -1
- package/dist/panels/FunctionConfigPanel.d.ts.map +1 -1
- package/dist/panels/FunctionConfigPanel.js +4 -1
- package/dist/panels/FunctionConfigPanel.js.map +1 -1
- package/dist/panels/FunctionListPanel.d.ts.map +1 -1
- package/dist/panels/FunctionListPanel.js +3 -0
- package/dist/panels/FunctionListPanel.js.map +1 -1
- package/dist/panels/MemoryConfigPanel.d.ts.map +1 -1
- package/dist/panels/MemoryConfigPanel.js +3 -0
- package/dist/panels/MemoryConfigPanel.js.map +1 -1
- package/dist/panels/MemoryPanel.d.ts.map +1 -1
- package/dist/panels/MemoryPanel.js +3 -0
- package/dist/panels/MemoryPanel.js.map +1 -1
- package/dist/panels/ModelConfigPanel.d.ts.map +1 -1
- package/dist/panels/ModelConfigPanel.js +3 -0
- package/dist/panels/ModelConfigPanel.js.map +1 -1
- package/dist/panels/ModelsPanel.d.ts.map +1 -1
- package/dist/panels/ModelsPanel.js +3 -0
- package/dist/panels/ModelsPanel.js.map +1 -1
- package/dist/panels/NodeConfigPanel.d.ts.map +1 -1
- package/dist/panels/NodeConfigPanel.js +4 -1
- package/dist/panels/NodeConfigPanel.js.map +1 -1
- package/dist/panels/NodeLibrary.d.ts.map +1 -1
- package/dist/panels/NodeLibrary.js +4 -1
- package/dist/panels/NodeLibrary.js.map +1 -1
- package/dist/panels/ResourceConfigPanel.d.ts.map +1 -1
- package/dist/panels/ResourceConfigPanel.js +4 -1
- package/dist/panels/ResourceConfigPanel.js.map +1 -1
- package/dist/panels/ResourceListPanel.d.ts.map +1 -1
- package/dist/panels/ResourceListPanel.js +4 -1
- package/dist/panels/ResourceListPanel.js.map +1 -1
- package/dist/panels/VariableConfigPanel.d.ts.map +1 -1
- package/dist/panels/VariableConfigPanel.js +4 -1
- package/dist/panels/VariableConfigPanel.js.map +1 -1
- package/dist/panels/VariablesPanel.d.ts.map +1 -1
- package/dist/panels/VariablesPanel.js +4 -1
- package/dist/panels/VariablesPanel.js.map +1 -1
- package/dist/stores/canvasStore.d.ts.map +1 -1
- package/dist/stores/canvasStore.js +3 -0
- package/dist/stores/canvasStore.js.map +1 -1
- package/dist/stores/debugStore.d.ts.map +1 -1
- package/dist/stores/debugStore.js +3 -0
- package/dist/stores/debugStore.js.map +1 -1
- package/dist/stores/diagnosticsStore.d.ts.map +1 -1
- package/dist/stores/diagnosticsStore.js +3 -0
- package/dist/stores/diagnosticsStore.js.map +1 -1
- package/dist/stores/editorStore.d.ts +1 -1
- package/dist/stores/editorStore.d.ts.map +1 -1
- package/dist/stores/editorStore.js +3 -0
- package/dist/stores/editorStore.js.map +1 -1
- package/dist/utils/categoryConstants.d.ts.map +1 -1
- package/dist/utils/categoryConstants.js +3 -0
- package/dist/utils/categoryConstants.js.map +1 -1
- package/dist/utils/channelOperations.d.ts.map +1 -1
- package/dist/utils/channelOperations.js +3 -0
- package/dist/utils/channelOperations.js.map +1 -1
- package/dist/utils/connectionRules.d.ts +3 -1
- package/dist/utils/connectionRules.d.ts.map +1 -1
- package/dist/utils/connectionRules.js +11 -16
- package/dist/utils/connectionRules.js.map +1 -1
- package/dist/utils/functionOperations.d.ts.map +1 -1
- package/dist/utils/functionOperations.js +3 -0
- package/dist/utils/functionOperations.js.map +1 -1
- package/dist/utils/graphOperations.d.ts.map +1 -1
- package/dist/utils/graphOperations.js +3 -0
- package/dist/utils/graphOperations.js.map +1 -1
- package/dist/utils/history.d.ts.map +1 -1
- package/dist/utils/history.js +4 -1
- package/dist/utils/history.js.map +1 -1
- package/dist/utils/memoryOperations.d.ts.map +1 -1
- package/dist/utils/memoryOperations.js +3 -0
- package/dist/utils/memoryOperations.js.map +1 -1
- package/dist/utils/migrateFunctionNodes.d.ts.map +1 -1
- package/dist/utils/migrateFunctionNodes.js +3 -0
- package/dist/utils/migrateFunctionNodes.js.map +1 -1
- package/dist/utils/modelOperations.d.ts.map +1 -1
- package/dist/utils/modelOperations.js +3 -0
- package/dist/utils/modelOperations.js.map +1 -1
- package/dist/utils/paramDisplay.d.ts.map +1 -1
- package/dist/utils/paramDisplay.js +3 -0
- package/dist/utils/paramDisplay.js.map +1 -1
- package/dist/utils/resourceHelpers.d.ts.map +1 -1
- package/dist/utils/resourceHelpers.js +3 -0
- package/dist/utils/resourceHelpers.js.map +1 -1
- package/dist/utils/translation.d.ts.map +1 -1
- package/dist/utils/translation.js +3 -0
- package/dist/utils/translation.js.map +1 -1
- package/dist/utils/variableOperations.d.ts.map +1 -1
- package/dist/utils/variableOperations.js +3 -0
- package/dist/utils/variableOperations.js.map +1 -1
- package/package.json +2 -2
- package/src/BuilderLayout.tsx +338 -345
- package/src/Canvas.tsx +270 -261
- package/src/CanvasEditor.tsx +146 -142
- package/src/CanvasTabsToolbar.tsx +180 -176
- package/src/RightConfigPanel.tsx +270 -266
- package/src/WorkflowBuilder.tsx +423 -408
- package/src/cn.ts +10 -6
- package/src/components/ui/add-button.tsx +43 -39
- package/src/components/ui/alert-dialog.tsx +145 -141
- package/src/components/ui/alert.tsx +63 -59
- package/src/components/ui/badge.tsx +40 -36
- package/src/components/ui/button.tsx +89 -85
- package/src/components/ui/card.tsx +83 -79
- package/src/components/ui/checkbox.tsx +32 -28
- package/src/components/ui/collapsible.tsx +13 -9
- package/src/components/ui/command.tsx +157 -153
- package/src/components/ui/delete-button.tsx +27 -23
- package/src/components/ui/dialog.tsx +129 -125
- package/src/components/ui/dropdown-menu.tsx +202 -198
- package/src/components/ui/input.tsx +59 -55
- package/src/components/ui/label.tsx +28 -24
- package/src/components/ui/readonly-banner.tsx +19 -15
- package/src/components/ui/resizable.tsx +47 -43
- package/src/components/ui/scroll-area.tsx +106 -102
- package/src/components/ui/select.tsx +164 -160
- package/src/components/ui/separator.tsx +33 -29
- package/src/components/ui/switch.tsx +31 -27
- package/src/components/ui/textarea.tsx +55 -51
- package/src/components/ui/toast.tsx +131 -127
- package/src/components/ui/toaster.tsx +37 -33
- package/src/components/ui/toggle-group.tsx +63 -59
- package/src/components/ui/toggle.tsx +47 -43
- package/src/components/ui/tooltip.tsx +36 -32
- package/src/dialogs/NodePickerDialog.tsx +88 -84
- package/src/dialogs/ValidationDialog.tsx +188 -184
- package/src/graph/BaseNode.tsx +563 -557
- package/src/graph/CustomEdge.tsx +189 -185
- package/src/graph/CustomNode.tsx +20 -16
- package/src/graph/FunctionCallNode.tsx +34 -30
- package/src/graph/PortHandle.tsx +193 -189
- package/src/graph/reactFlowRegistry.ts +30 -26
- package/src/hooks/use-toast.ts +129 -125
- package/src/hooks/useAvailableVariables.ts +24 -20
- package/src/hooks/useCanvasHistory.ts +26 -22
- package/src/hooks/useCanvasTabs.ts +172 -168
- package/src/hooks/useFunctionDiagnosticsSync.ts +44 -40
- package/src/hooks/useFunctionRegistry.ts +30 -26
- package/src/hooks/useFunctions.ts +48 -44
- package/src/hooks/useGraph.ts +165 -161
- package/src/hooks/useNodeDefinitions.ts +86 -82
- package/src/hooks/useParamErrors.ts +30 -26
- package/src/hooks/useResolvedTheme.ts +34 -30
- package/src/hooks/useResourceDiagnosticsSync.ts +62 -58
- package/src/hooks/useSuppressThemeTransition.ts +83 -79
- package/src/hooks/useWorkflowSerialization.ts +145 -141
- package/src/i18n/index.ts +57 -53
- package/src/i18n/locales/de.json +501 -501
- package/src/i18n/locales/en.json +557 -557
- package/src/index.ts +31 -27
- package/src/inputs/ExpressionInput.tsx +301 -297
- package/src/inputs/ParameterEditor.tsx +519 -515
- package/src/inputs/PortSection.tsx +148 -144
- package/src/mode.ts +15 -0
- package/src/panels/BuilderSidebar.tsx +305 -301
- package/src/panels/ChannelConfigPanel.tsx +53 -49
- package/src/panels/ChannelsPanel.tsx +32 -28
- package/src/panels/DebugConsolePanel.tsx +77 -73
- package/src/panels/DebugContextPanel.tsx +81 -77
- package/src/panels/DebugExternalIOPanel.tsx +184 -180
- package/src/panels/DiagnosticsPanel.tsx +174 -170
- package/src/panels/EdgeConfigPanel.tsx +108 -104
- package/src/panels/FunctionConfigPanel.tsx +183 -179
- package/src/panels/FunctionListPanel.tsx +49 -45
- package/src/panels/MemoryConfigPanel.tsx +59 -55
- package/src/panels/MemoryPanel.tsx +44 -40
- package/src/panels/ModelConfigPanel.tsx +45 -41
- package/src/panels/ModelsPanel.tsx +40 -36
- package/src/panels/NodeConfigPanel.tsx +634 -630
- package/src/panels/NodeLibrary.tsx +292 -288
- package/src/panels/ResourceConfigPanel.tsx +136 -132
- package/src/panels/ResourceListPanel.tsx +117 -113
- package/src/panels/VariableConfigPanel.tsx +165 -161
- package/src/panels/VariablesPanel.tsx +149 -145
- package/src/stores/canvasStore.test.ts +48 -44
- package/src/stores/canvasStore.ts +249 -245
- package/src/stores/debugStore.ts +78 -74
- package/src/stores/diagnosticsStore.ts +134 -130
- package/src/stores/editorStore.ts +194 -190
- package/src/styles/index.css +526 -526
- package/src/utils/categoryConstants.ts +30 -26
- package/src/utils/channelOperations.ts +90 -86
- package/src/utils/connectionRules.ts +140 -137
- package/src/utils/functionOperations.ts +183 -179
- package/src/utils/graphOperations.ts +554 -550
- package/src/utils/history.test.ts +92 -0
- package/src/utils/history.ts +211 -207
- package/src/utils/memoryOperations.ts +61 -57
- package/src/utils/migrateFunctionNodes.ts +111 -107
- package/src/utils/modelOperations.ts +59 -55
- package/src/utils/paramDisplay.ts +75 -71
- package/src/utils/resourceHelpers.ts +36 -32
- package/src/utils/translation.ts +32 -28
- package/src/utils/variableOperations.ts +79 -75
- package/tailwind-preset.ts +170 -166
- package/dist/lib/utils.d.ts +0 -3
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js +0 -6
- package/dist/lib/utils.js.map +0 -1
- package/dist/toolbars/CanvasTabsToolbar.d.ts +0 -11
- package/dist/toolbars/CanvasTabsToolbar.d.ts.map +0 -1
- package/dist/toolbars/CanvasTabsToolbar.js +0 -101
- package/dist/toolbars/CanvasTabsToolbar.js.map +0 -1
package/src/BuilderLayout.tsx
CHANGED
|
@@ -1,345 +1,338 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* -
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
* -
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
//
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
//
|
|
102
|
-
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
//
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
//
|
|
207
|
-
//
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
onTestNode={onTestNode}
|
|
340
|
-
onDebugStep={onDebugStep}
|
|
341
|
-
/>
|
|
342
|
-
</div>
|
|
343
|
-
</div>
|
|
344
|
-
);
|
|
345
|
-
};
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
// Copyright (c) 2026 ForestHub. All rights reserved.
|
|
3
|
+
// For commercial licensing, contact root@foresthub.ai
|
|
4
|
+
|
|
5
|
+
import type { FunctionDeclaration } from "@foresthubai/workflow-core/function";
|
|
6
|
+
import type { NodeDefinition } from "@foresthubai/workflow-core/node";
|
|
7
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
8
|
+
import type { Connection, OnSelectionChangeFunc } from "@xyflow/react";
|
|
9
|
+
|
|
10
|
+
import { toast } from "./hooks/use-toast";
|
|
11
|
+
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from "./components/ui/resizable";
|
|
12
|
+
import { BuilderSidebar } from "./panels/BuilderSidebar";
|
|
13
|
+
import { CanvasTabsToolbar } from "./CanvasTabsToolbar";
|
|
14
|
+
import { CanvasEditor } from "./CanvasEditor";
|
|
15
|
+
import { RightConfigPanel } from "./RightConfigPanel";
|
|
16
|
+
import { useCanvasHistory } from "./hooks/useCanvasHistory";
|
|
17
|
+
import { useGraph } from "./hooks/useGraph";
|
|
18
|
+
import { useNodeDefinitions } from "./hooks/useNodeDefinitions";
|
|
19
|
+
import { DebugConsolePanel } from "./panels/DebugConsolePanel";
|
|
20
|
+
import type { CanvasTab } from "./hooks/useCanvasTabs";
|
|
21
|
+
import { getOrCreateCanvasStore, MAIN_CANVAS_ID } from "./stores/canvasStore";
|
|
22
|
+
import { useEditorStore } from "./stores/editorStore";
|
|
23
|
+
import { isReadOnly } from "./mode";
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Chrome composer. Stable across canvas switches — only the {@link CanvasEditor}
|
|
27
|
+
* child remounts via `key={activeCanvasId}`.
|
|
28
|
+
*
|
|
29
|
+
* Owns:
|
|
30
|
+
* - Sidebar tab state and the mode → sidebar-tab auto-switch effect.
|
|
31
|
+
* - viewportCenterRef (populated by ReactFlow, consumed by sidebar's
|
|
32
|
+
* click-to-add path).
|
|
33
|
+
* - Selection-drag flag (lifted here so RightConfigPanel can read it).
|
|
34
|
+
* - All graph mutation handlers — bound to active canvas via
|
|
35
|
+
* `useGraph(activeCanvasId)`. Handlers stay stable enough to pass to the
|
|
36
|
+
* sidebar; closures refresh automatically when the active canvas changes.
|
|
37
|
+
* - Document-level keyboard handlers (undo/redo/copy/paste/delete/escape).
|
|
38
|
+
*
|
|
39
|
+
* Receives the open-tab list and function-CRUD callbacks from
|
|
40
|
+
* {@link WorkflowBuilder} above (which owns long-lived editor state).
|
|
41
|
+
*/
|
|
42
|
+
export interface BuilderLayoutProps {
|
|
43
|
+
functions: FunctionDeclaration[];
|
|
44
|
+
/** Open (and select) an existing function — used by the sidebar list and tab dropdown. */
|
|
45
|
+
onOpenFunction: (functionId: string) => void;
|
|
46
|
+
/** Create a new function and open it — the sidebar list's "Add" action. */
|
|
47
|
+
onCreateFunction: () => string;
|
|
48
|
+
|
|
49
|
+
canvasTabs: CanvasTab[];
|
|
50
|
+
onCanvasTabChange: (tabId: string) => void;
|
|
51
|
+
onCanvasTabClose: (tabId: string) => void;
|
|
52
|
+
onCanvasTabReorder: (fromIndex: number, toIndex: number) => void;
|
|
53
|
+
|
|
54
|
+
onTestNode?: (nodeId: string) => void;
|
|
55
|
+
onDebugStep?: (nodeId?: string) => void;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const BuilderLayout = ({
|
|
59
|
+
functions,
|
|
60
|
+
onOpenFunction,
|
|
61
|
+
onCreateFunction,
|
|
62
|
+
canvasTabs,
|
|
63
|
+
onCanvasTabChange,
|
|
64
|
+
onCanvasTabClose,
|
|
65
|
+
onCanvasTabReorder,
|
|
66
|
+
onTestNode,
|
|
67
|
+
onDebugStep,
|
|
68
|
+
}: BuilderLayoutProps) => {
|
|
69
|
+
const activeCanvasId = useEditorStore((s) => s.activeCanvasId);
|
|
70
|
+
const builderMode = useEditorStore((s) => s.builderMode);
|
|
71
|
+
const readOnly = isReadOnly(builderMode);
|
|
72
|
+
const isDebugMode = builderMode.type === "debug";
|
|
73
|
+
|
|
74
|
+
// NodeRegistry (static) + dynamic function nodes — derived, not embedder-provided.
|
|
75
|
+
const { nodeDefinitions, getNodeDefinition, getAllCategories } = useNodeDefinitions();
|
|
76
|
+
|
|
77
|
+
const graph = useGraph(activeCanvasId, readOnly);
|
|
78
|
+
const { undo, redo, takeCheckpoint, canUndo, canRedo } = useCanvasHistory(activeCanvasId);
|
|
79
|
+
|
|
80
|
+
// Selection (project-wide in editorStore, mirrored to canvas store for RF visual)
|
|
81
|
+
const selection = useEditorStore((s) => s.selection);
|
|
82
|
+
const selectGraph = useEditorStore((s) => s.selectGraph);
|
|
83
|
+
const syncSelectionFromRF = useEditorStore((s) => s.syncSelectionFromRF);
|
|
84
|
+
const clearSelection = useEditorStore((s) => s.clearSelection);
|
|
85
|
+
|
|
86
|
+
// Sidebar tab state + mode auto-switch.
|
|
87
|
+
const activeSidebarTab = useEditorStore((s) => s.activeSidebarTab);
|
|
88
|
+
const setActiveSidebarTab = useEditorStore((s) => s.setActiveSidebarTab);
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
const isDebugTab = activeSidebarTab === "debug-context";
|
|
91
|
+
if (isDebugMode && !isDebugTab) {
|
|
92
|
+
setActiveSidebarTab("debug-context");
|
|
93
|
+
} else if (!isDebugMode && isDebugTab) {
|
|
94
|
+
setActiveSidebarTab("nodes");
|
|
95
|
+
}
|
|
96
|
+
}, [isDebugMode, activeSidebarTab, setActiveSidebarTab]);
|
|
97
|
+
|
|
98
|
+
// Selection-drag flag (used by RightConfigPanel to suppress during drag).
|
|
99
|
+
const [selectionDrag, setSelectionDrag] = useState(false);
|
|
100
|
+
|
|
101
|
+
// ViewportCenter ref (populated by ReactFlow inside CanvasEditor, consumed
|
|
102
|
+
// here for sidebar's click-to-add path).
|
|
103
|
+
const viewportCenterRef = useRef<(() => { x: number; y: number }) | null>(null);
|
|
104
|
+
|
|
105
|
+
// ── Handlers ──────────────────────────────────────────────────────────────
|
|
106
|
+
|
|
107
|
+
const selectNodeById: (id: string) => void = useCallback(
|
|
108
|
+
(nodeId: string) => selectGraph([nodeId], []),
|
|
109
|
+
[selectGraph],
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
const selectEdgeById = useCallback((edgeId: string) => selectGraph([], [edgeId]), [selectGraph]);
|
|
113
|
+
|
|
114
|
+
const handleAddNode = useCallback(
|
|
115
|
+
(nodeDef: NodeDefinition, position?: { x: number; y: number }) => {
|
|
116
|
+
const pos = position ?? viewportCenterRef.current?.();
|
|
117
|
+
const id = graph.addNode(nodeDef, pos);
|
|
118
|
+
if (id == null) {
|
|
119
|
+
toast({ title: `Only one ${nodeDef.label} node allowed per canvas`, variant: "destructive" });
|
|
120
|
+
}
|
|
121
|
+
return id;
|
|
122
|
+
},
|
|
123
|
+
[graph],
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const handleConnect = useCallback(
|
|
127
|
+
(conn: Connection) => {
|
|
128
|
+
const edgeType = graph.onConnect(conn);
|
|
129
|
+
// Auto-select agent edges so the config panel opens for parameter entry.
|
|
130
|
+
if (edgeType && edgeType !== "control" && edgeType !== "tool") {
|
|
131
|
+
const { edges: currentEdges } = getOrCreateCanvasStore(activeCanvasId).getState();
|
|
132
|
+
const newEdge = currentEdges.find(
|
|
133
|
+
(e) =>
|
|
134
|
+
e.source === conn.source &&
|
|
135
|
+
e.target === conn.target &&
|
|
136
|
+
e.sourceHandle === conn.sourceHandle &&
|
|
137
|
+
e.targetHandle === conn.targetHandle,
|
|
138
|
+
);
|
|
139
|
+
if (newEdge) selectEdgeById(newEdge.id);
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
[graph, activeCanvasId, selectEdgeById],
|
|
143
|
+
);
|
|
144
|
+
|
|
145
|
+
const handleAddNodeAndConnect = useCallback(
|
|
146
|
+
(
|
|
147
|
+
nodeDef: NodeDefinition,
|
|
148
|
+
position: { x: number; y: number },
|
|
149
|
+
connection: { source: string; sourceHandle: string; target: string; targetHandle: string },
|
|
150
|
+
) => {
|
|
151
|
+
const newNodeId = graph.addNodeAndConnect(nodeDef, position, connection);
|
|
152
|
+
if (newNodeId == null) {
|
|
153
|
+
toast({ title: `Only one ${nodeDef.label} node allowed per canvas`, variant: "destructive" });
|
|
154
|
+
}
|
|
155
|
+
return newNodeId;
|
|
156
|
+
},
|
|
157
|
+
[graph],
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
const handleSelectionChange: OnSelectionChangeFunc = useCallback(
|
|
161
|
+
({ nodes: selNodes, edges: selEdges }) => {
|
|
162
|
+
syncSelectionFromRF(
|
|
163
|
+
selNodes.map((n) => n.id),
|
|
164
|
+
selEdges.map((e) => e.id),
|
|
165
|
+
);
|
|
166
|
+
},
|
|
167
|
+
[syncSelectionFromRF],
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
const handleDeleteEdge = useCallback(
|
|
171
|
+
(edgeId: string) => {
|
|
172
|
+
graph.deleteEdges([edgeId]);
|
|
173
|
+
clearSelection();
|
|
174
|
+
},
|
|
175
|
+
[graph, clearSelection],
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
const handleNodeDragStart = useCallback(() => {
|
|
179
|
+
takeCheckpoint();
|
|
180
|
+
}, [takeCheckpoint]);
|
|
181
|
+
|
|
182
|
+
const deleteSelected = useCallback(() => {
|
|
183
|
+
const sel = useEditorStore.getState().selection;
|
|
184
|
+
const nodeIds = sel.kind === "graph" ? sel.nodeIds : [];
|
|
185
|
+
const edgeIds = sel.kind === "graph" ? sel.edgeIds : [];
|
|
186
|
+
graph.deleteSelected(nodeIds, edgeIds);
|
|
187
|
+
clearSelection();
|
|
188
|
+
}, [graph, clearSelection]);
|
|
189
|
+
|
|
190
|
+
const handlePaste = useCallback(
|
|
191
|
+
(offset?: { x: number; y: number }) => {
|
|
192
|
+
const result = graph.pasteSelection(offset);
|
|
193
|
+
if (result?.skippedLabels.length) {
|
|
194
|
+
for (const label of result.skippedLabels) {
|
|
195
|
+
toast({ title: `Only one ${label} node allowed per canvas`, variant: "destructive" });
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return result;
|
|
199
|
+
},
|
|
200
|
+
[graph],
|
|
201
|
+
);
|
|
202
|
+
|
|
203
|
+
// Keyboard handlers — undo/redo/copy/paste/delete/escape. Attached to the
|
|
204
|
+
// builder's root element (focusable via tabIndex), NOT to document: an
|
|
205
|
+
// embedded component must not steal Ctrl+Z/Delete from the host page. The
|
|
206
|
+
// handler fires only while focus is inside the builder, which clicking the
|
|
207
|
+
// canvas or any panel establishes.
|
|
208
|
+
const handleKeyDown = (event: React.KeyboardEvent<HTMLDivElement>) => {
|
|
209
|
+
const target = event.target as HTMLElement;
|
|
210
|
+
if (target?.tagName === "INPUT" || target?.tagName === "TEXTAREA" || target?.isContentEditable) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
if (readOnly) {
|
|
214
|
+
if (event.key === "Escape") clearSelection();
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if ((event.ctrlKey || event.metaKey) && event.key === "z" && !event.shiftKey) {
|
|
218
|
+
event.preventDefault();
|
|
219
|
+
if (canUndo()) {
|
|
220
|
+
clearSelection();
|
|
221
|
+
undo();
|
|
222
|
+
}
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if ((event.ctrlKey || event.metaKey) && (event.key === "y" || (event.key === "z" && event.shiftKey))) {
|
|
226
|
+
event.preventDefault();
|
|
227
|
+
if (canRedo()) {
|
|
228
|
+
clearSelection();
|
|
229
|
+
redo();
|
|
230
|
+
}
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
if ((event.ctrlKey || event.metaKey) && event.key === "c") {
|
|
234
|
+
if (selection.kind === "graph" && selection.nodeIds.length > 0) {
|
|
235
|
+
event.preventDefault();
|
|
236
|
+
graph.copySelection(selection.nodeIds);
|
|
237
|
+
}
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
if ((event.ctrlKey || event.metaKey) && event.key === "v") {
|
|
241
|
+
event.preventDefault();
|
|
242
|
+
handlePaste();
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
if (event.key === "Delete" || event.key === "Backspace") {
|
|
246
|
+
deleteSelected();
|
|
247
|
+
}
|
|
248
|
+
if (event.key === "Escape") {
|
|
249
|
+
clearSelection();
|
|
250
|
+
}
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
const isFunctionCanvas = activeCanvasId !== MAIN_CANVAS_ID;
|
|
254
|
+
|
|
255
|
+
// ── Render ───────────────────────────────────────────────────────────────
|
|
256
|
+
|
|
257
|
+
const canvasArea = (
|
|
258
|
+
<div className="flex flex-col h-full min-w-0">
|
|
259
|
+
<CanvasTabsToolbar
|
|
260
|
+
tabs={canvasTabs}
|
|
261
|
+
activeTabId={activeCanvasId}
|
|
262
|
+
onTabChange={onCanvasTabChange}
|
|
263
|
+
onTabClose={onCanvasTabClose}
|
|
264
|
+
onTabReorder={onCanvasTabReorder}
|
|
265
|
+
/>
|
|
266
|
+
<div className="flex-1 relative">
|
|
267
|
+
<CanvasEditor
|
|
268
|
+
key={activeCanvasId}
|
|
269
|
+
canvasId={activeCanvasId}
|
|
270
|
+
viewportCenterRef={viewportCenterRef}
|
|
271
|
+
nodeDefinitions={nodeDefinitions}
|
|
272
|
+
onConnect={handleConnect}
|
|
273
|
+
onAddNode={handleAddNode}
|
|
274
|
+
onAddNodeAndConnect={handleAddNodeAndConnect}
|
|
275
|
+
onSelectionChange={handleSelectionChange}
|
|
276
|
+
onPaneClick={clearSelection}
|
|
277
|
+
onNodeDragStart={handleNodeDragStart}
|
|
278
|
+
setSelectionDrag={setSelectionDrag}
|
|
279
|
+
/>
|
|
280
|
+
</div>
|
|
281
|
+
</div>
|
|
282
|
+
);
|
|
283
|
+
|
|
284
|
+
return (
|
|
285
|
+
// tabIndex makes the root focusable so clicks anywhere inside land focus
|
|
286
|
+
// here (nearest focusable ancestor) and the scoped key handler receives
|
|
287
|
+
// shortcuts; outline-none suppresses the focus ring this would add.
|
|
288
|
+
<div className="h-full bg-canvas-bg flex flex-col outline-none" tabIndex={-1} onKeyDown={handleKeyDown}>
|
|
289
|
+
<div className="flex-1 flex overflow-hidden">
|
|
290
|
+
<BuilderSidebar
|
|
291
|
+
canvasId={activeCanvasId}
|
|
292
|
+
activeTab={activeSidebarTab}
|
|
293
|
+
onTabChange={setActiveSidebarTab}
|
|
294
|
+
onAddNode={handleAddNode}
|
|
295
|
+
nodeDefinitions={nodeDefinitions}
|
|
296
|
+
getAllCategories={getAllCategories}
|
|
297
|
+
onSelectNode={selectNodeById}
|
|
298
|
+
onSelectEdge={selectEdgeById}
|
|
299
|
+
isFunctionCanvas={isFunctionCanvas}
|
|
300
|
+
functions={functions}
|
|
301
|
+
onOpenFunction={onOpenFunction}
|
|
302
|
+
onCreateFunction={onCreateFunction}
|
|
303
|
+
isDebugMode={isDebugMode}
|
|
304
|
+
/>
|
|
305
|
+
|
|
306
|
+
<div className="flex-1 flex flex-col h-full min-w-0">
|
|
307
|
+
{isDebugMode ? (
|
|
308
|
+
<ResizablePanelGroup direction="vertical">
|
|
309
|
+
<ResizablePanel defaultSize={75} minSize={30}>
|
|
310
|
+
{canvasArea}
|
|
311
|
+
</ResizablePanel>
|
|
312
|
+
<ResizableHandle withHandle />
|
|
313
|
+
<ResizablePanel defaultSize={25} minSize={10}>
|
|
314
|
+
<DebugConsolePanel />
|
|
315
|
+
</ResizablePanel>
|
|
316
|
+
</ResizablePanelGroup>
|
|
317
|
+
) : (
|
|
318
|
+
canvasArea
|
|
319
|
+
)}
|
|
320
|
+
</div>
|
|
321
|
+
|
|
322
|
+
<RightConfigPanel
|
|
323
|
+
canvasId={activeCanvasId}
|
|
324
|
+
isDebugMode={isDebugMode}
|
|
325
|
+
selectionDrag={selectionDrag}
|
|
326
|
+
getNodeDef={getNodeDefinition}
|
|
327
|
+
onNodeUpdate={graph.updateNode}
|
|
328
|
+
onNodeDelete={graph.deleteNode}
|
|
329
|
+
onEdgeUpdate={graph.updateEdge}
|
|
330
|
+
onEdgeDelete={handleDeleteEdge}
|
|
331
|
+
onClearSelection={clearSelection}
|
|
332
|
+
onTestNode={onTestNode}
|
|
333
|
+
onDebugStep={onDebugStep}
|
|
334
|
+
/>
|
|
335
|
+
</div>
|
|
336
|
+
</div>
|
|
337
|
+
);
|
|
338
|
+
};
|