@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
|
@@ -1,630 +1,634 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
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
|
-
const
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
//
|
|
95
|
-
const
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
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
|
-
|
|
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
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const
|
|
285
|
-
() => (nodeDefinition.outputs ?? []).filter((o): o is
|
|
286
|
-
[nodeDefinition],
|
|
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
|
-
//
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
const
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
const
|
|
352
|
-
if (
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
)
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
</
|
|
438
|
-
)
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
)
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
const
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
const
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
)
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
<
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
)
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
</
|
|
572
|
-
)
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
)
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
</
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
}
|
|
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 { Button } from "../components/ui/button";
|
|
6
|
+
import { AddButton } from "../components/ui/add-button";
|
|
7
|
+
import { ReadOnlyBanner } from "../components/ui/readonly-banner";
|
|
8
|
+
import { DeleteButton } from "../components/ui/delete-button";
|
|
9
|
+
import { Checkbox } from "../components/ui/checkbox";
|
|
10
|
+
import { Input } from "../components/ui/input";
|
|
11
|
+
import { Separator } from "../components/ui/separator";
|
|
12
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../components/ui/select";
|
|
13
|
+
import { ToggleGroup, ToggleGroupItem } from "../components/ui/toggle-group";
|
|
14
|
+
import {
|
|
15
|
+
NodeDefinition,
|
|
16
|
+
NodeData,
|
|
17
|
+
OutputBinding,
|
|
18
|
+
FunctionCallNode,
|
|
19
|
+
getArguments,
|
|
20
|
+
getNodeAvailableOutput,
|
|
21
|
+
getOutputBinding,
|
|
22
|
+
} from "@foresthubai/workflow-core/node";
|
|
23
|
+
import type { DataType, Reference } from "@foresthubai/workflow-core";
|
|
24
|
+
import type { StaticOutput, OutputList, OutputDeclaration } from "@foresthubai/workflow-core/parameter";
|
|
25
|
+
import { isParameterActive, Parameter } from "@foresthubai/workflow-core/parameter";
|
|
26
|
+
import { generateId } from "@foresthubai/workflow-core/id";
|
|
27
|
+
import { ArrowRight, ChevronRight, Plus, RefreshCw, Trash2 } from "lucide-react";
|
|
28
|
+
import { getOrCreateCanvasStore } from "../stores/canvasStore";
|
|
29
|
+
import { isNodeUsedAsTool } from "@foresthubai/workflow-core/node";
|
|
30
|
+
import { varKey, refToLookupKey } from "@foresthubai/workflow-core/variable";
|
|
31
|
+
import type { Diagnostic } from "@foresthubai/workflow-core/diagnostics";
|
|
32
|
+
import { Fragment, useCallback, useEffect, useMemo, useState } from "react";
|
|
33
|
+
import { useTranslation } from "react-i18next";
|
|
34
|
+
import ParameterEditor from "../inputs/ParameterEditor";
|
|
35
|
+
import { useDiagnosticsStore } from "../stores/diagnosticsStore";
|
|
36
|
+
import { useFunctionRegistry } from "../hooks/useFunctionRegistry";
|
|
37
|
+
import { useParamErrors } from "../hooks/useParamErrors";
|
|
38
|
+
import { buildFunctionNodeDef } from "../hooks/useNodeDefinitions";
|
|
39
|
+
import { useEditorStore } from "../stores/editorStore";
|
|
40
|
+
import { isReadOnly } from "../mode";
|
|
41
|
+
import { migrateFunctionCallNodes } from "../utils/migrateFunctionNodes";
|
|
42
|
+
import { getNodeDescription } from "../utils/translation";
|
|
43
|
+
import { useAvailableVariables } from "../hooks/useAvailableVariables";
|
|
44
|
+
|
|
45
|
+
interface NodeConfigPanelProps {
|
|
46
|
+
canvasId: string;
|
|
47
|
+
selectedNode: NodeData;
|
|
48
|
+
onNodeUpdate: (nodeId: string, updates: { arguments?: Record<string, unknown>; label?: string }) => void;
|
|
49
|
+
onNodeDelete: (nodeId: string) => void;
|
|
50
|
+
onClose: () => void;
|
|
51
|
+
onOpenTest: (nodeId: string) => void;
|
|
52
|
+
getNodeDef: (node: NodeData) => NodeDefinition | undefined;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export const NodeConfigPanel = ({
|
|
56
|
+
canvasId,
|
|
57
|
+
selectedNode,
|
|
58
|
+
onNodeUpdate,
|
|
59
|
+
onNodeDelete,
|
|
60
|
+
onClose,
|
|
61
|
+
onOpenTest,
|
|
62
|
+
getNodeDef,
|
|
63
|
+
}: NodeConfigPanelProps) => {
|
|
64
|
+
const { t } = useTranslation();
|
|
65
|
+
const readOnly = useEditorStore((s) => isReadOnly(s.builderMode));
|
|
66
|
+
|
|
67
|
+
// Local state for label input to preserve cursor position
|
|
68
|
+
const [localLabel, setLocalLabel] = useState(selectedNode.label || "");
|
|
69
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
setLocalLabel(selectedNode.label || "");
|
|
72
|
+
}, [selectedNode.id, selectedNode.label]);
|
|
73
|
+
|
|
74
|
+
// Check if FunctionCall node is stale (e.g. after undo reverted migration)
|
|
75
|
+
const functionId = selectedNode.type === "FunctionCall" ? (selectedNode as FunctionCallNode).functionInfo.id : null;
|
|
76
|
+
const { getFunction } = useFunctionRegistry();
|
|
77
|
+
const functionInfo = functionId ? getFunction(functionId) : undefined;
|
|
78
|
+
const isStaleFunction = (() => {
|
|
79
|
+
if (selectedNode.type !== "FunctionCall" || !functionInfo) return false;
|
|
80
|
+
const functionNode = selectedNode as FunctionCallNode;
|
|
81
|
+
return functionNode.functionInfo.version !== functionInfo.version;
|
|
82
|
+
})();
|
|
83
|
+
|
|
84
|
+
// Get node definition - for FunctionCallNodes, build from node's stored functionInfo
|
|
85
|
+
const nodeDefinition =
|
|
86
|
+
selectedNode.type === "FunctionCall"
|
|
87
|
+
? buildFunctionNodeDef({
|
|
88
|
+
...(selectedNode as FunctionCallNode).functionInfo,
|
|
89
|
+
name: functionInfo?.name ?? (selectedNode as FunctionCallNode).functionInfo.name,
|
|
90
|
+
})
|
|
91
|
+
: getNodeDef(selectedNode);
|
|
92
|
+
const cannotDelete = nodeDefinition?.isUnremovable ?? false;
|
|
93
|
+
|
|
94
|
+
// Detect whether this node is currently used as a tool input
|
|
95
|
+
const edges = getOrCreateCanvasStore(canvasId)((s) => s.edges);
|
|
96
|
+
const usedAsToolInput = useMemo(() => isNodeUsedAsTool(selectedNode.id, selectedNode, edges), [selectedNode, edges]);
|
|
97
|
+
|
|
98
|
+
// Read per-parameter error state from diagnostics store
|
|
99
|
+
const nodeDiags = useDiagnosticsStore((s) => s.byNodeId[selectedNode.id]);
|
|
100
|
+
const paramErrors = useParamErrors(nodeDiags);
|
|
101
|
+
|
|
102
|
+
if (!nodeDefinition) {
|
|
103
|
+
return (
|
|
104
|
+
<div className="p-4">
|
|
105
|
+
<p className="text-sm text-muted-foreground">{t("unknownNodeType", { type: selectedNode.type })}</p>
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
const allArguments = getArguments(selectedNode);
|
|
110
|
+
const parameters = nodeDefinition.parameters.filter((p) => isParameterActive(p, allArguments, usedAsToolInput));
|
|
111
|
+
// OutputsSection self-hides when there's nothing to render; gate on "has any output defined".
|
|
112
|
+
const hasAnyOutputs = (nodeDefinition.outputs ?? []).length > 0;
|
|
113
|
+
|
|
114
|
+
return (
|
|
115
|
+
<div className="p-4">
|
|
116
|
+
<div className="space-y-4">
|
|
117
|
+
<div className="flex items-center justify-between gap-2">
|
|
118
|
+
<div className="flex-1 min-w-0">
|
|
119
|
+
<div className="group flex items-center gap-1.5 rounded-md border border-transparent px-1.5 -mx-1.5 hover:border-input focus-within:border-input transition-colors">
|
|
120
|
+
<input
|
|
121
|
+
type="text"
|
|
122
|
+
title={t("nodeLabel")}
|
|
123
|
+
className="font-semibold text-lg bg-transparent w-full outline-none cursor-text py-0.5"
|
|
124
|
+
value={isFocused ? localLabel : localLabel || nodeDefinition.label}
|
|
125
|
+
readOnly={readOnly}
|
|
126
|
+
onFocus={() => {
|
|
127
|
+
if (readOnly) return;
|
|
128
|
+
setIsFocused(true);
|
|
129
|
+
if (!localLabel) {
|
|
130
|
+
setLocalLabel(nodeDefinition.label);
|
|
131
|
+
}
|
|
132
|
+
}}
|
|
133
|
+
onBlur={() => {
|
|
134
|
+
setIsFocused(false);
|
|
135
|
+
if (!localLabel || localLabel === nodeDefinition.label) {
|
|
136
|
+
setLocalLabel("");
|
|
137
|
+
onNodeUpdate(selectedNode.id, { label: undefined });
|
|
138
|
+
}
|
|
139
|
+
}}
|
|
140
|
+
onChange={(e) => {
|
|
141
|
+
setLocalLabel(e.target.value);
|
|
142
|
+
onNodeUpdate(selectedNode.id, { label: e.target.value });
|
|
143
|
+
}}
|
|
144
|
+
/>
|
|
145
|
+
</div>
|
|
146
|
+
<p className="text-sm text-muted-foreground">{getNodeDescription(t, nodeDefinition)}</p>
|
|
147
|
+
</div>
|
|
148
|
+
<Button variant="ghost" size="icon" className="shrink-0" onClick={onClose}>
|
|
149
|
+
<ChevronRight className="h-4 w-4" />
|
|
150
|
+
</Button>
|
|
151
|
+
</div>
|
|
152
|
+
|
|
153
|
+
{readOnly && <ReadOnlyBanner />}
|
|
154
|
+
|
|
155
|
+
{parameters.length > 0 && (
|
|
156
|
+
<>
|
|
157
|
+
<Separator />
|
|
158
|
+
<div className={`space-y-3 ${readOnly ? "pointer-events-none opacity-60" : ""}`}>
|
|
159
|
+
{parameters.map((param: Parameter) => (
|
|
160
|
+
<ParameterEditor
|
|
161
|
+
canvasId={canvasId}
|
|
162
|
+
key={param.id}
|
|
163
|
+
parameter={param}
|
|
164
|
+
value={allArguments[param.id]}
|
|
165
|
+
allArguments={allArguments}
|
|
166
|
+
onChange={(value) => onNodeUpdate(selectedNode.id, { arguments: { [param.id]: value } })}
|
|
167
|
+
errors={paramErrors.get(param.id)}
|
|
168
|
+
translationPrefix={`nodes.${selectedNode.type}`}
|
|
169
|
+
/>
|
|
170
|
+
))}
|
|
171
|
+
</div>
|
|
172
|
+
</>
|
|
173
|
+
)}
|
|
174
|
+
|
|
175
|
+
{!readOnly && isStaleFunction && (
|
|
176
|
+
<>
|
|
177
|
+
<Separator />
|
|
178
|
+
<Button
|
|
179
|
+
variant="outline"
|
|
180
|
+
className="w-full border-warning text-warning hover:bg-warning/10"
|
|
181
|
+
onClick={() => migrateFunctionCallNodes()}
|
|
182
|
+
>
|
|
183
|
+
<RefreshCw className="w-4 h-4 mr-2" />
|
|
184
|
+
{t("updateToLatestDefinition")}
|
|
185
|
+
</Button>
|
|
186
|
+
</>
|
|
187
|
+
)}
|
|
188
|
+
|
|
189
|
+
{!readOnly && hasAnyOutputs && !usedAsToolInput && (
|
|
190
|
+
<>
|
|
191
|
+
<Separator />
|
|
192
|
+
<OutputsSection
|
|
193
|
+
canvasId={canvasId}
|
|
194
|
+
node={selectedNode}
|
|
195
|
+
nodeDefinition={nodeDefinition}
|
|
196
|
+
onNodeUpdate={onNodeUpdate}
|
|
197
|
+
nodeDiags={nodeDiags}
|
|
198
|
+
/>
|
|
199
|
+
</>
|
|
200
|
+
)}
|
|
201
|
+
|
|
202
|
+
{!readOnly && selectedNode.type === "Agent" && (
|
|
203
|
+
<>
|
|
204
|
+
<Separator />
|
|
205
|
+
<Button variant="outline" className="w-full" onClick={() => onOpenTest(selectedNode.id)}>
|
|
206
|
+
{t("testAgent")}
|
|
207
|
+
</Button>
|
|
208
|
+
</>
|
|
209
|
+
)}
|
|
210
|
+
|
|
211
|
+
{!readOnly && !cannotDelete && (
|
|
212
|
+
<>
|
|
213
|
+
<Separator />
|
|
214
|
+
<DeleteButton onClick={() => onNodeDelete(selectedNode.id)}>{t("deleteNode")}</DeleteButton>
|
|
215
|
+
</>
|
|
216
|
+
)}
|
|
217
|
+
</div>
|
|
218
|
+
</div>
|
|
219
|
+
);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
// ============================================================================
|
|
223
|
+
// Outputs Section
|
|
224
|
+
// ============================================================================
|
|
225
|
+
//
|
|
226
|
+
// Single unified section for all of a node's outputs. Renders under one "OUTPUTS"
|
|
227
|
+
// header with sequential rows — no sub-sections, no per-list separator. Two row
|
|
228
|
+
// shapes live side by side here:
|
|
229
|
+
//
|
|
230
|
+
// 1. Static output row — rows for NodeDefinition.outputs.type === "static"
|
|
231
|
+
// (FunctionCall returns are just StaticOutputs — they
|
|
232
|
+
// flow through this same path). Active checkbox toggles
|
|
233
|
+
// binding.active; mode toggle picks emit vs. assign.
|
|
234
|
+
// 2. List declaration row — rows for each entry in an OutputList's backing array
|
|
235
|
+
// (mode: emit/assign, own dataType selector, own delete button)
|
|
236
|
+
//
|
|
237
|
+
// List outputs also render an "+ Add" button after their entries so new declarations
|
|
238
|
+
// can be appended. Errors on any row (static or list) apply a destructive ring using
|
|
239
|
+
// the same `outputId` key diagnostics.ts produces.
|
|
240
|
+
|
|
241
|
+
const DATA_TYPES: DataType[] = ["int", "float", "bool", "string"];
|
|
242
|
+
|
|
243
|
+
const DATA_TYPE_LABELS: Record<DataType, string> = {
|
|
244
|
+
int: "int",
|
|
245
|
+
float: "float",
|
|
246
|
+
bool: "bool",
|
|
247
|
+
string: "string",
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
/** Stable synthetic outputId used to key list-entry diagnostics (matches diagnostics.ts). */
|
|
251
|
+
function listEntryOutputId(listId: string, index: number): string {
|
|
252
|
+
return `${listId}[${index}]`;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
/** Convert an AvailableVariable into a canonical Reference (srcId + varId). */
|
|
256
|
+
function availableVarToRef(
|
|
257
|
+
v:
|
|
258
|
+
| { kind: "node"; nodeId: string; outputId: string }
|
|
259
|
+
| { kind: "declared"; uid: string }
|
|
260
|
+
| { kind: "fnarg"; uid: string },
|
|
261
|
+
): Reference {
|
|
262
|
+
if (v.kind === "node") return { srcId: v.nodeId, varId: v.outputId };
|
|
263
|
+
if (v.kind === "declared") return { srcId: "declared", varId: v.uid };
|
|
264
|
+
return { srcId: "fnarg", varId: v.uid };
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function OutputsSection({
|
|
268
|
+
canvasId,
|
|
269
|
+
node,
|
|
270
|
+
nodeDefinition,
|
|
271
|
+
onNodeUpdate,
|
|
272
|
+
nodeDiags,
|
|
273
|
+
}: {
|
|
274
|
+
canvasId: string;
|
|
275
|
+
node: NodeData;
|
|
276
|
+
nodeDefinition: NodeDefinition;
|
|
277
|
+
onNodeUpdate: (nodeId: string, updates: { arguments?: Record<string, unknown> }) => void;
|
|
278
|
+
nodeDiags: Diagnostic[] | undefined;
|
|
279
|
+
}) {
|
|
280
|
+
const { t } = useTranslation();
|
|
281
|
+
const { list: availableVars } = useAvailableVariables(canvasId);
|
|
282
|
+
const availableOutput = useMemo(() => getNodeAvailableOutput(node), [node]);
|
|
283
|
+
|
|
284
|
+
const staticOutputs = useMemo(
|
|
285
|
+
() => (nodeDefinition.outputs ?? []).filter((o): o is StaticOutput => o.type === "static"),
|
|
286
|
+
[nodeDefinition],
|
|
287
|
+
);
|
|
288
|
+
const listOutputs = useMemo(
|
|
289
|
+
() => (nodeDefinition.outputs ?? []).filter((o): o is OutputList => o.type === "list"),
|
|
290
|
+
[nodeDefinition],
|
|
291
|
+
);
|
|
292
|
+
|
|
293
|
+
// Collect diagnostics keyed by outputId so rows can look themselves up.
|
|
294
|
+
const outputErrors = useMemo(() => {
|
|
295
|
+
const map = new Map<string, string[]>();
|
|
296
|
+
if (!nodeDiags) return map;
|
|
297
|
+
for (const d of nodeDiags) {
|
|
298
|
+
if (d.outputId && d.severity === "error") {
|
|
299
|
+
const arr = map.get(d.outputId);
|
|
300
|
+
if (arr) arr.push(d.message);
|
|
301
|
+
else map.set(d.outputId, [d.message]);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return map;
|
|
305
|
+
}, [nodeDiags]);
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Write a binding for a static output (or FunctionCall return). List entries
|
|
309
|
+
* have their own update path via `replaceListEntry`.
|
|
310
|
+
*/
|
|
311
|
+
const updateStaticBinding = useCallback(
|
|
312
|
+
(key: string, binding: OutputBinding) => {
|
|
313
|
+
onNodeUpdate(node.id, { arguments: { [key]: binding } });
|
|
314
|
+
},
|
|
315
|
+
[node.id, onNodeUpdate],
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
const writeListEntries = useCallback(
|
|
319
|
+
(listId: string, next: OutputDeclaration[]) => onNodeUpdate(node.id, { arguments: { [listId]: next } }),
|
|
320
|
+
[node.id, onNodeUpdate],
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
// Filter available vars to matching dataType, excluding this node's own outputs
|
|
324
|
+
// (a node can't assign its own output back into itself).
|
|
325
|
+
const filterCompatible = useCallback(
|
|
326
|
+
(dataType: DataType) =>
|
|
327
|
+
availableVars.filter((v) => v.dataType === dataType && !("nodeId" in v && v.nodeId === node.id)),
|
|
328
|
+
[availableVars, node.id],
|
|
329
|
+
);
|
|
330
|
+
|
|
331
|
+
// Any rows to show? Early-exit so the parent panel doesn't render an empty section.
|
|
332
|
+
if (staticOutputs.length === 0 && listOutputs.length === 0) return null;
|
|
333
|
+
|
|
334
|
+
// --- Row renderer: static output / FunctionCall return ------------------------------
|
|
335
|
+
// UX shape:
|
|
336
|
+
// ┌─ card ────────────────────────────────────────┐
|
|
337
|
+
// │ [☑] label dataType │
|
|
338
|
+
// │ [emit | assign] [ name OR variable picker ] │
|
|
339
|
+
// └────────────────────────────────────────────────┘
|
|
340
|
+
// Checkbox sits inline with the label (so the card width matches list-entry rows
|
|
341
|
+
// which have no checkbox). Toggles `binding.active`; mode/name/target are kept as
|
|
342
|
+
// draft state when inactive so off→on round-trips identically. Body is dimmed and
|
|
343
|
+
// pointer-event-disabled while inactive.
|
|
344
|
+
const renderStaticRow = (key: string, output: { name: string; dataType: DataType }, displayLabel: string) => {
|
|
345
|
+
const binding = getOutputBinding(node, key) ?? ({ active: true, mode: "emit", name: output.name } as OutputBinding);
|
|
346
|
+
const compatibleVars = filterCompatible(output.dataType);
|
|
347
|
+
const errors = outputErrors.get(key);
|
|
348
|
+
const hasError = !!errors?.length;
|
|
349
|
+
const enabled = binding.active;
|
|
350
|
+
|
|
351
|
+
const setEnabled = (next: boolean) => {
|
|
352
|
+
if (next === enabled) return;
|
|
353
|
+
updateStaticBinding(key, { ...binding, active: next });
|
|
354
|
+
};
|
|
355
|
+
const setMode = (mode: "emit" | "assign") => {
|
|
356
|
+
if (mode === binding.mode) return;
|
|
357
|
+
if (mode === "emit") updateStaticBinding(key, { active: binding.active, mode: "emit", name: output.name });
|
|
358
|
+
else updateStaticBinding(key, { active: binding.active, mode: "assign", target: { srcId: "", varId: "" } });
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
return (
|
|
362
|
+
<div
|
|
363
|
+
key={key}
|
|
364
|
+
className={`rounded-lg bg-card shadow-sm border p-2 space-y-2 transition-all hover:shadow-md ${hasError ? "border-destructive ring-1 ring-destructive" : "border-border"}`}
|
|
365
|
+
>
|
|
366
|
+
<div className="flex items-center gap-2">
|
|
367
|
+
<Checkbox
|
|
368
|
+
checked={enabled}
|
|
369
|
+
onCheckedChange={(c) => setEnabled(c === true)}
|
|
370
|
+
aria-label={t("outputBinding.enable", "Enable output")}
|
|
371
|
+
className="shrink-0"
|
|
372
|
+
/>
|
|
373
|
+
<span className={`text-xs font-medium flex-1 truncate ${enabled ? "" : "opacity-50"}`}>{displayLabel}</span>
|
|
374
|
+
<span className={`text-xs text-muted-foreground ${enabled ? "" : "opacity-50"}`}>
|
|
375
|
+
{DATA_TYPE_LABELS[output.dataType]}
|
|
376
|
+
</span>
|
|
377
|
+
</div>
|
|
378
|
+
<div className={enabled ? "" : "opacity-50"}>
|
|
379
|
+
<div className={`flex items-center gap-2 ${enabled ? "" : "pointer-events-none"}`}>
|
|
380
|
+
<ToggleGroup
|
|
381
|
+
type="single"
|
|
382
|
+
value={binding.mode}
|
|
383
|
+
onValueChange={(v) => v && setMode(v as "emit" | "assign")}
|
|
384
|
+
className="gap-0"
|
|
385
|
+
>
|
|
386
|
+
<ToggleGroupItem
|
|
387
|
+
value="emit"
|
|
388
|
+
size="sm"
|
|
389
|
+
variant="outline"
|
|
390
|
+
className="h-7 w-7 p-0 rounded-r-none"
|
|
391
|
+
aria-label={t("outputBinding.emit", "Emit")}
|
|
392
|
+
title={t("outputBinding.emit", "Emit")}
|
|
393
|
+
>
|
|
394
|
+
<Plus className="w-3.5 h-3.5" />
|
|
395
|
+
</ToggleGroupItem>
|
|
396
|
+
<ToggleGroupItem
|
|
397
|
+
value="assign"
|
|
398
|
+
size="sm"
|
|
399
|
+
variant="outline"
|
|
400
|
+
className="h-7 w-7 p-0 rounded-l-none -ml-px"
|
|
401
|
+
aria-label={t("outputBinding.assign", "Assign")}
|
|
402
|
+
title={t("outputBinding.assign", "Assign")}
|
|
403
|
+
>
|
|
404
|
+
<ArrowRight className="w-3.5 h-3.5" />
|
|
405
|
+
</ToggleGroupItem>
|
|
406
|
+
</ToggleGroup>
|
|
407
|
+
|
|
408
|
+
{binding.mode === "emit" ? (
|
|
409
|
+
<Input
|
|
410
|
+
className="h-7 text-xs flex-1"
|
|
411
|
+
value={binding.name}
|
|
412
|
+
disabled={!enabled}
|
|
413
|
+
onChange={(e) =>
|
|
414
|
+
updateStaticBinding(key, { active: binding.active, mode: "emit", name: e.target.value })
|
|
415
|
+
}
|
|
416
|
+
/>
|
|
417
|
+
) : compatibleVars.length > 0 ? (
|
|
418
|
+
<Select
|
|
419
|
+
value={binding.target.srcId ? refToLookupKey(binding.target) : ""}
|
|
420
|
+
onValueChange={(lookupKey) => {
|
|
421
|
+
const v = availableVars.find((av) => varKey(av) === lookupKey);
|
|
422
|
+
if (!v) return;
|
|
423
|
+
updateStaticBinding(key, { active: binding.active, mode: "assign", target: availableVarToRef(v) });
|
|
424
|
+
}}
|
|
425
|
+
disabled={!enabled}
|
|
426
|
+
>
|
|
427
|
+
<SelectTrigger className="h-7 text-xs flex-1">
|
|
428
|
+
<SelectValue placeholder={t("outputBinding.selectVariable", "Select variable...")} />
|
|
429
|
+
</SelectTrigger>
|
|
430
|
+
<SelectContent>
|
|
431
|
+
{compatibleVars.map((v) => (
|
|
432
|
+
<SelectItem key={varKey(v)} value={varKey(v)}>
|
|
433
|
+
{v.name}
|
|
434
|
+
</SelectItem>
|
|
435
|
+
))}
|
|
436
|
+
</SelectContent>
|
|
437
|
+
</Select>
|
|
438
|
+
) : (
|
|
439
|
+
<span className="text-xs text-muted-foreground italic flex-1">
|
|
440
|
+
{t("outputBinding.noCompatibleVariables", "No compatible variables")}
|
|
441
|
+
</span>
|
|
442
|
+
)}
|
|
443
|
+
</div>
|
|
444
|
+
{hasError && (
|
|
445
|
+
<div className="space-y-0.5">
|
|
446
|
+
{errors.map((msg, i) => (
|
|
447
|
+
<p key={i} className="text-xs text-destructive">
|
|
448
|
+
{msg}
|
|
449
|
+
</p>
|
|
450
|
+
))}
|
|
451
|
+
</div>
|
|
452
|
+
)}
|
|
453
|
+
</div>
|
|
454
|
+
</div>
|
|
455
|
+
);
|
|
456
|
+
};
|
|
457
|
+
|
|
458
|
+
// --- Row renderer: list declaration entry ------------------------------------------
|
|
459
|
+
const renderListEntryRow = (listId: string, entries: OutputDeclaration[], index: number) => {
|
|
460
|
+
const entry = entries[index];
|
|
461
|
+
if (!entry) return null;
|
|
462
|
+
const compatibleVars = filterCompatible(entry.dataType);
|
|
463
|
+
const outputId = listEntryOutputId(listId, index);
|
|
464
|
+
const errors = outputErrors.get(outputId);
|
|
465
|
+
const hasError = !!errors?.length;
|
|
466
|
+
|
|
467
|
+
const replace = (next: OutputDeclaration) =>
|
|
468
|
+
writeListEntries(
|
|
469
|
+
listId,
|
|
470
|
+
entries.map((e, i) => (i === index ? next : e)),
|
|
471
|
+
);
|
|
472
|
+
const remove = () =>
|
|
473
|
+
writeListEntries(
|
|
474
|
+
listId,
|
|
475
|
+
entries.filter((_, i) => i !== index),
|
|
476
|
+
);
|
|
477
|
+
// Mode flip preserves name + dataType — the user already typed/picked them.
|
|
478
|
+
// emit↔assign only swaps the trailing payload (uid vs target).
|
|
479
|
+
const changeMode = (newMode: "emit" | "assign") => {
|
|
480
|
+
if (entry.mode === newMode) return;
|
|
481
|
+
if (newMode === "emit") {
|
|
482
|
+
replace({ mode: "emit", uid: generateId(), name: entry.name, dataType: entry.dataType });
|
|
483
|
+
} else {
|
|
484
|
+
replace({ mode: "assign", name: entry.name, dataType: entry.dataType, target: { srcId: "", varId: "" } });
|
|
485
|
+
}
|
|
486
|
+
};
|
|
487
|
+
const changeName = (name: string) => replace({ ...entry, name });
|
|
488
|
+
const changeDataType = (dt: DataType) => replace({ ...entry, dataType: dt });
|
|
489
|
+
|
|
490
|
+
return (
|
|
491
|
+
<div
|
|
492
|
+
key={`${listId}-${entry.mode === "emit" ? entry.uid : `assign-${index}`}`}
|
|
493
|
+
className={`rounded-lg bg-card shadow-sm border p-2 space-y-2 transition-all hover:shadow-md ${hasError ? "border-destructive ring-1 ring-destructive" : "border-border"}`}
|
|
494
|
+
>
|
|
495
|
+
<div className="flex items-center gap-2">
|
|
496
|
+
{/* Row 1 mirrors OutputBinding's header: leading control (trash↔checkbox),
|
|
497
|
+
name (editable here, label-only there), dataType (editable here, RO there). */}
|
|
498
|
+
<Button variant="ghost" size="icon" className="h-7 w-7 shrink-0" onClick={remove}>
|
|
499
|
+
<Trash2 className="w-3.5 h-3.5" />
|
|
500
|
+
</Button>
|
|
501
|
+
<Input
|
|
502
|
+
className="h-7 text-xs flex-1"
|
|
503
|
+
value={entry.name}
|
|
504
|
+
placeholder={t("outputBinding.name", "Name")}
|
|
505
|
+
onChange={(e) => changeName(e.target.value)}
|
|
506
|
+
/>
|
|
507
|
+
<Select value={entry.dataType} onValueChange={(dt: DataType) => changeDataType(dt)}>
|
|
508
|
+
<SelectTrigger className="h-7 text-xs w-20">
|
|
509
|
+
<SelectValue />
|
|
510
|
+
</SelectTrigger>
|
|
511
|
+
<SelectContent>
|
|
512
|
+
{DATA_TYPES.map((dt) => (
|
|
513
|
+
<SelectItem key={dt} value={dt}>
|
|
514
|
+
{dt}
|
|
515
|
+
</SelectItem>
|
|
516
|
+
))}
|
|
517
|
+
</SelectContent>
|
|
518
|
+
</Select>
|
|
519
|
+
</div>
|
|
520
|
+
<div className="flex items-center gap-2">
|
|
521
|
+
<ToggleGroup
|
|
522
|
+
type="single"
|
|
523
|
+
value={entry.mode}
|
|
524
|
+
onValueChange={(v) => v && changeMode(v as "emit" | "assign")}
|
|
525
|
+
className="gap-0"
|
|
526
|
+
>
|
|
527
|
+
<ToggleGroupItem
|
|
528
|
+
value="emit"
|
|
529
|
+
size="sm"
|
|
530
|
+
variant="outline"
|
|
531
|
+
className="h-7 w-7 p-0 rounded-r-none"
|
|
532
|
+
aria-label={t("outputBinding.emit", "Emit")}
|
|
533
|
+
title={t("outputBinding.emit", "Emit")}
|
|
534
|
+
>
|
|
535
|
+
<Plus className="w-3.5 h-3.5" />
|
|
536
|
+
</ToggleGroupItem>
|
|
537
|
+
<ToggleGroupItem
|
|
538
|
+
value="assign"
|
|
539
|
+
size="sm"
|
|
540
|
+
variant="outline"
|
|
541
|
+
className="h-7 w-7 p-0 rounded-l-none -ml-px"
|
|
542
|
+
aria-label={t("outputBinding.assign", "Assign")}
|
|
543
|
+
title={t("outputBinding.assign", "Assign")}
|
|
544
|
+
>
|
|
545
|
+
<ArrowRight className="w-3.5 h-3.5" />
|
|
546
|
+
</ToggleGroupItem>
|
|
547
|
+
</ToggleGroup>
|
|
548
|
+
{entry.mode === "emit" ? (
|
|
549
|
+
<span className="text-xs text-muted-foreground italic flex-1">
|
|
550
|
+
{t("outputBinding.emitHint", "creates new variable in scope")}
|
|
551
|
+
</span>
|
|
552
|
+
) : compatibleVars.length > 0 ? (
|
|
553
|
+
<Select
|
|
554
|
+
value={entry.target.srcId ? refToLookupKey(entry.target) : ""}
|
|
555
|
+
onValueChange={(lookupKey) => {
|
|
556
|
+
const v = availableVars.find((av) => varKey(av) === lookupKey);
|
|
557
|
+
if (!v) return;
|
|
558
|
+
replace({ ...entry, target: availableVarToRef(v) });
|
|
559
|
+
}}
|
|
560
|
+
>
|
|
561
|
+
<SelectTrigger className="h-7 text-xs flex-1">
|
|
562
|
+
<SelectValue placeholder={t("outputBinding.selectVariable", "Select variable...")} />
|
|
563
|
+
</SelectTrigger>
|
|
564
|
+
<SelectContent>
|
|
565
|
+
{compatibleVars.map((v) => (
|
|
566
|
+
<SelectItem key={varKey(v)} value={varKey(v)}>
|
|
567
|
+
{v.name}
|
|
568
|
+
</SelectItem>
|
|
569
|
+
))}
|
|
570
|
+
</SelectContent>
|
|
571
|
+
</Select>
|
|
572
|
+
) : (
|
|
573
|
+
<span className="text-xs text-muted-foreground italic flex-1">
|
|
574
|
+
{t("outputBinding.noCompatibleVariables", "No compatible variables")}
|
|
575
|
+
</span>
|
|
576
|
+
)}
|
|
577
|
+
</div>
|
|
578
|
+
{hasError && (
|
|
579
|
+
<div className="space-y-0.5">
|
|
580
|
+
{errors.map((msg, i) => (
|
|
581
|
+
<p key={i} className="text-xs text-destructive">
|
|
582
|
+
{msg}
|
|
583
|
+
</p>
|
|
584
|
+
))}
|
|
585
|
+
</div>
|
|
586
|
+
)}
|
|
587
|
+
</div>
|
|
588
|
+
);
|
|
589
|
+
};
|
|
590
|
+
|
|
591
|
+
const addListEntry = (listId: string, entries: OutputDeclaration[]) => {
|
|
592
|
+
const fresh: OutputDeclaration = {
|
|
593
|
+
mode: "emit",
|
|
594
|
+
uid: generateId(),
|
|
595
|
+
name: `output${entries.length + 1}`,
|
|
596
|
+
dataType: "string",
|
|
597
|
+
};
|
|
598
|
+
writeListEntries(listId, [...entries, fresh]);
|
|
599
|
+
};
|
|
600
|
+
|
|
601
|
+
return (
|
|
602
|
+
<div className="space-y-2">
|
|
603
|
+
<p className="text-xs font-medium text-muted-foreground uppercase tracking-wide">{t("outputs", "Outputs")}</p>
|
|
604
|
+
<div className="space-y-2">
|
|
605
|
+
{/* Static outputs from the node definition (FunctionCall returns flow here too). */}
|
|
606
|
+
{staticOutputs.map((out) => {
|
|
607
|
+
const output = availableOutput[out.id];
|
|
608
|
+
if (!output) return null;
|
|
609
|
+
return renderStaticRow(out.id, output, out.label);
|
|
610
|
+
})}
|
|
611
|
+
|
|
612
|
+
{/* List outputs — each list gets a minor subheader (its label), then its entries,
|
|
613
|
+
then an "Add" button. The subheader also serves as the visual boundary between
|
|
614
|
+
static outputs above and list entries below. */}
|
|
615
|
+
{listOutputs.map((out) => {
|
|
616
|
+
const entries =
|
|
617
|
+
((node.arguments as Record<string, unknown>)[out.id] as OutputDeclaration[] | undefined) ?? [];
|
|
618
|
+
return (
|
|
619
|
+
<Fragment key={out.id}>
|
|
620
|
+
<div className="flex items-center gap-2 pt-1">
|
|
621
|
+
<span className="text-[11px] font-medium text-muted-foreground">{out.label}</span>
|
|
622
|
+
<div className="flex-1 h-px bg-border/60" />
|
|
623
|
+
</div>
|
|
624
|
+
{entries.map((_, index) => renderListEntryRow(out.id, entries, index))}
|
|
625
|
+
<AddButton onClick={() => addListEntry(out.id, entries)}>
|
|
626
|
+
{t("addOutput", { label: out.label, defaultValue: `Add ${out.label.toLowerCase()}` })}
|
|
627
|
+
</AddButton>
|
|
628
|
+
</Fragment>
|
|
629
|
+
);
|
|
630
|
+
})}
|
|
631
|
+
</div>
|
|
632
|
+
</div>
|
|
633
|
+
);
|
|
634
|
+
}
|