@flowdrop/flowdrop 1.15.0 → 2.0.0-beta.10
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/CHANGELOG.md +648 -0
- package/MIGRATION-2.0.md +642 -0
- package/README.md +28 -28
- package/dist/adapters/WorkflowAdapter.d.ts +1 -1
- package/dist/adapters/WorkflowAdapter.js +18 -13
- package/dist/adapters/agentspec/AgentSpecAdapter.js +10 -10
- package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
- package/dist/api/enhanced-client.js +6 -11
- package/dist/chat/batchFeedback.d.ts +39 -0
- package/dist/chat/batchFeedback.js +51 -0
- package/dist/commands/executor.js +66 -27
- package/dist/commands/storeIntegration.svelte.d.ts +4 -1
- package/dist/commands/storeIntegration.svelte.js +36 -21
- package/dist/commands/types.d.ts +2 -0
- package/dist/commands/types.js +5 -5
- package/dist/components/App.svelte +696 -565
- package/dist/components/App.svelte.d.ts +63 -16
- package/dist/components/Button.stories.svelte +65 -0
- package/dist/components/Button.stories.svelte.d.ts +19 -0
- package/dist/components/Button.svelte +62 -0
- package/dist/components/Button.svelte.d.ts +24 -0
- package/dist/components/CanvasIconButton.svelte +76 -0
- package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
- package/dist/components/ConfigForm.svelte +181 -552
- package/dist/components/ConfigForm.svelte.d.ts +24 -7
- package/dist/components/ConfigModal.svelte +16 -3
- package/dist/components/ConfigPanel.svelte +234 -15
- package/dist/components/ConfigPanel.svelte.d.ts +6 -0
- package/dist/components/ConnectionLine.svelte +4 -2
- package/dist/components/EditorStatusBar.stories.svelte +44 -0
- package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
- package/dist/components/EditorStatusBar.svelte +99 -0
- package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
- package/dist/components/IconButton.svelte +80 -0
- package/dist/components/IconButton.svelte.d.ts +30 -0
- package/dist/components/Input.svelte +74 -0
- package/dist/components/Input.svelte.d.ts +17 -0
- package/dist/components/LogoWordmark.svelte +113 -0
- package/dist/components/LogoWordmark.svelte.d.ts +26 -0
- package/dist/components/Navbar.svelte +78 -64
- package/dist/components/Navbar.svelte.d.ts +3 -0
- package/dist/components/NodeSidebar.svelte +48 -171
- package/dist/components/NodeStatusOverlay.svelte +94 -6
- package/dist/components/NodeSwapPicker.svelte +22 -38
- package/dist/components/PipelineStatus.svelte +22 -68
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/PortCoordinateTracker.svelte +5 -6
- package/dist/components/PortMappingRow.svelte +0 -2
- package/dist/components/SchemaForm.stories.svelte +1 -3
- package/dist/components/SchemaForm.svelte +22 -39
- package/dist/components/SchemaForm.svelte.d.ts +0 -8
- package/dist/components/Select.svelte +53 -0
- package/dist/components/Select.svelte.d.ts +15 -0
- package/dist/components/SettingsModal.svelte +8 -8
- package/dist/components/SettingsPanel.svelte +44 -10
- package/dist/components/SwapMappingEditor.svelte +67 -49
- package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
- package/dist/components/Textarea.svelte +39 -0
- package/dist/components/Textarea.svelte.d.ts +12 -0
- package/dist/components/ThemeToggle.svelte +15 -94
- package/dist/components/UniversalNode.svelte +45 -11
- package/dist/components/UniversalNode.svelte.d.ts +1 -1
- package/dist/components/WorkflowEditor.svelte +183 -162
- package/dist/components/WorkflowEditor.svelte.d.ts +39 -10
- package/dist/components/chat/AIChatPanel.svelte +99 -90
- package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
- package/dist/components/chat/CommandPreview.svelte +2 -1
- package/dist/components/console/CommandConsole.svelte +7 -5
- package/dist/components/console/ConsoleAutocomplete.svelte +11 -12
- package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
- package/dist/components/console/ConsoleInput.svelte +18 -9
- package/dist/components/console/ConsoleOutput.svelte +4 -3
- package/dist/components/form/FormArray.svelte +42 -182
- package/dist/components/form/FormArray.svelte.d.ts +2 -1
- package/dist/components/form/FormAutocomplete.svelte +26 -21
- package/dist/components/form/FormCheckboxGroup.svelte +1 -5
- package/dist/components/form/FormCodeEditor.svelte +9 -7
- package/dist/components/form/FormField.svelte +22 -44
- package/dist/components/form/FormFieldLight.svelte +56 -50
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormFieldset.svelte +45 -11
- package/dist/components/form/FormMarkdownEditor.svelte +17 -9
- package/dist/components/form/FormNumberField.svelte +4 -36
- package/dist/components/form/FormPorts.svelte +262 -0
- package/dist/components/form/FormPorts.svelte.d.ts +13 -0
- package/dist/components/form/FormRangeField.svelte +62 -30
- package/dist/components/form/FormSelect.svelte +13 -75
- package/dist/components/form/FormTemplateEditor.svelte +17 -7
- package/dist/components/form/FormTextField.svelte +3 -35
- package/dist/components/form/FormTextarea.svelte +4 -39
- package/dist/components/form/FormToggle.svelte +5 -16
- package/dist/components/form/FormToggle.svelte.d.ts +4 -2
- package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
- package/dist/components/form/resolveFieldType.d.ts +24 -0
- package/dist/components/form/resolveFieldType.js +55 -0
- package/dist/components/form/templateAutocomplete.js +1 -5
- package/dist/components/form/types.d.ts +1 -14
- package/dist/components/icons/CloseIcon.svelte +6 -0
- package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
- package/dist/components/icons/CommandLineIcon.svelte +15 -0
- package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuIcon.svelte +4 -0
- package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
- package/dist/components/icons/MenuOpenIcon.svelte +6 -0
- package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
- package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
- package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
- package/dist/components/interrupt/FormPrompt.svelte +3 -2
- package/dist/components/interrupt/InterruptBubble.svelte +25 -27
- package/dist/components/interrupt/ReviewPrompt.svelte +10 -23
- package/dist/components/interrupt/TextInputPrompt.svelte +2 -7
- package/dist/components/layouts/MainLayout.svelte +24 -18
- package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
- package/dist/components/nodes/AtomNode.svelte +70 -72
- package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
- package/dist/components/nodes/GatewayNode.svelte +134 -172
- package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
- package/dist/components/nodes/IdeaNode.svelte +79 -98
- package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
- package/dist/components/nodes/NodeConfigButton.svelte +86 -0
- package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
- package/dist/components/nodes/NotesNode.svelte +76 -85
- package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
- package/dist/components/nodes/SimpleNode.svelte +68 -137
- package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
- package/dist/components/nodes/SquareNode.svelte +122 -169
- package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
- package/dist/components/nodes/TerminalNode.svelte +70 -127
- package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
- package/dist/components/nodes/ToolNode.svelte +99 -104
- package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
- package/dist/components/nodes/WorkflowNode.svelte +145 -195
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
- package/dist/components/playground/ChatInput.svelte +11 -15
- package/dist/components/playground/ChatPanel.svelte +6 -49
- package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
- package/dist/components/playground/ControlPanel.svelte +134 -123
- package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
- package/dist/components/playground/ExecutionLogs.svelte +11 -9
- package/dist/components/playground/InputCollector.svelte +22 -57
- package/dist/components/playground/MessageStream.svelte +17 -23
- package/dist/components/playground/PipelineKanbanView.svelte +69 -8
- package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
- package/dist/components/playground/PipelinePanel.svelte +31 -8
- package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
- package/dist/components/playground/PipelineTableView.svelte +188 -44
- package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
- package/dist/components/playground/Playground.svelte +154 -105
- package/dist/components/playground/Playground.svelte.d.ts +5 -0
- package/dist/components/playground/PlaygroundApp.svelte +12 -2
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundModal.svelte +18 -3
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +6 -0
- package/dist/components/playground/PlaygroundStudio.svelte +40 -37
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +6 -0
- package/dist/components/playground/SessionManager.svelte +9 -12
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +30 -1
- package/dist/components/playground/pipelineViewUtils.svelte.js +40 -3
- package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
- package/dist/components/surfaces/TabbedSurface.svelte +133 -0
- package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
- package/dist/config/endpoints.d.ts +23 -7
- package/dist/config/endpoints.js +30 -10
- package/dist/core/index.d.ts +6 -7
- package/dist/core/index.js +8 -12
- package/dist/display/index.d.ts +6 -3
- package/dist/display/index.js +7 -5
- package/dist/editor/index.d.ts +20 -21
- package/dist/editor/index.js +26 -36
- package/dist/form/code.d.ts +25 -15
- package/dist/form/code.js +44 -41
- package/dist/form/fieldRegistry.d.ts +17 -13
- package/dist/form/fieldRegistry.js +32 -12
- package/dist/form/full.d.ts +19 -14
- package/dist/form/full.js +26 -28
- package/dist/form/index.d.ts +3 -4
- package/dist/form/index.js +6 -5
- package/dist/form/markdown.d.ts +13 -8
- package/dist/form/markdown.js +22 -23
- package/dist/helpers/proximityConnect.d.ts +3 -2
- package/dist/helpers/proximityConnect.js +2 -5
- package/dist/helpers/workflowEditorHelper.d.ts +14 -5
- package/dist/helpers/workflowEditorHelper.js +32 -30
- package/dist/index.d.ts +28 -24
- package/dist/index.js +27 -50
- package/dist/messages/defaults.d.ts +2 -5
- package/dist/messages/defaults.js +3 -6
- package/dist/messages/index.d.ts +1 -2
- package/dist/messages/index.js +1 -2
- package/dist/mocks/app-forms.d.ts +6 -2
- package/dist/mocks/app-forms.js +11 -4
- package/dist/openapi/v1/openapi.yaml +38 -26
- package/dist/playground/index.d.ts +4 -5
- package/dist/playground/index.js +4 -32
- package/dist/playground/mount.d.ts +34 -5
- package/dist/playground/mount.js +58 -24
- package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
- package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
- package/dist/registry/builtinFormats.d.ts +9 -18
- package/dist/registry/builtinFormats.js +9 -39
- package/dist/registry/builtinNodeTypes.d.ts +53 -0
- package/dist/registry/builtinNodeTypes.js +67 -0
- package/dist/registry/builtinNodes.d.ts +2 -64
- package/dist/registry/builtinNodes.js +7 -103
- package/dist/registry/index.d.ts +3 -4
- package/dist/registry/index.js +4 -6
- package/dist/registry/nodeComponentRegistry.d.ts +184 -16
- package/dist/registry/nodeComponentRegistry.js +235 -17
- package/dist/registry/workflowFormatRegistry.d.ts +14 -9
- package/dist/registry/workflowFormatRegistry.js +24 -8
- package/dist/{schema → schemas}/index.d.ts +2 -2
- package/dist/{schema → schemas}/index.js +2 -2
- package/dist/schemas/v1/workflow.schema.json +19 -17
- package/dist/services/agentSpecExecutionService.d.ts +0 -2
- package/dist/services/agentSpecExecutionService.js +0 -3
- package/dist/services/apiVariableService.d.ts +2 -1
- package/dist/services/apiVariableService.js +16 -47
- package/dist/services/autoSaveService.d.ts +7 -0
- package/dist/services/autoSaveService.js +6 -4
- package/dist/services/categoriesApi.js +3 -6
- package/dist/services/chatService.d.ts +9 -4
- package/dist/services/chatService.js +23 -28
- package/dist/services/draftStorage.d.ts +129 -13
- package/dist/services/draftStorage.js +185 -37
- package/dist/services/dynamicSchemaService.d.ts +33 -5
- package/dist/services/dynamicSchemaService.js +67 -55
- package/dist/services/globalSave.d.ts +13 -12
- package/dist/services/globalSave.js +29 -51
- package/dist/services/historyService.d.ts +39 -11
- package/dist/services/historyService.js +60 -18
- package/dist/services/interruptService.d.ts +15 -9
- package/dist/services/interruptService.js +35 -37
- package/dist/services/nodeExecutionService.d.ts +18 -3
- package/dist/services/nodeExecutionService.js +71 -45
- package/dist/services/playgroundService.d.ts +16 -10
- package/dist/services/playgroundService.js +42 -43
- package/dist/services/portConfigApi.js +3 -6
- package/dist/services/settingsService.d.ts +9 -4
- package/dist/services/settingsService.js +23 -12
- package/dist/services/variableService.d.ts +2 -1
- package/dist/services/variableService.js +2 -2
- package/dist/services/workflowStorage.js +6 -6
- package/dist/skins/drafter.d.ts +30 -0
- package/dist/skins/drafter.js +198 -0
- package/dist/skins/index.d.ts +2 -1
- package/dist/skins/index.js +4 -2
- package/dist/stores/apiContext.d.ts +56 -0
- package/dist/stores/apiContext.js +80 -0
- package/dist/stores/categoriesStore.svelte.d.ts +28 -23
- package/dist/stores/categoriesStore.svelte.js +69 -64
- package/dist/stores/getInstance.svelte.d.ts +39 -0
- package/dist/stores/getInstance.svelte.js +65 -0
- package/dist/stores/historyStore.svelte.d.ts +89 -91
- package/dist/stores/historyStore.svelte.js +159 -158
- package/dist/stores/instanceContainer.svelte.d.ts +111 -0
- package/dist/stores/instanceContainer.svelte.js +119 -0
- package/dist/stores/interruptStore.svelte.d.ts +112 -82
- package/dist/stores/interruptStore.svelte.js +253 -226
- package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
- package/dist/stores/pipelinePanelStore.svelte.js +61 -14
- package/dist/stores/playgroundStore.svelte.d.ts +169 -222
- package/dist/stores/playgroundStore.svelte.js +513 -580
- package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
- package/dist/stores/portCoordinateStore.svelte.js +109 -98
- package/dist/stores/settingsStore.svelte.d.ts +17 -1
- package/dist/stores/settingsStore.svelte.js +79 -12
- package/dist/stores/workflowStore.svelte.d.ts +212 -210
- package/dist/stores/workflowStore.svelte.js +527 -502
- package/dist/stories/EdgeDecorator.svelte +5 -2
- package/dist/stories/NodeDecorator.svelte +5 -3
- package/dist/styles/base.css +285 -14
- package/dist/styles/tokens.css +60 -2
- package/dist/svelte-app.d.ts +78 -11
- package/dist/svelte-app.js +210 -141
- package/dist/themes/drafter.d.ts +2 -0
- package/dist/themes/drafter.js +15 -0
- package/dist/themes/index.d.ts +2 -1
- package/dist/themes/index.js +8 -2
- package/dist/types/auth.d.ts +9 -51
- package/dist/types/auth.js +4 -54
- package/dist/types/events.d.ts +24 -3
- package/dist/types/events.js +2 -1
- package/dist/types/index.d.ts +117 -32
- package/dist/types/index.js +0 -1
- package/dist/types/navbar.d.ts +7 -0
- package/dist/types/playground.d.ts +18 -3
- package/dist/types/settings.d.ts +30 -1
- package/dist/types/settings.js +5 -2
- package/dist/types/skin.d.ts +1 -1
- package/dist/types/theme.d.ts +16 -2
- package/dist/types/uischema.d.ts +5 -0
- package/dist/utils/colors.d.ts +74 -21
- package/dist/utils/colors.js +92 -68
- package/dist/utils/connections.d.ts +9 -15
- package/dist/utils/connections.js +33 -88
- package/dist/utils/duration.d.ts +13 -0
- package/dist/utils/duration.js +45 -0
- package/dist/utils/edgeStyling.js +9 -5
- package/dist/utils/fetchWithAuth.d.ts +36 -15
- package/dist/utils/fetchWithAuth.js +53 -23
- package/dist/utils/icons.d.ts +5 -2
- package/dist/utils/icons.js +6 -5
- package/dist/utils/nodeIds.d.ts +1 -1
- package/dist/utils/nodeIds.js +1 -1
- package/dist/utils/nodeSwap.d.ts +6 -2
- package/dist/utils/nodeSwap.js +62 -129
- package/dist/utils/nodeTypes.d.ts +17 -8
- package/dist/utils/nodeTypes.js +27 -20
- package/dist/utils/performanceUtils.js +7 -0
- package/dist/utils/portUtils.d.ts +47 -11
- package/dist/utils/portUtils.js +67 -14
- package/dist/utils/portal.d.ts +18 -0
- package/dist/utils/portal.js +34 -0
- package/dist/utils/schemaMerge.d.ts +25 -0
- package/dist/utils/schemaMerge.js +61 -0
- package/package.json +7 -5
- package/dist/messages/deprecation.d.ts +0 -20
- package/dist/messages/deprecation.js +0 -33
- package/dist/registry/plugin.d.ts +0 -215
- package/dist/registry/plugin.js +0 -249
- package/dist/services/api.d.ts +0 -129
- package/dist/services/api.js +0 -217
|
@@ -21,23 +21,20 @@
|
|
|
21
21
|
getEditorSettings,
|
|
22
22
|
getBehaviorSettings
|
|
23
23
|
} from '../stores/settingsStore.svelte.js';
|
|
24
|
-
import type {
|
|
25
|
-
WorkflowNode as WorkflowNodeType,
|
|
26
|
-
NodeMetadata,
|
|
27
|
-
Workflow,
|
|
28
|
-
WorkflowEdge
|
|
29
|
-
} from '../types/index.js';
|
|
24
|
+
import type { WorkflowNode as WorkflowNodeType, Workflow, WorkflowEdge } from '../types/index.js';
|
|
30
25
|
import CanvasBanner from './CanvasBanner.svelte';
|
|
31
26
|
import CanvasController from './CanvasController.svelte';
|
|
32
27
|
import FlowDropZone from './FlowDropZone.svelte';
|
|
33
28
|
import EdgeRefresher from './EdgeRefresher.svelte';
|
|
34
|
-
import { tick, untrack } from 'svelte';
|
|
29
|
+
import { tick, untrack, onMount } from 'svelte';
|
|
35
30
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
31
|
+
import type { AuthProvider } from '../types/auth.js';
|
|
36
32
|
import ConnectionLine from './ConnectionLine.svelte';
|
|
37
33
|
import FlowDropEdge from './FlowDropEdge.svelte';
|
|
38
34
|
import { m } from '../messages/index.js';
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
35
|
+
import { provideInstance } from '../stores/getInstance.svelte.js';
|
|
36
|
+
import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
37
|
+
import type { FlowDropGridVariant } from '../types/theme.js';
|
|
41
38
|
import UniversalNode from './UniversalNode.svelte';
|
|
42
39
|
import {
|
|
43
40
|
EdgeStylingHelper,
|
|
@@ -57,34 +54,96 @@
|
|
|
57
54
|
type ProximityEdgeCandidate
|
|
58
55
|
} from '../helpers/proximityConnect.js';
|
|
59
56
|
import PortCoordinateTracker from './PortCoordinateTracker.svelte';
|
|
60
|
-
import { getPortCoordinateSnapshot } from '../stores/portCoordinateStore.svelte.js';
|
|
61
57
|
import { logger } from '../utils/logger.js';
|
|
62
58
|
import { validateWorkflowData } from '../utils/validation.js';
|
|
63
59
|
import { createEditorStateMachine } from '../stores/editorStateMachine.svelte.js';
|
|
64
|
-
import
|
|
60
|
+
import CanvasIconButton from './CanvasIconButton.svelte';
|
|
61
|
+
import CommandLineIcon from './icons/CommandLineIcon.svelte';
|
|
62
|
+
import { DEV } from 'esm-env';
|
|
65
63
|
|
|
66
64
|
interface Props {
|
|
67
|
-
nodes?: NodeMetadata[];
|
|
68
65
|
endpointConfig?: EndpointConfig;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
isConfigSidebarOpen?: boolean;
|
|
72
|
-
selectedNodeForConfig?: WorkflowNodeType | null;
|
|
66
|
+
/** Auth provider applied to this instance's API requests. */
|
|
67
|
+
authProvider?: AuthProvider;
|
|
73
68
|
openConfigSidebar?: (node: WorkflowNodeType) => void;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
/**
|
|
70
|
+
* Editor interaction mode. `'edit'` allows node drag/connect/select and
|
|
71
|
+
* proximity-connect; `'readonly'` and `'locked'` disable all canvas
|
|
72
|
+
* editing (they behave identically today — see App's `mode` prop for the
|
|
73
|
+
* full matrix). Replaces the former `readOnly` + `lockWorkflow` booleans.
|
|
74
|
+
* @default 'edit'
|
|
75
|
+
*/
|
|
76
|
+
mode?: 'edit' | 'readonly' | 'locked';
|
|
79
77
|
// Pipeline ID for fetching node execution info from jobs
|
|
80
78
|
pipelineId?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Increments to force a re-fetch of node execution info from the server.
|
|
81
|
+
* Used by parents (e.g. PipelineStatus) to push poll ticks / chat-message
|
|
82
|
+
* arrivals down to the canvas without owning a separate status channel.
|
|
83
|
+
*/
|
|
84
|
+
refreshTrigger?: number;
|
|
81
85
|
// Console toggle
|
|
82
86
|
consoleOpen?: boolean;
|
|
83
87
|
onToggleConsole?: () => void;
|
|
88
|
+
/** Per-instance state container (created by mount functions). Defaults to the page-default instance. */
|
|
89
|
+
instance?: FlowDropInstance;
|
|
90
|
+
/**
|
|
91
|
+
* Canvas background grid pattern. Supplied by App from the active theme's
|
|
92
|
+
* `config.canvas.grid` default; any theme can opt into 'lines' / 'cross'.
|
|
93
|
+
* Color is driven separately by the `--fd-grid-pattern-color` token.
|
|
94
|
+
* @default 'dots'
|
|
95
|
+
*/
|
|
96
|
+
gridVariant?: FlowDropGridVariant;
|
|
97
|
+
/**
|
|
98
|
+
* Register the built-in heavy form editors (markdown / code / template)
|
|
99
|
+
* on this instance's field registry. Batteries-included by default — node
|
|
100
|
+
* config fields with `format: 'markdown' | 'code' | 'template'` render real
|
|
101
|
+
* CodeMirror editors. The chunks are code-split (loaded lazily here), so
|
|
102
|
+
* the `/editor` static bundle stays light. Set `false` to keep the textarea
|
|
103
|
+
* fallback or register your own field components. See `features.builtinEditors`.
|
|
104
|
+
* @default true
|
|
105
|
+
*/
|
|
106
|
+
builtinEditors?: boolean;
|
|
84
107
|
}
|
|
85
108
|
|
|
86
109
|
let props: Props = $props();
|
|
87
110
|
|
|
111
|
+
// Resolve (and provide to children) the per-instance state container.
|
|
112
|
+
// Must run during component init — provideInstance reads/sets Svelte context.
|
|
113
|
+
// The instance never changes for a mounted component, so capturing it once is correct.
|
|
114
|
+
// svelte-ignore state_referenced_locally
|
|
115
|
+
const fd = provideInstance(props.instance);
|
|
116
|
+
|
|
117
|
+
// Batteries-included: register the built-in heavy form editors (markdown /
|
|
118
|
+
// code / template) on this instance's field registry so node config fields
|
|
119
|
+
// render real editors out of the box. Dynamic import is deliberate — the
|
|
120
|
+
// bundle guard only inspects *static* imports, and `form/markdown`/`form/code`
|
|
121
|
+
// statically re-export their CodeMirror components, so a static import here
|
|
122
|
+
// would leak CodeMirror into the light `/editor` entry. Importing lazily on
|
|
123
|
+
// mount keeps the static graph clean while the chunks load on demand.
|
|
124
|
+
// register*Field is idempotent per registry, so re-mounts are safe.
|
|
125
|
+
onMount(() => {
|
|
126
|
+
if (props.builtinEditors === false) return;
|
|
127
|
+
void (async () => {
|
|
128
|
+
const [code, markdown] = await Promise.all([
|
|
129
|
+
import('../form/code.js'),
|
|
130
|
+
import('../form/markdown.js')
|
|
131
|
+
]);
|
|
132
|
+
code.registerCodeEditorField(fd.fields);
|
|
133
|
+
code.registerTemplateEditorField(fd.fields);
|
|
134
|
+
markdown.registerMarkdownEditorField(fd.fields);
|
|
135
|
+
})();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
// `mode` is the public API; the canvas only needs to know whether editing is
|
|
139
|
+
// enabled. 'readonly' and 'locked' both disable interaction identically.
|
|
140
|
+
const canvasEditable = $derived((props.mode ?? 'edit') === 'edit');
|
|
141
|
+
|
|
142
|
+
// Canvas grid pattern, supplied by the active theme's config.canvas.grid
|
|
143
|
+
// (App passes it down). BackgroundVariant's enum values are the same strings
|
|
144
|
+
// ('dots' | 'lines' | 'cross'), so the theme config maps straight through.
|
|
145
|
+
const gridVariant = $derived((props.gridVariant ?? 'dots') as BackgroundVariant);
|
|
146
|
+
|
|
88
147
|
// ---------------------------------------------------------------------------
|
|
89
148
|
// Editor State Machine
|
|
90
149
|
// Centralizes reactive guards — replaces scattered boolean flags
|
|
@@ -93,7 +152,7 @@
|
|
|
93
152
|
const machine = createEditorStateMachine();
|
|
94
153
|
|
|
95
154
|
// Dev-mode transition logging
|
|
96
|
-
if (
|
|
155
|
+
if (DEV) {
|
|
97
156
|
machine.onTransition((from, event, to) => {
|
|
98
157
|
logger.debug(`[EditorFSM] ${from} --${event}--> ${to}`);
|
|
99
158
|
});
|
|
@@ -122,7 +181,7 @@
|
|
|
122
181
|
* Key for SvelteFlow component — changes when workflow ID changes.
|
|
123
182
|
* Forces SvelteFlow to remount with fresh state, allowing fitView to work correctly.
|
|
124
183
|
*/
|
|
125
|
-
let svelteFlowKey = $derived(
|
|
184
|
+
let svelteFlowKey = $derived(fd.workflow.current?.id ?? 'default');
|
|
126
185
|
|
|
127
186
|
/**
|
|
128
187
|
* Derive snap grid configuration from editor settings
|
|
@@ -164,14 +223,14 @@
|
|
|
164
223
|
// Helper: sync current flowNodes/flowEdges back to the global store
|
|
165
224
|
// ---------------------------------------------------------------------------
|
|
166
225
|
function syncFlowToStore(): void {
|
|
167
|
-
const storeValue = untrack(() =>
|
|
226
|
+
const storeValue = untrack(() => fd.workflow.current);
|
|
168
227
|
if (!storeValue) return;
|
|
169
228
|
const updatedWorkflow = WorkflowOperationsHelper.updateWorkflow(
|
|
170
229
|
storeValue,
|
|
171
230
|
flowNodes,
|
|
172
231
|
flowEdges
|
|
173
232
|
);
|
|
174
|
-
|
|
233
|
+
fd.workflow.updateWorkflow(updatedWorkflow);
|
|
175
234
|
}
|
|
176
235
|
|
|
177
236
|
// ---------------------------------------------------------------------------
|
|
@@ -182,7 +241,7 @@
|
|
|
182
241
|
let previousSyncedWorkflowId: string | null = null;
|
|
183
242
|
|
|
184
243
|
$effect(() => {
|
|
185
|
-
const storeValue =
|
|
244
|
+
const storeValue = fd.workflow.current;
|
|
186
245
|
|
|
187
246
|
// Suppressed during operations — handlers write to flowNodes directly
|
|
188
247
|
if (untrack(() => machine.permissions.suppressEffect)) return;
|
|
@@ -228,7 +287,7 @@
|
|
|
228
287
|
let previousExecPipelineId: string | undefined = undefined;
|
|
229
288
|
|
|
230
289
|
$effect(() => {
|
|
231
|
-
const storeValue =
|
|
290
|
+
const storeValue = fd.workflow.current;
|
|
232
291
|
const pipelineId = props.pipelineId;
|
|
233
292
|
|
|
234
293
|
if (!storeValue || !pipelineId) return;
|
|
@@ -241,15 +300,12 @@
|
|
|
241
300
|
previousExecWorkflowId = storeValue.id;
|
|
242
301
|
previousExecPipelineId = pipelineId;
|
|
243
302
|
|
|
244
|
-
// Cancel any pending timeout
|
|
303
|
+
// Cancel any pending idle/timeout schedule. In-flight fetches are
|
|
304
|
+
// cancelled by loadNodeExecutionInfo() itself when it's re-entered.
|
|
245
305
|
if (loadExecutionInfoTimeout) {
|
|
246
306
|
clearTimeout(loadExecutionInfoTimeout);
|
|
247
307
|
loadExecutionInfoTimeout = null;
|
|
248
308
|
}
|
|
249
|
-
if (executionInfoAbortController) {
|
|
250
|
-
executionInfoAbortController.abort();
|
|
251
|
-
executionInfoAbortController = null;
|
|
252
|
-
}
|
|
253
309
|
|
|
254
310
|
// Schedule loading with requestIdleCallback (falls back to setTimeout)
|
|
255
311
|
if (typeof requestIdleCallback !== 'undefined') {
|
|
@@ -266,44 +322,26 @@
|
|
|
266
322
|
}
|
|
267
323
|
});
|
|
268
324
|
|
|
269
|
-
//
|
|
270
|
-
//
|
|
271
|
-
//
|
|
325
|
+
// Re-fetch node execution info when the parent bumps refreshTrigger
|
|
326
|
+
// (poll ticks, chat-message arrivals, manual refresh). loadNodeExecutionInfo()
|
|
327
|
+
// is the single writer of executionInfo on flowNodes — no parallel channel.
|
|
328
|
+
// svelte-ignore state_referenced_locally
|
|
329
|
+
let _prevExecRefreshTrigger = props.refreshTrigger ?? 0;
|
|
272
330
|
$effect(() => {
|
|
273
|
-
const
|
|
274
|
-
if (
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
const rawStatus = statuses[node.id];
|
|
278
|
-
if (!rawStatus) return node;
|
|
279
|
-
|
|
280
|
-
const existing = node.data.executionInfo ?? {
|
|
281
|
-
status: 'idle' as const,
|
|
282
|
-
executionCount: 0,
|
|
283
|
-
isExecuting: false
|
|
284
|
-
};
|
|
285
|
-
return {
|
|
286
|
-
...node,
|
|
287
|
-
data: {
|
|
288
|
-
...node.data,
|
|
289
|
-
executionInfo: {
|
|
290
|
-
...existing,
|
|
291
|
-
status: rawStatus === 'error' ? ('failed' as const) : rawStatus,
|
|
292
|
-
isExecuting: rawStatus === 'running'
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
};
|
|
296
|
-
});
|
|
331
|
+
const t = props.refreshTrigger ?? 0;
|
|
332
|
+
if (t === 0 || t === _prevExecRefreshTrigger) return;
|
|
333
|
+
_prevExecRefreshTrigger = t;
|
|
334
|
+
loadNodeExecutionInfo();
|
|
297
335
|
});
|
|
298
336
|
|
|
299
337
|
// ---------------------------------------------------------------------------
|
|
300
338
|
// History restore callback
|
|
301
339
|
// ---------------------------------------------------------------------------
|
|
302
340
|
$effect(() => {
|
|
303
|
-
setOnRestoreCallback((restoredWorkflow: Workflow) => {
|
|
341
|
+
fd.historyBindings.setOnRestoreCallback((restoredWorkflow: Workflow) => {
|
|
304
342
|
machine.send('START_RESTORE');
|
|
305
343
|
// Update the store (effect is suppressed during 'restoring')
|
|
306
|
-
|
|
344
|
+
fd.workflow.restoreFromHistory(restoredWorkflow);
|
|
307
345
|
// Derive flowNodes/flowEdges directly for immediate visual update
|
|
308
346
|
const derived = buildFlowNodesFromStore(restoredWorkflow);
|
|
309
347
|
flowNodes = derived.nodes;
|
|
@@ -314,26 +352,38 @@
|
|
|
314
352
|
});
|
|
315
353
|
|
|
316
354
|
return () => {
|
|
317
|
-
|
|
355
|
+
// Reinstate the container's default wiring rather than nulling it: the
|
|
356
|
+
// default instance survives unmount, and a bare null would make legacy
|
|
357
|
+
// historyActions.undo() silently restore nothing afterwards.
|
|
358
|
+
fd.historyBindings.setOnRestoreCallback((restored: Workflow) =>
|
|
359
|
+
fd.workflow.restoreFromHistory(restored)
|
|
360
|
+
);
|
|
318
361
|
};
|
|
319
362
|
});
|
|
320
363
|
|
|
321
364
|
/**
|
|
322
|
-
* Load node execution information for all nodes in the workflow
|
|
365
|
+
* Load node execution information for all nodes in the workflow.
|
|
366
|
+
* Cancels any in-flight fetch so concurrent callers (pipelineId change
|
|
367
|
+
* and refreshTrigger bumps) can't race on flowNodes.
|
|
323
368
|
*/
|
|
324
369
|
async function loadNodeExecutionInfo(): Promise<void> {
|
|
325
|
-
const workflow = untrack(() =>
|
|
370
|
+
const workflow = untrack(() => fd.workflow.current);
|
|
326
371
|
if (!workflow?.nodes || !props.pipelineId) return;
|
|
327
372
|
|
|
328
|
-
|
|
329
|
-
executionInfoAbortController
|
|
373
|
+
if (executionInfoAbortController) {
|
|
374
|
+
executionInfoAbortController.abort();
|
|
375
|
+
}
|
|
376
|
+
const controller = new AbortController();
|
|
377
|
+
executionInfoAbortController = controller;
|
|
330
378
|
|
|
379
|
+
try {
|
|
331
380
|
const executionInfo = await NodeOperationsHelper.loadNodeExecutionInfo(
|
|
381
|
+
fd.api,
|
|
332
382
|
workflow,
|
|
333
383
|
props.pipelineId
|
|
334
384
|
);
|
|
335
385
|
|
|
336
|
-
if (
|
|
386
|
+
if (controller.signal.aborted) return;
|
|
337
387
|
|
|
338
388
|
const defaultExecutionInfo: NodeExecutionInfo = {
|
|
339
389
|
status: 'idle' as const,
|
|
@@ -350,7 +400,9 @@
|
|
|
350
400
|
}
|
|
351
401
|
}));
|
|
352
402
|
|
|
353
|
-
executionInfoAbortController
|
|
403
|
+
if (executionInfoAbortController === controller) {
|
|
404
|
+
executionInfoAbortController = null;
|
|
405
|
+
}
|
|
354
406
|
} catch (error) {
|
|
355
407
|
if (error instanceof Error && error.name !== 'AbortError') {
|
|
356
408
|
logger.error('Failed to load node execution info:', error);
|
|
@@ -401,12 +453,7 @@
|
|
|
401
453
|
nodes: WorkflowNodeType[];
|
|
402
454
|
event: MouseEvent | TouchEvent;
|
|
403
455
|
}): void {
|
|
404
|
-
if (
|
|
405
|
-
!getEditorSettings().proximityConnect ||
|
|
406
|
-
!targetNode ||
|
|
407
|
-
props.readOnly ||
|
|
408
|
-
props.lockWorkflow
|
|
409
|
-
) {
|
|
456
|
+
if (!getEditorSettings().proximityConnect || !targetNode || !canvasEditable) {
|
|
410
457
|
if (currentProximityCandidates.length > 0) {
|
|
411
458
|
flowEdges = ProximityConnectHelper.removePreviewEdges(flowEdges);
|
|
412
459
|
currentProximityCandidates = [];
|
|
@@ -422,16 +469,18 @@
|
|
|
422
469
|
const baseEdges = ProximityConnectHelper.removePreviewEdges(flowEdges);
|
|
423
470
|
|
|
424
471
|
// Find the best compatible edge using port-to-port distance
|
|
425
|
-
const portCoordinates =
|
|
472
|
+
const portCoordinates = fd.portCoordinates.coordinates;
|
|
426
473
|
const candidates =
|
|
427
474
|
portCoordinates.size > 0
|
|
428
475
|
? ProximityConnectHelper.findCompatibleEdgesByPortCoordinates(
|
|
476
|
+
fd.portCompatibility,
|
|
429
477
|
targetNode.id,
|
|
430
478
|
portCoordinates,
|
|
431
479
|
baseEdges,
|
|
432
480
|
getEditorSettings().proximityConnectDistance
|
|
433
481
|
)
|
|
434
482
|
: ProximityConnectHelper.findCompatibleEdges(
|
|
483
|
+
fd.portCompatibility,
|
|
435
484
|
targetNode,
|
|
436
485
|
flowNodes,
|
|
437
486
|
baseEdges,
|
|
@@ -478,9 +527,9 @@
|
|
|
478
527
|
syncFlowToStore();
|
|
479
528
|
|
|
480
529
|
// Push history AFTER the drag completed
|
|
481
|
-
const storeValue =
|
|
530
|
+
const storeValue = fd.workflow.current;
|
|
482
531
|
if (storeValue) {
|
|
483
|
-
|
|
532
|
+
fd.workflow.pushHistory('Move node', storeValue);
|
|
484
533
|
}
|
|
485
534
|
|
|
486
535
|
// Transition to idle — sync effect is now unblocked
|
|
@@ -488,14 +537,11 @@
|
|
|
488
537
|
}
|
|
489
538
|
|
|
490
539
|
/**
|
|
491
|
-
* Handle new connections between nodes
|
|
540
|
+
* Handle new connections between nodes.
|
|
541
|
+
* The connection details aren't needed — SvelteFlow auto-creates the edge
|
|
542
|
+
* via bind:edges; this only drives the state machine and history snapshot.
|
|
492
543
|
*/
|
|
493
|
-
async function handleConnect(
|
|
494
|
-
source: string;
|
|
495
|
-
target: string;
|
|
496
|
-
sourceHandle?: string;
|
|
497
|
-
targetHandle?: string;
|
|
498
|
-
}): Promise<void> {
|
|
544
|
+
async function handleConnect(): Promise<void> {
|
|
499
545
|
machine.send('START_CONNECT');
|
|
500
546
|
|
|
501
547
|
// SvelteFlow auto-creates the edge via bind:edges — wait for DOM update
|
|
@@ -507,9 +553,9 @@
|
|
|
507
553
|
// Sync to store
|
|
508
554
|
syncFlowToStore();
|
|
509
555
|
|
|
510
|
-
const storeValue =
|
|
556
|
+
const storeValue = fd.workflow.current;
|
|
511
557
|
if (storeValue) {
|
|
512
|
-
|
|
558
|
+
fd.workflow.pushHistory('Add connection', storeValue);
|
|
513
559
|
}
|
|
514
560
|
|
|
515
561
|
machine.send('CONNECTION_MADE');
|
|
@@ -585,9 +631,9 @@
|
|
|
585
631
|
} else if (edgeCount > 0) {
|
|
586
632
|
description = `Delete ${edgeCount} connection${edgeCount > 1 ? 's' : ''}`;
|
|
587
633
|
}
|
|
588
|
-
const storeValue =
|
|
634
|
+
const storeValue = fd.workflow.current;
|
|
589
635
|
if (storeValue) {
|
|
590
|
-
|
|
636
|
+
fd.workflow.pushHistory(description, storeValue);
|
|
591
637
|
}
|
|
592
638
|
|
|
593
639
|
machine.send('DELETE_COMPLETE');
|
|
@@ -598,7 +644,7 @@
|
|
|
598
644
|
// Configure endpoints when props change
|
|
599
645
|
$effect(() => {
|
|
600
646
|
if (props.endpointConfig) {
|
|
601
|
-
ConfigurationHelper.configureEndpoints(props.endpointConfig);
|
|
647
|
+
ConfigurationHelper.configureEndpoints(fd.api, props.endpointConfig, props.authProvider);
|
|
602
648
|
}
|
|
603
649
|
});
|
|
604
650
|
|
|
@@ -635,9 +681,9 @@
|
|
|
635
681
|
|
|
636
682
|
await tick();
|
|
637
683
|
|
|
638
|
-
const storeValue =
|
|
684
|
+
const storeValue = fd.workflow.current;
|
|
639
685
|
if (storeValue) {
|
|
640
|
-
|
|
686
|
+
fd.workflow.pushHistory('Add node', storeValue);
|
|
641
687
|
}
|
|
642
688
|
} else {
|
|
643
689
|
logger.warn('Failed to create node from drop data');
|
|
@@ -667,7 +713,7 @@
|
|
|
667
713
|
logger.warn('Workflow file drop validation failed:', validation.error);
|
|
668
714
|
return;
|
|
669
715
|
}
|
|
670
|
-
|
|
716
|
+
fd.workflow.initialize(data as Workflow);
|
|
671
717
|
} catch (error) {
|
|
672
718
|
const errorObj = error instanceof Error ? error : new Error('Unknown error occurred');
|
|
673
719
|
logger.error('Workflow file drop import failed:', errorObj);
|
|
@@ -693,7 +739,7 @@
|
|
|
693
739
|
/**
|
|
694
740
|
* Update a node's data in the local editor state.
|
|
695
741
|
* Called by App.svelte AFTER it has already updated the global store via
|
|
696
|
-
*
|
|
742
|
+
* fd.workflow.updateNode(). We only need to update flowNodes for
|
|
697
743
|
* immediate visual feedback — no store sync needed.
|
|
698
744
|
*
|
|
699
745
|
* @param nodeId - The ID of the node to update
|
|
@@ -774,15 +820,15 @@
|
|
|
774
820
|
* - Ctrl+Z (or Cmd+Z on Mac): Undo
|
|
775
821
|
* - Ctrl+Shift+Z (or Cmd+Shift+Z): Redo
|
|
776
822
|
* - Ctrl+Y (or Cmd+Y): Redo (Windows convention)
|
|
823
|
+
*
|
|
824
|
+
* Also suppresses WebKit's legacy default action for Backspace outside
|
|
825
|
+
* editable content — history back-navigation. SvelteFlow's KeyHandler
|
|
826
|
+
* deletes the selected elements on Backspace but never preventDefaults,
|
|
827
|
+
* so in embedded WebKit the page navigates away mid-delete. Scoped to
|
|
828
|
+
* keydowns originating inside the flow canvas so host-page behavior
|
|
829
|
+
* outside the editor is untouched.
|
|
777
830
|
*/
|
|
778
831
|
function handleKeydown(event: KeyboardEvent): void {
|
|
779
|
-
// Check for Ctrl (Windows/Linux) or Cmd (Mac)
|
|
780
|
-
const isModifierPressed = event.ctrlKey || event.metaKey;
|
|
781
|
-
|
|
782
|
-
if (!isModifierPressed) {
|
|
783
|
-
return;
|
|
784
|
-
}
|
|
785
|
-
|
|
786
832
|
// Don't handle shortcuts if user is typing in an input, textarea, or contenteditable
|
|
787
833
|
const target = event.target as HTMLElement;
|
|
788
834
|
const isInputElement =
|
|
@@ -792,17 +838,31 @@
|
|
|
792
838
|
return;
|
|
793
839
|
}
|
|
794
840
|
|
|
841
|
+
// Backspace/Delete on a canvas element: let SvelteFlow handle the
|
|
842
|
+
// deletion, but block the browser default (WebKit navigates back).
|
|
843
|
+
if ((event.key === 'Backspace' || event.key === 'Delete') && target.closest('.svelte-flow')) {
|
|
844
|
+
event.preventDefault();
|
|
845
|
+
return;
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
// Check for Ctrl (Windows/Linux) or Cmd (Mac)
|
|
849
|
+
const isModifierPressed = event.ctrlKey || event.metaKey;
|
|
850
|
+
|
|
851
|
+
if (!isModifierPressed) {
|
|
852
|
+
return;
|
|
853
|
+
}
|
|
854
|
+
|
|
795
855
|
// Undo: Ctrl+Z (without Shift)
|
|
796
856
|
if (event.key === 'z' && !event.shiftKey) {
|
|
797
857
|
event.preventDefault();
|
|
798
|
-
|
|
858
|
+
fd.historyBindings.undo();
|
|
799
859
|
return;
|
|
800
860
|
}
|
|
801
861
|
|
|
802
862
|
// Redo: Ctrl+Shift+Z or Ctrl+Y
|
|
803
863
|
if ((event.key === 'z' && event.shiftKey) || event.key === 'y') {
|
|
804
864
|
event.preventDefault();
|
|
805
|
-
|
|
865
|
+
fd.historyBindings.redo();
|
|
806
866
|
return;
|
|
807
867
|
}
|
|
808
868
|
}
|
|
@@ -832,18 +892,13 @@
|
|
|
832
892
|
<FlowDropZone ondrop={handleNodeDrop} onfiledrop={handleWorkflowFileDrop}>
|
|
833
893
|
{#key svelteFlowKey}
|
|
834
894
|
<SvelteFlow
|
|
895
|
+
id={fd.id}
|
|
835
896
|
bind:nodes={flowNodes}
|
|
836
897
|
bind:edges={flowEdges}
|
|
837
898
|
{nodeTypes}
|
|
838
899
|
{edgeTypes}
|
|
839
900
|
{defaultEdgeOptions}
|
|
840
|
-
onconnect={(
|
|
841
|
-
void handleConnect({
|
|
842
|
-
source: connection.source,
|
|
843
|
-
target: connection.target,
|
|
844
|
-
sourceHandle: connection.sourceHandle ?? undefined,
|
|
845
|
-
targetHandle: connection.targetHandle ?? undefined
|
|
846
|
-
})}
|
|
901
|
+
onconnect={() => void handleConnect()}
|
|
847
902
|
onbeforedelete={handleBeforeDelete}
|
|
848
903
|
ondelete={handleNodesDelete}
|
|
849
904
|
onnodedragstart={handleNodeDragStart}
|
|
@@ -859,29 +914,32 @@
|
|
|
859
914
|
{initialViewport}
|
|
860
915
|
colorMode={getResolvedTheme() as ColorMode}
|
|
861
916
|
fitView={getEditorSettings().fitViewOnLoad}
|
|
862
|
-
nodesDraggable={
|
|
863
|
-
nodesConnectable={
|
|
864
|
-
elementsSelectable={
|
|
917
|
+
nodesDraggable={canvasEditable}
|
|
918
|
+
nodesConnectable={canvasEditable}
|
|
919
|
+
elementsSelectable={canvasEditable}
|
|
865
920
|
>
|
|
866
921
|
<Controls />
|
|
867
|
-
{#if
|
|
868
|
-
<
|
|
922
|
+
{#if canvasEditable && props.onToggleConsole}
|
|
923
|
+
<CanvasIconButton
|
|
869
924
|
class="flowdrop-console-toggle"
|
|
870
|
-
|
|
925
|
+
label={m().layout.commandConsole}
|
|
926
|
+
active={props.consoleOpen}
|
|
871
927
|
onclick={props.onToggleConsole}
|
|
872
|
-
aria-label={m().layout.commandConsole}
|
|
873
|
-
title={m().layout.commandConsole}
|
|
874
|
-
type="button"
|
|
875
928
|
>
|
|
876
|
-
|
|
877
|
-
|
|
929
|
+
{#snippet icon()}
|
|
930
|
+
<CommandLineIcon />
|
|
931
|
+
{/snippet}
|
|
932
|
+
</CanvasIconButton>
|
|
878
933
|
{/if}
|
|
879
934
|
<!-- Always render Background for consistent bg color in dark/light mode -->
|
|
880
935
|
<Background
|
|
881
936
|
gap={getEditorSettings().gridSize}
|
|
882
|
-
bgColor="var(--fd-
|
|
883
|
-
variant={
|
|
884
|
-
|
|
937
|
+
bgColor="var(--fd-canvas-bg)"
|
|
938
|
+
variant={gridVariant}
|
|
939
|
+
lineWidth={1}
|
|
940
|
+
patternColor={getEditorSettings().showGrid
|
|
941
|
+
? 'var(--fd-grid-pattern-color)'
|
|
942
|
+
: 'transparent'}
|
|
885
943
|
/>
|
|
886
944
|
{#if getEditorSettings().showMinimap}
|
|
887
945
|
<MiniMap />
|
|
@@ -996,48 +1054,11 @@
|
|
|
996
1054
|
justify-content: space-between;
|
|
997
1055
|
}
|
|
998
1056
|
|
|
999
|
-
|
|
1000
|
-
|
|
1057
|
+
/* Console toggle — placement only; visuals live in CanvasIconButton */
|
|
1058
|
+
:global(.flowdrop-console-toggle) {
|
|
1001
1059
|
bottom: 140px;
|
|
1002
1060
|
left: 12px;
|
|
1003
1061
|
z-index: 5;
|
|
1004
|
-
display: flex;
|
|
1005
|
-
align-items: center;
|
|
1006
|
-
justify-content: center;
|
|
1007
|
-
width: 2rem;
|
|
1008
|
-
height: 2rem;
|
|
1009
|
-
border: 1px solid var(--fd-border);
|
|
1010
|
-
border-radius: var(--fd-radius-md);
|
|
1011
|
-
background-color: var(--fd-background);
|
|
1012
|
-
color: var(--fd-muted-foreground);
|
|
1013
|
-
cursor: pointer;
|
|
1014
|
-
box-shadow: var(--fd-shadow-sm);
|
|
1015
|
-
transition:
|
|
1016
|
-
color var(--fd-transition-fast),
|
|
1017
|
-
background-color var(--fd-transition-fast),
|
|
1018
|
-
box-shadow var(--fd-transition-fast);
|
|
1019
|
-
}
|
|
1020
|
-
|
|
1021
|
-
.flowdrop-console-toggle:hover {
|
|
1022
|
-
color: var(--fd-foreground);
|
|
1023
|
-
background-color: var(--fd-subtle);
|
|
1024
|
-
box-shadow: var(--fd-shadow-md);
|
|
1025
|
-
}
|
|
1026
|
-
|
|
1027
|
-
.flowdrop-console-toggle:focus {
|
|
1028
|
-
outline: none;
|
|
1029
|
-
box-shadow: 0 0 0 2px var(--fd-ring);
|
|
1030
|
-
}
|
|
1031
|
-
|
|
1032
|
-
.flowdrop-console-toggle--active {
|
|
1033
|
-
color: var(--fd-primary);
|
|
1034
|
-
background-color: var(--fd-primary-muted);
|
|
1035
|
-
border-color: var(--fd-primary);
|
|
1036
|
-
}
|
|
1037
|
-
|
|
1038
|
-
.flowdrop-console-toggle--active:hover {
|
|
1039
|
-
color: var(--fd-primary);
|
|
1040
|
-
background-color: var(--fd-primary-muted);
|
|
1041
1062
|
}
|
|
1042
1063
|
|
|
1043
1064
|
:global(.flowdrop-workflow-editor .svelte-flow__node:hover) {
|
|
@@ -1,21 +1,50 @@
|
|
|
1
1
|
import '@xyflow/svelte/dist/style.css';
|
|
2
|
-
import type { WorkflowNode as WorkflowNodeType
|
|
2
|
+
import type { WorkflowNode as WorkflowNodeType } from '../types/index.js';
|
|
3
3
|
import type { EndpointConfig } from '../config/endpoints.js';
|
|
4
|
+
import type { AuthProvider } from '../types/auth.js';
|
|
5
|
+
import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
6
|
+
import type { FlowDropGridVariant } from '../types/theme.js';
|
|
4
7
|
interface Props {
|
|
5
|
-
nodes?: NodeMetadata[];
|
|
6
8
|
endpointConfig?: EndpointConfig;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
isConfigSidebarOpen?: boolean;
|
|
10
|
-
selectedNodeForConfig?: WorkflowNodeType | null;
|
|
9
|
+
/** Auth provider applied to this instance's API requests. */
|
|
10
|
+
authProvider?: AuthProvider;
|
|
11
11
|
openConfigSidebar?: (node: WorkflowNodeType) => void;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Editor interaction mode. `'edit'` allows node drag/connect/select and
|
|
14
|
+
* proximity-connect; `'readonly'` and `'locked'` disable all canvas
|
|
15
|
+
* editing (they behave identically today — see App's `mode` prop for the
|
|
16
|
+
* full matrix). Replaces the former `readOnly` + `lockWorkflow` booleans.
|
|
17
|
+
* @default 'edit'
|
|
18
|
+
*/
|
|
19
|
+
mode?: 'edit' | 'readonly' | 'locked';
|
|
16
20
|
pipelineId?: string;
|
|
21
|
+
/**
|
|
22
|
+
* Increments to force a re-fetch of node execution info from the server.
|
|
23
|
+
* Used by parents (e.g. PipelineStatus) to push poll ticks / chat-message
|
|
24
|
+
* arrivals down to the canvas without owning a separate status channel.
|
|
25
|
+
*/
|
|
26
|
+
refreshTrigger?: number;
|
|
17
27
|
consoleOpen?: boolean;
|
|
18
28
|
onToggleConsole?: () => void;
|
|
29
|
+
/** Per-instance state container (created by mount functions). Defaults to the page-default instance. */
|
|
30
|
+
instance?: FlowDropInstance;
|
|
31
|
+
/**
|
|
32
|
+
* Canvas background grid pattern. Supplied by App from the active theme's
|
|
33
|
+
* `config.canvas.grid` default; any theme can opt into 'lines' / 'cross'.
|
|
34
|
+
* Color is driven separately by the `--fd-grid-pattern-color` token.
|
|
35
|
+
* @default 'dots'
|
|
36
|
+
*/
|
|
37
|
+
gridVariant?: FlowDropGridVariant;
|
|
38
|
+
/**
|
|
39
|
+
* Register the built-in heavy form editors (markdown / code / template)
|
|
40
|
+
* on this instance's field registry. Batteries-included by default — node
|
|
41
|
+
* config fields with `format: 'markdown' | 'code' | 'template'` render real
|
|
42
|
+
* CodeMirror editors. The chunks are code-split (loaded lazily here), so
|
|
43
|
+
* the `/editor` static bundle stays light. Set `false` to keep the textarea
|
|
44
|
+
* fallback or register your own field components. See `features.builtinEditors`.
|
|
45
|
+
* @default true
|
|
46
|
+
*/
|
|
47
|
+
builtinEditors?: boolean;
|
|
19
48
|
}
|
|
20
49
|
declare const WorkflowEditor: import("svelte").Component<Props, {
|
|
21
50
|
updateNodeData: (nodeId: string, dataUpdates: Partial<WorkflowNodeType["data"]>) => void;
|