@foresthubai/workflow-builder 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +661 -0
- package/NOTICE +16 -0
- package/README.md +93 -0
- package/dist/BuilderLayout.d.ts +34 -0
- package/dist/BuilderLayout.d.ts.map +1 -0
- package/dist/BuilderLayout.js +172 -0
- package/dist/BuilderLayout.js.map +1 -0
- package/dist/Canvas.d.ts +23 -0
- package/dist/Canvas.d.ts.map +1 -0
- package/dist/Canvas.js +141 -0
- package/dist/Canvas.js.map +1 -0
- package/dist/CanvasEditor.d.ts +46 -0
- package/dist/CanvasEditor.d.ts.map +1 -0
- package/dist/CanvasEditor.js +57 -0
- package/dist/CanvasEditor.js.map +1 -0
- package/dist/CanvasTabsToolbar.d.ts +11 -0
- package/dist/CanvasTabsToolbar.d.ts.map +1 -0
- package/dist/CanvasTabsToolbar.js +101 -0
- package/dist/CanvasTabsToolbar.js.map +1 -0
- package/dist/RightConfigPanel.d.ts +27 -0
- package/dist/RightConfigPanel.d.ts.map +1 -0
- package/dist/RightConfigPanel.js +102 -0
- package/dist/RightConfigPanel.js.map +1 -0
- package/dist/WorkflowBuilder.d.ts +62 -0
- package/dist/WorkflowBuilder.d.ts.map +1 -0
- package/dist/WorkflowBuilder.js +275 -0
- package/dist/WorkflowBuilder.js.map +1 -0
- package/dist/cn.d.ts +3 -0
- package/dist/cn.d.ts.map +1 -0
- package/dist/cn.js +6 -0
- package/dist/cn.js.map +1 -0
- package/dist/components/ui/add-button.d.ts +16 -0
- package/dist/components/ui/add-button.d.ts.map +1 -0
- package/dist/components/ui/add-button.js +21 -0
- package/dist/components/ui/add-button.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +21 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +30 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/alert.d.ts +9 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +23 -0
- package/dist/components/ui/alert.js.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +21 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +40 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +17 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/checkbox.d.ts +5 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +9 -0
- package/dist/components/ui/checkbox.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +6 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/command.d.ts +82 -0
- package/dist/components/ui/command.d.ts.map +1 -0
- package/dist/components/ui/command.js +29 -0
- package/dist/components/ui/command.js.map +1 -0
- package/dist/components/ui/delete-button.d.ts +11 -0
- package/dist/components/ui/delete-button.d.ts.map +1 -0
- package/dist/components/ui/delete-button.js +14 -0
- package/dist/components/ui/delete-button.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +22 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +27 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +28 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +36 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/input.d.ts +13 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +34 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/label.d.ts +6 -0
- package/dist/components/ui/label.d.ts.map +1 -0
- package/dist/components/ui/label.js +10 -0
- package/dist/components/ui/label.js.map +1 -0
- package/dist/components/ui/readonly-banner.d.ts +7 -0
- package/dist/components/ui/readonly-banner.d.ts.map +1 -0
- package/dist/components/ui/readonly-banner.js +12 -0
- package/dist/components/ui/readonly-banner.js.map +1 -0
- package/dist/components/ui/resizable.d.ts +24 -0
- package/dist/components/ui/resizable.d.ts.map +1 -0
- package/dist/components/ui/resizable.js +9 -0
- package/dist/components/ui/resizable.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +45 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +27 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +14 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +30 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +8 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/switch.d.ts +5 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +8 -0
- package/dist/components/ui/switch.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +12 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +34 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/toast.d.ts +16 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +34 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/dist/components/ui/toaster.d.ts +2 -0
- package/dist/components/ui/toaster.d.ts.map +1 -0
- package/dist/components/ui/toaster.js +10 -0
- package/dist/components/ui/toaster.js.map +1 -0
- package/dist/components/ui/toggle-group.d.ts +13 -0
- package/dist/components/ui/toggle-group.d.ts.map +1 -0
- package/dist/components/ui/toggle-group.js +21 -0
- package/dist/components/ui/toggle-group.js.map +1 -0
- package/dist/components/ui/toggle.d.ts +13 -0
- package/dist/components/ui/toggle.d.ts.map +1 -0
- package/dist/components/ui/toggle.js +26 -0
- package/dist/components/ui/toggle.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +14 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/dialogs/NodePickerDialog.d.ts +10 -0
- package/dist/dialogs/NodePickerDialog.d.ts.map +1 -0
- package/dist/dialogs/NodePickerDialog.js +39 -0
- package/dist/dialogs/NodePickerDialog.js.map +1 -0
- package/dist/dialogs/ValidationDialog.d.ts +17 -0
- package/dist/dialogs/ValidationDialog.d.ts.map +1 -0
- package/dist/dialogs/ValidationDialog.js +29 -0
- package/dist/dialogs/ValidationDialog.js.map +1 -0
- package/dist/graph/BaseNode.d.ts +9 -0
- package/dist/graph/BaseNode.d.ts.map +1 -0
- package/dist/graph/BaseNode.js +318 -0
- package/dist/graph/BaseNode.js.map +1 -0
- package/dist/graph/CustomEdge.d.ts +14 -0
- package/dist/graph/CustomEdge.d.ts.map +1 -0
- package/dist/graph/CustomEdge.js +107 -0
- package/dist/graph/CustomEdge.js.map +1 -0
- package/dist/graph/CustomNode.d.ts +3 -0
- package/dist/graph/CustomNode.d.ts.map +1 -0
- package/dist/graph/CustomNode.js +15 -0
- package/dist/graph/CustomNode.js.map +1 -0
- package/dist/graph/FunctionCallNode.d.ts +3 -0
- package/dist/graph/FunctionCallNode.d.ts.map +1 -0
- package/dist/graph/FunctionCallNode.js +25 -0
- package/dist/graph/FunctionCallNode.js.map +1 -0
- package/dist/graph/PortHandle.d.ts +21 -0
- package/dist/graph/PortHandle.d.ts.map +1 -0
- package/dist/graph/PortHandle.js +113 -0
- package/dist/graph/PortHandle.js.map +1 -0
- package/dist/graph/reactFlowRegistry.d.ts +65 -0
- package/dist/graph/reactFlowRegistry.d.ts.map +1 -0
- package/dist/graph/reactFlowRegistry.js +24 -0
- package/dist/graph/reactFlowRegistry.js.map +1 -0
- package/dist/hooks/use-toast.d.ts +47 -0
- package/dist/hooks/use-toast.d.ts.map +1 -0
- package/dist/hooks/use-toast.js +95 -0
- package/dist/hooks/use-toast.js.map +1 -0
- package/dist/hooks/useAvailableVariables.d.ts +12 -0
- package/dist/hooks/useAvailableVariables.d.ts.map +1 -0
- package/dist/hooks/useAvailableVariables.js +16 -0
- package/dist/hooks/useAvailableVariables.js.map +1 -0
- package/dist/hooks/useCanvasHistory.d.ts +14 -0
- package/dist/hooks/useCanvasHistory.d.ts.map +1 -0
- package/dist/hooks/useCanvasHistory.js +20 -0
- package/dist/hooks/useCanvasHistory.js.map +1 -0
- package/dist/hooks/useCanvasTabs.d.ts +23 -0
- package/dist/hooks/useCanvasTabs.d.ts.map +1 -0
- package/dist/hooks/useCanvasTabs.js +136 -0
- package/dist/hooks/useCanvasTabs.js.map +1 -0
- package/dist/hooks/useFunctionDiagnosticsSync.d.ts +14 -0
- package/dist/hooks/useFunctionDiagnosticsSync.d.ts.map +1 -0
- package/dist/hooks/useFunctionDiagnosticsSync.js +38 -0
- package/dist/hooks/useFunctionDiagnosticsSync.js.map +1 -0
- package/dist/hooks/useFunctionRegistry.d.ts +15 -0
- package/dist/hooks/useFunctionRegistry.d.ts.map +1 -0
- package/dist/hooks/useFunctionRegistry.js +22 -0
- package/dist/hooks/useFunctionRegistry.js.map +1 -0
- package/dist/hooks/useFunctions.d.ts +15 -0
- package/dist/hooks/useFunctions.d.ts.map +1 -0
- package/dist/hooks/useFunctions.js +34 -0
- package/dist/hooks/useFunctions.js.map +1 -0
- package/dist/hooks/useGraph.d.ts +40 -0
- package/dist/hooks/useGraph.d.ts.map +1 -0
- package/dist/hooks/useGraph.js +102 -0
- package/dist/hooks/useGraph.js.map +1 -0
- package/dist/hooks/useNodeDefinitions.d.ts +17 -0
- package/dist/hooks/useNodeDefinitions.d.ts.map +1 -0
- package/dist/hooks/useNodeDefinitions.js +65 -0
- package/dist/hooks/useNodeDefinitions.js.map +1 -0
- package/dist/hooks/useParamErrors.d.ts +12 -0
- package/dist/hooks/useParamErrors.d.ts.map +1 -0
- package/dist/hooks/useParamErrors.js +28 -0
- package/dist/hooks/useParamErrors.js.map +1 -0
- package/dist/hooks/useResolvedTheme.d.ts +10 -0
- package/dist/hooks/useResolvedTheme.d.ts.map +1 -0
- package/dist/hooks/useResolvedTheme.js +29 -0
- package/dist/hooks/useResolvedTheme.js.map +1 -0
- package/dist/hooks/useResourceDiagnosticsSync.d.ts +40 -0
- package/dist/hooks/useResourceDiagnosticsSync.d.ts.map +1 -0
- package/dist/hooks/useResourceDiagnosticsSync.js +39 -0
- package/dist/hooks/useResourceDiagnosticsSync.js.map +1 -0
- package/dist/hooks/useSuppressThemeTransition.d.ts +32 -0
- package/dist/hooks/useSuppressThemeTransition.d.ts.map +1 -0
- package/dist/hooks/useSuppressThemeTransition.js +75 -0
- package/dist/hooks/useSuppressThemeTransition.js.map +1 -0
- package/dist/hooks/useWorkflowSerialization.d.ts +24 -0
- package/dist/hooks/useWorkflowSerialization.d.ts.map +1 -0
- package/dist/hooks/useWorkflowSerialization.js +113 -0
- package/dist/hooks/useWorkflowSerialization.js.map +1 -0
- package/dist/i18n/index.d.ts +4 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +46 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/locales/de.json +501 -0
- package/dist/i18n/locales/en.json +557 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/inputs/ExpressionInput.d.ts +12 -0
- package/dist/inputs/ExpressionInput.d.ts.map +1 -0
- package/dist/inputs/ExpressionInput.js +203 -0
- package/dist/inputs/ExpressionInput.js.map +1 -0
- package/dist/inputs/ParameterEditor.d.ts +13 -0
- package/dist/inputs/ParameterEditor.d.ts.map +1 -0
- package/dist/inputs/ParameterEditor.js +204 -0
- package/dist/inputs/ParameterEditor.js.map +1 -0
- package/dist/inputs/PortSection.d.ts +31 -0
- package/dist/inputs/PortSection.d.ts.map +1 -0
- package/dist/inputs/PortSection.js +26 -0
- package/dist/inputs/PortSection.js.map +1 -0
- package/dist/panels/BuilderSidebar.d.ts +24 -0
- package/dist/panels/BuilderSidebar.d.ts.map +1 -0
- package/dist/panels/BuilderSidebar.js +202 -0
- package/dist/panels/BuilderSidebar.js.map +1 -0
- package/dist/panels/ChannelConfigPanel.d.ts +8 -0
- package/dist/panels/ChannelConfigPanel.d.ts.map +1 -0
- package/dist/panels/ChannelConfigPanel.js +26 -0
- package/dist/panels/ChannelConfigPanel.js.map +1 -0
- package/dist/panels/ChannelsPanel.d.ts +2 -0
- package/dist/panels/ChannelsPanel.d.ts.map +1 -0
- package/dist/panels/ChannelsPanel.js +16 -0
- package/dist/panels/ChannelsPanel.js.map +1 -0
- package/dist/panels/DebugConsolePanel.d.ts +2 -0
- package/dist/panels/DebugConsolePanel.d.ts.map +1 -0
- package/dist/panels/DebugConsolePanel.js +32 -0
- package/dist/panels/DebugConsolePanel.js.map +1 -0
- package/dist/panels/DebugContextPanel.d.ts +2 -0
- package/dist/panels/DebugContextPanel.d.ts.map +1 -0
- package/dist/panels/DebugContextPanel.js +32 -0
- package/dist/panels/DebugContextPanel.js.map +1 -0
- package/dist/panels/DebugExternalIOPanel.d.ts +9 -0
- package/dist/panels/DebugExternalIOPanel.d.ts.map +1 -0
- package/dist/panels/DebugExternalIOPanel.js +66 -0
- package/dist/panels/DebugExternalIOPanel.js.map +1 -0
- package/dist/panels/DiagnosticsPanel.d.ts +8 -0
- package/dist/panels/DiagnosticsPanel.d.ts.map +1 -0
- package/dist/panels/DiagnosticsPanel.js +86 -0
- package/dist/panels/DiagnosticsPanel.js.map +1 -0
- package/dist/panels/EdgeConfigPanel.d.ts +14 -0
- package/dist/panels/EdgeConfigPanel.d.ts.map +1 -0
- package/dist/panels/EdgeConfigPanel.js +34 -0
- package/dist/panels/EdgeConfigPanel.js.map +1 -0
- package/dist/panels/FunctionConfigPanel.d.ts +16 -0
- package/dist/panels/FunctionConfigPanel.d.ts.map +1 -0
- package/dist/panels/FunctionConfigPanel.js +62 -0
- package/dist/panels/FunctionConfigPanel.js.map +1 -0
- package/dist/panels/FunctionListPanel.d.ts +14 -0
- package/dist/panels/FunctionListPanel.d.ts.map +1 -0
- package/dist/panels/FunctionListPanel.js +25 -0
- package/dist/panels/FunctionListPanel.js.map +1 -0
- package/dist/panels/MemoryConfigPanel.d.ts +8 -0
- package/dist/panels/MemoryConfigPanel.d.ts.map +1 -0
- package/dist/panels/MemoryConfigPanel.js +22 -0
- package/dist/panels/MemoryConfigPanel.js.map +1 -0
- package/dist/panels/MemoryPanel.d.ts +2 -0
- package/dist/panels/MemoryPanel.d.ts.map +1 -0
- package/dist/panels/MemoryPanel.js +25 -0
- package/dist/panels/MemoryPanel.js.map +1 -0
- package/dist/panels/ModelConfigPanel.d.ts +8 -0
- package/dist/panels/ModelConfigPanel.d.ts.map +1 -0
- package/dist/panels/ModelConfigPanel.js +14 -0
- package/dist/panels/ModelConfigPanel.js.map +1 -0
- package/dist/panels/ModelsPanel.d.ts +8 -0
- package/dist/panels/ModelsPanel.d.ts.map +1 -0
- package/dist/panels/ModelsPanel.js +24 -0
- package/dist/panels/ModelsPanel.js.map +1 -0
- package/dist/panels/NodeConfigPanel.d.ts +16 -0
- package/dist/panels/NodeConfigPanel.d.ts.map +1 -0
- package/dist/panels/NodeConfigPanel.js +248 -0
- package/dist/panels/NodeConfigPanel.js.map +1 -0
- package/dist/panels/NodeLibrary.d.ts +16 -0
- package/dist/panels/NodeLibrary.d.ts.map +1 -0
- package/dist/panels/NodeLibrary.js +125 -0
- package/dist/panels/NodeLibrary.js.map +1 -0
- package/dist/panels/ResourceConfigPanel.d.ts +37 -0
- package/dist/panels/ResourceConfigPanel.d.ts.map +1 -0
- package/dist/panels/ResourceConfigPanel.js +35 -0
- package/dist/panels/ResourceConfigPanel.js.map +1 -0
- package/dist/panels/ResourceListPanel.d.ts +35 -0
- package/dist/panels/ResourceListPanel.d.ts.map +1 -0
- package/dist/panels/ResourceListPanel.js +35 -0
- package/dist/panels/ResourceListPanel.js.map +1 -0
- package/dist/panels/VariableConfigPanel.d.ts +9 -0
- package/dist/panels/VariableConfigPanel.d.ts.map +1 -0
- package/dist/panels/VariableConfigPanel.js +50 -0
- package/dist/panels/VariableConfigPanel.js.map +1 -0
- package/dist/panels/VariablesPanel.d.ts +7 -0
- package/dist/panels/VariablesPanel.d.ts.map +1 -0
- package/dist/panels/VariablesPanel.js +56 -0
- package/dist/panels/VariablesPanel.js.map +1 -0
- package/dist/stores/canvasStore.d.ts +41 -0
- package/dist/stores/canvasStore.d.ts.map +1 -0
- package/dist/stores/canvasStore.js +187 -0
- package/dist/stores/canvasStore.js.map +1 -0
- package/dist/stores/debugStore.d.ts +42 -0
- package/dist/stores/debugStore.d.ts.map +1 -0
- package/dist/stores/debugStore.js +22 -0
- package/dist/stores/debugStore.js.map +1 -0
- package/dist/stores/diagnosticsStore.d.ts +41 -0
- package/dist/stores/diagnosticsStore.d.ts.map +1 -0
- package/dist/stores/diagnosticsStore.js +67 -0
- package/dist/stores/diagnosticsStore.js.map +1 -0
- package/dist/stores/editorStore.d.ts +76 -0
- package/dist/stores/editorStore.d.ts.map +1 -0
- package/dist/stores/editorStore.js +116 -0
- package/dist/stores/editorStore.js.map +1 -0
- package/dist/utils/categoryConstants.d.ts +4 -0
- package/dist/utils/categoryConstants.d.ts.map +1 -0
- package/dist/utils/categoryConstants.js +24 -0
- package/dist/utils/categoryConstants.js.map +1 -0
- package/dist/utils/channelOperations.d.ts +21 -0
- package/dist/utils/channelOperations.d.ts.map +1 -0
- package/dist/utils/channelOperations.js +84 -0
- package/dist/utils/channelOperations.js.map +1 -0
- package/dist/utils/connectionRules.d.ts +15 -0
- package/dist/utils/connectionRules.d.ts.map +1 -0
- package/dist/utils/connectionRules.js +113 -0
- package/dist/utils/connectionRules.js.map +1 -0
- package/dist/utils/functionOperations.d.ts +27 -0
- package/dist/utils/functionOperations.d.ts.map +1 -0
- package/dist/utils/functionOperations.js +140 -0
- package/dist/utils/functionOperations.js.map +1 -0
- package/dist/utils/graphOperations.d.ts +54 -0
- package/dist/utils/graphOperations.d.ts.map +1 -0
- package/dist/utils/graphOperations.js +461 -0
- package/dist/utils/graphOperations.js.map +1 -0
- package/dist/utils/history.d.ts +76 -0
- package/dist/utils/history.d.ts.map +1 -0
- package/dist/utils/history.js +93 -0
- package/dist/utils/history.js.map +1 -0
- package/dist/utils/memoryOperations.d.ts +14 -0
- package/dist/utils/memoryOperations.d.ts.map +1 -0
- package/dist/utils/memoryOperations.js +55 -0
- package/dist/utils/memoryOperations.js.map +1 -0
- package/dist/utils/migrateFunctionNodes.d.ts +9 -0
- package/dist/utils/migrateFunctionNodes.d.ts.map +1 -0
- package/dist/utils/migrateFunctionNodes.js +89 -0
- package/dist/utils/migrateFunctionNodes.js.map +1 -0
- package/dist/utils/modelOperations.d.ts +13 -0
- package/dist/utils/modelOperations.d.ts.map +1 -0
- package/dist/utils/modelOperations.js +53 -0
- package/dist/utils/modelOperations.js.map +1 -0
- package/dist/utils/paramDisplay.d.ts +12 -0
- package/dist/utils/paramDisplay.d.ts.map +1 -0
- package/dist/utils/paramDisplay.js +56 -0
- package/dist/utils/paramDisplay.js.map +1 -0
- package/dist/utils/resourceHelpers.d.ts +17 -0
- package/dist/utils/resourceHelpers.d.ts.map +1 -0
- package/dist/utils/resourceHelpers.js +32 -0
- package/dist/utils/resourceHelpers.js.map +1 -0
- package/dist/utils/translation.d.ts +20 -0
- package/dist/utils/translation.d.ts.map +1 -0
- package/dist/utils/translation.js +23 -0
- package/dist/utils/translation.js.map +1 -0
- package/dist/utils/variableOperations.d.ts +15 -0
- package/dist/utils/variableOperations.d.ts.map +1 -0
- package/dist/utils/variableOperations.js +71 -0
- package/dist/utils/variableOperations.js.map +1 -0
- package/package.json +79 -0
- package/src/BuilderLayout.tsx +345 -0
- package/src/Canvas.tsx +261 -0
- package/src/CanvasEditor.tsx +142 -0
- package/src/CanvasTabsToolbar.tsx +176 -0
- package/src/RightConfigPanel.tsx +266 -0
- package/src/WorkflowBuilder.tsx +412 -0
- package/src/cn.ts +6 -0
- package/src/components/ui/add-button.tsx +39 -0
- package/src/components/ui/alert-dialog.tsx +141 -0
- package/src/components/ui/alert.tsx +59 -0
- package/src/components/ui/badge.tsx +36 -0
- package/src/components/ui/button.tsx +85 -0
- package/src/components/ui/card.tsx +79 -0
- package/src/components/ui/checkbox.tsx +28 -0
- package/src/components/ui/collapsible.tsx +9 -0
- package/src/components/ui/command.tsx +153 -0
- package/src/components/ui/delete-button.tsx +23 -0
- package/src/components/ui/dialog.tsx +125 -0
- package/src/components/ui/dropdown-menu.tsx +198 -0
- package/src/components/ui/input.tsx +55 -0
- package/src/components/ui/label.tsx +24 -0
- package/src/components/ui/readonly-banner.tsx +15 -0
- package/src/components/ui/resizable.tsx +43 -0
- package/src/components/ui/scroll-area.tsx +102 -0
- package/src/components/ui/select.tsx +160 -0
- package/src/components/ui/separator.tsx +29 -0
- package/src/components/ui/switch.tsx +27 -0
- package/src/components/ui/textarea.tsx +51 -0
- package/src/components/ui/toast.tsx +127 -0
- package/src/components/ui/toaster.tsx +33 -0
- package/src/components/ui/toggle-group.tsx +59 -0
- package/src/components/ui/toggle.tsx +43 -0
- package/src/components/ui/tooltip.tsx +32 -0
- package/src/dialogs/NodePickerDialog.tsx +84 -0
- package/src/dialogs/ValidationDialog.tsx +184 -0
- package/src/graph/BaseNode.tsx +557 -0
- package/src/graph/CustomEdge.tsx +185 -0
- package/src/graph/CustomNode.tsx +16 -0
- package/src/graph/FunctionCallNode.tsx +30 -0
- package/src/graph/PortHandle.tsx +189 -0
- package/src/graph/reactFlowRegistry.ts +26 -0
- package/src/hooks/use-toast.ts +125 -0
- package/src/hooks/useAvailableVariables.ts +20 -0
- package/src/hooks/useCanvasHistory.ts +22 -0
- package/src/hooks/useCanvasTabs.ts +168 -0
- package/src/hooks/useFunctionDiagnosticsSync.ts +40 -0
- package/src/hooks/useFunctionRegistry.ts +26 -0
- package/src/hooks/useFunctions.ts +44 -0
- package/src/hooks/useGraph.ts +161 -0
- package/src/hooks/useNodeDefinitions.ts +82 -0
- package/src/hooks/useParamErrors.ts +26 -0
- package/src/hooks/useResolvedTheme.ts +30 -0
- package/src/hooks/useResourceDiagnosticsSync.ts +58 -0
- package/src/hooks/useSuppressThemeTransition.ts +79 -0
- package/src/hooks/useWorkflowSerialization.ts +127 -0
- package/src/i18n/index.ts +53 -0
- package/src/i18n/locales/de.json +501 -0
- package/src/i18n/locales/en.json +557 -0
- package/src/index.ts +27 -0
- package/src/inputs/ExpressionInput.tsx +297 -0
- package/src/inputs/ParameterEditor.tsx +515 -0
- package/src/inputs/PortSection.tsx +144 -0
- package/src/panels/BuilderSidebar.tsx +301 -0
- package/src/panels/ChannelConfigPanel.tsx +49 -0
- package/src/panels/ChannelsPanel.tsx +28 -0
- package/src/panels/DebugConsolePanel.tsx +73 -0
- package/src/panels/DebugContextPanel.tsx +77 -0
- package/src/panels/DebugExternalIOPanel.tsx +180 -0
- package/src/panels/DiagnosticsPanel.tsx +170 -0
- package/src/panels/EdgeConfigPanel.tsx +104 -0
- package/src/panels/FunctionConfigPanel.tsx +179 -0
- package/src/panels/FunctionListPanel.tsx +45 -0
- package/src/panels/MemoryConfigPanel.tsx +55 -0
- package/src/panels/MemoryPanel.tsx +40 -0
- package/src/panels/ModelConfigPanel.tsx +41 -0
- package/src/panels/ModelsPanel.tsx +36 -0
- package/src/panels/NodeConfigPanel.tsx +630 -0
- package/src/panels/NodeLibrary.tsx +288 -0
- package/src/panels/ResourceConfigPanel.tsx +132 -0
- package/src/panels/ResourceListPanel.tsx +113 -0
- package/src/panels/VariableConfigPanel.tsx +161 -0
- package/src/panels/VariablesPanel.tsx +145 -0
- package/src/stores/canvasStore.test.ts +44 -0
- package/src/stores/canvasStore.ts +245 -0
- package/src/stores/debugStore.ts +74 -0
- package/src/stores/diagnosticsStore.ts +130 -0
- package/src/stores/editorStore.ts +202 -0
- package/src/styles/index.css +526 -0
- package/src/utils/categoryConstants.ts +26 -0
- package/src/utils/channelOperations.ts +86 -0
- package/src/utils/connectionRules.ts +137 -0
- package/src/utils/functionOperations.ts +179 -0
- package/src/utils/graphOperations.ts +550 -0
- package/src/utils/history.ts +207 -0
- package/src/utils/memoryOperations.ts +57 -0
- package/src/utils/migrateFunctionNodes.ts +107 -0
- package/src/utils/modelOperations.ts +55 -0
- package/src/utils/paramDisplay.ts +71 -0
- package/src/utils/resourceHelpers.ts +32 -0
- package/src/utils/translation.ts +28 -0
- package/src/utils/variableOperations.ts +75 -0
- package/tailwind-preset.ts +166 -0
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { Badge } from "../components/ui/badge";
|
|
2
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../components/ui/collapsible";
|
|
3
|
+
import { Input } from "../components/ui/input";
|
|
4
|
+
import { ScrollArea } from "../components/ui/scroll-area";
|
|
5
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../components/ui/tooltip";
|
|
6
|
+
import { NodeCategory } from "@foresthubai/workflow-core/node";
|
|
7
|
+
import type { FunctionDeclaration } from "@foresthubai/workflow-core/function";
|
|
8
|
+
import { ChevronDown, ChevronDown as DropdownIcon, Hash, Search, ToggleLeft, Type } from "lucide-react";
|
|
9
|
+
import type { TFunction } from "i18next";
|
|
10
|
+
import React, { useState } from "react";
|
|
11
|
+
import { useTranslation } from "react-i18next";
|
|
12
|
+
|
|
13
|
+
import { NodeDefinition } from "@foresthubai/workflow-core/node";
|
|
14
|
+
import { categoryIcons, categoryColors } from "../utils/categoryConstants";
|
|
15
|
+
import { useEditorStore } from "../stores/editorStore";
|
|
16
|
+
import { isReadOnly } from "../WorkflowBuilder";
|
|
17
|
+
import { FunctionNodeDefinition } from "@foresthubai/workflow-core/node";
|
|
18
|
+
import { Parameter } from "@foresthubai/workflow-core/parameter";
|
|
19
|
+
import { getNodeDescription } from "../utils/translation";
|
|
20
|
+
|
|
21
|
+
const getParameterIcon = (type: string) => {
|
|
22
|
+
switch (type) {
|
|
23
|
+
case "string":
|
|
24
|
+
return Type;
|
|
25
|
+
case "number":
|
|
26
|
+
case "int":
|
|
27
|
+
case "float":
|
|
28
|
+
return Hash;
|
|
29
|
+
case "boolean":
|
|
30
|
+
case "bool":
|
|
31
|
+
return ToggleLeft;
|
|
32
|
+
case "dropdown":
|
|
33
|
+
case "selection":
|
|
34
|
+
return DropdownIcon;
|
|
35
|
+
default:
|
|
36
|
+
return Type;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const getParameterTypeLabel = (type: string, t: TFunction) => {
|
|
41
|
+
switch (type) {
|
|
42
|
+
case "string":
|
|
43
|
+
return t("paramTypeText");
|
|
44
|
+
case "int":
|
|
45
|
+
case "float":
|
|
46
|
+
case "number":
|
|
47
|
+
return t("paramTypeNumber");
|
|
48
|
+
case "boolean":
|
|
49
|
+
case "bool":
|
|
50
|
+
return t("paramTypeBoolean");
|
|
51
|
+
case "dropdown":
|
|
52
|
+
case "selection":
|
|
53
|
+
return t("paramTypeSelection");
|
|
54
|
+
case "expression":
|
|
55
|
+
return t("paramTypeExpression");
|
|
56
|
+
default:
|
|
57
|
+
return type;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const ParameterTooltip: React.FC<{
|
|
62
|
+
parameters: Parameter[];
|
|
63
|
+
t: TFunction;
|
|
64
|
+
}> = ({ parameters, t }) => {
|
|
65
|
+
if (parameters.length === 0) return null;
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div className="space-y-2 max-w-sm">
|
|
69
|
+
<div className="font-medium text-sm">{t("parametersLabel")}</div>
|
|
70
|
+
{parameters.map((param, index) => {
|
|
71
|
+
const IconComponent = getParameterIcon(param.type);
|
|
72
|
+
const isOptional = param.optional === true;
|
|
73
|
+
return (
|
|
74
|
+
<div key={index} className="space-y-1">
|
|
75
|
+
<div className="flex items-center gap-2">
|
|
76
|
+
<IconComponent className="w-3 h-3" />
|
|
77
|
+
<span className="font-medium text-sm">{param.label}</span>
|
|
78
|
+
{!isOptional ? (
|
|
79
|
+
<Badge variant="destructive" className="text-xs">
|
|
80
|
+
{t("required")}
|
|
81
|
+
</Badge>
|
|
82
|
+
) : (
|
|
83
|
+
<Badge variant="secondary" className="text-xs">
|
|
84
|
+
{t("optional")}
|
|
85
|
+
</Badge>
|
|
86
|
+
)}
|
|
87
|
+
</div>
|
|
88
|
+
<div className="text-xs text-muted-foreground pl-5">
|
|
89
|
+
{t("typeLabel")} {getParameterTypeLabel(param.type, t)}
|
|
90
|
+
{param.default !== undefined && (
|
|
91
|
+
<span>
|
|
92
|
+
{" "}
|
|
93
|
+
• {t("defaultLabel")} {String(param.default)}
|
|
94
|
+
</span>
|
|
95
|
+
)}
|
|
96
|
+
{"options" in param && param.options && (
|
|
97
|
+
<span>
|
|
98
|
+
{" "}
|
|
99
|
+
• {t("optionsLabel")} {param.options.map((o) => o.label || o.value).join(", ")}
|
|
100
|
+
</span>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
})}
|
|
106
|
+
</div>
|
|
107
|
+
);
|
|
108
|
+
};
|
|
109
|
+
|
|
110
|
+
interface NodeLibraryProps {
|
|
111
|
+
onAddNode: (nodeType: NodeDefinition, position?: { x: number; y: number }) => void;
|
|
112
|
+
nodeDefinitions: NodeDefinition[];
|
|
113
|
+
getAllCategories: () => NodeCategory[];
|
|
114
|
+
functions: FunctionDeclaration[];
|
|
115
|
+
isFunctionCanvas: boolean;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const NodeLibrary = ({
|
|
119
|
+
onAddNode,
|
|
120
|
+
nodeDefinitions,
|
|
121
|
+
getAllCategories,
|
|
122
|
+
functions,
|
|
123
|
+
isFunctionCanvas,
|
|
124
|
+
}: NodeLibraryProps) => {
|
|
125
|
+
const { t } = useTranslation();
|
|
126
|
+
const readOnly = useEditorStore((s) => isReadOnly(s.builderMode));
|
|
127
|
+
const [searchTerm, setSearchTerm] = useState("");
|
|
128
|
+
const [expandedCategories, setExpandedCategories] = useState<Set<string>>(new Set());
|
|
129
|
+
|
|
130
|
+
const search = searchTerm.toLowerCase();
|
|
131
|
+
const filteredNodes = nodeDefinitions.filter(
|
|
132
|
+
(node) =>
|
|
133
|
+
!node.isUnremovable &&
|
|
134
|
+
!(isFunctionCanvas && node.category === NodeCategory.Trigger) &&
|
|
135
|
+
// Search filter: label, category, or any tag
|
|
136
|
+
(node.label.toLowerCase().includes(search) ||
|
|
137
|
+
node.category.toLowerCase().includes(search) ||
|
|
138
|
+
(node.tags ?? []).some((tag) => tag.toLowerCase().includes(search))),
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
// Get categories that have matching nodes when searching
|
|
142
|
+
const categoriesWithMatches = new Set(filteredNodes.map((node) => node.category));
|
|
143
|
+
|
|
144
|
+
const toggleCategory = (category: NodeCategory) => {
|
|
145
|
+
const newExpanded = new Set(expandedCategories);
|
|
146
|
+
if (newExpanded.has(category)) {
|
|
147
|
+
newExpanded.delete(category);
|
|
148
|
+
} else {
|
|
149
|
+
newExpanded.add(category);
|
|
150
|
+
}
|
|
151
|
+
setExpandedCategories(newExpanded);
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
// When searching, auto-expand categories with matches
|
|
155
|
+
const isCategoryExpanded = (category: NodeCategory) => {
|
|
156
|
+
if (searchTerm.trim() && categoriesWithMatches.has(category)) {
|
|
157
|
+
return true;
|
|
158
|
+
}
|
|
159
|
+
return expandedCategories.has(category);
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const hasResults = filteredNodes.length > 0;
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<div className="h-full flex flex-col">
|
|
166
|
+
{/* Search */}
|
|
167
|
+
<div className="relative shrink-0">
|
|
168
|
+
<Search className="absolute left-3 top-1/2 -translate-y-1/2 w-4 h-4 text-muted-foreground pointer-events-none" />
|
|
169
|
+
<Input
|
|
170
|
+
placeholder={t("searchBlocks")}
|
|
171
|
+
value={searchTerm}
|
|
172
|
+
onChange={(e) => setSearchTerm(e.target.value)}
|
|
173
|
+
className="pl-10 h-9 rounded-lg"
|
|
174
|
+
/>
|
|
175
|
+
</div>
|
|
176
|
+
|
|
177
|
+
<ScrollArea className="flex-1 mt-3">
|
|
178
|
+
{/* disableHoverableContent: close the tooltip as soon as the cursor
|
|
179
|
+
leaves the tile, instead of keeping it open when the pointer moves
|
|
180
|
+
onto the description itself. */}
|
|
181
|
+
<TooltipProvider disableHoverableContent>
|
|
182
|
+
{/* px-1 keeps tile hover borders off the scroll-clip edge */}
|
|
183
|
+
<div className="flex flex-col gap-0.5 px-1 pb-4">
|
|
184
|
+
{!hasResults && (
|
|
185
|
+
<p className="text-sm text-muted-foreground text-center py-10">{t("noResults", "No matching nodes")}</p>
|
|
186
|
+
)}
|
|
187
|
+
{getAllCategories().map((category) => {
|
|
188
|
+
const categoryNodes = filteredNodes.filter((node) => node.category === category);
|
|
189
|
+
if (categoryNodes.length === 0) return null;
|
|
190
|
+
|
|
191
|
+
const isExpanded = isCategoryExpanded(category);
|
|
192
|
+
const CategoryIcon = categoryIcons[category];
|
|
193
|
+
const iconChipClass = categoryColors[category] ?? "bg-muted text-muted-foreground border-border";
|
|
194
|
+
|
|
195
|
+
return (
|
|
196
|
+
<Collapsible key={category} open={isExpanded} onOpenChange={() => toggleCategory(category)}>
|
|
197
|
+
<CollapsibleTrigger className="flex items-center gap-2 w-full px-2 py-1.5 rounded-md text-left hover:bg-muted/50 transition-colors group">
|
|
198
|
+
<ChevronDown
|
|
199
|
+
className={`w-4 h-4 text-muted-foreground transition-transform duration-200 ${
|
|
200
|
+
isExpanded ? "" : "-rotate-90"
|
|
201
|
+
}`}
|
|
202
|
+
/>
|
|
203
|
+
{CategoryIcon && <CategoryIcon className="w-4 h-4 text-muted-foreground shrink-0" />}
|
|
204
|
+
<span className="flex-1 font-medium text-sm truncate">{category}</span>
|
|
205
|
+
<span className="text-xs text-muted-foreground tabular-nums">{categoryNodes.length}</span>
|
|
206
|
+
</CollapsibleTrigger>
|
|
207
|
+
|
|
208
|
+
<CollapsibleContent>
|
|
209
|
+
<div className="grid grid-cols-2 gap-1.5 px-1 pt-1.5 pb-2">
|
|
210
|
+
{categoryNodes.map((nodedef) => {
|
|
211
|
+
const staticParams = nodedef.parameters;
|
|
212
|
+
const nodeKey = `${nodedef.type}-${"functionInfo" in nodedef ? (nodedef as FunctionNodeDefinition).functionInfo.id : ""}`;
|
|
213
|
+
const hasParams = staticParams.length > 0;
|
|
214
|
+
const description = getNodeDescription(t, nodedef);
|
|
215
|
+
const firstTag = nodedef.tags?.[0];
|
|
216
|
+
|
|
217
|
+
const tile = (
|
|
218
|
+
<button
|
|
219
|
+
type="button"
|
|
220
|
+
draggable={!readOnly}
|
|
221
|
+
onDragStart={
|
|
222
|
+
readOnly
|
|
223
|
+
? undefined
|
|
224
|
+
: (e) => {
|
|
225
|
+
const dragData = { nodeDef: nodedef };
|
|
226
|
+
e.dataTransfer.setData("application/json", JSON.stringify(dragData));
|
|
227
|
+
e.dataTransfer.effectAllowed = "copy";
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
onClick={readOnly ? undefined : () => onAddNode(nodedef)}
|
|
231
|
+
disabled={readOnly}
|
|
232
|
+
className={`relative flex flex-col items-center gap-2 rounded-lg border border-border bg-card p-2.5 text-center transition-colors duration-150 ${
|
|
233
|
+
readOnly
|
|
234
|
+
? "opacity-60 cursor-default"
|
|
235
|
+
: "cursor-grab active:cursor-grabbing hover:border-primary/50 hover:bg-accent/40"
|
|
236
|
+
}`}
|
|
237
|
+
>
|
|
238
|
+
<div
|
|
239
|
+
className={`flex items-center justify-center w-9 h-9 rounded-lg border ${iconChipClass}`}
|
|
240
|
+
>
|
|
241
|
+
{CategoryIcon && <CategoryIcon className="w-4 h-4" />}
|
|
242
|
+
</div>
|
|
243
|
+
<span className="text-[11px] font-medium leading-tight line-clamp-2 w-full">
|
|
244
|
+
{nodedef.label}
|
|
245
|
+
</span>
|
|
246
|
+
{firstTag && (
|
|
247
|
+
<Badge
|
|
248
|
+
variant="secondary"
|
|
249
|
+
className="absolute top-1 right-1 text-[9px] h-3.5 px-1 font-normal leading-none"
|
|
250
|
+
>
|
|
251
|
+
{firstTag}
|
|
252
|
+
</Badge>
|
|
253
|
+
)}
|
|
254
|
+
</button>
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
const hasTooltipContent = description || hasParams;
|
|
258
|
+
if (!hasTooltipContent) {
|
|
259
|
+
return <React.Fragment key={nodeKey}>{tile}</React.Fragment>;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return (
|
|
263
|
+
<Tooltip key={nodeKey} delayDuration={300}>
|
|
264
|
+
<TooltipTrigger asChild>{tile}</TooltipTrigger>
|
|
265
|
+
<TooltipContent side="right" className="max-w-sm pointer-events-none">
|
|
266
|
+
<div className="space-y-2">
|
|
267
|
+
{description && (
|
|
268
|
+
<p className="text-xs text-muted-foreground leading-relaxed">{description}</p>
|
|
269
|
+
)}
|
|
270
|
+
{hasParams && <ParameterTooltip parameters={staticParams} t={t} />}
|
|
271
|
+
</div>
|
|
272
|
+
</TooltipContent>
|
|
273
|
+
</Tooltip>
|
|
274
|
+
);
|
|
275
|
+
})}
|
|
276
|
+
</div>
|
|
277
|
+
</CollapsibleContent>
|
|
278
|
+
</Collapsible>
|
|
279
|
+
);
|
|
280
|
+
})}
|
|
281
|
+
</div>
|
|
282
|
+
</TooltipProvider>
|
|
283
|
+
</ScrollArea>
|
|
284
|
+
</div>
|
|
285
|
+
);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export default NodeLibrary;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { useEffect, useState, type ReactNode } from "react";
|
|
2
|
+
import { Button } from "../components/ui/button";
|
|
3
|
+
import { Separator } from "../components/ui/separator";
|
|
4
|
+
import { ChevronRight } from "lucide-react";
|
|
5
|
+
import type { Parameter } from "@foresthubai/workflow-core/parameter";
|
|
6
|
+
import type { Diagnostic } from "@foresthubai/workflow-core/diagnostics";
|
|
7
|
+
import ParameterEditor from "../inputs/ParameterEditor";
|
|
8
|
+
import { MAIN_CANVAS_ID } from "../stores/canvasStore";
|
|
9
|
+
import { useEditorStore } from "../stores/editorStore";
|
|
10
|
+
import { isReadOnly } from "../WorkflowBuilder";
|
|
11
|
+
import { useParamErrors } from "../hooks/useParamErrors";
|
|
12
|
+
import { ReadOnlyBanner } from "../components/ui/readonly-banner";
|
|
13
|
+
import { DeleteButton } from "../components/ui/delete-button";
|
|
14
|
+
|
|
15
|
+
interface ResourceConfigPanelProps {
|
|
16
|
+
/** Stable id of the open resource — resets the local label field when it changes. */
|
|
17
|
+
resetKey: string;
|
|
18
|
+
label: string;
|
|
19
|
+
/** `title`/aria text for the label input. */
|
|
20
|
+
labelTitle: string;
|
|
21
|
+
onLabelChange: (label: string) => void;
|
|
22
|
+
description: string;
|
|
23
|
+
/** Optional validation messages rendered under the title (e.g. empty/duplicate label). */
|
|
24
|
+
belowLabel?: ReactNode;
|
|
25
|
+
parameters: Parameter[];
|
|
26
|
+
/** Read the current value for a parameter (channels map `type` to a top-level field). */
|
|
27
|
+
getValue: (param: Parameter) => unknown;
|
|
28
|
+
allArguments: Record<string, unknown>;
|
|
29
|
+
onParamChange: (paramId: string, value: unknown) => void;
|
|
30
|
+
diagnostics: Diagnostic[] | undefined;
|
|
31
|
+
translationPrefix: string;
|
|
32
|
+
deleteLabel: string;
|
|
33
|
+
onDelete: () => void;
|
|
34
|
+
onClose: () => void;
|
|
35
|
+
/** Canvas used for variable resolution in ParameterEditor. Project-scoped resources use MAIN. */
|
|
36
|
+
canvasId?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Shared editor shell for the project-scoped "primitive" resources that all
|
|
41
|
+
* render a `{type, arguments}` bag through `ParameterEditor` — channels, memory,
|
|
42
|
+
* declared models. Owns the chrome (editable title, readOnly banner, parameter
|
|
43
|
+
* list, delete/close buttons); each wrapper supplies the parameter source, the
|
|
44
|
+
* value accessor, and the mutation callbacks. Nodes/edges are too divergent to
|
|
45
|
+
* use this and keep their own bodies (sharing only {@link useParamErrors}).
|
|
46
|
+
*/
|
|
47
|
+
export const ResourceConfigPanel = ({
|
|
48
|
+
resetKey,
|
|
49
|
+
label,
|
|
50
|
+
labelTitle,
|
|
51
|
+
onLabelChange,
|
|
52
|
+
description,
|
|
53
|
+
belowLabel,
|
|
54
|
+
parameters,
|
|
55
|
+
getValue,
|
|
56
|
+
allArguments,
|
|
57
|
+
onParamChange,
|
|
58
|
+
diagnostics,
|
|
59
|
+
translationPrefix,
|
|
60
|
+
deleteLabel,
|
|
61
|
+
onDelete,
|
|
62
|
+
onClose,
|
|
63
|
+
canvasId = MAIN_CANVAS_ID,
|
|
64
|
+
}: ResourceConfigPanelProps) => {
|
|
65
|
+
const readOnly = useEditorStore((s) => isReadOnly(s.builderMode));
|
|
66
|
+
const paramErrors = useParamErrors(diagnostics);
|
|
67
|
+
|
|
68
|
+
// Local label state preserves cursor position on edit; resets when a different
|
|
69
|
+
// resource is opened.
|
|
70
|
+
const [localLabel, setLocalLabel] = useState(label);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
setLocalLabel(label);
|
|
73
|
+
}, [resetKey, label]);
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div className="p-4">
|
|
77
|
+
<div className="space-y-4">
|
|
78
|
+
<div className="flex items-center justify-between gap-2">
|
|
79
|
+
<div className="flex-1 min-w-0">
|
|
80
|
+
<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">
|
|
81
|
+
<input
|
|
82
|
+
type="text"
|
|
83
|
+
title={labelTitle}
|
|
84
|
+
className="font-semibold text-lg bg-transparent w-full outline-none cursor-text py-0.5"
|
|
85
|
+
value={localLabel}
|
|
86
|
+
readOnly={readOnly}
|
|
87
|
+
onChange={(e) => {
|
|
88
|
+
setLocalLabel(e.target.value);
|
|
89
|
+
onLabelChange(e.target.value);
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
</div>
|
|
93
|
+
<p className="text-sm text-muted-foreground">{description}</p>
|
|
94
|
+
{belowLabel}
|
|
95
|
+
</div>
|
|
96
|
+
<Button variant="ghost" size="icon" className="shrink-0" onClick={onClose}>
|
|
97
|
+
<ChevronRight className="h-4 w-4" />
|
|
98
|
+
</Button>
|
|
99
|
+
</div>
|
|
100
|
+
|
|
101
|
+
{readOnly && <ReadOnlyBanner />}
|
|
102
|
+
|
|
103
|
+
{parameters.length > 0 && (
|
|
104
|
+
<>
|
|
105
|
+
<Separator />
|
|
106
|
+
<div className={`space-y-3 ${readOnly ? "pointer-events-none opacity-60" : ""}`}>
|
|
107
|
+
{parameters.map((param) => (
|
|
108
|
+
<ParameterEditor
|
|
109
|
+
key={param.id}
|
|
110
|
+
canvasId={canvasId}
|
|
111
|
+
parameter={param}
|
|
112
|
+
value={getValue(param)}
|
|
113
|
+
allArguments={allArguments}
|
|
114
|
+
onChange={(value) => onParamChange(param.id, value)}
|
|
115
|
+
errors={paramErrors.get(param.id)}
|
|
116
|
+
translationPrefix={translationPrefix}
|
|
117
|
+
/>
|
|
118
|
+
))}
|
|
119
|
+
</div>
|
|
120
|
+
</>
|
|
121
|
+
)}
|
|
122
|
+
|
|
123
|
+
{!readOnly && (
|
|
124
|
+
<>
|
|
125
|
+
<Separator />
|
|
126
|
+
<DeleteButton onClick={onDelete}>{deleteLabel}</DeleteButton>
|
|
127
|
+
</>
|
|
128
|
+
)}
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
);
|
|
132
|
+
};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { AlertTriangle, type LucideIcon } from "lucide-react";
|
|
2
|
+
import { AddButton } from "../components/ui/add-button";
|
|
3
|
+
import { cn } from "../cn";
|
|
4
|
+
import { useEditorStore } from "../stores/editorStore";
|
|
5
|
+
import { isReadOnly } from "../WorkflowBuilder";
|
|
6
|
+
import type { Diagnostic } from "@foresthubai/workflow-core/diagnostics";
|
|
7
|
+
|
|
8
|
+
interface ResourceListItem {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
interface AddAction {
|
|
14
|
+
label: string;
|
|
15
|
+
icon: LucideIcon;
|
|
16
|
+
onAdd: () => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
interface ResourceListPanelProps<I extends ResourceListItem> {
|
|
20
|
+
items: I[];
|
|
21
|
+
selectedId: string | null;
|
|
22
|
+
onSelect: (id: string) => void;
|
|
23
|
+
/** The matching diagnostics slot (byChannelId / byMemoryId / byModelId). */
|
|
24
|
+
diagnosticsSlot: Record<string, Diagnostic[]>;
|
|
25
|
+
/** Short type-badge text shown on the right of each row. */
|
|
26
|
+
badge: (item: I) => string;
|
|
27
|
+
emptyIcon: LucideIcon;
|
|
28
|
+
emptyText: string;
|
|
29
|
+
emptyHint: string;
|
|
30
|
+
/** One add button (channels/models) or several (memory: File + Vector). */
|
|
31
|
+
addActions: AddAction[];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Shared sidebar list for the project-scoped primitive resources (channels,
|
|
36
|
+
* memory, declared models): a selectable row per item with an error ring +
|
|
37
|
+
* warning icon driven by the diagnostics slot, a type badge, and add button(s).
|
|
38
|
+
* Variables are not listed here — they're canvas-scoped, sectioned, and don't
|
|
39
|
+
* use this error-badge model.
|
|
40
|
+
*/
|
|
41
|
+
export function ResourceListPanel<I extends ResourceListItem>({
|
|
42
|
+
items,
|
|
43
|
+
selectedId,
|
|
44
|
+
onSelect,
|
|
45
|
+
diagnosticsSlot,
|
|
46
|
+
badge,
|
|
47
|
+
emptyIcon: EmptyIcon,
|
|
48
|
+
emptyText,
|
|
49
|
+
emptyHint,
|
|
50
|
+
addActions,
|
|
51
|
+
}: ResourceListPanelProps<I>) {
|
|
52
|
+
const readOnly = useEditorStore((s) => isReadOnly(s.builderMode));
|
|
53
|
+
|
|
54
|
+
const addButtons = (
|
|
55
|
+
<div className="flex flex-col gap-1.5">
|
|
56
|
+
{addActions.map(({ label, icon, onAdd }) => (
|
|
57
|
+
<AddButton key={label} icon={icon} onClick={onAdd}>
|
|
58
|
+
{label}
|
|
59
|
+
</AddButton>
|
|
60
|
+
))}
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
if (items.length === 0) {
|
|
65
|
+
return (
|
|
66
|
+
<div className="flex flex-col items-center justify-center py-8 text-center">
|
|
67
|
+
<EmptyIcon className="w-10 h-10 text-muted-foreground/50 mb-3" />
|
|
68
|
+
<p className="text-sm text-muted-foreground">{emptyText}</p>
|
|
69
|
+
<p className="text-xs text-muted-foreground/70 mt-1">{emptyHint}</p>
|
|
70
|
+
{!readOnly && <div className="mt-3 w-full px-2">{addButtons}</div>}
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return (
|
|
76
|
+
<div className="space-y-1.5">
|
|
77
|
+
{items.map((item) => {
|
|
78
|
+
const isSelected = selectedId === item.id;
|
|
79
|
+
const hasError = (diagnosticsSlot[item.id] ?? []).some((d) => d.severity === "error");
|
|
80
|
+
return (
|
|
81
|
+
<div
|
|
82
|
+
key={item.id}
|
|
83
|
+
onClick={() => onSelect(item.id)}
|
|
84
|
+
className={cn(
|
|
85
|
+
// Background/shadow come from selection; border/ring come from error
|
|
86
|
+
// status. Layered, not exclusive — so a selected row with an error
|
|
87
|
+
// keeps its red outline against the green selection tint instead of
|
|
88
|
+
// hiding the very signal the user is acting on.
|
|
89
|
+
"p-3 rounded-lg transition-all cursor-pointer border ring-1",
|
|
90
|
+
isSelected ? "bg-accent shadow-md" : "bg-card shadow-sm hover:shadow-md",
|
|
91
|
+
hasError
|
|
92
|
+
? "border-destructive ring-destructive"
|
|
93
|
+
: isSelected
|
|
94
|
+
? "border-primary/40 ring-primary/40"
|
|
95
|
+
: "border-border ring-transparent",
|
|
96
|
+
)}
|
|
97
|
+
>
|
|
98
|
+
<div className="flex items-center justify-between gap-2">
|
|
99
|
+
<span className="font-mono text-sm text-foreground truncate flex items-center gap-1.5">
|
|
100
|
+
{hasError && <AlertTriangle className="w-3.5 h-3.5 text-destructive shrink-0" />}
|
|
101
|
+
{item.label}
|
|
102
|
+
</span>
|
|
103
|
+
<span className="text-[10px] font-medium px-1.5 py-0.5 rounded border border-border/50 text-muted-foreground shrink-0">
|
|
104
|
+
{badge(item)}
|
|
105
|
+
</span>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
})}
|
|
110
|
+
{!readOnly && <div className="pt-1">{addButtons}</div>}
|
|
111
|
+
</div>
|
|
112
|
+
);
|
|
113
|
+
}
|