@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,451 @@
|
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
EditorView,
|
|
4
|
+
keymap,
|
|
5
|
+
highlightSpecialChars,
|
|
6
|
+
ViewPlugin,
|
|
7
|
+
ViewUpdate,
|
|
8
|
+
Decoration,
|
|
9
|
+
DecorationSet,
|
|
10
|
+
WidgetType,
|
|
11
|
+
} from '@codemirror/view';
|
|
12
|
+
import { EditorState, Extension, RangeSetBuilder, Prec } from '@codemirror/state';
|
|
13
|
+
import { defaultKeymap, history, historyKeymap } from '@codemirror/commands';
|
|
14
|
+
import { cn } from '../../lib/utils';
|
|
15
|
+
import {
|
|
16
|
+
CODEMIRROR_IOSEVKA_FONT_STACK,
|
|
17
|
+
useCodeMirrorVscodePalette,
|
|
18
|
+
useCodeMirrorVscodeTheme,
|
|
19
|
+
type CodeMirrorVscodePalette,
|
|
20
|
+
} from './codemirror-vscode-theme';
|
|
21
|
+
|
|
22
|
+
interface CodeMirrorNunjucksEditorProps {
|
|
23
|
+
value: string;
|
|
24
|
+
onChange?: (value: string) => void;
|
|
25
|
+
readOnly?: boolean;
|
|
26
|
+
className?: string;
|
|
27
|
+
placeholder?: string;
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
multiline?: boolean;
|
|
30
|
+
rows?: number;
|
|
31
|
+
fillAvailableHeight?: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Custom decoration for nunjucks expressions {{ ... }}
|
|
35
|
+
const nunjucksBraceMark = Decoration.mark({
|
|
36
|
+
class: 'cm-nunjucks-brace',
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const nunjucksVariableMark = Decoration.mark({
|
|
40
|
+
class: 'cm-nunjucks-variable',
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
const nunjucksFilterMark = Decoration.mark({
|
|
44
|
+
class: 'cm-nunjucks-filter',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// Parse and decorate nunjucks expressions
|
|
48
|
+
function parseNunjucksDecorations(view: EditorView): DecorationSet {
|
|
49
|
+
const builder = new RangeSetBuilder<Decoration>();
|
|
50
|
+
const doc = view.state.doc.toString();
|
|
51
|
+
|
|
52
|
+
// Match {{ ... }} expressions
|
|
53
|
+
const expressionRegex = /\{\{(.*?)\}\}/g;
|
|
54
|
+
let match;
|
|
55
|
+
|
|
56
|
+
while ((match = expressionRegex.exec(doc)) !== null) {
|
|
57
|
+
const start = match.index;
|
|
58
|
+
const end = start + match[0].length;
|
|
59
|
+
const inner = match[1];
|
|
60
|
+
const innerStart = start + 2; // After {{
|
|
61
|
+
|
|
62
|
+
// Highlight opening braces
|
|
63
|
+
builder.add(start, start + 2, nunjucksBraceMark);
|
|
64
|
+
|
|
65
|
+
// Parse the inner content for variables, properties, and filters
|
|
66
|
+
// Simple parser for: variable.property.path | filter | filter2
|
|
67
|
+
let inVariable = true;
|
|
68
|
+
let wordStart = -1;
|
|
69
|
+
|
|
70
|
+
for (let i = 0; i < inner.length; i++) {
|
|
71
|
+
const char = inner[i];
|
|
72
|
+
|
|
73
|
+
if (char === ' ' || char === '\t' || char === '\n') {
|
|
74
|
+
if (wordStart >= 0) {
|
|
75
|
+
// End of a word
|
|
76
|
+
const wordEnd = i;
|
|
77
|
+
if (inVariable) {
|
|
78
|
+
builder.add(innerStart + wordStart, innerStart + wordEnd, nunjucksVariableMark);
|
|
79
|
+
} else {
|
|
80
|
+
builder.add(innerStart + wordStart, innerStart + wordEnd, nunjucksFilterMark);
|
|
81
|
+
}
|
|
82
|
+
wordStart = -1;
|
|
83
|
+
}
|
|
84
|
+
continue;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if (char === '|') {
|
|
88
|
+
// Filter separator
|
|
89
|
+
if (wordStart >= 0) {
|
|
90
|
+
const wordEnd = i;
|
|
91
|
+
if (inVariable) {
|
|
92
|
+
builder.add(innerStart + wordStart, innerStart + wordEnd, nunjucksVariableMark);
|
|
93
|
+
} else {
|
|
94
|
+
builder.add(innerStart + wordStart, innerStart + wordEnd, nunjucksFilterMark);
|
|
95
|
+
}
|
|
96
|
+
wordStart = -1;
|
|
97
|
+
}
|
|
98
|
+
inVariable = false;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (char === '.') {
|
|
103
|
+
// Property separator within variable path
|
|
104
|
+
if (wordStart >= 0) {
|
|
105
|
+
builder.add(innerStart + wordStart, innerStart + i, nunjucksVariableMark);
|
|
106
|
+
wordStart = -1;
|
|
107
|
+
}
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
if (wordStart < 0 && /[a-zA-Z_]/.test(char)) {
|
|
112
|
+
wordStart = i;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// Handle last word
|
|
117
|
+
if (wordStart >= 0) {
|
|
118
|
+
if (inVariable) {
|
|
119
|
+
builder.add(innerStart + wordStart, innerStart + inner.length, nunjucksVariableMark);
|
|
120
|
+
} else {
|
|
121
|
+
builder.add(innerStart + wordStart, innerStart + inner.length, nunjucksFilterMark);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Highlight closing braces
|
|
126
|
+
builder.add(end - 2, end, nunjucksBraceMark);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Also highlight {% ... %} tags
|
|
130
|
+
const tagRegex = /\{%(.*?)%\}/g;
|
|
131
|
+
while ((match = tagRegex.exec(doc)) !== null) {
|
|
132
|
+
const start = match.index;
|
|
133
|
+
const end = start + match[0].length;
|
|
134
|
+
builder.add(start, start + 2, nunjucksBraceMark);
|
|
135
|
+
builder.add(end - 2, end, nunjucksBraceMark);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
// Also highlight {# ... #} comments
|
|
139
|
+
const commentRegex = /\{#(.*?)#\}/g;
|
|
140
|
+
while ((match = commentRegex.exec(doc)) !== null) {
|
|
141
|
+
const start = match.index;
|
|
142
|
+
const end = start + match[0].length;
|
|
143
|
+
builder.add(start, start + 2, nunjucksBraceMark);
|
|
144
|
+
builder.add(end - 2, end, nunjucksBraceMark);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
return builder.finish();
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Plugin to update decorations
|
|
151
|
+
const nunjucksDecorationPlugin = ViewPlugin.fromClass(
|
|
152
|
+
class {
|
|
153
|
+
decorations: DecorationSet;
|
|
154
|
+
|
|
155
|
+
constructor(view: EditorView) {
|
|
156
|
+
this.decorations = parseNunjucksDecorations(view);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
update(update: ViewUpdate) {
|
|
160
|
+
if (update.docChanged || update.viewportChanged) {
|
|
161
|
+
this.decorations = parseNunjucksDecorations(update.view);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
decorations: (v) => v.decorations,
|
|
167
|
+
},
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
// Theme extension for styling
|
|
171
|
+
function createEditorTheme(palette: CodeMirrorVscodePalette) {
|
|
172
|
+
return EditorView.theme({
|
|
173
|
+
'&': {
|
|
174
|
+
fontSize: '12px',
|
|
175
|
+
fontFamily: CODEMIRROR_IOSEVKA_FONT_STACK,
|
|
176
|
+
},
|
|
177
|
+
'.cm-scroller, .cm-content, .cm-gutters, .cm-lineNumbers, .cm-tooltip': {
|
|
178
|
+
fontFamily: CODEMIRROR_IOSEVKA_FONT_STACK,
|
|
179
|
+
},
|
|
180
|
+
'.cm-content': {
|
|
181
|
+
padding: '8px',
|
|
182
|
+
},
|
|
183
|
+
'.cm-line': {
|
|
184
|
+
padding: '0',
|
|
185
|
+
},
|
|
186
|
+
'&.cm-focused': {
|
|
187
|
+
outline: 'none',
|
|
188
|
+
},
|
|
189
|
+
'.cm-scroller': {
|
|
190
|
+
overflow: 'auto',
|
|
191
|
+
},
|
|
192
|
+
'.cm-tooltip': {
|
|
193
|
+
backgroundColor: palette.surface,
|
|
194
|
+
border: `1px solid ${palette.border}`,
|
|
195
|
+
color: palette.foreground,
|
|
196
|
+
boxShadow: `0 6px 18px color-mix(in srgb, ${palette.border} 35%, transparent)`,
|
|
197
|
+
},
|
|
198
|
+
'.cm-panels': {
|
|
199
|
+
backgroundColor: palette.surface,
|
|
200
|
+
color: palette.foreground,
|
|
201
|
+
borderColor: palette.border,
|
|
202
|
+
},
|
|
203
|
+
'.cm-panel button': {
|
|
204
|
+
backgroundColor: palette.surfaceAlt,
|
|
205
|
+
color: palette.foreground,
|
|
206
|
+
border: `1px solid ${palette.border}`,
|
|
207
|
+
},
|
|
208
|
+
'.cm-panel button:hover': {
|
|
209
|
+
backgroundColor: palette.surface,
|
|
210
|
+
borderColor: palette.accent,
|
|
211
|
+
},
|
|
212
|
+
'.cm-placeholder': {
|
|
213
|
+
color: palette.foregroundMuted,
|
|
214
|
+
fontStyle: 'italic',
|
|
215
|
+
},
|
|
216
|
+
'.cm-nunjucks-brace': {
|
|
217
|
+
color: palette.keyword,
|
|
218
|
+
fontWeight: '600',
|
|
219
|
+
},
|
|
220
|
+
'.cm-nunjucks-variable': {
|
|
221
|
+
color: palette.variable,
|
|
222
|
+
},
|
|
223
|
+
'.cm-nunjucks-filter': {
|
|
224
|
+
color: palette.operator,
|
|
225
|
+
},
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Single-line theme (no line wrapping for single-line mode)
|
|
230
|
+
const singleLineTheme = EditorView.theme({
|
|
231
|
+
'&': {
|
|
232
|
+
minHeight: '2rem',
|
|
233
|
+
},
|
|
234
|
+
'.cm-content': {
|
|
235
|
+
whiteSpace: 'nowrap',
|
|
236
|
+
padding: '5px 8px',
|
|
237
|
+
},
|
|
238
|
+
'.cm-scroller': {
|
|
239
|
+
overflow: 'hidden',
|
|
240
|
+
},
|
|
241
|
+
'.cm-line': {
|
|
242
|
+
padding: '0',
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
// Placeholder widget
|
|
247
|
+
class PlaceholderWidget extends WidgetType {
|
|
248
|
+
constructor(readonly text: string) {
|
|
249
|
+
super();
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
toDOM() {
|
|
253
|
+
const span = document.createElement('span');
|
|
254
|
+
span.className = 'cm-placeholder';
|
|
255
|
+
span.textContent = this.text;
|
|
256
|
+
span.style.pointerEvents = 'none';
|
|
257
|
+
return span;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
ignoreEvent() {
|
|
261
|
+
return true;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Placeholder plugin that shows placeholder when empty
|
|
266
|
+
function placeholderPlugin(placeholder: string): Extension {
|
|
267
|
+
return ViewPlugin.fromClass(
|
|
268
|
+
class {
|
|
269
|
+
decorations: DecorationSet;
|
|
270
|
+
|
|
271
|
+
constructor(view: EditorView) {
|
|
272
|
+
this.decorations = this.getDecorations(view);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
update(update: ViewUpdate) {
|
|
276
|
+
if (update.docChanged) {
|
|
277
|
+
this.decorations = this.getDecorations(update.view);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
getDecorations(view: EditorView): DecorationSet {
|
|
282
|
+
if (view.state.doc.length === 0) {
|
|
283
|
+
return Decoration.set([
|
|
284
|
+
Decoration.widget({
|
|
285
|
+
widget: new PlaceholderWidget(placeholder),
|
|
286
|
+
side: 1,
|
|
287
|
+
}).range(0),
|
|
288
|
+
]);
|
|
289
|
+
}
|
|
290
|
+
return Decoration.none;
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
decorations: (v) => v.decorations,
|
|
295
|
+
},
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
export function CodeMirrorNunjucksEditor({
|
|
300
|
+
value,
|
|
301
|
+
onChange,
|
|
302
|
+
readOnly = false,
|
|
303
|
+
className,
|
|
304
|
+
placeholder = '',
|
|
305
|
+
disabled = false,
|
|
306
|
+
multiline = false,
|
|
307
|
+
rows = 3,
|
|
308
|
+
fillAvailableHeight = false,
|
|
309
|
+
}: CodeMirrorNunjucksEditorProps) {
|
|
310
|
+
const vscodePalette = useCodeMirrorVscodePalette();
|
|
311
|
+
const vscodeTheme = useCodeMirrorVscodeTheme();
|
|
312
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
313
|
+
const viewRef = useRef<EditorView | null>(null);
|
|
314
|
+
const onChangeRef = useRef(onChange);
|
|
315
|
+
const initialValueRef = useRef(value);
|
|
316
|
+
|
|
317
|
+
// Keep refs up to date
|
|
318
|
+
useEffect(() => {
|
|
319
|
+
onChangeRef.current = onChange;
|
|
320
|
+
}, [onChange]);
|
|
321
|
+
|
|
322
|
+
// Update initial value ref for editor creation
|
|
323
|
+
useEffect(() => {
|
|
324
|
+
initialValueRef.current = value;
|
|
325
|
+
}, [value]);
|
|
326
|
+
|
|
327
|
+
// Create the editor
|
|
328
|
+
useEffect(() => {
|
|
329
|
+
if (!containerRef.current) {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
const extensions: Extension[] = [
|
|
334
|
+
highlightSpecialChars(),
|
|
335
|
+
history(),
|
|
336
|
+
vscodeTheme,
|
|
337
|
+
createEditorTheme(vscodePalette),
|
|
338
|
+
EditorView.domEventHandlers({
|
|
339
|
+
keydown: (event) => {
|
|
340
|
+
event.stopPropagation();
|
|
341
|
+
return false;
|
|
342
|
+
},
|
|
343
|
+
keyup: (event) => {
|
|
344
|
+
event.stopPropagation();
|
|
345
|
+
return false;
|
|
346
|
+
},
|
|
347
|
+
}),
|
|
348
|
+
nunjucksDecorationPlugin,
|
|
349
|
+
keymap.of([...defaultKeymap, ...historyKeymap]),
|
|
350
|
+
];
|
|
351
|
+
|
|
352
|
+
// Add placeholder
|
|
353
|
+
if (placeholder) {
|
|
354
|
+
extensions.push(placeholderPlugin(placeholder));
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
// Add multiline or single-line behavior
|
|
358
|
+
if (multiline) {
|
|
359
|
+
extensions.push(EditorView.lineWrapping);
|
|
360
|
+
} else {
|
|
361
|
+
extensions.push(singleLineTheme);
|
|
362
|
+
// Prevent Enter key from creating new lines in single-line mode
|
|
363
|
+
extensions.push(
|
|
364
|
+
Prec.highest(
|
|
365
|
+
keymap.of([
|
|
366
|
+
{
|
|
367
|
+
key: 'Enter',
|
|
368
|
+
run: () => true, // Prevent default (consume the event)
|
|
369
|
+
},
|
|
370
|
+
]),
|
|
371
|
+
),
|
|
372
|
+
);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
if (readOnly || disabled) {
|
|
376
|
+
extensions.push(EditorState.readOnly.of(true));
|
|
377
|
+
} else {
|
|
378
|
+
// Add update listener for editable mode
|
|
379
|
+
extensions.push(
|
|
380
|
+
EditorView.updateListener.of((update) => {
|
|
381
|
+
if (update.docChanged && onChangeRef.current) {
|
|
382
|
+
let newValue = update.state.doc.toString();
|
|
383
|
+
// In single-line mode, remove any newlines
|
|
384
|
+
if (!multiline) {
|
|
385
|
+
newValue = newValue.replace(/\n/g, '');
|
|
386
|
+
}
|
|
387
|
+
onChangeRef.current(newValue);
|
|
388
|
+
}
|
|
389
|
+
}),
|
|
390
|
+
);
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const state = EditorState.create({
|
|
394
|
+
doc: initialValueRef.current,
|
|
395
|
+
extensions,
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
const view = new EditorView({
|
|
399
|
+
state,
|
|
400
|
+
parent: containerRef.current,
|
|
401
|
+
});
|
|
402
|
+
|
|
403
|
+
viewRef.current = view;
|
|
404
|
+
|
|
405
|
+
return () => {
|
|
406
|
+
view.destroy();
|
|
407
|
+
viewRef.current = null;
|
|
408
|
+
};
|
|
409
|
+
}, [readOnly, disabled, multiline, placeholder, vscodePalette, vscodeTheme]);
|
|
410
|
+
|
|
411
|
+
// Update content when value changes from outside
|
|
412
|
+
useEffect(() => {
|
|
413
|
+
const view = viewRef.current;
|
|
414
|
+
if (!view) {
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
const currentContent = view.state.doc.toString();
|
|
419
|
+
if (currentContent !== value) {
|
|
420
|
+
view.dispatch({
|
|
421
|
+
changes: {
|
|
422
|
+
from: 0,
|
|
423
|
+
to: currentContent.length,
|
|
424
|
+
insert: value,
|
|
425
|
+
},
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
}, [value]);
|
|
429
|
+
|
|
430
|
+
// Calculate height based on rows
|
|
431
|
+
const maxHeight = multiline ? `${Math.max(rows * 2, 8)}em` : '2.25rem';
|
|
432
|
+
|
|
433
|
+
return (
|
|
434
|
+
<div
|
|
435
|
+
ref={containerRef}
|
|
436
|
+
className={cn(
|
|
437
|
+
'rounded-md border bg-background text-sm',
|
|
438
|
+
'focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2',
|
|
439
|
+
disabled && 'opacity-50 cursor-not-allowed',
|
|
440
|
+
'[&_.cm-editor]:min-h-full [&_.cm-scroller]:overflow-auto',
|
|
441
|
+
fillAvailableHeight && 'h-full min-h-0 [&_.cm-editor]:h-full [&_.cm-scroller]:h-full',
|
|
442
|
+
className,
|
|
443
|
+
)}
|
|
444
|
+
style={
|
|
445
|
+
fillAvailableHeight
|
|
446
|
+
? { height: '100%', overflow: 'hidden' }
|
|
447
|
+
: { maxHeight, overflow: 'hidden' }
|
|
448
|
+
}
|
|
449
|
+
/>
|
|
450
|
+
);
|
|
451
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import type { Extension } from '@codemirror/state';
|
|
2
|
+
import { EditorView } from '@codemirror/view';
|
|
3
|
+
import { HighlightStyle, syntaxHighlighting } from '@codemirror/language';
|
|
4
|
+
import { tags as t } from '@lezer/highlight';
|
|
5
|
+
import { useOptionalTheme } from '../../contexts/ThemeProvider';
|
|
6
|
+
|
|
7
|
+
export const CODEMIRROR_IOSEVKA_FONT_STACK =
|
|
8
|
+
'"Iosevka", var(--font-mono, ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace)';
|
|
9
|
+
|
|
10
|
+
export interface CodeMirrorVscodePalette {
|
|
11
|
+
keyword: string;
|
|
12
|
+
operator: string;
|
|
13
|
+
variable: string;
|
|
14
|
+
string: string;
|
|
15
|
+
function: string;
|
|
16
|
+
comment: string;
|
|
17
|
+
error: string;
|
|
18
|
+
surface: string;
|
|
19
|
+
surfaceAlt: string;
|
|
20
|
+
border: string;
|
|
21
|
+
foreground: string;
|
|
22
|
+
foregroundMuted: string;
|
|
23
|
+
foregroundInverse: string;
|
|
24
|
+
accent: string;
|
|
25
|
+
accentHover: string;
|
|
26
|
+
selection: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ─── Dark Modern ────────────────────────────────────────────────────────────
|
|
30
|
+
|
|
31
|
+
const darkModernEditorTheme = EditorView.theme(
|
|
32
|
+
{
|
|
33
|
+
'&': {
|
|
34
|
+
color: '#cccccc',
|
|
35
|
+
backgroundColor: '#1f1f1f',
|
|
36
|
+
fontSize: '13px',
|
|
37
|
+
fontFamily: CODEMIRROR_IOSEVKA_FONT_STACK,
|
|
38
|
+
},
|
|
39
|
+
'.cm-content': { caretColor: '#aeafad', lineHeight: '1.5' },
|
|
40
|
+
'.cm-cursor, .cm-dropCursor': { borderLeftColor: '#aeafad', borderLeftWidth: '2px' },
|
|
41
|
+
'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {
|
|
42
|
+
backgroundColor: '#264f78',
|
|
43
|
+
},
|
|
44
|
+
'.cm-panels': { backgroundColor: '#252526', color: '#cccccc' },
|
|
45
|
+
'.cm-panels.cm-panels-top': { borderBottom: '1px solid #3c3c3c' },
|
|
46
|
+
'.cm-panels.cm-panels-bottom': { borderTop: '1px solid #3c3c3c' },
|
|
47
|
+
'.cm-searchMatch': { backgroundColor: '#72a1ff59', outline: '1px solid #457dff' },
|
|
48
|
+
'.cm-searchMatch.cm-searchMatch-selected': { backgroundColor: '#6199ff2f' },
|
|
49
|
+
'.cm-activeLine': { backgroundColor: '#ffffff08' },
|
|
50
|
+
'.cm-selectionMatch': { backgroundColor: '#72a1ff59' },
|
|
51
|
+
'&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
|
|
52
|
+
backgroundColor: '#ffffff15',
|
|
53
|
+
outline: '1px solid #569cd690',
|
|
54
|
+
},
|
|
55
|
+
'.cm-gutters': {
|
|
56
|
+
backgroundColor: '#1e1e1e',
|
|
57
|
+
color: '#858585',
|
|
58
|
+
border: 'none',
|
|
59
|
+
borderRight: '1px solid #3c3c3c',
|
|
60
|
+
},
|
|
61
|
+
'.cm-activeLineGutter': { color: '#c6c6c6', backgroundColor: '#282828' },
|
|
62
|
+
'.cm-foldPlaceholder': { backgroundColor: 'transparent', border: 'none', color: '#858585' },
|
|
63
|
+
'.cm-tooltip': {
|
|
64
|
+
border: '1px solid #454545',
|
|
65
|
+
backgroundColor: '#252526',
|
|
66
|
+
boxShadow: '0 2px 6px rgba(0,0,0,0.4)',
|
|
67
|
+
borderRadius: '4px',
|
|
68
|
+
},
|
|
69
|
+
'.cm-tooltip-autocomplete': {
|
|
70
|
+
'& > ul > li[aria-selected]': { backgroundColor: '#04395e', color: '#cccccc' },
|
|
71
|
+
},
|
|
72
|
+
'.cm-completionIcon': { color: '#569cd6' },
|
|
73
|
+
},
|
|
74
|
+
{ dark: true },
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const darkModernHighlight = syntaxHighlighting(
|
|
78
|
+
HighlightStyle.define([
|
|
79
|
+
{ tag: [t.keyword, t.moduleKeyword], color: '#569cd6' },
|
|
80
|
+
{ tag: [t.controlKeyword, t.operatorKeyword], color: '#c586c0' },
|
|
81
|
+
{ tag: t.operator, color: '#d4d4d4' },
|
|
82
|
+
{ tag: [t.function(t.variableName), t.function(t.propertyName)], color: '#dcdcaa' },
|
|
83
|
+
{ tag: [t.typeName, t.className, t.namespace], color: '#4ec9b0' },
|
|
84
|
+
{ tag: [t.propertyName, t.definition(t.propertyName)], color: '#9cdcfe' },
|
|
85
|
+
{ tag: [t.variableName, t.name], color: '#9cdcfe' },
|
|
86
|
+
{ tag: t.definition(t.variableName), color: '#9cdcfe' },
|
|
87
|
+
{ tag: [t.string, t.special(t.string)], color: '#ce9178' },
|
|
88
|
+
{ tag: t.number, color: '#b5cea8' },
|
|
89
|
+
{ tag: [t.bool, t.null], color: '#569cd6' },
|
|
90
|
+
{
|
|
91
|
+
tag: [t.comment, t.lineComment, t.blockComment, t.docComment],
|
|
92
|
+
color: '#6a9955',
|
|
93
|
+
fontStyle: 'italic',
|
|
94
|
+
},
|
|
95
|
+
{ tag: t.tagName, color: '#569cd6' },
|
|
96
|
+
{ tag: t.attributeName, color: '#9cdcfe' },
|
|
97
|
+
{ tag: t.attributeValue, color: '#ce9178' },
|
|
98
|
+
{ tag: [t.regexp, t.escape], color: '#d16969' },
|
|
99
|
+
{ tag: t.meta, color: '#569cd6' },
|
|
100
|
+
{ tag: t.strong, fontWeight: 'bold' },
|
|
101
|
+
{ tag: t.emphasis, fontStyle: 'italic' },
|
|
102
|
+
{ tag: t.strikethrough, textDecoration: 'line-through' },
|
|
103
|
+
{ tag: t.link, color: '#6a9955', textDecoration: 'underline' },
|
|
104
|
+
{ tag: t.heading, fontWeight: 'bold', color: '#569cd6' },
|
|
105
|
+
{ tag: t.invalid, color: '#f44747', textDecoration: 'underline' },
|
|
106
|
+
]),
|
|
107
|
+
);
|
|
108
|
+
|
|
109
|
+
export const vsCodeDarkModern: Extension = [darkModernEditorTheme, darkModernHighlight];
|
|
110
|
+
|
|
111
|
+
// ─── Light Modern ───────────────────────────────────────────────────────────
|
|
112
|
+
|
|
113
|
+
const lightModernEditorTheme = EditorView.theme(
|
|
114
|
+
{
|
|
115
|
+
'&': {
|
|
116
|
+
color: '#3b3b3b',
|
|
117
|
+
backgroundColor: '#ffffff',
|
|
118
|
+
fontSize: '13px',
|
|
119
|
+
fontFamily: CODEMIRROR_IOSEVKA_FONT_STACK,
|
|
120
|
+
},
|
|
121
|
+
'.cm-content': { caretColor: '#3b3b3b', lineHeight: '1.5' },
|
|
122
|
+
'.cm-cursor, .cm-dropCursor': { borderLeftColor: '#3b3b3b', borderLeftWidth: '2px' },
|
|
123
|
+
'&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection': {
|
|
124
|
+
backgroundColor: '#add6ff',
|
|
125
|
+
},
|
|
126
|
+
'.cm-panels': { backgroundColor: '#f3f3f3', color: '#3b3b3b' },
|
|
127
|
+
'.cm-panels.cm-panels-top': { borderBottom: '1px solid #e5e5e5' },
|
|
128
|
+
'.cm-panels.cm-panels-bottom': { borderTop: '1px solid #e5e5e5' },
|
|
129
|
+
'.cm-searchMatch': { backgroundColor: '#f7c94399', outline: '1px solid #f7c943' },
|
|
130
|
+
'.cm-searchMatch.cm-searchMatch-selected': { backgroundColor: '#f7c94366' },
|
|
131
|
+
'.cm-activeLine': { backgroundColor: '#f8f8f8' },
|
|
132
|
+
'.cm-selectionMatch': { backgroundColor: '#a8ac94a0' },
|
|
133
|
+
'&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket': {
|
|
134
|
+
backgroundColor: '#0064ff20',
|
|
135
|
+
outline: '1px solid #0064ff50',
|
|
136
|
+
},
|
|
137
|
+
'.cm-gutters': {
|
|
138
|
+
backgroundColor: '#f8f8f8',
|
|
139
|
+
color: '#6e7681',
|
|
140
|
+
border: 'none',
|
|
141
|
+
borderRight: '1px solid #e5e5e5',
|
|
142
|
+
},
|
|
143
|
+
'.cm-activeLineGutter': { color: '#3b3b3b', backgroundColor: '#f0f0f0' },
|
|
144
|
+
'.cm-foldPlaceholder': { backgroundColor: 'transparent', border: 'none', color: '#6e7681' },
|
|
145
|
+
'.cm-tooltip': {
|
|
146
|
+
border: '1px solid #c8c8c8',
|
|
147
|
+
backgroundColor: '#f3f3f3',
|
|
148
|
+
boxShadow: '0 2px 6px rgba(0,0,0,0.12)',
|
|
149
|
+
borderRadius: '4px',
|
|
150
|
+
},
|
|
151
|
+
'.cm-tooltip-autocomplete': {
|
|
152
|
+
'& > ul > li[aria-selected]': { backgroundColor: '#d6ebff', color: '#3b3b3b' },
|
|
153
|
+
},
|
|
154
|
+
'.cm-completionIcon': { color: '#0064ff' },
|
|
155
|
+
},
|
|
156
|
+
{ dark: false },
|
|
157
|
+
);
|
|
158
|
+
|
|
159
|
+
const lightModernHighlight = syntaxHighlighting(
|
|
160
|
+
HighlightStyle.define([
|
|
161
|
+
{ tag: [t.keyword, t.moduleKeyword], color: '#0000ff' },
|
|
162
|
+
{ tag: [t.controlKeyword, t.operatorKeyword], color: '#af00db' },
|
|
163
|
+
{ tag: t.operator, color: '#3b3b3b' },
|
|
164
|
+
{ tag: [t.function(t.variableName), t.function(t.propertyName)], color: '#795e26' },
|
|
165
|
+
{ tag: [t.typeName, t.className, t.namespace], color: '#267f99' },
|
|
166
|
+
{ tag: [t.propertyName, t.definition(t.propertyName)], color: '#0451a5' },
|
|
167
|
+
{ tag: [t.variableName, t.name], color: '#001080' },
|
|
168
|
+
{ tag: t.definition(t.variableName), color: '#001080' },
|
|
169
|
+
{ tag: [t.string, t.special(t.string)], color: '#a31515' },
|
|
170
|
+
{ tag: t.number, color: '#098658' },
|
|
171
|
+
{ tag: [t.bool, t.null], color: '#0000ff' },
|
|
172
|
+
{
|
|
173
|
+
tag: [t.comment, t.lineComment, t.blockComment, t.docComment],
|
|
174
|
+
color: '#008000',
|
|
175
|
+
fontStyle: 'italic',
|
|
176
|
+
},
|
|
177
|
+
{ tag: t.tagName, color: '#800000' },
|
|
178
|
+
{ tag: t.attributeName, color: '#e50000' },
|
|
179
|
+
{ tag: t.attributeValue, color: '#a31515' },
|
|
180
|
+
{ tag: [t.regexp, t.escape], color: '#811f3f' },
|
|
181
|
+
{ tag: t.meta, color: '#0000ff' },
|
|
182
|
+
{ tag: t.strong, fontWeight: 'bold' },
|
|
183
|
+
{ tag: t.emphasis, fontStyle: 'italic' },
|
|
184
|
+
{ tag: t.strikethrough, textDecoration: 'line-through' },
|
|
185
|
+
{ tag: t.link, color: '#008000', textDecoration: 'underline' },
|
|
186
|
+
{ tag: t.heading, fontWeight: 'bold', color: '#0000ff' },
|
|
187
|
+
{ tag: t.invalid, color: '#cd3131', textDecoration: 'underline' },
|
|
188
|
+
]),
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
export const vsCodeLightModern: Extension = [lightModernEditorTheme, lightModernHighlight];
|
|
192
|
+
|
|
193
|
+
// ─── Palettes (used by other components for matching UI colors) ──────────────
|
|
194
|
+
|
|
195
|
+
const vscodeDarkPalette: CodeMirrorVscodePalette = {
|
|
196
|
+
keyword: '#569cd6',
|
|
197
|
+
operator: '#c586c0',
|
|
198
|
+
variable: '#9cdcfe',
|
|
199
|
+
string: '#ce9178',
|
|
200
|
+
function: '#dcdcaa',
|
|
201
|
+
comment: '#6a9955',
|
|
202
|
+
error: '#f44747',
|
|
203
|
+
surface: '#252526',
|
|
204
|
+
surfaceAlt: '#1f1f1f',
|
|
205
|
+
border: '#3c3c3c',
|
|
206
|
+
foreground: '#cccccc',
|
|
207
|
+
foregroundMuted: '#858585',
|
|
208
|
+
foregroundInverse: '#ffffff',
|
|
209
|
+
accent: '#3794ff',
|
|
210
|
+
accentHover: '#4daafc',
|
|
211
|
+
selection: '#264f78',
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
const vscodeLightPalette: CodeMirrorVscodePalette = {
|
|
215
|
+
keyword: '#0000ff',
|
|
216
|
+
operator: '#af00db',
|
|
217
|
+
variable: '#001080',
|
|
218
|
+
string: '#a31515',
|
|
219
|
+
function: '#795e26',
|
|
220
|
+
comment: '#008000',
|
|
221
|
+
error: '#cd3131',
|
|
222
|
+
surface: '#f8f8f8',
|
|
223
|
+
surfaceAlt: '#ffffff',
|
|
224
|
+
border: '#e5e5e5',
|
|
225
|
+
foreground: '#3b3b3b',
|
|
226
|
+
foregroundMuted: '#6e7681',
|
|
227
|
+
foregroundInverse: '#ffffff',
|
|
228
|
+
accent: '#0064ff',
|
|
229
|
+
accentHover: '#0050cc',
|
|
230
|
+
selection: '#add6ff',
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
export function useCodeMirrorVscodeTheme(): Extension {
|
|
234
|
+
const themeContext = useOptionalTheme();
|
|
235
|
+
|
|
236
|
+
return themeContext?.resolvedTheme === 'dark' ? vsCodeDarkModern : vsCodeLightModern;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
export function useCodeMirrorVscodePalette(): CodeMirrorVscodePalette {
|
|
240
|
+
const themeContext = useOptionalTheme();
|
|
241
|
+
|
|
242
|
+
return themeContext?.resolvedTheme === 'dark' ? vscodeDarkPalette : vscodeLightPalette;
|
|
243
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
|
|
5
|
+
|
|
6
|
+
const Collapsible = CollapsiblePrimitive.Root;
|
|
7
|
+
|
|
8
|
+
const CollapsibleTrigger = CollapsiblePrimitive.CollapsibleTrigger;
|
|
9
|
+
|
|
10
|
+
const CollapsibleContent = CollapsiblePrimitive.CollapsibleContent;
|
|
11
|
+
|
|
12
|
+
export { Collapsible, CollapsibleTrigger, CollapsibleContent };
|