@invect/ui 0.0.1
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 +21 -0
- package/README.md +77 -0
- package/dist/Invect-CWpIwZ5F.js +92738 -0
- package/dist/Invect.d.ts +25 -0
- package/dist/InvectShell.d.ts +14 -0
- package/dist/api/agent-tools.api.d.ts +1 -0
- package/dist/api/client.d.ts +207 -0
- package/dist/api/credentials.api.d.ts +47 -0
- package/dist/api/executions.api.d.ts +43 -0
- package/dist/api/flows.api.d.ts +100 -0
- package/dist/api/index.d.ts +9 -0
- package/dist/api/node-data.api.d.ts +66 -0
- package/dist/api/query-keys.d.ts +22 -0
- package/dist/api/triggers.api.d.ts +44 -0
- package/dist/api/types.d.ts +147 -0
- package/dist/api/use-flow-run-stream.d.ts +12 -0
- package/dist/assets/invect-branding.d.ts +4 -0
- package/dist/assets/provider-icons/index.d.ts +8 -0
- package/dist/babel-C9OtljFZ.js +9721 -0
- package/dist/components/PageLayout.d.ts +17 -0
- package/dist/components/chat/ChatInput.d.ts +17 -0
- package/dist/components/chat/ChatMessageList.d.ts +14 -0
- package/dist/components/chat/ChatModelSelector.d.ts +11 -0
- package/dist/components/chat/ChatPanel.d.ts +19 -0
- package/dist/components/chat/ChatPromptOverlay.d.ts +13 -0
- package/dist/components/chat/ChatProviderSelector.d.ts +9 -0
- package/dist/components/chat/ChatSettingsPanel.d.ts +11 -0
- package/dist/components/chat/InlineCredentialSetup.d.ts +9 -0
- package/dist/components/chat/MarkdownRenderer.d.ts +7 -0
- package/dist/components/chat/chat-memory.d.ts +21 -0
- package/dist/components/chat/chat.store.d.ts +416 -0
- package/dist/components/chat/index.d.ts +5 -0
- package/dist/components/chat/use-chat.d.ts +28 -0
- package/dist/components/credentials/CreateCredentialModal.d.ts +13 -0
- package/dist/components/credentials/CredentialDetailDialog.d.ts +17 -0
- package/dist/components/credentials/EditCredentialModal.d.ts +11 -0
- package/dist/components/credentials/OAuth2ConnectButton.d.ts +38 -0
- package/dist/components/credentials/OAuth2ProviderSelector.d.ts +15 -0
- package/dist/components/credentials/credential-utils.d.ts +12 -0
- package/dist/components/credentials/index.d.ts +9 -0
- package/dist/components/dashboard/FailedRunsAlert.d.ts +3 -0
- package/dist/components/dashboard/FlowCard.d.ts +7 -0
- package/dist/components/dashboard/RecentActivityTable.d.ts +9 -0
- package/dist/components/dashboard/StatCard.d.ts +10 -0
- package/dist/components/dashboard/index.d.ts +5 -0
- package/dist/components/dashboard/status-helpers.d.ts +5 -0
- package/dist/components/flow-editor/ActionsSidebar.d.ts +2 -0
- package/dist/components/flow-editor/FlowEditor.d.ts +21 -0
- package/dist/components/flow-editor/FlowHeader.d.ts +9 -0
- package/dist/components/flow-editor/FlowLayout.d.ts +24 -0
- package/dist/components/flow-editor/ModeSwitcher.d.ts +7 -0
- package/dist/components/flow-editor/NodeSidebar.d.ts +24 -0
- package/dist/components/flow-editor/RunControls.d.ts +12 -0
- package/dist/components/flow-editor/ToolConfigPanel.d.ts +16 -0
- package/dist/components/flow-editor/ValidationPanel.d.ts +5 -0
- package/dist/components/flow-editor/flow-editor.store.d.ts +1 -0
- package/dist/components/flow-editor/index.d.ts +6 -0
- package/dist/components/flow-editor/inline-edit.d.ts +10 -0
- package/dist/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.d.ts +26 -0
- package/dist/components/flow-editor/node-config-panel/CredentialCombobox.d.ts +21 -0
- package/dist/components/flow-editor/node-config-panel/CredentialsSection.d.ts +19 -0
- package/dist/components/flow-editor/node-config-panel/DroppableInput.d.ts +20 -0
- package/dist/components/flow-editor/node-config-panel/DynamicSelectField.d.ts +22 -0
- package/dist/components/flow-editor/node-config-panel/JsonPreviewPanel.d.ts +25 -0
- package/dist/components/flow-editor/node-config-panel/NodeConfigPanel.d.ts +14 -0
- package/dist/components/flow-editor/node-config-panel/NodeConfigPanelHeader.d.ts +15 -0
- package/dist/components/flow-editor/node-config-panel/ParametersSection.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/SearchableSelectField.d.ts +17 -0
- package/dist/components/flow-editor/node-config-panel/SwitchCasesField.d.ts +18 -0
- package/dist/components/flow-editor/node-config-panel/hooks/index.d.ts +2 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.d.ts +24 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-node-execution.d.ts +46 -0
- package/dist/components/flow-editor/node-config-panel/hooks/use-upstream-slots.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/panels/AgentToolsPanel.d.ts +18 -0
- package/dist/components/flow-editor/node-config-panel/panels/ConfigurationPanel.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/panels/DataMapperPane.d.ts +40 -0
- package/dist/components/flow-editor/node-config-panel/panels/InputPanel.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/panels/OutputPanel.d.ts +7 -0
- package/dist/components/flow-editor/node-config-panel/panels/index.d.ts +4 -0
- package/dist/components/flow-editor/node-config-panel/types.d.ts +19 -0
- package/dist/components/flow-editor/node-config-panel/use-node-config-panel-store.d.ts +49 -0
- package/dist/components/flow-editor/node-config-panel/use-node-config-state.d.ts +26 -0
- package/dist/components/flow-editor/node-config-panel/use-run-node.d.ts +16 -0
- package/dist/components/flow-editor/node-config-panel/utils.d.ts +9 -0
- package/dist/components/flow-editor/serialize-to-sdk.d.ts +20 -0
- package/dist/components/flow-editor/toolbar-context.d.ts +2 -0
- package/dist/components/flow-editor/use-copy-paste.d.ts +7 -0
- package/dist/components/flow-editor/use-copy-paste.types.d.ts +38 -0
- package/dist/components/flow-editor/use-flow-editor.d.ts +44 -0
- package/dist/components/flow-runs-table/FlowRunsTable.d.ts +6 -0
- package/dist/components/flow-runs-table/index.d.ts +1 -0
- package/dist/components/flow-viewer/FlowRunsView.d.ts +7 -0
- package/dist/components/flow-viewer/FlowStatusView.d.ts +21 -0
- package/dist/components/flow-viewer/RunSelector.d.ts +13 -0
- package/dist/components/flow-viewer/RunsSidebar.d.ts +14 -0
- package/dist/components/flow-viewer/agent-tool-executions-list.d.ts +7 -0
- package/dist/components/flow-viewer/index.d.ts +1 -0
- package/dist/components/flow-viewer/logs-panel.d.ts +18 -0
- package/dist/components/flow-viewer/use-execution-log-data.d.ts +113 -0
- package/dist/components/graph/BatchFlowEdge.d.ts +33 -0
- package/dist/components/graph/LayoutSelector.d.ts +9 -0
- package/dist/components/graph/index.d.ts +47 -0
- package/dist/components/graph/styleUtils.d.ts +124 -0
- package/dist/components/nodes/AgentConfigPanel.d.ts +24 -0
- package/dist/components/nodes/AgentNode.d.ts +8 -0
- package/dist/components/nodes/AgentToolsBox.d.ts +41 -0
- package/dist/components/nodes/NodeAppendix.d.ts +19 -0
- package/dist/components/nodes/NodeStatusIndicator.d.ts +30 -0
- package/dist/components/nodes/NodeViewContext.d.ts +18 -0
- package/dist/components/nodes/ToolParamField.d.ts +28 -0
- package/dist/components/nodes/ToolSelectorModal.d.ts +80 -0
- package/dist/components/nodes/ToolSelectorParts.d.ts +30 -0
- package/dist/components/nodes/UniversalNode.d.ts +2 -0
- package/dist/components/nodes/createContextAwareNodes.d.ts +6 -0
- package/dist/components/nodes/index.d.ts +22 -0
- package/dist/components/nodes/nodeRegistry.d.ts +13 -0
- package/dist/components/nodes/withNodeContext.d.ts +7 -0
- package/dist/components/shared/InvectLoader.d.ts +8 -0
- package/dist/components/shared/InvectLogo.d.ts +9 -0
- package/dist/components/shared/ProviderIcon.d.ts +23 -0
- package/dist/components/side-menu/side-menu.d.ts +4 -0
- package/dist/components/sidebar/BaseSidebar.d.ts +17 -0
- package/dist/components/sidebar/index.d.ts +1 -0
- package/dist/components/triggers/CronPreview.d.ts +12 -0
- package/dist/components/triggers/index.d.ts +1 -0
- package/dist/components/ui/alert-dialog.d.ts +18 -0
- package/dist/components/ui/badge.d.ts +9 -0
- package/dist/components/ui/button.d.ts +13 -0
- package/dist/components/ui/card.d.ts +9 -0
- package/dist/components/ui/codemirror-js-editor.d.ts +25 -0
- package/dist/components/ui/codemirror-json-editor.d.ts +18 -0
- package/dist/components/ui/codemirror-nunjucks-editor.d.ts +13 -0
- package/dist/components/ui/codemirror-vscode-theme.d.ts +24 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/command.d.ts +18 -0
- package/dist/components/ui/dialog.d.ts +18 -0
- package/dist/components/ui/dropdown-menu.d.ts +25 -0
- package/dist/components/ui/empty-state.d.ts +21 -0
- package/dist/components/ui/input.d.ts +3 -0
- package/dist/components/ui/label.d.ts +4 -0
- package/dist/components/ui/popover.d.ts +10 -0
- package/dist/components/ui/resizable.d.ts +8 -0
- package/dist/components/ui/scroll-area.d.ts +5 -0
- package/dist/components/ui/select.d.ts +18 -0
- package/dist/components/ui/separator.d.ts +4 -0
- package/dist/components/ui/slider.d.ts +4 -0
- package/dist/components/ui/switch.d.ts +3 -0
- package/dist/components/ui/table.d.ts +10 -0
- package/dist/components/ui/textarea.d.ts +3 -0
- package/dist/components/ui/tooltip.d.ts +7 -0
- package/dist/components/ui/tree-view.d.ts +107 -0
- package/dist/contexts/AgentToolCallbacksContext.d.ts +23 -0
- package/dist/contexts/ApiContext.d.ts +11 -0
- package/dist/contexts/FlowDataContext.d.ts +9 -0
- package/dist/contexts/NodeRegistryContext.d.ts +14 -0
- package/dist/contexts/PluginRegistryContext.d.ts +39 -0
- package/dist/contexts/ThemeProvider.d.ts +18 -0
- package/dist/contexts/ValidationContext.d.ts +22 -0
- package/dist/demo/DemoInvect.d.ts +11 -0
- package/dist/demo/FlowViewer.d.ts +31 -0
- package/dist/demo/demo-api-client.d.ts +33 -0
- package/dist/demo/index.d.ts +6 -0
- package/dist/demo/sample-data.d.ts +1538 -0
- package/dist/demo.d.ts +2 -0
- package/dist/demo.js +2774 -0
- package/dist/estree-ClbRfS-1.js +7076 -0
- package/dist/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/iosevka-latin-400-normal.woff2 +0 -0
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/use-document-title.d.ts +1 -0
- package/dist/hooks/use-flow-data.d.ts +22 -0
- package/dist/hooks/use-invect-portal-class.d.ts +21 -0
- package/dist/hooks/useFlowEditorStore.d.ts +1 -0
- package/dist/index.css +3 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +717 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/prettier.d.ts +13 -0
- package/dist/routes/all-flow-runs.d.ts +5 -0
- package/dist/routes/credentials.d.ts +5 -0
- package/dist/routes/flow-route-layout.d.ts +19 -0
- package/dist/routes/flow-runs.d.ts +5 -0
- package/dist/routes/flow.d.ts +5 -0
- package/dist/routes/home.d.ts +5 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/standalone-C3Df7W52.js +3463 -0
- package/dist/stores/executionViewStore.d.ts +64 -0
- package/dist/stores/flow-editor.store.d.ts +137 -0
- package/dist/stores/flowEditorStore.d.ts +1 -0
- package/dist/stores/index.d.ts +2 -0
- package/dist/stores/uiStore.d.ts +45 -0
- package/dist/types/agent-tools.types.d.ts +53 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/node-definition.types.d.ts +85 -0
- package/dist/types/plugin.types.d.ts +100 -0
- package/dist/utils/credentialBranding.d.ts +8 -0
- package/dist/utils/credentialFiltering.d.ts +20 -0
- package/dist/utils/flowTransformations.d.ts +16 -0
- package/dist/utils/layoutUtils.d.ts +23 -0
- package/dist/utils/nodeReferenceUtils.d.ts +37 -0
- package/dist/vendor.d.ts +5 -0
- package/package.json +130 -0
- package/src/.DS_Store +0 -0
- package/src/Invect.tsx +229 -0
- package/src/InvectShell.tsx +55 -0
- package/src/api/agent-tools.api.ts +23 -0
- package/src/api/client.ts +899 -0
- package/src/api/credentials.api.ts +197 -0
- package/src/api/executions.api.ts +228 -0
- package/src/api/flows.api.ts +195 -0
- package/src/api/index.ts +17 -0
- package/src/api/node-data.api.ts +167 -0
- package/src/api/query-keys.ts +44 -0
- package/src/api/triggers.api.ts +120 -0
- package/src/api/types.ts +212 -0
- package/src/api/use-flow-run-stream.ts +206 -0
- package/src/app.css +560 -0
- package/src/assets/.DS_Store +0 -0
- package/src/assets/favicon.ico +0 -0
- package/src/assets/fonts/geist-cyrillic-wght-normal.woff2 +0 -0
- package/src/assets/fonts/geist-latin-ext-wght-normal.woff2 +0 -0
- package/src/assets/fonts/geist-latin-wght-normal.woff2 +0 -0
- package/src/assets/fonts/iosevka-latin-400-normal.woff2 +0 -0
- package/src/assets/invect-branding.ts +51 -0
- package/src/assets/provider-icons/anthropic.svg +1 -0
- package/src/assets/provider-icons/anthropic_light.svg +1 -0
- package/src/assets/provider-icons/github.svg +1 -0
- package/src/assets/provider-icons/github_light.svg +1 -0
- package/src/assets/provider-icons/gmail.svg +1 -0
- package/src/assets/provider-icons/google_calendar.svg +1 -0
- package/src/assets/provider-icons/google_docs.svg +1 -0
- package/src/assets/provider-icons/google_drive.svg +1 -0
- package/src/assets/provider-icons/google_sheets.svg +1 -0
- package/src/assets/provider-icons/index.ts +55 -0
- package/src/assets/provider-icons/linear.svg +1 -0
- package/src/assets/provider-icons/openai.svg +1 -0
- package/src/assets/provider-icons/postgres.svg +1 -0
- package/src/assets/provider-icons/slack.svg +1 -0
- package/src/assets/small-loader-dark.svg +22 -0
- package/src/assets/small-loader-light.svg +22 -0
- package/src/assets/small.svg +7 -0
- package/src/components/.DS_Store +0 -0
- package/src/components/PageLayout.tsx +55 -0
- package/src/components/chat/ChatInput.tsx +115 -0
- package/src/components/chat/ChatMessageList.tsx +788 -0
- package/src/components/chat/ChatModelSelector.tsx +208 -0
- package/src/components/chat/ChatPanel.tsx +243 -0
- package/src/components/chat/ChatPromptOverlay.tsx +150 -0
- package/src/components/chat/ChatProviderSelector.tsx +135 -0
- package/src/components/chat/ChatSettingsPanel.tsx +277 -0
- package/src/components/chat/InlineCredentialSetup.tsx +343 -0
- package/src/components/chat/MarkdownRenderer.tsx +140 -0
- package/src/components/chat/chat-memory.ts +88 -0
- package/src/components/chat/chat.store.ts +479 -0
- package/src/components/chat/index.ts +5 -0
- package/src/components/chat/use-chat.ts +473 -0
- package/src/components/credentials/CreateCredentialModal.tsx +609 -0
- package/src/components/credentials/CredentialDetailDialog.tsx +882 -0
- package/src/components/credentials/EditCredentialModal.tsx +399 -0
- package/src/components/credentials/OAuth2ConnectButton.tsx +288 -0
- package/src/components/credentials/OAuth2ProviderSelector.tsx +360 -0
- package/src/components/credentials/credential-utils.ts +99 -0
- package/src/components/credentials/index.ts +10 -0
- package/src/components/dashboard/FailedRunsAlert.tsx +67 -0
- package/src/components/dashboard/FlowCard.tsx +64 -0
- package/src/components/dashboard/RecentActivityTable.tsx +92 -0
- package/src/components/dashboard/StatCard.tsx +32 -0
- package/src/components/dashboard/index.ts +5 -0
- package/src/components/dashboard/status-helpers.tsx +102 -0
- package/src/components/flow-editor/ActionsSidebar.tsx +503 -0
- package/src/components/flow-editor/FlowEditor.tsx +1002 -0
- package/src/components/flow-editor/FlowHeader.tsx +87 -0
- package/src/components/flow-editor/FlowLayout.tsx +117 -0
- package/src/components/flow-editor/ModeSwitcher.tsx +49 -0
- package/src/components/flow-editor/NodeSidebar.tsx +343 -0
- package/src/components/flow-editor/RunControls.tsx +109 -0
- package/src/components/flow-editor/ToolConfigPanel.tsx +434 -0
- package/src/components/flow-editor/ValidationPanel.tsx +167 -0
- package/src/components/flow-editor/flow-editor.store.ts +2 -0
- package/src/components/flow-editor/index.ts +6 -0
- package/src/components/flow-editor/inline-edit.tsx +111 -0
- package/src/components/flow-editor/node-config-panel/ConfigFieldWithTemplate.tsx +334 -0
- package/src/components/flow-editor/node-config-panel/CredentialCombobox.tsx +217 -0
- package/src/components/flow-editor/node-config-panel/CredentialsSection.tsx +154 -0
- package/src/components/flow-editor/node-config-panel/DroppableInput.tsx +45 -0
- package/src/components/flow-editor/node-config-panel/DynamicSelectField.tsx +223 -0
- package/src/components/flow-editor/node-config-panel/JsonPreviewPanel.tsx +134 -0
- package/src/components/flow-editor/node-config-panel/NodeConfigPanel.tsx +650 -0
- package/src/components/flow-editor/node-config-panel/NodeConfigPanelHeader.tsx +91 -0
- package/src/components/flow-editor/node-config-panel/ParametersSection.tsx +144 -0
- package/src/components/flow-editor/node-config-panel/SearchableSelectField.tsx +126 -0
- package/src/components/flow-editor/node-config-panel/SwitchCasesField.tsx +212 -0
- package/src/components/flow-editor/node-config-panel/hooks/index.ts +2 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-node-config-panel-state.ts +284 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-node-execution.ts +287 -0
- package/src/components/flow-editor/node-config-panel/hooks/use-upstream-slots.ts +310 -0
- package/src/components/flow-editor/node-config-panel/panels/AgentToolsPanel.tsx +837 -0
- package/src/components/flow-editor/node-config-panel/panels/ConfigurationPanel.tsx +383 -0
- package/src/components/flow-editor/node-config-panel/panels/DataMapperPane.tsx +456 -0
- package/src/components/flow-editor/node-config-panel/panels/InputPanel.tsx +338 -0
- package/src/components/flow-editor/node-config-panel/panels/OutputPanel.tsx +109 -0
- package/src/components/flow-editor/node-config-panel/panels/index.ts +4 -0
- package/src/components/flow-editor/node-config-panel/types.ts +20 -0
- package/src/components/flow-editor/node-config-panel/use-node-config-panel-store.ts +283 -0
- package/src/components/flow-editor/node-config-panel/use-node-config-state.ts +172 -0
- package/src/components/flow-editor/node-config-panel/use-run-node.ts +147 -0
- package/src/components/flow-editor/node-config-panel/utils.ts +73 -0
- package/src/components/flow-editor/serialize-to-sdk.ts +204 -0
- package/src/components/flow-editor/toolbar-context.ts +9 -0
- package/src/components/flow-editor/use-copy-paste.ts +575 -0
- package/src/components/flow-editor/use-copy-paste.types.ts +35 -0
- package/src/components/flow-editor/use-flow-editor.ts +241 -0
- package/src/components/flow-runs-table/FlowRunsTable.tsx +631 -0
- package/src/components/flow-runs-table/index.ts +1 -0
- package/src/components/flow-viewer/FlowRunsView.tsx +268 -0
- package/src/components/flow-viewer/FlowStatusView.tsx +351 -0
- package/src/components/flow-viewer/RunSelector.tsx +422 -0
- package/src/components/flow-viewer/RunsSidebar.tsx +125 -0
- package/src/components/flow-viewer/agent-tool-executions-list.tsx +298 -0
- package/src/components/flow-viewer/index.ts +1 -0
- package/src/components/flow-viewer/logs-panel.tsx +567 -0
- package/src/components/flow-viewer/use-execution-log-data.ts +374 -0
- package/src/components/graph/BatchFlowEdge.tsx +229 -0
- package/src/components/graph/LayoutSelector.tsx +42 -0
- package/src/components/graph/index.ts +61 -0
- package/src/components/graph/styleUtils.ts +375 -0
- package/src/components/nodes/.DS_Store +0 -0
- package/src/components/nodes/AgentConfigPanel.tsx +1033 -0
- package/src/components/nodes/AgentNode.tsx +298 -0
- package/src/components/nodes/AgentToolsBox.tsx +193 -0
- package/src/components/nodes/NodeAppendix.tsx +98 -0
- package/src/components/nodes/NodeStatusIndicator.tsx +74 -0
- package/src/components/nodes/NodeViewContext.tsx +45 -0
- package/src/components/nodes/ToolParamField.tsx +282 -0
- package/src/components/nodes/ToolSelectorModal.tsx +648 -0
- package/src/components/nodes/ToolSelectorParts.tsx +505 -0
- package/src/components/nodes/UniversalNode.tsx +356 -0
- package/src/components/nodes/createContextAwareNodes.ts +19 -0
- package/src/components/nodes/index.ts +45 -0
- package/src/components/nodes/nodeRegistry.ts +50 -0
- package/src/components/nodes/withNodeContext.tsx +55 -0
- package/src/components/shared/InvectLoader.tsx +59 -0
- package/src/components/shared/InvectLogo.tsx +59 -0
- package/src/components/shared/ProviderIcon.tsx +115 -0
- package/src/components/side-menu/side-menu.tsx +267 -0
- package/src/components/sidebar/BaseSidebar.tsx +148 -0
- package/src/components/sidebar/index.ts +1 -0
- package/src/components/triggers/CronPreview.tsx +243 -0
- package/src/components/triggers/index.ts +1 -0
- package/src/components/ui/alert-dialog.tsx +152 -0
- package/src/components/ui/badge.tsx +39 -0
- package/src/components/ui/button.tsx +58 -0
- package/src/components/ui/card.tsx +75 -0
- package/src/components/ui/codemirror-js-editor.tsx +432 -0
- package/src/components/ui/codemirror-json-editor.tsx +816 -0
- package/src/components/ui/codemirror-nunjucks-editor.tsx +451 -0
- package/src/components/ui/codemirror-vscode-theme.ts +243 -0
- package/src/components/ui/collapsible.tsx +12 -0
- package/src/components/ui/command.tsx +162 -0
- package/src/components/ui/dialog.tsx +140 -0
- package/src/components/ui/dropdown-menu.tsx +232 -0
- package/src/components/ui/empty-state.tsx +93 -0
- package/src/components/ui/input.tsx +26 -0
- package/src/components/ui/label.tsx +19 -0
- package/src/components/ui/popover.tsx +53 -0
- package/src/components/ui/resizable.tsx +61 -0
- package/src/components/ui/scroll-area.tsx +56 -0
- package/src/components/ui/select.tsx +179 -0
- package/src/components/ui/separator.tsx +26 -0
- package/src/components/ui/slider.tsx +58 -0
- package/src/components/ui/switch.tsx +22 -0
- package/src/components/ui/table.tsx +90 -0
- package/src/components/ui/textarea.tsx +23 -0
- package/src/components/ui/tooltip.tsx +54 -0
- package/src/components/ui/tree-view.tsx +574 -0
- package/src/contexts/AgentToolCallbacksContext.tsx +31 -0
- package/src/contexts/ApiContext.tsx +51 -0
- package/src/contexts/FlowDataContext.tsx +21 -0
- package/src/contexts/NodeRegistryContext.tsx +54 -0
- package/src/contexts/PluginRegistryContext.tsx +182 -0
- package/src/contexts/ThemeProvider.tsx +106 -0
- package/src/contexts/ValidationContext.tsx +122 -0
- package/src/demo/DemoInvect.tsx +42 -0
- package/src/demo/FlowViewer.tsx +294 -0
- package/src/demo/demo-api-client.ts +246 -0
- package/src/demo/index.ts +28 -0
- package/src/demo/sample-data.ts +1980 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/use-document-title.ts +8 -0
- package/src/hooks/use-flow-data.ts +144 -0
- package/src/hooks/use-invect-portal-class.ts +27 -0
- package/src/hooks/useFlowEditorStore.ts +2 -0
- package/src/index.ts +70 -0
- package/src/lib/utils.ts +6 -0
- package/src/prettier.d.ts +13 -0
- package/src/routes/all-flow-runs.tsx +27 -0
- package/src/routes/credentials.tsx +362 -0
- package/src/routes/flow-route-layout.tsx +113 -0
- package/src/routes/flow-runs.tsx +22 -0
- package/src/routes/flow.tsx +22 -0
- package/src/routes/home.tsx +282 -0
- package/src/services/index.ts +6 -0
- package/src/stores/executionViewStore.ts +211 -0
- package/src/stores/flow-editor.store.ts +738 -0
- package/src/stores/flowEditorStore.ts +2 -0
- package/src/stores/index.ts +10 -0
- package/src/stores/uiStore.ts +189 -0
- package/src/types/agent-tools.types.ts +64 -0
- package/src/types/index.ts +5 -0
- package/src/types/node-definition.types.ts +104 -0
- package/src/types/plugin.types.ts +123 -0
- package/src/utils/credentialBranding.ts +116 -0
- package/src/utils/credentialFiltering.ts +68 -0
- package/src/utils/flowTransformations.ts +137 -0
- package/src/utils/layoutUtils.ts +127 -0
- package/src/utils/nodeReferenceUtils.ts +135 -0
- package/src/vendor.d.ts +7 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { memo } from 'react';
|
|
4
|
+
import * as Icons from 'lucide-react';
|
|
5
|
+
import { Zap } from 'lucide-react';
|
|
6
|
+
import { cn } from '../../lib/utils';
|
|
7
|
+
import { PROVIDER_SVG_ICONS } from '../../assets/provider-icons';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Provider IDs that have a bundled inline SVG.
|
|
11
|
+
* Derived automatically from the PROVIDER_SVG_ICONS map, excluding `_light` variants.
|
|
12
|
+
*/
|
|
13
|
+
const PROVIDERS_WITH_SVG_ICON = new Set(
|
|
14
|
+
Object.keys(PROVIDER_SVG_ICONS).filter((k) => !k.endsWith('_light')),
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Providers whose dark-fill logo is invisible on dark backgrounds.
|
|
19
|
+
* For these we ship a `{id}_light` variant and swap via CSS.
|
|
20
|
+
*/
|
|
21
|
+
const PROVIDERS_WITH_LIGHT_VARIANT = new Set(['github', 'anthropic']);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Resolve a Lucide icon component from its name string.
|
|
25
|
+
* Falls back to Zap if the name is not found.
|
|
26
|
+
*/
|
|
27
|
+
export const getLucideIcon = (iconName?: string): React.ElementType => {
|
|
28
|
+
if (!iconName) {
|
|
29
|
+
return Zap;
|
|
30
|
+
}
|
|
31
|
+
// @ts-ignore - Dynamic access to icons
|
|
32
|
+
return Icons[iconName] || Zap;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export interface ProviderIconProps {
|
|
36
|
+
/** Provider id — when it matches a known provider, a bundled inline SVG is rendered */
|
|
37
|
+
providerId?: string;
|
|
38
|
+
/** Lucide icon name (e.g. "Mail", "Github") */
|
|
39
|
+
icon?: string;
|
|
40
|
+
/** Raw SVG markup string — takes precedence over `icon` (legacy, prefer providerId) */
|
|
41
|
+
svgIcon?: string;
|
|
42
|
+
/** CSS class applied to the wrapper / Lucide icon component */
|
|
43
|
+
className?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Renders a provider icon with the following priority:
|
|
48
|
+
*
|
|
49
|
+
* 1. **Bundled inline SVG** — if `providerId` matches a known provider
|
|
50
|
+
* 2. **Inline SVG string** — if `svgIcon` is provided (legacy fallback)
|
|
51
|
+
* 3. **Lucide icon** — resolved from the `icon` name string
|
|
52
|
+
*/
|
|
53
|
+
export const ProviderIcon = memo(function ProviderIcon({
|
|
54
|
+
providerId,
|
|
55
|
+
icon,
|
|
56
|
+
svgIcon,
|
|
57
|
+
className,
|
|
58
|
+
}: ProviderIconProps) {
|
|
59
|
+
// 1. Bundled inline SVG for known providers
|
|
60
|
+
if (providerId && PROVIDERS_WITH_SVG_ICON.has(providerId)) {
|
|
61
|
+
const svgMarkup = PROVIDER_SVG_ICONS[providerId];
|
|
62
|
+
|
|
63
|
+
// Providers with a dark logo that needs a light variant for dark mode
|
|
64
|
+
if (PROVIDERS_WITH_LIGHT_VARIANT.has(providerId)) {
|
|
65
|
+
const lightSvgMarkup = PROVIDER_SVG_ICONS[`${providerId}_light`];
|
|
66
|
+
return (
|
|
67
|
+
<>
|
|
68
|
+
<span
|
|
69
|
+
className={cn(
|
|
70
|
+
'inline-flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full dark:hidden',
|
|
71
|
+
className,
|
|
72
|
+
)}
|
|
73
|
+
dangerouslySetInnerHTML={{ __html: svgMarkup }}
|
|
74
|
+
/>
|
|
75
|
+
<span
|
|
76
|
+
className={cn(
|
|
77
|
+
'hidden items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full dark:inline-flex',
|
|
78
|
+
className,
|
|
79
|
+
)}
|
|
80
|
+
dangerouslySetInnerHTML={{ __html: lightSvgMarkup }}
|
|
81
|
+
/>
|
|
82
|
+
</>
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<span
|
|
88
|
+
className={cn(
|
|
89
|
+
'inline-flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full',
|
|
90
|
+
className,
|
|
91
|
+
)}
|
|
92
|
+
dangerouslySetInnerHTML={{ __html: svgMarkup }}
|
|
93
|
+
/>
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// 2. Inline SVG string (legacy — for custom / third-party providers)
|
|
98
|
+
if (svgIcon) {
|
|
99
|
+
return (
|
|
100
|
+
<span
|
|
101
|
+
className={cn(
|
|
102
|
+
'inline-flex items-center justify-center shrink-0 [&>svg]:w-full [&>svg]:h-full',
|
|
103
|
+
className,
|
|
104
|
+
)}
|
|
105
|
+
dangerouslySetInnerHTML={{ __html: svgIcon }}
|
|
106
|
+
/>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// 3. Lucide icon fallback
|
|
111
|
+
const LucideIcon = getLucideIcon(icon);
|
|
112
|
+
return <LucideIcon className={className} />;
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
ProviderIcon.displayName = 'ProviderIcon';
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
import { useState, useEffect, useRef } from 'react';
|
|
2
|
+
import { Link, useLocation } from 'react-router';
|
|
3
|
+
import { ChevronLeft, ChevronRight, Home, FileText, KeyRound, Sun, Moon } from 'lucide-react';
|
|
4
|
+
import { cn } from '~/lib/utils';
|
|
5
|
+
import { Button } from '../ui/button';
|
|
6
|
+
import { Tooltip, TooltipContent, TooltipTrigger, TooltipProvider } from '../ui/tooltip';
|
|
7
|
+
import { useTheme } from '~/contexts/ThemeProvider';
|
|
8
|
+
import { usePluginRegistry } from '~/contexts/PluginRegistryContext';
|
|
9
|
+
import { InvectLogo } from '../shared/InvectLogo';
|
|
10
|
+
|
|
11
|
+
export interface AppSideMenuProps {
|
|
12
|
+
basePath?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function AppSideMenu({ basePath = '' }: AppSideMenuProps) {
|
|
16
|
+
const [isCollapsed, setIsCollapsed] = useState(true);
|
|
17
|
+
const [tooltipsEnabled, setTooltipsEnabled] = useState(false);
|
|
18
|
+
const sidebarRef = useRef<HTMLDivElement>(null);
|
|
19
|
+
const location = useLocation();
|
|
20
|
+
const { resolvedTheme, setTheme } = useTheme();
|
|
21
|
+
const registry = usePluginRegistry();
|
|
22
|
+
|
|
23
|
+
const toggleTheme = () => {
|
|
24
|
+
setTheme(resolvedTheme === 'dark' ? 'light' : 'dark');
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const menuItems = [
|
|
28
|
+
{ icon: Home, label: 'Home', href: basePath || '/' },
|
|
29
|
+
{ icon: FileText, label: 'Flow Runs', href: `${basePath}/flow-runs` },
|
|
30
|
+
{ icon: KeyRound, label: 'Credentials', href: `${basePath}/credentials` },
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
// Plugin-contributed sidebar items (top position = after defaults)
|
|
34
|
+
const pluginTopItems = registry.sidebarItems
|
|
35
|
+
.filter((item) => item.position !== 'bottom')
|
|
36
|
+
.filter((item) => !item.permission || registry.checkPermission(item.permission))
|
|
37
|
+
.map((item) => ({
|
|
38
|
+
icon: item.icon,
|
|
39
|
+
label: item.label,
|
|
40
|
+
href: `${basePath}${item.path}`,
|
|
41
|
+
}));
|
|
42
|
+
|
|
43
|
+
const pluginBottomItems = registry.sidebarItems
|
|
44
|
+
.filter((item) => item.position === 'bottom')
|
|
45
|
+
.filter((item) => !item.permission || registry.checkPermission(item.permission))
|
|
46
|
+
.map((item) => ({
|
|
47
|
+
icon: item.icon,
|
|
48
|
+
label: item.label,
|
|
49
|
+
href: `${basePath}${item.path}`,
|
|
50
|
+
}));
|
|
51
|
+
|
|
52
|
+
const allMainItems = [...menuItems, ...pluginTopItems];
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
function handleClickOutside(event: MouseEvent) {
|
|
56
|
+
if (
|
|
57
|
+
!isCollapsed &&
|
|
58
|
+
sidebarRef.current &&
|
|
59
|
+
!sidebarRef.current.contains(event.target as Node)
|
|
60
|
+
) {
|
|
61
|
+
setIsCollapsed(true);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
66
|
+
return () => {
|
|
67
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
68
|
+
};
|
|
69
|
+
}, [isCollapsed]);
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
setTooltipsEnabled(false);
|
|
73
|
+
|
|
74
|
+
if (!isCollapsed) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const timeoutId = window.setTimeout(() => {
|
|
79
|
+
setTooltipsEnabled(true);
|
|
80
|
+
}, 300);
|
|
81
|
+
|
|
82
|
+
return () => {
|
|
83
|
+
window.clearTimeout(timeoutId);
|
|
84
|
+
};
|
|
85
|
+
}, [isCollapsed]);
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div className="relative w-16 shrink-0">
|
|
89
|
+
<div
|
|
90
|
+
ref={sidebarRef}
|
|
91
|
+
className={cn(
|
|
92
|
+
'imp-sidebar-shell absolute left-0 top-0 z-50 flex h-full flex-col border-r border-imp-border bg-imp-sidebar text-imp-sidebar-foreground transition-all duration-300',
|
|
93
|
+
isCollapsed ? 'w-16' : 'w-64',
|
|
94
|
+
)}
|
|
95
|
+
>
|
|
96
|
+
<Button
|
|
97
|
+
variant="ghost"
|
|
98
|
+
size="icon"
|
|
99
|
+
className="absolute z-10 w-6 h-6 border rounded-full -right-3 top-4 border-imp-border bg-imp-background"
|
|
100
|
+
onClick={() => setIsCollapsed(!isCollapsed)}
|
|
101
|
+
>
|
|
102
|
+
{isCollapsed ? <ChevronRight className="w-4 h-4" /> : <ChevronLeft className="w-4 h-4" />}
|
|
103
|
+
</Button>
|
|
104
|
+
|
|
105
|
+
{/* Sidebar content */}
|
|
106
|
+
<div className="flex items-center px-4 border-b h-14 border-border">
|
|
107
|
+
{isCollapsed ? (
|
|
108
|
+
<button
|
|
109
|
+
onClick={() => setIsCollapsed(false)}
|
|
110
|
+
className="flex items-center justify-center w-8 h-8 transition-opacity rounded cursor-pointer text-primary-foreground hover:opacity-90"
|
|
111
|
+
>
|
|
112
|
+
<InvectLogo iconClassName="h-6" />
|
|
113
|
+
</button>
|
|
114
|
+
) : (
|
|
115
|
+
<InvectLogo
|
|
116
|
+
showLabel
|
|
117
|
+
className="pl-2.5"
|
|
118
|
+
iconClassName="h-6"
|
|
119
|
+
// labelClassName="text-lg font-semibold"
|
|
120
|
+
/>
|
|
121
|
+
)}
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
{/* Menu items */}
|
|
125
|
+
<TooltipProvider>
|
|
126
|
+
<nav className="flex-1 p-2 space-y-1">
|
|
127
|
+
{allMainItems.map((item) => {
|
|
128
|
+
const isHome = item.href === basePath || item.href === '/';
|
|
129
|
+
const isActive = isHome
|
|
130
|
+
? location.pathname === item.href
|
|
131
|
+
: location.pathname.startsWith(item.href);
|
|
132
|
+
|
|
133
|
+
if (!tooltipsEnabled) {
|
|
134
|
+
return (
|
|
135
|
+
<Link key={item.label} to={item.href} aria-label={item.label}>
|
|
136
|
+
<Button
|
|
137
|
+
variant={isActive ? 'secondary' : 'ghost'}
|
|
138
|
+
className="justify-start w-full px-0"
|
|
139
|
+
>
|
|
140
|
+
<span className="flex items-center justify-center w-12 shrink-0">
|
|
141
|
+
<item.icon className="w-5 h-5" />
|
|
142
|
+
</span>
|
|
143
|
+
{!isCollapsed && <span>{item.label}</span>}
|
|
144
|
+
</Button>
|
|
145
|
+
</Link>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
return (
|
|
149
|
+
<Tooltip key={item.label} delayDuration={0}>
|
|
150
|
+
<TooltipTrigger asChild>
|
|
151
|
+
<Link to={item.href} aria-label={item.label}>
|
|
152
|
+
<Button
|
|
153
|
+
variant={isActive ? 'secondary' : 'ghost'}
|
|
154
|
+
className="justify-start w-full px-0"
|
|
155
|
+
>
|
|
156
|
+
<span className="flex items-center justify-center w-12 shrink-0">
|
|
157
|
+
<item.icon className="w-5 h-5" />
|
|
158
|
+
</span>
|
|
159
|
+
{!isCollapsed && <span>{item.label}</span>}
|
|
160
|
+
</Button>
|
|
161
|
+
</Link>
|
|
162
|
+
</TooltipTrigger>
|
|
163
|
+
{isCollapsed && (
|
|
164
|
+
<TooltipContent side="right" sideOffset={16}>
|
|
165
|
+
<p>{item.label}</p>
|
|
166
|
+
</TooltipContent>
|
|
167
|
+
)}
|
|
168
|
+
</Tooltip>
|
|
169
|
+
);
|
|
170
|
+
})}
|
|
171
|
+
</nav>
|
|
172
|
+
|
|
173
|
+
{/* Plugin bottom sidebar items + Dark Mode Toggle */}
|
|
174
|
+
<div className="p-2 space-y-1 border-t border-border">
|
|
175
|
+
{pluginBottomItems.map((item) => {
|
|
176
|
+
const isActive = location.pathname.startsWith(item.href);
|
|
177
|
+
if (!tooltipsEnabled) {
|
|
178
|
+
return (
|
|
179
|
+
<Link key={item.label} to={item.href} aria-label={item.label}>
|
|
180
|
+
<Button
|
|
181
|
+
variant={isActive ? 'secondary' : 'ghost'}
|
|
182
|
+
className="justify-start w-full px-0"
|
|
183
|
+
>
|
|
184
|
+
<span className="flex items-center justify-center w-12 shrink-0">
|
|
185
|
+
<item.icon className="w-5 h-5" />
|
|
186
|
+
</span>
|
|
187
|
+
{!isCollapsed && <span>{item.label}</span>}
|
|
188
|
+
</Button>
|
|
189
|
+
</Link>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
return (
|
|
193
|
+
<Tooltip key={item.label} delayDuration={0}>
|
|
194
|
+
<TooltipTrigger asChild>
|
|
195
|
+
<Link to={item.href} aria-label={item.label}>
|
|
196
|
+
<Button
|
|
197
|
+
variant={isActive ? 'secondary' : 'ghost'}
|
|
198
|
+
className="justify-start w-full px-0"
|
|
199
|
+
>
|
|
200
|
+
<span className="flex items-center justify-center w-12 shrink-0">
|
|
201
|
+
<item.icon className="w-5 h-5" />
|
|
202
|
+
</span>
|
|
203
|
+
{!isCollapsed && <span>{item.label}</span>}
|
|
204
|
+
</Button>
|
|
205
|
+
</Link>
|
|
206
|
+
</TooltipTrigger>
|
|
207
|
+
{isCollapsed && (
|
|
208
|
+
<TooltipContent side="right" sideOffset={16}>
|
|
209
|
+
<p>{item.label}</p>
|
|
210
|
+
</TooltipContent>
|
|
211
|
+
)}
|
|
212
|
+
</Tooltip>
|
|
213
|
+
);
|
|
214
|
+
})}
|
|
215
|
+
{tooltipsEnabled ? (
|
|
216
|
+
<Tooltip delayDuration={0}>
|
|
217
|
+
<TooltipTrigger asChild>
|
|
218
|
+
<Button
|
|
219
|
+
variant="ghost"
|
|
220
|
+
onClick={toggleTheme}
|
|
221
|
+
className="justify-start w-full px-0"
|
|
222
|
+
>
|
|
223
|
+
<span className="flex items-center justify-center w-12 shrink-0">
|
|
224
|
+
{resolvedTheme === 'dark' ? (
|
|
225
|
+
<Sun className="w-5 h-5" />
|
|
226
|
+
) : (
|
|
227
|
+
<Moon className="w-5 h-5" />
|
|
228
|
+
)}
|
|
229
|
+
</span>
|
|
230
|
+
{!isCollapsed && (
|
|
231
|
+
<span>{resolvedTheme === 'dark' ? 'Light Mode' : 'Dark Mode'}</span>
|
|
232
|
+
)}
|
|
233
|
+
</Button>
|
|
234
|
+
</TooltipTrigger>
|
|
235
|
+
{isCollapsed && (
|
|
236
|
+
<TooltipContent side="right" sideOffset={16}>
|
|
237
|
+
<p>{resolvedTheme === 'dark' ? 'Light Mode' : 'Dark Mode'}</p>
|
|
238
|
+
</TooltipContent>
|
|
239
|
+
)}
|
|
240
|
+
</Tooltip>
|
|
241
|
+
) : (
|
|
242
|
+
<Button variant="ghost" onClick={toggleTheme} className="justify-start w-full px-0">
|
|
243
|
+
<span className="flex items-center justify-center w-12 shrink-0">
|
|
244
|
+
{resolvedTheme === 'dark' ? (
|
|
245
|
+
<Sun className="w-5 h-5" />
|
|
246
|
+
) : (
|
|
247
|
+
<Moon className="w-5 h-5" />
|
|
248
|
+
)}
|
|
249
|
+
</span>
|
|
250
|
+
{!isCollapsed && (
|
|
251
|
+
<span>{resolvedTheme === 'dark' ? 'Light Mode' : 'Dark Mode'}</span>
|
|
252
|
+
)}
|
|
253
|
+
</Button>
|
|
254
|
+
)}
|
|
255
|
+
</div>
|
|
256
|
+
|
|
257
|
+
{/* Plugin sidebar footer (e.g. user menu) */}
|
|
258
|
+
{registry.SidebarFooter && (
|
|
259
|
+
<div className="p-2 border-t border-border">
|
|
260
|
+
<registry.SidebarFooter collapsed={isCollapsed} basePath={basePath} />
|
|
261
|
+
</div>
|
|
262
|
+
)}
|
|
263
|
+
</TooltipProvider>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
);
|
|
267
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from 'react-router';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
import { ArrowLeft, Workflow, Clock, Users, ChevronDown } from 'lucide-react';
|
|
5
|
+
import {
|
|
6
|
+
DropdownMenu,
|
|
7
|
+
DropdownMenuContent,
|
|
8
|
+
DropdownMenuItem,
|
|
9
|
+
DropdownMenuTrigger,
|
|
10
|
+
} from '../ui/dropdown-menu';
|
|
11
|
+
import { Button } from '../ui/button';
|
|
12
|
+
import type { FlowVersion } from '@invect/core/types';
|
|
13
|
+
|
|
14
|
+
interface BaseSidebarProps {
|
|
15
|
+
title?: string;
|
|
16
|
+
lastModified?: Date;
|
|
17
|
+
author?: string;
|
|
18
|
+
className?: string;
|
|
19
|
+
children?: React.ReactNode;
|
|
20
|
+
width?: 'narrow' | 'normal' | 'wide';
|
|
21
|
+
backUrl?: string;
|
|
22
|
+
backTitle?: string;
|
|
23
|
+
versions?: FlowVersion[];
|
|
24
|
+
currentVersion?: FlowVersion;
|
|
25
|
+
onVersionChange?: (versionId: string) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const BaseSidebar: React.FC<BaseSidebarProps> = ({
|
|
29
|
+
title = 'Untitled Flow',
|
|
30
|
+
lastModified,
|
|
31
|
+
author,
|
|
32
|
+
className,
|
|
33
|
+
children,
|
|
34
|
+
width = 'normal',
|
|
35
|
+
backUrl = '/',
|
|
36
|
+
backTitle = 'Back to Home',
|
|
37
|
+
versions = [],
|
|
38
|
+
currentVersion,
|
|
39
|
+
onVersionChange,
|
|
40
|
+
}) => {
|
|
41
|
+
const widthClasses = {
|
|
42
|
+
narrow: 'w-60',
|
|
43
|
+
normal: 'w-72',
|
|
44
|
+
wide: 'w-80',
|
|
45
|
+
} as const;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div
|
|
49
|
+
className={cn(
|
|
50
|
+
'flex h-full shrink-0 flex-col overflow-hidden bg-imp-background text-card-foreground border-r border-border shadow-[var(--imp-shadow-sidebar)]',
|
|
51
|
+
widthClasses[width],
|
|
52
|
+
className,
|
|
53
|
+
)}
|
|
54
|
+
>
|
|
55
|
+
{/* Top Section */}
|
|
56
|
+
<div className="px-4 py-3 border-b border-border">
|
|
57
|
+
<div className="flex items-center gap-3">
|
|
58
|
+
{/* Back Button */}
|
|
59
|
+
<Link
|
|
60
|
+
to={backUrl}
|
|
61
|
+
className="flex items-center justify-center w-8 h-8 transition-colors rounded-md hover:bg-accent/50"
|
|
62
|
+
title={backTitle}
|
|
63
|
+
>
|
|
64
|
+
<ArrowLeft className="w-4 h-4" />
|
|
65
|
+
</Link>
|
|
66
|
+
|
|
67
|
+
{/* Flow Info */}
|
|
68
|
+
<div className="flex-1 min-w-0">
|
|
69
|
+
<div className="flex items-center min-w-0 gap-3">
|
|
70
|
+
<div className="flex items-center justify-center w-8 h-8 border rounded-lg border-primary/20 bg-primary/10">
|
|
71
|
+
<Workflow className="w-4 h-4 text-primary" />
|
|
72
|
+
</div>
|
|
73
|
+
<div className="flex-1 min-w-0 space-y-2">
|
|
74
|
+
<h1 className="text-sm font-semibold line-clamp-1 text-card-foreground">{title}</h1>
|
|
75
|
+
|
|
76
|
+
{/* Version Selector */}
|
|
77
|
+
{versions.length > 0 && (
|
|
78
|
+
<div>
|
|
79
|
+
<DropdownMenu>
|
|
80
|
+
<DropdownMenuTrigger asChild>
|
|
81
|
+
<Button
|
|
82
|
+
variant="outline"
|
|
83
|
+
size="sm"
|
|
84
|
+
className="justify-start min-w-0 px-2 text-xs h-7 w-fit bg-card hover:bg-muted"
|
|
85
|
+
>
|
|
86
|
+
<span className="truncate">
|
|
87
|
+
v{currentVersion?.version || versions[0]?.version || 1}
|
|
88
|
+
</span>
|
|
89
|
+
<ChevronDown className="flex-shrink-0 w-3 h-3 ml-1" />
|
|
90
|
+
</Button>
|
|
91
|
+
</DropdownMenuTrigger>
|
|
92
|
+
<DropdownMenuContent className="w-56 overflow-y-auto max-h-48" align="start">
|
|
93
|
+
{versions.map((version) => (
|
|
94
|
+
<DropdownMenuItem
|
|
95
|
+
key={`${version.flowId}-${version.version}`}
|
|
96
|
+
onClick={() =>
|
|
97
|
+
onVersionChange?.(`${version.flowId}-${version.version}`)
|
|
98
|
+
}
|
|
99
|
+
className="flex items-center justify-between"
|
|
100
|
+
>
|
|
101
|
+
<div className="flex items-center gap-2">
|
|
102
|
+
<span className="text-xs font-medium">v{version.version}</span>
|
|
103
|
+
{currentVersion?.version === version.version && (
|
|
104
|
+
<span className="rounded bg-green-100 px-1.5 py-0.5 text-[10px] font-medium text-green-700">
|
|
105
|
+
Current
|
|
106
|
+
</span>
|
|
107
|
+
)}
|
|
108
|
+
</div>
|
|
109
|
+
<span className="text-xs text-muted-foreground">
|
|
110
|
+
{new Date(version.createdAt).toLocaleDateString('en-GB', {
|
|
111
|
+
day: 'numeric',
|
|
112
|
+
month: 'short',
|
|
113
|
+
year: '2-digit',
|
|
114
|
+
})}
|
|
115
|
+
</span>
|
|
116
|
+
</DropdownMenuItem>
|
|
117
|
+
))}
|
|
118
|
+
</DropdownMenuContent>
|
|
119
|
+
</DropdownMenu>
|
|
120
|
+
</div>
|
|
121
|
+
)}
|
|
122
|
+
|
|
123
|
+
<div className="flex items-center gap-2 text-xs text-muted-foreground">
|
|
124
|
+
{author && (
|
|
125
|
+
<>
|
|
126
|
+
<Users className="w-3 h-3" />
|
|
127
|
+
<span>{author}</span>
|
|
128
|
+
<span>•</span>
|
|
129
|
+
</>
|
|
130
|
+
)}
|
|
131
|
+
{lastModified && (
|
|
132
|
+
<>
|
|
133
|
+
<Clock className="w-3 h-3" />
|
|
134
|
+
<span>{lastModified.toLocaleDateString()}</span>
|
|
135
|
+
</>
|
|
136
|
+
)}
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
</div>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
{/* Content Area */}
|
|
145
|
+
<div className="flex flex-col flex-1 gap-3 px-4 py-3 overflow-auto">{children}</div>
|
|
146
|
+
</div>
|
|
147
|
+
);
|
|
148
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { BaseSidebar } from './BaseSidebar';
|