@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,11 @@
|
|
|
1
|
+
import { CanvasTab } from "./hooks/useCanvasTabs";
|
|
2
|
+
interface CanvasTabsToolbarProps {
|
|
3
|
+
tabs: CanvasTab[];
|
|
4
|
+
activeTabId: string;
|
|
5
|
+
onTabChange: (tabId: string) => void;
|
|
6
|
+
onTabClose: (tabId: string) => void;
|
|
7
|
+
onTabReorder: (fromIndex: number, toIndex: number) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const CanvasTabsToolbar: ({ tabs, activeTabId, onTabChange, onTabClose, onTabReorder, }: CanvasTabsToolbarProps) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=CanvasTabsToolbar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CanvasTabsToolbar.d.ts","sourceRoot":"","sources":["../src/CanvasTabsToolbar.tsx"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAGlD,UAAU,sBAAsB;IAC9B,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5D;AAED,eAAO,MAAM,iBAAiB,GAAI,+DAM/B,sBAAsB,4CA0JxB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ScrollArea } from "./components/ui/scroll-area";
|
|
3
|
+
import { cn } from "./cn";
|
|
4
|
+
import { FunctionSquare, Workflow, X } from "lucide-react";
|
|
5
|
+
import React, { useCallback, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { MAIN_CANVAS_ID } from "./stores/canvasStore";
|
|
7
|
+
export const CanvasTabsToolbar = ({ tabs, activeTabId, onTabChange, onTabClose, onTabReorder, }) => {
|
|
8
|
+
const containerRef = useRef(null);
|
|
9
|
+
const viewportRef = useRef(null);
|
|
10
|
+
const dragIndex = useRef(null);
|
|
11
|
+
// Translate vertical mouse-wheel deltas into horizontal scroll on the tabs
|
|
12
|
+
// viewport. A non-passive native listener is required because React's
|
|
13
|
+
// synthetic onWheel is passive — preventDefault() there is a no-op, so the
|
|
14
|
+
// page would also scroll vertically alongside the toolbar shift. We leave
|
|
15
|
+
// genuine horizontal wheels (touchpads, tilt wheels) alone by gating on
|
|
16
|
+
// deltaY, and skip the override entirely when there's nothing to scroll
|
|
17
|
+
// so vertical-page scrolling still works when the pointer happens to
|
|
18
|
+
// hover an unfilled toolbar.
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
const el = viewportRef.current;
|
|
21
|
+
if (!el)
|
|
22
|
+
return;
|
|
23
|
+
const handler = (e) => {
|
|
24
|
+
if (e.deltaY === 0)
|
|
25
|
+
return;
|
|
26
|
+
if (el.scrollWidth <= el.clientWidth)
|
|
27
|
+
return;
|
|
28
|
+
e.preventDefault();
|
|
29
|
+
el.scrollLeft += e.deltaY;
|
|
30
|
+
};
|
|
31
|
+
el.addEventListener("wheel", handler, { passive: false });
|
|
32
|
+
return () => el.removeEventListener("wheel", handler);
|
|
33
|
+
}, []);
|
|
34
|
+
// dropSlot: insertion index (before which tab the dragged tab lands)
|
|
35
|
+
const [dropSlot, setDropSlot] = useState(null);
|
|
36
|
+
// indicatorX: pixel offset from container left for the visual line
|
|
37
|
+
const [indicatorX, setIndicatorX] = useState(null);
|
|
38
|
+
const isMainTab = (index) => tabs[index]?.id === MAIN_CANVAS_ID;
|
|
39
|
+
const clearDrag = useCallback(() => {
|
|
40
|
+
dragIndex.current = null;
|
|
41
|
+
setDropSlot(null);
|
|
42
|
+
setIndicatorX(null);
|
|
43
|
+
}, []);
|
|
44
|
+
const handleTabDragOver = useCallback((e, index) => {
|
|
45
|
+
if (dragIndex.current === null || !containerRef.current)
|
|
46
|
+
return;
|
|
47
|
+
// Ignore Main tab entirely — not a valid drag target
|
|
48
|
+
if (tabs[index]?.id === MAIN_CANVAS_ID)
|
|
49
|
+
return;
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
e.stopPropagation();
|
|
52
|
+
e.dataTransfer.dropEffect = "move";
|
|
53
|
+
const rect = e.currentTarget.getBoundingClientRect();
|
|
54
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
55
|
+
const midX = rect.left + rect.width / 2;
|
|
56
|
+
const isLeftHalf = e.clientX < midX;
|
|
57
|
+
// Slot: insertion index
|
|
58
|
+
const slot = isLeftHalf ? index : index + 1;
|
|
59
|
+
// Tabs are now flush with a 1px separator between them — land the indicator on that seam.
|
|
60
|
+
const raw = isLeftHalf ? rect.left - containerRect.left : rect.right - containerRect.left;
|
|
61
|
+
// Clamp so the indicator stays fully visible inside the container
|
|
62
|
+
const x = Math.round(Math.max(0, Math.min(raw, containerRef.current.clientWidth - 2)));
|
|
63
|
+
setDropSlot(slot);
|
|
64
|
+
setIndicatorX(x);
|
|
65
|
+
}, [tabs]);
|
|
66
|
+
return (
|
|
67
|
+
// ScrollArea provides the horizontal overlay scrollbar (hover-only, in the
|
|
68
|
+
// panel gutter so the tab row doesn't shift). The Root carries the bg +
|
|
69
|
+
// bottom border; the inner div inside the Viewport stays the drag/drop
|
|
70
|
+
// container — containerRef points at it so the indicator's coordinates
|
|
71
|
+
// remain relative to the (scrollable) tab row, not the fixed Root.
|
|
72
|
+
_jsx(ScrollArea, { className: "bg-card/80 border-b border-border/50", viewportRef: viewportRef, children: _jsxs("div", { ref: containerRef, className: "relative flex items-stretch", onDragOver: (e) => {
|
|
73
|
+
// Fallback for empty area past last tab
|
|
74
|
+
if (dragIndex.current === null || !containerRef.current)
|
|
75
|
+
return;
|
|
76
|
+
e.preventDefault();
|
|
77
|
+
e.dataTransfer.dropEffect = "move";
|
|
78
|
+
}, onDrop: (e) => {
|
|
79
|
+
e.preventDefault();
|
|
80
|
+
if (dragIndex.current !== null && dropSlot !== null) {
|
|
81
|
+
const from = dragIndex.current;
|
|
82
|
+
const target = dropSlot > from ? dropSlot - 1 : dropSlot;
|
|
83
|
+
if (target > 0 && target !== from) {
|
|
84
|
+
onTabReorder(from, target);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
clearDrag();
|
|
88
|
+
}, children: [indicatorX !== null && (_jsx("div", { className: "absolute top-0 bottom-0 bg-primary z-10 pointer-events-none", style: { left: 0, width: "2px", transform: `translateX(${indicatorX}px)` } })), tabs.map((tab, index) => {
|
|
89
|
+
const isDraggable = !isMainTab(index);
|
|
90
|
+
return (_jsxs(React.Fragment, { children: [index > 0 && _jsx("div", { className: "w-px bg-border/70 shrink-0" }), _jsxs("div", { draggable: isDraggable, onDragStart: (e) => {
|
|
91
|
+
if (!isDraggable)
|
|
92
|
+
return;
|
|
93
|
+
dragIndex.current = index;
|
|
94
|
+
e.dataTransfer.effectAllowed = "move";
|
|
95
|
+
}, onDragOver: (e) => handleTabDragOver(e, index), onDragEnd: clearDrag, className: cn("group flex items-center gap-1.5 pl-2 pr-1 text-sm font-medium cursor-pointer transition-colors", "hover:bg-field/80", activeTabId === tab.id ? "bg-field text-foreground" : "text-muted-foreground hover:text-foreground", isDraggable ? "cursor-grab active:cursor-grabbing" : "select-none"), onClick: () => onTabChange(tab.id), children: [isMainTab(index) ? (_jsx(Workflow, { className: "w-3.5 h-3.5 shrink-0" })) : (_jsx(FunctionSquare, { className: "w-3.5 h-3.5 shrink-0" })), _jsx("span", { className: "truncate max-w-[120px] py-1", children: tab.label }), tab.id !== MAIN_CANVAS_ID ? (_jsx("button", { type: "button", "aria-label": `Close tab ${tab.label}`, title: `Close tab ${tab.label}`, className: "flex items-center justify-center w-4 h-4 shrink-0 rounded opacity-0 group-hover:opacity-100 transition-opacity hover:bg-destructive/15 hover:text-destructive", onClick: (e) => {
|
|
96
|
+
e.stopPropagation();
|
|
97
|
+
onTabClose(tab.id);
|
|
98
|
+
}, children: _jsx(X, { className: "w-3.5 h-3.5" }) })) : (_jsx("span", { className: "w-1 shrink-0" }))] })] }, tab.id));
|
|
99
|
+
})] }) }));
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=CanvasTabsToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CanvasTabsToolbar.js","sourceRoot":"","sources":["../src/CanvasTabsToolbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAUtD,MAAM,CAAC,MAAM,iBAA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,EACD,eAAM,SAAS,EAAC,6BAA6B,YAAE,GAAG,CAAC,KAAK,GAAQ,EAC/D,GAAG,CAAC,EAAE,KAAK,cAAc,CAAC,CAAC,CAAC,CAC3B,iBACE,IAAI,EAAC,QAAQ,gBACD,aAAa,GAAG,CAAC,KAAK,EAAE,EACpC,KAAK,EAAE,aAAa,GAAG,CAAC,KAAK,EAAE,EAC/B,SAAS,EAAC,+JAA+J,EACzK,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;4CACb,CAAC,CAAC,eAAe,EAAE,CAAC;4CACpB,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;wCACrB,CAAC,YAED,KAAC,CAAC,IAAC,SAAS,EAAC,aAAa,GAAG,GACtB,CACV,CAAC,CAAC,CAAC,CACF,eAAM,SAAS,EAAC,cAAc,GAAG,CAClC,IACG,KAzCa,GAAG,CAAC,EAAE,CA0CV,CAClB,CAAC;gBACJ,CAAC,CAAC,IACE,GACK,CACd,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { NodeData, NodeDefinition } from "@foresthubai/workflow-core/node";
|
|
2
|
+
import type { EdgeData } from "@foresthubai/workflow-core/edge";
|
|
3
|
+
/**
|
|
4
|
+
* Right-side selection-routed config panel.
|
|
5
|
+
*
|
|
6
|
+
* Reads the current selection from editorStore (project-wide) and the
|
|
7
|
+
* selected node/edge from the active canvas store, then renders the
|
|
8
|
+
* appropriate config component. Receives graph mutation handlers from
|
|
9
|
+
* BuilderLayout — it never touches the canvas store directly for writes.
|
|
10
|
+
*
|
|
11
|
+
* Hidden while the user is mid selection-drag to avoid flicker.
|
|
12
|
+
*/
|
|
13
|
+
export interface RightConfigPanelProps {
|
|
14
|
+
canvasId: string;
|
|
15
|
+
isDebugMode: boolean;
|
|
16
|
+
selectionDrag: boolean;
|
|
17
|
+
getNodeDef: (node: NodeData) => NodeDefinition | undefined;
|
|
18
|
+
onNodeUpdate: (nodeId: string, updates: Partial<NodeData>) => void;
|
|
19
|
+
onNodeDelete: (nodeId: string) => void;
|
|
20
|
+
onEdgeUpdate: (edgeId: string, updates: Partial<EdgeData>) => void;
|
|
21
|
+
onEdgeDelete: (edgeId: string) => void;
|
|
22
|
+
onClearSelection: () => void;
|
|
23
|
+
onTestNode?: (nodeId: string) => void;
|
|
24
|
+
onDebugStep?: (nodeId?: string) => void;
|
|
25
|
+
}
|
|
26
|
+
export declare const RightConfigPanel: ({ canvasId, isDebugMode, selectionDrag, getNodeDef, onNodeUpdate, onNodeDelete, onEdgeUpdate, onEdgeDelete, onClearSelection, onTestNode, onDebugStep, }: RightConfigPanelProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
27
|
+
//# sourceMappingURL=RightConfigPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RightConfigPanel.d.ts","sourceRoot":"","sources":["../src/RightConfigPanel.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAChF,OAAO,KAAK,EAAE,QAAQ,EAAY,MAAM,iCAAiC,CAAC;AAkB1E;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IAGvB,UAAU,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,cAAc,GAAG,SAAS,CAAC;IAG3D,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IACnE,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC;IACnE,YAAY,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAG7B,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,gBAAgB,GAAI,0JAY9B,qBAAqB,mDAsLvB,CAAC"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
3
|
+
import { isControlFlow } from "@foresthubai/workflow-core/edge";
|
|
4
|
+
import { ScrollArea } from "./components/ui/scroll-area";
|
|
5
|
+
import { cn } from "./cn";
|
|
6
|
+
import { ChannelConfigPanel } from "./panels/ChannelConfigPanel";
|
|
7
|
+
import { DebugExternalIOPanel } from "./panels/DebugExternalIOPanel";
|
|
8
|
+
import { EdgeConfigPanel } from "./panels/EdgeConfigPanel";
|
|
9
|
+
import { FunctionConfigPanel } from "./panels/FunctionConfigPanel";
|
|
10
|
+
import { MemoryConfigPanel } from "./panels/MemoryConfigPanel";
|
|
11
|
+
import { ModelConfigPanel } from "./panels/ModelConfigPanel";
|
|
12
|
+
import { NodeConfigPanel } from "./panels/NodeConfigPanel";
|
|
13
|
+
import { VariableConfigPanel } from "./panels/VariableConfigPanel";
|
|
14
|
+
import { getOrCreateCanvasStore } from "./stores/canvasStore";
|
|
15
|
+
import { useEditorStore } from "./stores/editorStore";
|
|
16
|
+
import { declaredVarKey } from "@foresthubai/workflow-core/variable";
|
|
17
|
+
export const RightConfigPanel = ({ canvasId, isDebugMode, selectionDrag, getNodeDef, onNodeUpdate, onNodeDelete, onEdgeUpdate, onEdgeDelete, onClearSelection, onTestNode, onDebugStep, }) => {
|
|
18
|
+
const selection = useEditorStore((s) => s.selection);
|
|
19
|
+
const clearSelection = useEditorStore((s) => s.clearSelection);
|
|
20
|
+
const channels = useEditorStore((s) => s.channels);
|
|
21
|
+
const memory = useEditorStore((s) => s.memory);
|
|
22
|
+
const models = useEditorStore((s) => s.models);
|
|
23
|
+
const functions = useEditorStore((s) => s.functions);
|
|
24
|
+
const useStore = getOrCreateCanvasStore(canvasId);
|
|
25
|
+
const selectedNode = useStore(useCallback((s) => {
|
|
26
|
+
if (selection.kind !== "graph" || selection.nodeIds.length !== 1)
|
|
27
|
+
return null;
|
|
28
|
+
const node = s.nodes.find((n) => n.id === selection.nodeIds[0]);
|
|
29
|
+
return node?.data ?? null;
|
|
30
|
+
}, [selection]));
|
|
31
|
+
const selectedVariable = useStore(useCallback((s) => {
|
|
32
|
+
if (selection.kind !== "variable")
|
|
33
|
+
return null;
|
|
34
|
+
const v = s.variables[declaredVarKey(selection.uid)];
|
|
35
|
+
return v && v.kind === "declared" ? v : null;
|
|
36
|
+
}, [selection]));
|
|
37
|
+
const selectedEdgeRaw = useStore(useCallback((s) => {
|
|
38
|
+
// Edge panel shows only for a lone edge (a node selection takes priority).
|
|
39
|
+
if (selection.kind !== "graph" || selection.edgeIds.length !== 1 || selection.nodeIds.length > 0)
|
|
40
|
+
return null;
|
|
41
|
+
return s.edges.find((e) => e.id === selection.edgeIds[0]) ?? null;
|
|
42
|
+
}, [selection]));
|
|
43
|
+
const selectedEdge = selectedEdgeRaw
|
|
44
|
+
? {
|
|
45
|
+
id: selectedEdgeRaw.id,
|
|
46
|
+
source: selectedEdgeRaw.source,
|
|
47
|
+
type: (selectedEdgeRaw.type ?? "control"),
|
|
48
|
+
data: (selectedEdgeRaw.data ?? {}),
|
|
49
|
+
}
|
|
50
|
+
: null;
|
|
51
|
+
const sourceControlEdgeCount = useStore(useCallback((s) => {
|
|
52
|
+
if (!selectedEdge)
|
|
53
|
+
return 0;
|
|
54
|
+
return s.edges.filter((e) => e.source === selectedEdge.source && isControlFlow(e.type)).length;
|
|
55
|
+
},
|
|
56
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
57
|
+
[selectedEdge?.source]));
|
|
58
|
+
const selectedChannel = useMemo(() => (selection.kind === "channel" ? (Object.values(channels).find((v) => v.id === selection.id) ?? null) : null), [selection, channels]);
|
|
59
|
+
const selectedMemory = useMemo(() => (selection.kind === "memory" ? (Object.values(memory).find((m) => m.id === selection.id) ?? null) : null), [selection, memory]);
|
|
60
|
+
const selectedModel = useMemo(() => (selection.kind === "model" ? (Object.values(models).find((m) => m.id === selection.id) ?? null) : null), [selection, models]);
|
|
61
|
+
const selectedFunction = useMemo(() => (selection.kind === "function" ? (functions[selection.id] ?? null) : null), [selection, functions]);
|
|
62
|
+
const getNodeCategory = useCallback((node) => getNodeDef(node)?.category, [getNodeDef]);
|
|
63
|
+
const handleTestNode = useCallback((nodeId) => onTestNode?.(nodeId), [onTestNode]);
|
|
64
|
+
if (selectionDrag)
|
|
65
|
+
return null;
|
|
66
|
+
if (isDebugMode) {
|
|
67
|
+
if (!selectedNode)
|
|
68
|
+
return null;
|
|
69
|
+
return (_jsx(Shell, { bg: "bg-background", pad: true, children: _jsx(DebugExternalIOPanel, { canvasId: canvasId, onStep: onDebugStep ?? (() => { }), getNodeCategory: getNodeCategory }) }));
|
|
70
|
+
}
|
|
71
|
+
if (selectedNode) {
|
|
72
|
+
return (_jsx(Shell, { children: _jsx(NodeConfigPanel, { canvasId: canvasId, selectedNode: selectedNode, onNodeUpdate: onNodeUpdate, onNodeDelete: onNodeDelete, onClose: onClearSelection, onOpenTest: handleTestNode, getNodeDef: getNodeDef }) }));
|
|
73
|
+
}
|
|
74
|
+
if (selectedEdge) {
|
|
75
|
+
return (_jsx(Shell, { children: _jsx(EdgeConfigPanel, { canvasId: canvasId, edgeId: selectedEdge.id, edgeType: selectedEdge.type, edgeData: selectedEdge.data, sourceControlEdgeCount: sourceControlEdgeCount, onEdgeUpdate: onEdgeUpdate, onEdgeDelete: onEdgeDelete, onClose: onClearSelection }) }));
|
|
76
|
+
}
|
|
77
|
+
if (selectedVariable) {
|
|
78
|
+
return (_jsx(Shell, { children: _jsx(VariableConfigPanel, { canvasId: canvasId, variable: selectedVariable, onClose: clearSelection }) }));
|
|
79
|
+
}
|
|
80
|
+
if (selectedChannel) {
|
|
81
|
+
return (_jsx(Shell, { children: _jsx(ChannelConfigPanel, { channel: selectedChannel, onClose: clearSelection }) }));
|
|
82
|
+
}
|
|
83
|
+
if (selectedMemory) {
|
|
84
|
+
return (_jsx(Shell, { children: _jsx(MemoryConfigPanel, { memory: selectedMemory, onClose: clearSelection }) }));
|
|
85
|
+
}
|
|
86
|
+
if (selectedModel) {
|
|
87
|
+
return (_jsx(Shell, { children: _jsx(ModelConfigPanel, { model: selectedModel, onClose: clearSelection }) }));
|
|
88
|
+
}
|
|
89
|
+
if (selectedFunction) {
|
|
90
|
+
return (_jsx(Shell, { children: _jsx(FunctionConfigPanel, { func: selectedFunction, onClose: clearSelection }) }));
|
|
91
|
+
}
|
|
92
|
+
return null;
|
|
93
|
+
};
|
|
94
|
+
/**
|
|
95
|
+
* Right-panel chrome — fixed-width column with the bordered card background
|
|
96
|
+
* and an overlay scrollbar. Extracted because all eight selection branches
|
|
97
|
+
* render the same shell; keeping them in lockstep by hand was an obvious
|
|
98
|
+
* drift risk. The debug variant overrides the surface and adds inner padding
|
|
99
|
+
* (other variants pad inside their own ConfigPanel).
|
|
100
|
+
*/
|
|
101
|
+
const Shell = ({ bg = "bg-card", pad = false, children, }) => (_jsx(ScrollArea, { className: cn("w-80 border-l border-border", bg), viewportClassName: pad ? "p-3" : undefined, children: children }));
|
|
102
|
+
//# sourceMappingURL=RightConfigPanel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RightConfigPanel.js","sourceRoot":"","sources":["../src/RightConfigPanel.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,OAAO,EAAkB,MAAM,OAAO,CAAC;AAG7D,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAGhE,OAAO,EAAE,UAAU,EAAE,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E,gBAAgB,EAC1B,OAAO,EAAE,cAAc,GACvB,GACI,CACT,CAAC;IACJ,CAAC;IAED,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,CACL,KAAC,KAAK,cACJ,KAAC,kBAAkB,IAAC,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,GAAI,GACnE,CACT,CAAC;IACJ,CAAC;IAED,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CACL,KAAC,KAAK,cACJ,KAAC,iBAAiB,IAAC,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,GAAI,GAChE,CACT,CAAC;IACJ,CAAC;IAED,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO,CACL,KAAC,KAAK,cACJ,KAAC,gBAAgB,IAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,cAAc,GAAI,GAC7D,CACT,CAAC;IACJ,CAAC;IAED,IAAI,gBAAgB,EAAE,CAAC;QACrB,OAAO,CACL,KAAC,KAAK,cACJ,KAAC,mBAAmB,IAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,cAAc,GAAI,GAClE,CACT,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,KAAK,GAAG,CAAC,EACb,EAAE,GAAG,SAAS,EACd,GAAG,GAAG,KAAK,EACX,QAAQ,GAKT,EAAE,EAAE,CAAC,CACJ,KAAC,UAAU,IAAC,SAAS,EAAE,EAAE,CAAC,6BAA6B,EAAE,EAAE,CAAC,EAAE,iBAAiB,EAAE,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,YACrG,QAAQ,GACE,CACd,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { ApiWorkflow } from "@foresthubai/workflow-core/workflow";
|
|
2
|
+
import type { ModelInfo } from "@foresthubai/workflow-core/model";
|
|
3
|
+
import { type DebugSessionPhase } from "./stores/debugStore";
|
|
4
|
+
/** BuilderMode steers the overall behavior of the workflow builder. */
|
|
5
|
+
export type BuilderMode = {
|
|
6
|
+
type: "edit";
|
|
7
|
+
} | {
|
|
8
|
+
type: "preview";
|
|
9
|
+
} | {
|
|
10
|
+
type: "debug";
|
|
11
|
+
};
|
|
12
|
+
/** True when canvas mutations should be blocked (preview or debug). */
|
|
13
|
+
export declare function isReadOnly(mode: BuilderMode): boolean;
|
|
14
|
+
/** Type guard for preview mode. */
|
|
15
|
+
export declare function isPreview(mode: BuilderMode): boolean;
|
|
16
|
+
export interface WorkflowBuilderProps {
|
|
17
|
+
/** Workflow loaded on mount. If none is provided, an empty workflow is created. */
|
|
18
|
+
initialWorkflow?: ApiWorkflow;
|
|
19
|
+
/** Builder mode on mount. Defaults to { type: "edit" }. */
|
|
20
|
+
initialMode?: BuilderMode;
|
|
21
|
+
/**
|
|
22
|
+
* Static model catalog — the models the llmproxy supports. Shown as the
|
|
23
|
+
* built-in options in agent model pickers. Self-hosted/custom models are
|
|
24
|
+
* declared in the Models tab instead. Defaults to [] (empty dropdown).
|
|
25
|
+
*/
|
|
26
|
+
models?: ModelInfo[];
|
|
27
|
+
/**
|
|
28
|
+
* UI language (e.g. "en", "de"). The host owns locale; the builder follows.
|
|
29
|
+
* Defaults to "en". The builder never auto-detects language.
|
|
30
|
+
*/
|
|
31
|
+
language?: string;
|
|
32
|
+
/** A node requested embedder-side testing (e.g. Agent "Test" button). */
|
|
33
|
+
onTestNode?: (nodeId: string) => void;
|
|
34
|
+
/** Step request from the in-builder debug panel — embedder forwards to the engine. */
|
|
35
|
+
onDebugStep?: (nodeId?: string) => void;
|
|
36
|
+
/** Fires after any domain-state mutation. Pull current state via handle.exportWorkflow(). */
|
|
37
|
+
onChange?: () => void;
|
|
38
|
+
/**
|
|
39
|
+
* Undo/redo availability for the ACTIVE canvas changed — on history mutation,
|
|
40
|
+
* undo/redo, or a tab switch (each canvas has its own history). For wiring host
|
|
41
|
+
* undo/redo buttons.
|
|
42
|
+
*/
|
|
43
|
+
onHistoryChange?: (state: {
|
|
44
|
+
canUndo: boolean;
|
|
45
|
+
canRedo: boolean;
|
|
46
|
+
}) => void;
|
|
47
|
+
/** Unexpected error during builder operations (e.g. failed load). */
|
|
48
|
+
onError?: (error: Error) => void;
|
|
49
|
+
}
|
|
50
|
+
export interface WorkflowBuilderHandle {
|
|
51
|
+
loadWorkflow: (workflow: ApiWorkflow) => void;
|
|
52
|
+
exportWorkflow: () => ApiWorkflow;
|
|
53
|
+
clear: () => void;
|
|
54
|
+
setMode: (mode: BuilderMode) => void;
|
|
55
|
+
getMode: () => BuilderMode;
|
|
56
|
+
validate: () => void;
|
|
57
|
+
undo: () => void;
|
|
58
|
+
redo: () => void;
|
|
59
|
+
setDebugPhase: (phase: DebugSessionPhase) => void;
|
|
60
|
+
}
|
|
61
|
+
export declare const WorkflowBuilder: import("react").ForwardRefExoticComponent<WorkflowBuilderProps & import("react").RefAttributes<WorkflowBuilderHandle>>;
|
|
62
|
+
//# sourceMappingURL=WorkflowBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorkflowBuilder.d.ts","sourceRoot":"","sources":["../src/WorkflowBuilder.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAgClE,OAAO,EAAiB,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAG5E,uEAAuE;AACvE,MAAM,MAAM,WAAW,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAErF,uEAAuE;AACvE,wBAAgB,UAAU,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAErD;AAED,mCAAmC;AACnC,wBAAgB,SAAS,CAAC,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,275 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { validateWorkflowState, validateChannel, validateMemory, validateModel, } from "@foresthubai/workflow-core/diagnostics";
|
|
3
|
+
import { forwardRef, useCallback, useEffect, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { I18nextProvider } from "react-i18next";
|
|
5
|
+
import i18n from "./i18n";
|
|
6
|
+
import { toast } from "./hooks/use-toast";
|
|
7
|
+
import ValidationDialog from "./dialogs/ValidationDialog";
|
|
8
|
+
import { BuilderLayout } from "./BuilderLayout";
|
|
9
|
+
import { TooltipProvider } from "./components/ui/tooltip";
|
|
10
|
+
import { Toaster } from "./components/ui/toaster";
|
|
11
|
+
import { useCanvasTabs } from "./hooks/useCanvasTabs";
|
|
12
|
+
import { useResourceDiagnosticsSync } from "./hooks/useResourceDiagnosticsSync";
|
|
13
|
+
import { useFunctionDiagnosticsSync } from "./hooks/useFunctionDiagnosticsSync";
|
|
14
|
+
import { useSuppressThemeTransition } from "./hooks/useSuppressThemeTransition";
|
|
15
|
+
import { useFunctions } from "./hooks/useFunctions";
|
|
16
|
+
import { useWorkflowSerialization, readStateFromStores } from "./hooks/useWorkflowSerialization";
|
|
17
|
+
import { clearAllCanvasStores, getAllCanvasStores, getOrCreateCanvasStore, subscribeCanvasRegistryChanges, MAIN_CANVAS_ID, } from "./stores/canvasStore";
|
|
18
|
+
import { useDebugStore } from "./stores/debugStore";
|
|
19
|
+
import { useEditorStore } from "./stores/editorStore";
|
|
20
|
+
/** True when canvas mutations should be blocked (preview or debug). */
|
|
21
|
+
export function isReadOnly(mode) {
|
|
22
|
+
return mode.type !== "edit";
|
|
23
|
+
}
|
|
24
|
+
/** Type guard for preview mode. */
|
|
25
|
+
export function isPreview(mode) {
|
|
26
|
+
return mode.type === "preview";
|
|
27
|
+
}
|
|
28
|
+
// ============================================================================
|
|
29
|
+
// Component — owns tabs/functions/dialogs; exposes the handle; delegates
|
|
30
|
+
// layout/canvas rendering to BuilderLayout.
|
|
31
|
+
// ============================================================================
|
|
32
|
+
export const WorkflowBuilder = forwardRef(function WorkflowBuilder(props, ref) {
|
|
33
|
+
const { initialWorkflow, initialMode, models, language, onTestNode, onDebugStep, onChange, onHistoryChange, onError, } = props;
|
|
34
|
+
// Host drives locale. useLayoutEffect (not useEffect) so the language is set
|
|
35
|
+
// before paint — mounting with language="de" shows German on the first frame
|
|
36
|
+
// rather than flashing English. changeLanguage is sync here (bundled resources).
|
|
37
|
+
useLayoutEffect(() => {
|
|
38
|
+
if (language && i18n.language !== language)
|
|
39
|
+
i18n.changeLanguage(language);
|
|
40
|
+
}, [language]);
|
|
41
|
+
const { importProject, exportProject } = useWorkflowSerialization();
|
|
42
|
+
// Color-mode toggles should snap, not fade — see hook docs.
|
|
43
|
+
useSuppressThemeTransition();
|
|
44
|
+
// Keep project-scoped (channel + memory + model) diagnostics in sync. Mounted
|
|
45
|
+
// once here at the root so badges survive sidebar tab open/close.
|
|
46
|
+
useResourceDiagnosticsSync({
|
|
47
|
+
selectItems: (s) => s.channels,
|
|
48
|
+
validate: validateChannel,
|
|
49
|
+
getStored: (d) => d.byChannelId,
|
|
50
|
+
set: (d, id, diags) => d.setChannelDiagnostics(id, diags),
|
|
51
|
+
clear: (d, id) => d.clearChannelDiagnostics(id),
|
|
52
|
+
});
|
|
53
|
+
useResourceDiagnosticsSync({
|
|
54
|
+
selectItems: (s) => s.memory,
|
|
55
|
+
validate: validateMemory,
|
|
56
|
+
getStored: (d) => d.byMemoryId,
|
|
57
|
+
set: (d, id, diags) => d.setMemoryDiagnostics(id, diags),
|
|
58
|
+
clear: (d, id) => d.clearMemoryDiagnostics(id),
|
|
59
|
+
});
|
|
60
|
+
useResourceDiagnosticsSync({
|
|
61
|
+
selectItems: (s) => s.models,
|
|
62
|
+
validate: validateModel,
|
|
63
|
+
getStored: (d) => d.byModelId,
|
|
64
|
+
set: (d, id, diags) => d.setModelDiagnostics(id, diags),
|
|
65
|
+
clear: (d, id) => d.clearModelDiagnostics(id),
|
|
66
|
+
});
|
|
67
|
+
// Functions are a FunctionDeclaration (not a flat resource bag), so they use a
|
|
68
|
+
// dedicated diagnostics sync.
|
|
69
|
+
useFunctionDiagnosticsSync();
|
|
70
|
+
// Push the embedder-supplied model catalog into the store so agent model
|
|
71
|
+
// pickers can read it. Catalog is config (not workflow content), so this
|
|
72
|
+
// never fires onChange.
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
useEditorStore.getState().setAvailableModels(models ?? []);
|
|
75
|
+
}, [models]);
|
|
76
|
+
// Canvas tabs + functions live here because they survive canvas switches.
|
|
77
|
+
const canvasTabs = useCanvasTabs();
|
|
78
|
+
const functionsHook = useFunctions({ onOpenTab: canvasTabs.openTab });
|
|
79
|
+
// Built-in validation UX. validate() presents the result itself rather than
|
|
80
|
+
// returning it: a success toast when clean, else this dialog. Non-null = open.
|
|
81
|
+
const [validation, setValidation] = useState(null);
|
|
82
|
+
const runValidate = useCallback(() => {
|
|
83
|
+
const result = validateWorkflowState(readStateFromStores());
|
|
84
|
+
if (result.totalErrors === 0 && result.totalWarnings === 0) {
|
|
85
|
+
toast({ title: i18n.t("validationPassed") });
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
setValidation(result);
|
|
89
|
+
}
|
|
90
|
+
}, []);
|
|
91
|
+
// Jump to a diagnostic's target, then dismiss the dialog so it's visible.
|
|
92
|
+
const navigateToDiagnostic = useCallback((d) => {
|
|
93
|
+
const editor = useEditorStore.getState();
|
|
94
|
+
// Project-scoped targets: open the matching sidebar tab AND select the item.
|
|
95
|
+
if (d.channelId) {
|
|
96
|
+
editor.setActiveSidebarTab("channels");
|
|
97
|
+
editor.selectChannel(d.channelId);
|
|
98
|
+
}
|
|
99
|
+
else if (d.memoryId) {
|
|
100
|
+
editor.setActiveSidebarTab("memory");
|
|
101
|
+
editor.selectMemory(d.memoryId);
|
|
102
|
+
}
|
|
103
|
+
else if (d.modelId) {
|
|
104
|
+
editor.setActiveSidebarTab("models");
|
|
105
|
+
editor.selectModel(d.modelId);
|
|
106
|
+
}
|
|
107
|
+
else if (d.canvasId) {
|
|
108
|
+
// Switch first so selectGraph targets the right canvas, then select.
|
|
109
|
+
if (d.canvasId === MAIN_CANVAS_ID)
|
|
110
|
+
editor.setActiveCanvas(MAIN_CANVAS_ID);
|
|
111
|
+
else
|
|
112
|
+
functionsHook.openFunction(d.canvasId);
|
|
113
|
+
if (d.nodeId)
|
|
114
|
+
editor.selectGraph([d.nodeId], []);
|
|
115
|
+
else if (d.edgeId)
|
|
116
|
+
editor.selectGraph([], [d.edgeId]);
|
|
117
|
+
}
|
|
118
|
+
setValidation(null);
|
|
119
|
+
}, [functionsHook]);
|
|
120
|
+
// Initial load (runs once, even under StrictMode double-mount).
|
|
121
|
+
const initialLoadDone = useRef(false);
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (initialLoadDone.current)
|
|
124
|
+
return;
|
|
125
|
+
initialLoadDone.current = true;
|
|
126
|
+
try {
|
|
127
|
+
if (initialMode)
|
|
128
|
+
useEditorStore.getState().setBuilderMode(initialMode);
|
|
129
|
+
if (initialWorkflow)
|
|
130
|
+
importProject(initialWorkflow);
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
onError?.(e instanceof Error ? e : new Error(String(e)));
|
|
134
|
+
}
|
|
135
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
136
|
+
}, []);
|
|
137
|
+
// ── Lifecycle subscriptions ────────────────────────────────────────────
|
|
138
|
+
// Stash latest callbacks in refs so the subscription effect runs once.
|
|
139
|
+
const onChangeRef = useRef(onChange);
|
|
140
|
+
const onHistoryChangeRef = useRef(onHistoryChange);
|
|
141
|
+
onChangeRef.current = onChange;
|
|
142
|
+
onHistoryChangeRef.current = onHistoryChange;
|
|
143
|
+
// onChange fires on any domain change. For canvas content we watch the
|
|
144
|
+
// history middleware's `mutationCount`, which bumps on checkpoints AND
|
|
145
|
+
// undo/redo but never on selection/drag (those go through setNodes without a
|
|
146
|
+
// checkpoint). That makes onChange honest for undo/redo and silent on
|
|
147
|
+
// view-state — the thing a raw store subscription can't do, since selection
|
|
148
|
+
// lives inside the nodes array. (editorStore exposes its own `mutationCount`
|
|
149
|
+
// for project-scoped channel/memory/model edits; watched separately below.)
|
|
150
|
+
useEffect(() => {
|
|
151
|
+
const subs = [];
|
|
152
|
+
const subscribedStores = new WeakSet();
|
|
153
|
+
function subscribeCanvas(store) {
|
|
154
|
+
if (subscribedStores.has(store))
|
|
155
|
+
return;
|
|
156
|
+
subscribedStores.add(store);
|
|
157
|
+
let prev = store.getState().mutationCount;
|
|
158
|
+
const unsub = store.subscribe((state) => {
|
|
159
|
+
if (state.mutationCount !== prev) {
|
|
160
|
+
prev = state.mutationCount;
|
|
161
|
+
onChangeRef.current?.();
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
subs.push(unsub);
|
|
165
|
+
}
|
|
166
|
+
function subscribeAllCanvases() {
|
|
167
|
+
for (const store of Object.values(getAllCanvasStores())) {
|
|
168
|
+
subscribeCanvas(store);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
subscribeAllCanvases();
|
|
172
|
+
// Canvas stores come and go (function add/delete, project load). Re-subscribe
|
|
173
|
+
// to the new set so newly created function bodies are watched. We do NOT fire
|
|
174
|
+
// onChange here: function add/delete/rename and all definition edits flow
|
|
175
|
+
// through editorStore.mutationCount (setFunctions), caught by the editor
|
|
176
|
+
// subscription below — so the change signal is covered without double-firing.
|
|
177
|
+
const unsubRegistry = subscribeCanvasRegistryChanges(() => {
|
|
178
|
+
subscribeAllCanvases();
|
|
179
|
+
});
|
|
180
|
+
subs.push(unsubRegistry);
|
|
181
|
+
// Project-scoped mutations (channels, memory, models, functions).
|
|
182
|
+
let prevEditorCount = useEditorStore.getState().mutationCount;
|
|
183
|
+
const unsubEditor = useEditorStore.subscribe((state) => {
|
|
184
|
+
if (state.mutationCount !== prevEditorCount) {
|
|
185
|
+
prevEditorCount = state.mutationCount;
|
|
186
|
+
onChangeRef.current?.();
|
|
187
|
+
}
|
|
188
|
+
});
|
|
189
|
+
subs.push(unsubEditor);
|
|
190
|
+
return () => {
|
|
191
|
+
for (const u of subs)
|
|
192
|
+
u();
|
|
193
|
+
};
|
|
194
|
+
}, []);
|
|
195
|
+
// History-affordance subscription — emits the ACTIVE canvas's canUndo/canRedo
|
|
196
|
+
// so host chrome can drive undo/redo buttons. Distinct from onChange: a tab
|
|
197
|
+
// switch changes which history is active without being a domain mutation, so
|
|
198
|
+
// it must update buttons without marking the document dirty.
|
|
199
|
+
useEffect(() => {
|
|
200
|
+
let prevCanUndo = null;
|
|
201
|
+
let prevCanRedo = null;
|
|
202
|
+
let unsubActive = null;
|
|
203
|
+
const emit = () => {
|
|
204
|
+
const store = getOrCreateCanvasStore(useEditorStore.getState().activeCanvasId);
|
|
205
|
+
const canUndo = store.canUndo();
|
|
206
|
+
const canRedo = store.canRedo();
|
|
207
|
+
if (canUndo === prevCanUndo && canRedo === prevCanRedo)
|
|
208
|
+
return;
|
|
209
|
+
prevCanUndo = canUndo;
|
|
210
|
+
prevCanRedo = canRedo;
|
|
211
|
+
onHistoryChangeRef.current?.({ canUndo, canRedo });
|
|
212
|
+
};
|
|
213
|
+
// Bind to the current active canvas (a) and emit. Re-run on tab switch (b)
|
|
214
|
+
// and on store-instance rebuilds from load/clear (c) — both can change which
|
|
215
|
+
// store, or store object, is active under us.
|
|
216
|
+
const bindActive = () => {
|
|
217
|
+
unsubActive?.();
|
|
218
|
+
unsubActive = getOrCreateCanvasStore(useEditorStore.getState().activeCanvasId).subscribe(emit);
|
|
219
|
+
emit();
|
|
220
|
+
};
|
|
221
|
+
bindActive();
|
|
222
|
+
let prevActive = useEditorStore.getState().activeCanvasId;
|
|
223
|
+
const unsubEditor = useEditorStore.subscribe((state) => {
|
|
224
|
+
if (state.activeCanvasId !== prevActive) {
|
|
225
|
+
prevActive = state.activeCanvasId;
|
|
226
|
+
bindActive(); // (b) tab switch
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
const unsubRegistry = subscribeCanvasRegistryChanges(bindActive); // (c) load/clear rebuild
|
|
230
|
+
return () => {
|
|
231
|
+
unsubActive?.();
|
|
232
|
+
unsubEditor();
|
|
233
|
+
unsubRegistry();
|
|
234
|
+
};
|
|
235
|
+
}, []);
|
|
236
|
+
// ── Imperative handle ─────────────────────────────────────────────────
|
|
237
|
+
useImperativeHandle(ref, () => ({
|
|
238
|
+
loadWorkflow: (workflow) => {
|
|
239
|
+
try {
|
|
240
|
+
importProject(workflow);
|
|
241
|
+
}
|
|
242
|
+
catch (e) {
|
|
243
|
+
onError?.(e instanceof Error ? e : new Error(String(e)));
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
exportWorkflow: () => exportProject(),
|
|
247
|
+
clear: () => {
|
|
248
|
+
clearAllCanvasStores();
|
|
249
|
+
// Function declarations are project-scoped (not in canvas stores), so reset
|
|
250
|
+
// them explicitly alongside the cleared bodies.
|
|
251
|
+
useEditorStore.getState().setFunctions(() => ({}));
|
|
252
|
+
useEditorStore.getState().clearSelection();
|
|
253
|
+
},
|
|
254
|
+
setMode: (mode) => useEditorStore.getState().setBuilderMode(mode),
|
|
255
|
+
getMode: () => useEditorStore.getState().builderMode,
|
|
256
|
+
validate: runValidate,
|
|
257
|
+
undo: () => getOrCreateCanvasStore(useEditorStore.getState().activeCanvasId).undo(),
|
|
258
|
+
redo: () => getOrCreateCanvasStore(useEditorStore.getState().activeCanvasId).redo(),
|
|
259
|
+
setDebugPhase: (phase) => useDebugStore.getState().setPhase(phase),
|
|
260
|
+
}), [importProject, exportProject, onError, runValidate]);
|
|
261
|
+
// I18nextProvider scopes the builder's PRIVATE i18n instance to this subtree,
|
|
262
|
+
// so the useTranslation() consumers read it (never the host's i18next).
|
|
263
|
+
//
|
|
264
|
+
// The `fh-builder` root carries the builder's OWN base look (font,
|
|
265
|
+
// text color, antialiasing) on its own element. The builder no longer styles
|
|
266
|
+
// the host's <body> — the host owns the page. `h-full w-full` makes the
|
|
267
|
+
// builder fill whatever container it's mounted in; it never assumes the
|
|
268
|
+
// viewport. TooltipProvider + Toaster live inside the package so the embedder
|
|
269
|
+
// doesn't need to know we use Radix tooltips or shadcn toasts internally.
|
|
270
|
+
return (_jsx(I18nextProvider, { i18n: i18n, children: _jsx(TooltipProvider, { delayDuration: 300, children: _jsxs("div", { className: "fh-builder h-full w-full bg-background text-foreground font-sans antialiased", children: [_jsx(BuilderLayout, { functions: functionsHook.functions, onOpenFunction: functionsHook.openFunction, onCreateFunction: functionsHook.createFunction, canvasTabs: canvasTabs.tabs, onCanvasTabChange: canvasTabs.setActiveTabId, onCanvasTabClose: canvasTabs.closeTab, onCanvasTabReorder: canvasTabs.reorderTabs, onTestNode: onTestNode, onDebugStep: onDebugStep }), _jsx(Toaster, {}), validation && (_jsx(ValidationDialog, { open: true, onOpenChange: (o) => {
|
|
271
|
+
if (!o)
|
|
272
|
+
setValidation(null);
|
|
273
|
+
}, validation: validation, onSelectDiagnostic: navigateToDiagnostic }))] }) }) }));
|
|
274
|
+
});
|
|
275
|
+
//# sourceMappingURL=WorkflowBuilder.js.map
|