@flowdrop/flowdrop 2.10.1 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +385 -0
- package/dist/adapters/agentspec/autoLayout.d.ts +18 -36
- package/dist/adapters/agentspec/autoLayout.js +75 -93
- package/dist/chat/activity.d.ts +49 -0
- package/dist/chat/activity.js +65 -0
- package/dist/chat/commandClassifier.js +2 -1
- package/dist/commands/executor.js +186 -27
- package/dist/commands/index.d.ts +2 -1
- package/dist/commands/index.js +2 -0
- package/dist/commands/parser.js +43 -3
- package/dist/commands/session.d.ts +60 -0
- package/dist/commands/session.js +332 -0
- package/dist/commands/storeIntegration.svelte.js +18 -1
- package/dist/commands/types.d.ts +77 -4
- package/dist/components/App.svelte +1030 -207
- package/dist/components/App.svelte.d.ts +26 -2
- package/dist/components/BindablePortListbox.svelte +68 -369
- package/dist/components/Button.svelte +17 -14
- package/dist/components/Button.svelte.d.ts +2 -2
- package/dist/components/CanvasContextMenu.svelte +31 -10
- package/dist/components/CanvasController.svelte +146 -3
- package/dist/components/CanvasController.svelte.d.ts +25 -33
- package/dist/components/CanvasIconButton.svelte +6 -6
- package/dist/components/CanvasToolbar.svelte +103 -0
- package/dist/components/CanvasToolbar.svelte.d.ts +23 -0
- package/dist/components/CanvasZoomControls.svelte +122 -0
- package/dist/components/CanvasZoomControls.svelte.d.ts +15 -0
- package/dist/components/ConfigForm.svelte +163 -125
- package/dist/components/ConfigModal.svelte +13 -56
- package/dist/components/ConfigModal.svelte.d.ts +1 -1
- package/dist/components/ConfigPanel.svelte +98 -228
- package/dist/components/ConfigPanel.svelte.d.ts +2 -2
- package/dist/components/ConnectPortPicker.svelte +153 -0
- package/dist/components/ConnectPortPicker.svelte.d.ts +22 -0
- package/dist/components/ConnectionLine.svelte +1 -1
- package/dist/components/DoctorMenu.svelte +422 -0
- package/dist/components/DoctorMenu.svelte.d.ts +7 -0
- package/dist/components/ExternalLinkRow.svelte +82 -0
- package/dist/components/ExternalLinkRow.svelte.d.ts +14 -0
- package/dist/components/FlowDropEdge.svelte +52 -2
- package/dist/components/FlowDropEdge.svelte.d.ts +5 -1
- package/dist/components/InterfaceNameInput.svelte +103 -0
- package/dist/components/InterfaceNameInput.svelte.d.ts +13 -0
- package/dist/components/InterfaceTag.svelte +215 -0
- package/dist/components/InterfaceTag.svelte.d.ts +20 -0
- package/dist/components/InterfaceTagAnchor.svelte +103 -0
- package/dist/components/InterfaceTagAnchor.svelte.d.ts +12 -0
- package/dist/components/InterfaceTagLayer.svelte +314 -0
- package/dist/components/InterfaceTagLayer.svelte.d.ts +28 -0
- package/dist/components/LogsSidebar.svelte +58 -55
- package/dist/components/LoopbackLanes.svelte +54 -0
- package/dist/components/LoopbackLanes.svelte.d.ts +8 -0
- package/dist/components/MarkdownDisplay.svelte +1 -1
- package/dist/components/Navbar.svelte +539 -169
- package/dist/components/Navbar.svelte.d.ts +20 -1
- package/dist/components/NodeInspector.svelte +153 -0
- package/dist/components/NodeInspector.svelte.d.ts +19 -0
- package/dist/components/NodeLastRun.svelte +212 -0
- package/dist/components/NodeLastRun.svelte.d.ts +13 -0
- package/dist/components/NodeSidebar.svelte +279 -23
- package/dist/components/NodeSidebar.svelte.d.ts +11 -0
- package/dist/components/NodeStatusOverlay.svelte +144 -353
- package/dist/components/NodeStatusOverlay.svelte.d.ts +4 -1
- package/dist/components/PipelineStatus.svelte +5 -18
- package/dist/components/PortMappingRow.svelte +28 -44
- package/dist/components/PortPickerListbox.svelte +475 -0
- package/dist/components/PortPickerListbox.svelte.d.ts +73 -0
- package/dist/components/ReadOnlyDetails.svelte +52 -89
- package/dist/components/RunBar.svelte +222 -0
- package/dist/components/RunBar.svelte.d.ts +20 -0
- package/dist/components/RunsMenu.svelte +649 -0
- package/dist/components/RunsMenu.svelte.d.ts +14 -0
- package/dist/components/SchemaForm.svelte +1 -1
- package/dist/components/SettingsModal.svelte +28 -60
- package/dist/components/SettingsPanel.svelte +516 -242
- package/dist/components/StraightGuides.svelte +46 -0
- package/dist/components/StraightGuides.svelte.d.ts +7 -0
- package/dist/components/ThemeToggle.svelte +14 -4
- package/dist/components/UniversalNode.svelte +152 -51
- package/dist/components/WebMCPBridgeMenu.svelte +336 -0
- package/dist/components/WebMCPBridgeMenu.svelte.d.ts +3 -0
- package/dist/components/WorkflowEditor.svelte +821 -142
- package/dist/components/WorkflowEditor.svelte.d.ts +43 -1
- package/dist/components/WorkflowInterfaceEditor.svelte +106 -100
- package/dist/components/WorkflowInterfaceEditor.svelte.d.ts +12 -1
- package/dist/components/WorkflowInterfaceEntryCard.svelte +496 -494
- package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +14 -1
- package/dist/components/WorkflowInterfaceEntryComposer.svelte +23 -67
- package/dist/components/WorkflowPlaygroundSettings.svelte +514 -0
- package/dist/components/WorkflowPlaygroundSettings.svelte.d.ts +20 -0
- package/dist/components/WorkflowSettingsPanel.svelte +311 -0
- package/dist/components/WorkflowSettingsPanel.svelte.d.ts +20 -0
- package/dist/components/ZoomTier.svelte +56 -0
- package/dist/components/ZoomTier.svelte.d.ts +4 -0
- package/dist/components/chat/AIChatPanel.svelte +464 -313
- package/dist/components/chat/ActivityList.svelte +130 -0
- package/dist/components/chat/ActivityList.svelte.d.ts +11 -0
- package/dist/components/chat/ActivityRow.svelte +179 -0
- package/dist/components/chat/ActivityRow.svelte.d.ts +16 -0
- package/dist/components/chat/CommandPreview.svelte +42 -64
- package/dist/components/console/CommandConsole.svelte +106 -41
- package/dist/components/console/CommandConsole.svelte.d.ts +2 -0
- package/dist/components/console/ConsoleAutocomplete.svelte +14 -13
- package/dist/components/console/ConsoleInput.svelte +60 -27
- package/dist/components/console/ConsoleOutput.svelte +86 -24
- package/dist/components/console/ConsoleStrip.svelte +80 -0
- package/dist/components/console/ConsoleStrip.svelte.d.ts +13 -0
- package/dist/components/form/FieldFactory.svelte +30 -4
- package/dist/components/form/FormArray.svelte +306 -339
- package/dist/components/form/FormArray.svelte.d.ts +10 -0
- package/dist/components/form/FormArrayRows.svelte +443 -0
- package/dist/components/form/FormArrayRows.svelte.d.ts +18 -0
- package/dist/components/form/FormAutocomplete.svelte +2 -2
- package/dist/components/form/FormCheckboxGroup.svelte +10 -85
- package/dist/components/form/FormCodeEditor.svelte +3 -3
- package/dist/components/form/FormFieldWrapper.svelte +98 -18
- package/dist/components/form/FormFieldWrapper.svelte.d.ts +10 -0
- package/dist/components/form/FormFieldset.svelte +44 -28
- package/dist/components/form/FormMarkdownEditor.svelte +6 -6
- package/dist/components/form/FormPorts.svelte +437 -141
- package/dist/components/form/FormSelect.svelte +1 -1
- package/dist/components/form/FormTemplateEditor.svelte +22 -26
- package/dist/components/form/FormToggle.svelte +15 -106
- package/dist/components/form/FormToggle.svelte.d.ts +3 -2
- package/dist/components/form/FormUISchemaRenderer.svelte +38 -3
- package/dist/components/form/humanizeKey.d.ts +7 -0
- package/dist/components/form/humanizeKey.js +21 -0
- package/dist/components/form/index.d.ts +2 -2
- package/dist/components/form/index.js +2 -2
- package/dist/components/form/types.d.ts +6 -0
- package/dist/components/icons/MenuOpenIcon.svelte +8 -1
- package/dist/components/interrupt/ChoicePrompt.svelte +51 -152
- package/dist/components/interrupt/ChoicePrompt.svelte.d.ts +0 -2
- package/dist/components/interrupt/ConfirmationPrompt.svelte +18 -201
- package/dist/components/interrupt/ConfirmationPrompt.svelte.d.ts +0 -4
- package/dist/components/interrupt/FormPrompt.svelte +22 -147
- package/dist/components/interrupt/FormPrompt.svelte.d.ts +0 -4
- package/dist/components/interrupt/InterruptBubble.svelte +198 -355
- package/dist/components/interrupt/InterruptBubble.svelte.d.ts +0 -2
- package/dist/components/interrupt/ReviewPrompt.svelte +0 -10
- package/dist/components/interrupt/TextInputPrompt.svelte +23 -120
- package/dist/components/interrupt/TextInputPrompt.svelte.d.ts +0 -2
- package/dist/components/layouts/MainLayout.svelte +110 -75
- package/dist/components/layouts/MainLayout.svelte.d.ts +17 -0
- package/dist/components/nodes/CaptionNode.svelte +7 -0
- package/dist/components/nodes/GatewayNode.svelte +66 -431
- package/dist/components/nodes/IdeaNode.svelte +6 -5
- package/dist/components/nodes/NodeCard.svelte +1051 -0
- package/dist/components/nodes/NodeCard.svelte.d.ts +30 -0
- package/dist/components/nodes/NodeConfigButton.svelte +28 -9
- package/dist/components/nodes/NodeProblemMark.svelte +113 -0
- package/dist/components/nodes/NodeProblemMark.svelte.d.ts +8 -0
- package/dist/components/nodes/NodeTip.svelte +104 -0
- package/dist/components/nodes/NodeTip.svelte.d.ts +15 -0
- package/dist/components/nodes/NotesNode.svelte +183 -150
- package/dist/components/nodes/SimpleNode.svelte +176 -44
- package/dist/components/nodes/SquareNode.svelte +127 -34
- package/dist/components/nodes/TerminalNode.svelte +232 -88
- package/dist/components/nodes/ToolNode.svelte +49 -381
- package/dist/components/nodes/WorkflowNode.svelte +40 -399
- package/dist/components/playground/ChatBubble.svelte +248 -62
- package/dist/components/playground/ChatInput.svelte +134 -297
- package/dist/components/playground/ChatInput.svelte.d.ts +17 -0
- package/dist/components/playground/ControlPanel.svelte +318 -188
- package/dist/components/playground/ControlPanel.svelte.d.ts +13 -0
- package/dist/components/playground/DockedPlayground.svelte +75 -0
- package/dist/components/playground/DockedPlayground.svelte.d.ts +24 -0
- package/dist/components/playground/ExecutionConsole.svelte +54 -36
- package/dist/components/playground/ExecutionConsole.svelte.d.ts +12 -0
- package/dist/components/playground/ExecutionLogs.svelte +4 -0
- package/dist/components/playground/HeaderMenu.svelte +170 -0
- package/dist/components/playground/HeaderMenu.svelte.d.ts +22 -0
- package/dist/components/playground/InputCollector.svelte +8 -32
- package/dist/components/playground/InputFields.svelte +246 -0
- package/dist/components/playground/InputFields.svelte.d.ts +16 -0
- package/dist/components/playground/InterfaceInputForm.svelte +285 -30
- package/dist/components/playground/InterfaceInputForm.svelte.d.ts +20 -0
- package/dist/components/playground/InterfaceJsonInput.svelte +92 -0
- package/dist/components/playground/InterfaceJsonInput.svelte.d.ts +10 -0
- package/dist/components/playground/LogRow.svelte +12 -12
- package/dist/components/playground/MessageMarkdown.svelte +11 -11
- package/dist/components/playground/MessageStream.svelte +154 -182
- package/dist/components/playground/Playground.svelte +17 -1087
- package/dist/components/playground/PlaygroundApp.svelte +12 -2
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +2 -1
- package/dist/components/playground/PlaygroundHeader.svelte +309 -0
- package/dist/components/playground/PlaygroundHeader.svelte.d.ts +22 -0
- package/dist/components/playground/PlaygroundModal.svelte +7 -1
- package/dist/components/playground/PlaygroundStudio.svelte +31 -33
- package/dist/components/playground/PlaygroundSurface.svelte +648 -0
- package/dist/components/playground/PlaygroundSurface.svelte.d.ts +79 -0
- package/dist/components/playground/StepsSummary.svelte +312 -0
- package/dist/components/playground/StepsSummary.svelte.d.ts +11 -0
- package/dist/components/playground/messageDisplay.d.ts +9 -0
- package/dist/components/playground/messageDisplay.js +24 -2
- package/dist/components/playground/stepSummary.d.ts +71 -0
- package/dist/components/playground/stepSummary.js +152 -0
- package/dist/components/ports/PortTypeBadge.svelte +13 -1
- package/dist/components/primitives/Button.svelte +226 -0
- package/dist/components/primitives/Button.svelte.d.ts +31 -0
- package/dist/components/primitives/Card.svelte +110 -0
- package/dist/components/primitives/Card.svelte.d.ts +20 -0
- package/dist/components/primitives/Checkbox.svelte +126 -0
- package/dist/components/primitives/Checkbox.svelte.d.ts +15 -0
- package/dist/components/primitives/Chip.svelte +143 -0
- package/dist/components/primitives/Chip.svelte.d.ts +22 -0
- package/dist/components/primitives/Combobox.svelte +444 -0
- package/dist/components/primitives/Combobox.svelte.d.ts +22 -0
- package/dist/components/primitives/Composer.svelte +293 -0
- package/dist/components/primitives/Composer.svelte.d.ts +47 -0
- package/dist/components/primitives/EmptyState.svelte +113 -0
- package/dist/components/primitives/EmptyState.svelte.d.ts +18 -0
- package/dist/components/primitives/Field.svelte +178 -0
- package/dist/components/primitives/Field.svelte.d.ts +30 -0
- package/dist/components/primitives/IconButton.svelte +156 -0
- package/dist/components/primitives/IconButton.svelte.d.ts +27 -0
- package/dist/components/primitives/Menu.svelte +435 -0
- package/dist/components/primitives/Menu.svelte.d.ts +61 -0
- package/dist/components/primitives/Notice.svelte +161 -0
- package/dist/components/primitives/Notice.svelte.d.ts +22 -0
- package/dist/components/primitives/PanelHeader.svelte +134 -0
- package/dist/components/primitives/PanelHeader.svelte.d.ts +23 -0
- package/dist/components/primitives/Segmented.svelte +198 -0
- package/dist/components/primitives/Segmented.svelte.d.ts +32 -0
- package/dist/components/primitives/Select.svelte +130 -0
- package/dist/components/primitives/Select.svelte.d.ts +26 -0
- package/dist/components/primitives/StatusPill.svelte +218 -0
- package/dist/components/primitives/StatusPill.svelte.d.ts +24 -0
- package/dist/components/primitives/Switch.svelte +113 -0
- package/dist/components/primitives/Switch.svelte.d.ts +14 -0
- package/dist/components/primitives/Tabs.svelte +209 -0
- package/dist/components/primitives/Tabs.svelte.d.ts +32 -0
- package/dist/components/primitives/Toolbar.svelte +94 -0
- package/dist/components/primitives/Toolbar.svelte.d.ts +14 -0
- package/dist/components/primitives/ToolbarSeparator.svelte +40 -0
- package/dist/components/primitives/ToolbarSeparator.svelte.d.ts +7 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte +10 -40
- package/dist/components/surfaces/TabbedSurface.svelte +49 -39
- package/dist/components/surfaces/TabbedSurface.svelte.d.ts +8 -0
- package/dist/components/toast/DismissibleToast.svelte +94 -32
- package/dist/components/toast/DismissibleToast.svelte.d.ts +17 -7
- package/dist/config/endpoints.d.ts +43 -1
- package/dist/config/endpoints.js +21 -3
- package/dist/core/index.d.ts +9 -6
- package/dist/core/index.js +1 -1
- package/dist/editor/connectCandidates.d.ts +56 -0
- package/dist/editor/connectCandidates.js +131 -0
- package/dist/editor/contextMenu.d.ts +31 -2
- package/dist/editor/contextMenu.js +96 -9
- package/dist/editor/index.d.ts +3 -1
- package/dist/editor/index.js +1 -0
- package/dist/editor/interfaceMenu.d.ts +35 -0
- package/dist/editor/interfaceMenu.js +47 -0
- package/dist/editor/portMenu.d.ts +23 -0
- package/dist/editor/portMenu.js +34 -0
- package/dist/editor/tidy.d.ts +30 -0
- package/dist/editor/tidy.js +66 -0
- package/dist/helpers/workflowEditorHelper.d.ts +15 -0
- package/dist/helpers/workflowEditorHelper.js +39 -3
- package/dist/layout/fromWorkflow.d.ts +42 -0
- package/dist/layout/fromWorkflow.js +135 -0
- package/dist/layout/geometry.d.ts +102 -0
- package/dist/layout/geometry.js +317 -0
- package/dist/layout/index.d.ts +21 -0
- package/dist/layout/index.js +14 -0
- package/dist/layout/inspect.d.ts +18 -0
- package/dist/layout/inspect.js +81 -0
- package/dist/layout/lanePath.d.ts +23 -0
- package/dist/layout/lanePath.js +47 -0
- package/dist/layout/measure.d.ts +141 -0
- package/dist/layout/measure.js +477 -0
- package/dist/layout/primitives.d.ts +124 -0
- package/dist/layout/primitives.js +461 -0
- package/dist/layout/sweep.d.ts +59 -0
- package/dist/layout/sweep.js +257 -0
- package/dist/layout/toWorkflow.d.ts +43 -0
- package/dist/layout/toWorkflow.js +131 -0
- package/dist/layout/types.d.ts +93 -0
- package/dist/layout/types.js +35 -0
- package/dist/messages/defaults.d.ts +694 -26
- package/dist/messages/defaults.js +626 -27
- package/dist/messages/types.d.ts +21 -1
- package/dist/openapi/v1/openapi.yaml +222 -5
- package/dist/playground/index.d.ts +31 -2
- package/dist/playground/index.js +31 -1
- package/dist/playground/mount.d.ts +34 -12
- package/dist/playground/mount.js +80 -35
- package/dist/playground/runAction.d.ts +29 -0
- package/dist/playground/runAction.js +38 -0
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/v1/workflow.schema.json +140 -2
- package/dist/services/doctorService.d.ts +52 -0
- package/dist/services/doctorService.js +113 -0
- package/dist/services/globalSave.js +17 -24
- package/dist/services/nodeExecutionService.d.ts +12 -1
- package/dist/services/nodeExecutionService.js +58 -58
- package/dist/services/playgroundService.d.ts +23 -3
- package/dist/services/playgroundService.js +53 -5
- package/dist/services/runsService.d.ts +42 -0
- package/dist/services/runsService.js +87 -0
- package/dist/services/toastQueue.d.ts +33 -0
- package/dist/services/toastQueue.js +38 -0
- package/dist/services/toastService.d.ts +30 -9
- package/dist/services/toastService.js +81 -46
- package/dist/settings/index.d.ts +1 -0
- package/dist/skins/default.d.ts +1 -1
- package/dist/skins/drafter.d.ts +1 -1
- package/dist/skins/graphite.d.ts +26 -0
- package/dist/skins/graphite.js +473 -0
- package/dist/skins/index.d.ts +6 -5
- package/dist/skins/index.js +7 -5
- package/dist/skins/slate.d.ts +1 -1
- package/dist/skins/slate.js +4 -4
- package/dist/stores/attachedRunStore.svelte.d.ts +35 -0
- package/dist/stores/attachedRunStore.svelte.js +47 -0
- package/dist/stores/connectDragStore.svelte.d.ts +39 -0
- package/dist/stores/connectDragStore.svelte.js +42 -0
- package/dist/stores/doctorStore.svelte.d.ts +79 -0
- package/dist/stores/doctorStore.svelte.js +244 -0
- package/dist/stores/editedNodesStore.svelte.d.ts +42 -0
- package/dist/stores/editedNodesStore.svelte.js +84 -0
- package/dist/stores/editorModeStore.svelte.d.ts +34 -0
- package/dist/stores/editorModeStore.svelte.js +55 -0
- package/dist/stores/instanceContainer.svelte.d.ts +68 -0
- package/dist/stores/instanceContainer.svelte.js +49 -2
- package/dist/stores/loopbackLanesStore.svelte.d.ts +18 -0
- package/dist/stores/loopbackLanesStore.svelte.js +25 -0
- package/dist/stores/nodeHighlightStore.svelte.d.ts +34 -0
- package/dist/stores/nodeHighlightStore.svelte.js +56 -0
- package/dist/stores/playgroundStore.svelte.d.ts +74 -2
- package/dist/stores/playgroundStore.svelte.js +182 -6
- package/dist/stores/runController.svelte.d.ts +382 -0
- package/dist/stores/runController.svelte.js +1217 -0
- package/dist/stores/settingsStore.svelte.d.ts +80 -18
- package/dist/stores/settingsStore.svelte.js +180 -62
- package/dist/stores/workflowStore.svelte.d.ts +18 -1
- package/dist/stores/workflowStore.svelte.js +29 -1
- package/dist/styles/base.css +300 -28
- package/dist/styles/fonts/Inter-LICENSE.txt +93 -0
- package/dist/styles/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/styles/fonts/inter.css +19 -0
- package/dist/styles/toast.css +100 -20
- package/dist/styles/tokenAliases.d.ts +13 -0
- package/dist/styles/tokenAliases.js +206 -0
- package/dist/styles/tokens.css +586 -14
- package/dist/svelte-app.d.ts +38 -5
- package/dist/svelte-app.js +14 -3
- package/dist/themes/graphite.d.ts +2 -0
- package/dist/themes/graphite.js +15 -0
- package/dist/themes/index.d.ts +2 -1
- package/dist/themes/index.js +22 -3
- package/dist/themes/minimal.js +10 -0
- package/dist/themes/scopedSkinCss.d.ts +47 -0
- package/dist/themes/scopedSkinCss.js +220 -0
- package/dist/types/chat.d.ts +6 -0
- package/dist/types/doctor.d.ts +82 -0
- package/dist/types/doctor.js +11 -0
- package/dist/types/events.d.ts +35 -0
- package/dist/types/events.js +4 -1
- package/dist/types/index.d.ts +103 -6
- package/dist/types/index.js +15 -3
- package/dist/types/navbar.d.ts +36 -0
- package/dist/types/playground.d.ts +66 -0
- package/dist/types/settings.d.ts +120 -7
- package/dist/types/settings.js +35 -3
- package/dist/types/skin.d.ts +23 -10
- package/dist/types/theme.d.ts +40 -2
- package/dist/utils/appearance.d.ts +19 -0
- package/dist/utils/appearance.js +13 -0
- package/dist/utils/canvasFit.d.ts +41 -0
- package/dist/utils/canvasFit.js +44 -0
- package/dist/utils/chipTitles.d.ts +9 -0
- package/dist/utils/chipTitles.js +19 -0
- package/dist/utils/connections.js +8 -0
- package/dist/utils/consoleHighlight.d.ts +28 -0
- package/dist/utils/consoleHighlight.js +269 -0
- package/dist/utils/deprecation.d.ts +17 -0
- package/dist/utils/deprecation.js +29 -0
- package/dist/utils/doctorOperations.d.ts +40 -0
- package/dist/utils/doctorOperations.js +237 -0
- package/dist/utils/duration.d.ts +13 -0
- package/dist/utils/duration.js +40 -0
- package/dist/utils/inspectorContext.d.ts +19 -0
- package/dist/utils/inspectorContext.js +12 -0
- package/dist/utils/inspectorSections.d.ts +20 -0
- package/dist/utils/inspectorSections.js +44 -0
- package/dist/utils/inspectorSurface.d.ts +46 -0
- package/dist/utils/inspectorSurface.js +51 -0
- package/dist/utils/interfaceTags.d.ts +102 -0
- package/dist/utils/interfaceTags.js +211 -0
- package/dist/utils/itemRef.d.ts +86 -0
- package/dist/utils/itemRef.js +106 -0
- package/dist/utils/lastRun.d.ts +35 -0
- package/dist/utils/lastRun.js +73 -0
- package/dist/utils/messageNodeLink.d.ts +17 -0
- package/dist/utils/messageNodeLink.js +16 -0
- package/dist/utils/minimapVisibility.d.ts +28 -0
- package/dist/utils/minimapVisibility.js +34 -0
- package/dist/utils/nodeAriaLabel.d.ts +12 -0
- package/dist/utils/nodeAriaLabel.js +17 -0
- package/dist/utils/nodeFingerprint.d.ts +27 -0
- package/dist/utils/nodeFingerprint.js +66 -0
- package/dist/utils/nodeFormSchema.d.ts +10 -0
- package/dist/utils/nodeFormSchema.js +2 -2
- package/dist/utils/nodeGeometry.d.ts +168 -0
- package/dist/utils/nodeGeometry.js +204 -0
- package/dist/utils/nodeProblem.d.ts +19 -0
- package/dist/utils/nodeProblem.js +9 -0
- package/dist/utils/nodeStatus.d.ts +38 -3
- package/dist/utils/nodeStatus.js +67 -39
- package/dist/utils/nodeSwap.js +9 -1
- package/dist/utils/nodeWrapper.d.ts +1 -0
- package/dist/utils/playgroundChat.d.ts +121 -0
- package/dist/utils/playgroundChat.js +275 -0
- package/dist/utils/playgroundHistory.d.ts +48 -0
- package/dist/utils/playgroundHistory.js +38 -0
- package/dist/utils/playgroundInputRuns.d.ts +26 -0
- package/dist/utils/playgroundInputRuns.js +50 -0
- package/dist/utils/portExposure.d.ts +49 -0
- package/dist/utils/portExposure.js +122 -0
- package/dist/utils/portUtils.d.ts +16 -0
- package/dist/utils/portUtils.js +37 -0
- package/dist/utils/portal.d.ts +3 -14
- package/dist/utils/portal.js +22 -0
- package/dist/utils/reservedPorts.d.ts +59 -0
- package/dist/utils/reservedPorts.js +60 -0
- package/dist/utils/runEdges.d.ts +24 -0
- package/dist/utils/runEdges.js +35 -0
- package/dist/utils/runsList.d.ts +69 -0
- package/dist/utils/runsList.js +134 -0
- package/dist/utils/selectOptions.d.ts +62 -0
- package/dist/utils/selectOptions.js +137 -0
- package/dist/utils/sessionRuns.d.ts +62 -0
- package/dist/utils/sessionRuns.js +123 -0
- package/dist/utils/sheetWidths.d.ts +29 -0
- package/dist/utils/sheetWidths.js +41 -0
- package/dist/utils/sidebarWidths.d.ts +34 -0
- package/dist/utils/sidebarWidths.js +47 -0
- package/dist/utils/straightWires.d.ts +73 -0
- package/dist/utils/straightWires.js +99 -0
- package/dist/utils/themeScope.svelte.d.ts +10 -0
- package/dist/utils/themeScope.svelte.js +80 -0
- package/dist/utils/wiredHandles.d.ts +10 -0
- package/dist/utils/wiredHandles.js +14 -0
- package/dist/utils/workflowDraft.d.ts +9 -0
- package/dist/utils/workflowDraft.js +39 -0
- package/dist/utils/workflowInterface.d.ts +128 -27
- package/dist/utils/workflowInterface.js +244 -33
- package/dist/utils/zoomTier.d.ts +43 -0
- package/dist/utils/zoomTier.js +107 -0
- package/dist/utils/zoomTierRows.d.ts +41 -0
- package/dist/utils/zoomTierRows.js +103 -0
- package/dist/webmcp/WebMCPConfirm.svelte +68 -18
- package/dist/webmcp/bridge.d.ts +5 -0
- package/dist/webmcp/bridge.js +8 -0
- package/dist/webmcp/bridgeController.svelte.d.ts +84 -0
- package/dist/webmcp/bridgeController.svelte.js +224 -0
- package/dist/webmcp/descriptors.d.ts +1 -1
- package/dist/webmcp/descriptors.js +66 -5
- package/dist/webmcp/fakeWidget.d.ts +34 -0
- package/dist/webmcp/fakeWidget.js +75 -0
- package/dist/webmcp/gate.d.ts +6 -0
- package/dist/webmcp/gate.js +8 -0
- package/dist/webmcp/index.d.ts +2 -0
- package/dist/webmcp/index.js +1 -0
- package/dist/webmcp/runtime.js +6 -2
- package/dist/webmcp/types.d.ts +2 -0
- package/dist/webmcp/validate.js +5 -1
- package/package.json +14 -7
- package/dist/components/Button.stories.svelte +0 -65
- package/dist/components/Button.stories.svelte.d.ts +0 -19
- package/dist/components/CanvasBanner.stories.svelte +0 -30
- package/dist/components/CanvasBanner.stories.svelte.d.ts +0 -27
- package/dist/components/CanvasContextMenu.stories.svelte +0 -63
- package/dist/components/CanvasContextMenu.stories.svelte.d.ts +0 -19
- package/dist/components/ConfigPanel.stories.svelte +0 -47
- package/dist/components/ConfigPanel.stories.svelte.d.ts +0 -27
- package/dist/components/EditorStatusBar.stories.svelte +0 -44
- package/dist/components/EditorStatusBar.stories.svelte.d.ts +0 -27
- package/dist/components/FlowDropEdge.stories.svelte +0 -197
- package/dist/components/FlowDropEdge.stories.svelte.d.ts +0 -26
- package/dist/components/LoadingSpinner.stories.svelte +0 -30
- package/dist/components/LoadingSpinner.stories.svelte.d.ts +0 -27
- package/dist/components/Logo.stories.svelte +0 -22
- package/dist/components/Logo.stories.svelte.d.ts +0 -27
- package/dist/components/MarkdownDisplay.stories.svelte +0 -38
- package/dist/components/MarkdownDisplay.stories.svelte.d.ts +0 -27
- package/dist/components/Navbar.stories.svelte +0 -58
- package/dist/components/Navbar.stories.svelte.d.ts +0 -27
- package/dist/components/NodeStatusOverlay.stories.svelte +0 -85
- package/dist/components/NodeStatusOverlay.stories.svelte.d.ts +0 -27
- package/dist/components/SchemaForm.stories.svelte +0 -122
- package/dist/components/SchemaForm.stories.svelte.d.ts +0 -27
- package/dist/components/Select.svelte +0 -53
- package/dist/components/Select.svelte.d.ts +0 -15
- package/dist/components/StatusIcon.stories.svelte +0 -60
- package/dist/components/StatusIcon.stories.svelte.d.ts +0 -27
- package/dist/components/StatusLabel.stories.svelte +0 -17
- package/dist/components/StatusLabel.stories.svelte.d.ts +0 -27
- package/dist/components/ThemeToggle.stories.svelte +0 -25
- package/dist/components/ThemeToggle.stories.svelte.d.ts +0 -27
- package/dist/components/console/CommandConsole.stories.svelte +0 -111
- package/dist/components/console/CommandConsole.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormCheckboxGroup.stories.svelte +0 -28
- package/dist/components/form/FormCheckboxGroup.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormFieldWrapper.stories.svelte +0 -53
- package/dist/components/form/FormFieldWrapper.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormNumberField.stories.svelte +0 -36
- package/dist/components/form/FormNumberField.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormRangeField.stories.svelte +0 -31
- package/dist/components/form/FormRangeField.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormSelect.stories.svelte +0 -50
- package/dist/components/form/FormSelect.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormTextField.stories.svelte +0 -30
- package/dist/components/form/FormTextField.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormTextarea.stories.svelte +0 -34
- package/dist/components/form/FormTextarea.stories.svelte.d.ts +0 -27
- package/dist/components/form/FormToggle.stories.svelte +0 -30
- package/dist/components/form/FormToggle.stories.svelte.d.ts +0 -27
- package/dist/components/icons/CommandLineIcon.svelte +0 -15
- package/dist/components/icons/CommandLineIcon.svelte.d.ts +0 -26
- package/dist/components/interrupt/ChoicePrompt.stories.svelte +0 -68
- package/dist/components/interrupt/ChoicePrompt.stories.svelte.d.ts +0 -27
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte +0 -71
- package/dist/components/interrupt/ConfirmationPrompt.stories.svelte.d.ts +0 -27
- package/dist/components/interrupt/ReviewPrompt.stories.svelte +0 -77
- package/dist/components/interrupt/ReviewPrompt.stories.svelte.d.ts +0 -27
- package/dist/components/interrupt/TextInputPrompt.stories.svelte +0 -51
- package/dist/components/interrupt/TextInputPrompt.stories.svelte.d.ts +0 -27
- package/dist/components/nodes/CaptionNode.stories.svelte +0 -65
- package/dist/components/nodes/CaptionNode.stories.svelte.d.ts +0 -18
- package/dist/components/nodes/GatewayNode.stories.svelte +0 -108
- package/dist/components/nodes/GatewayNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/IdeaNode.stories.svelte +0 -52
- package/dist/components/nodes/IdeaNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/NotesNode.stories.svelte +0 -76
- package/dist/components/nodes/NotesNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/SimpleNode.stories.svelte +0 -223
- package/dist/components/nodes/SimpleNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/SquareNode.stories.svelte +0 -127
- package/dist/components/nodes/SquareNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/TerminalNode.stories.svelte +0 -25
- package/dist/components/nodes/TerminalNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/ToolNode.stories.svelte +0 -189
- package/dist/components/nodes/ToolNode.stories.svelte.d.ts +0 -26
- package/dist/components/nodes/WorkflowNode.stories.svelte +0 -188
- package/dist/components/nodes/WorkflowNode.stories.svelte.d.ts +0 -26
- package/dist/components/playground/MessageBubble.stories.svelte +0 -151
- package/dist/components/playground/MessageBubble.stories.svelte.d.ts +0 -27
- package/dist/components/toast/WarningIcon.svelte +0 -28
- package/dist/components/toast/WarningIcon.svelte.d.ts +0 -26
- package/dist/mocks/app-environment.d.ts +0 -8
- package/dist/mocks/app-environment.js +0 -16
- package/dist/mocks/app-forms.d.ts +0 -6
- package/dist/mocks/app-forms.js +0 -29
- package/dist/mocks/app-navigation.d.ts +0 -5
- package/dist/mocks/app-navigation.js +0 -36
- package/dist/mocks/app-stores.d.ts +0 -14
- package/dist/mocks/app-stores.js +0 -26
- package/dist/stories/CanvasDecorator.svelte +0 -49
- package/dist/stories/CanvasDecorator.svelte.d.ts +0 -8
- package/dist/stories/EdgeDecorator.svelte +0 -125
- package/dist/stories/EdgeDecorator.svelte.d.ts +0 -17
- package/dist/stories/NodeDecorator.svelte +0 -75
- package/dist/stories/NodeDecorator.svelte.d.ts +0 -8
- package/dist/stories/WebMCPFakeAgent.svelte +0 -229
- package/dist/stories/WebMCPFakeAgent.svelte.d.ts +0 -10
- package/dist/stories/utils.d.ts +0 -93
- package/dist/stories/utils.js +0 -156
- package/dist/webmcp/WebMCP.stories.svelte +0 -101
- package/dist/webmcp/WebMCP.stories.svelte.d.ts +0 -18
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
import {
|
|
9
9
|
SvelteFlow,
|
|
10
10
|
ConnectionLineType,
|
|
11
|
-
Controls,
|
|
12
11
|
Background,
|
|
13
12
|
BackgroundVariant,
|
|
14
13
|
MiniMap,
|
|
15
|
-
type ColorMode
|
|
14
|
+
type ColorMode,
|
|
15
|
+
type OnConnectStart
|
|
16
16
|
} from '@xyflow/svelte';
|
|
17
17
|
import '@xyflow/svelte/dist/style.css';
|
|
18
18
|
import {
|
|
@@ -22,7 +22,15 @@
|
|
|
22
22
|
} from '../stores/settingsStore.svelte.js';
|
|
23
23
|
import type { WorkflowNode as WorkflowNodeType, Workflow, WorkflowEdge } from '../types/index.js';
|
|
24
24
|
import CanvasBanner from './CanvasBanner.svelte';
|
|
25
|
+
import CanvasToolbar from './CanvasToolbar.svelte';
|
|
25
26
|
import CanvasController from './CanvasController.svelte';
|
|
27
|
+
import StraightGuides from './StraightGuides.svelte';
|
|
28
|
+
import { snapToStraight, type StraightGuide } from '../utils/straightWires.js';
|
|
29
|
+
import { createStoreCommandContext } from '../commands/storeIntegration.svelte.js';
|
|
30
|
+
import { executeCommand } from '../commands/executor.js';
|
|
31
|
+
import type { CommandResult, LayoutResultData } from '../commands/types.js';
|
|
32
|
+
import { describeTidy, tweenPositions, TIDY_ANIMATION_MS } from '../editor/tidy.js';
|
|
33
|
+
import CanvasZoomControls from './CanvasZoomControls.svelte';
|
|
26
34
|
import CanvasContextMenu from './CanvasContextMenu.svelte';
|
|
27
35
|
import {
|
|
28
36
|
resolveContextMenuEntries,
|
|
@@ -35,6 +43,7 @@
|
|
|
35
43
|
} from '../editor/contextMenu.js';
|
|
36
44
|
import type { NodeMetadata } from '../types/index.js';
|
|
37
45
|
import { resolveComponentName } from '../utils/nodeTypes.js';
|
|
46
|
+
import { nodeAriaLabel } from '../utils/nodeAriaLabel.js';
|
|
38
47
|
import { decideInlineCommit } from '../utils/captionText.js';
|
|
39
48
|
import FlowDropZone from './FlowDropZone.svelte';
|
|
40
49
|
import EdgeRefresher from './EdgeRefresher.svelte';
|
|
@@ -43,7 +52,8 @@
|
|
|
43
52
|
import type { AuthProvider } from '../types/auth.js';
|
|
44
53
|
import ConnectionLine from './ConnectionLine.svelte';
|
|
45
54
|
import FlowDropEdge from './FlowDropEdge.svelte';
|
|
46
|
-
import
|
|
55
|
+
import LoopbackLanes from './LoopbackLanes.svelte';
|
|
56
|
+
import { getMessages } from '../messages/index.js';
|
|
47
57
|
import { provideInstance } from '../stores/getInstance.svelte.js';
|
|
48
58
|
import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
49
59
|
import type { FlowDropGridVariant } from '../types/theme.js';
|
|
@@ -54,31 +64,67 @@
|
|
|
54
64
|
WorkflowOperationsHelper,
|
|
55
65
|
ConfigurationHelper
|
|
56
66
|
} from '../helpers/workflowEditorHelper.js';
|
|
57
|
-
import type { NodeExecutionInfo } from '../types/index.js';
|
|
58
67
|
import { Toaster } from 'svelte-5-french-toast';
|
|
59
68
|
import {
|
|
60
69
|
flowdropToastOptions,
|
|
61
70
|
FLOWDROP_TOASTER_CLASS,
|
|
62
|
-
apiToasts
|
|
71
|
+
apiToasts,
|
|
72
|
+
showError,
|
|
73
|
+
showInfo,
|
|
74
|
+
showSuccess
|
|
63
75
|
} from '../services/toastService.js';
|
|
64
76
|
import {
|
|
65
77
|
ProximityConnectHelper,
|
|
66
78
|
type ProximityEdgeCandidate
|
|
67
79
|
} from '../helpers/proximityConnect.js';
|
|
68
80
|
import PortCoordinateTracker from './PortCoordinateTracker.svelte';
|
|
81
|
+
import { interfaceTagReserve } from '../utils/interfaceTags.js';
|
|
82
|
+
import ZoomTier from './ZoomTier.svelte';
|
|
83
|
+
import InterfaceTagLayer, { type InterfaceTagEdit } from './InterfaceTagLayer.svelte';
|
|
84
|
+
import type { InterfaceMenuActions, PortTarget } from '../editor/interfaceMenu.js';
|
|
85
|
+
import { buildPortMenuEntries, type PortMenuActions } from '../editor/portMenu.js';
|
|
86
|
+
import {
|
|
87
|
+
buildConnectEdge,
|
|
88
|
+
connectPickerGroups,
|
|
89
|
+
listConnectCandidates,
|
|
90
|
+
type ConnectCandidate
|
|
91
|
+
} from '../editor/connectCandidates.js';
|
|
92
|
+
import ConnectPortPicker from './ConnectPortPicker.svelte';
|
|
93
|
+
import {
|
|
94
|
+
applyPortExposure,
|
|
95
|
+
exposureCandidates,
|
|
96
|
+
type PortExposureMode
|
|
97
|
+
} from '../utils/portExposure.js';
|
|
98
|
+
import {
|
|
99
|
+
entryAtPort,
|
|
100
|
+
exposePortAsEntry,
|
|
101
|
+
removeInterfaceEntry,
|
|
102
|
+
renameInterfaceEntry
|
|
103
|
+
} from '../utils/interfaceTags.js';
|
|
104
|
+
import { extractDirection, extractPortId } from '../utils/handleIds.js';
|
|
69
105
|
import { logger } from '../utils/logger.js';
|
|
70
106
|
import { validateWorkflowData } from '../utils/validation.js';
|
|
71
107
|
import { suppressPortDragSelection } from '../utils/canvasSelection.js';
|
|
108
|
+
import {
|
|
109
|
+
MINIMAP_WIDTH,
|
|
110
|
+
MINIMAP_HEIGHT,
|
|
111
|
+
MINIMAP_BORDER,
|
|
112
|
+
shouldShowMinimap
|
|
113
|
+
} from '../utils/minimapVisibility.js';
|
|
72
114
|
import { createEditorStateMachine } from '../stores/editorStateMachine.svelte.js';
|
|
73
|
-
import CanvasIconButton from './CanvasIconButton.svelte';
|
|
74
|
-
import CommandLineIcon from './icons/CommandLineIcon.svelte';
|
|
75
115
|
import { DEV } from 'esm-env';
|
|
116
|
+
import { CANVAS_FIT_PADDING } from '../utils/canvasFit.js';
|
|
117
|
+
import { isEventInputConnection } from '../utils/reservedPorts.js';
|
|
76
118
|
|
|
77
119
|
interface Props {
|
|
78
120
|
endpointConfig?: EndpointConfig;
|
|
79
121
|
/** Auth provider applied to this instance's API requests. */
|
|
80
122
|
authProvider?: AuthProvider;
|
|
81
123
|
openConfigSidebar?: (node: WorkflowNodeType) => void;
|
|
124
|
+
/** Start the node-swap flow for a node. Omit to leave "Swap node" out of the context menu. */
|
|
125
|
+
onSwapNode?: (nodeId: string) => void;
|
|
126
|
+
/** A node was clicked (not dragged). Test mode opens its inspector sheet from here. */
|
|
127
|
+
onNodeClick?: (node: WorkflowNodeType) => void;
|
|
82
128
|
/**
|
|
83
129
|
* Editor interaction mode. `'edit'` allows node drag/connect/select and
|
|
84
130
|
* proximity-connect; `'readonly'` and `'locked'` disable all canvas
|
|
@@ -95,11 +141,22 @@
|
|
|
95
141
|
* arrivals down to the canvas without owning a separate status channel.
|
|
96
142
|
*/
|
|
97
143
|
refreshTrigger?: number;
|
|
98
|
-
|
|
144
|
+
/**
|
|
145
|
+
* @deprecated No effect. The console is a bottom strip driven by the `ui.consoleOpen`
|
|
146
|
+
* setting; the toolbar toggle these three props fed is gone. Accepted so 2.11.0 hosts
|
|
147
|
+
* keep compiling. Removed in 3.0; use `updateSettings({ ui: { consoleOpen } })`.
|
|
148
|
+
*/
|
|
99
149
|
consoleOpen?: boolean;
|
|
150
|
+
/** @deprecated No effect (see `consoleOpen`). Removed in 3.0. */
|
|
100
151
|
onToggleConsole?: () => void;
|
|
101
|
-
/**
|
|
152
|
+
/** @deprecated No effect (see `consoleOpen`). Removed in 3.0. */
|
|
102
153
|
consoleToggleLabel?: string;
|
|
154
|
+
/** Take a failed run on the run pill to the Assistant. */
|
|
155
|
+
onAskAssistant?: (runId: string) => void;
|
|
156
|
+
/** Offer the Runs list in Test mode (the canvas toolbar's "Runs"). @default false */
|
|
157
|
+
showRuns?: boolean;
|
|
158
|
+
/** Host URL templates for the Runs list's admin links (`features.adminLinks`). */
|
|
159
|
+
adminLinks?: { runs?: string; run?: string };
|
|
103
160
|
/** Per-instance state container (created by mount functions). Defaults to the page-default instance. */
|
|
104
161
|
instance?: FlowDropInstance;
|
|
105
162
|
/**
|
|
@@ -125,8 +182,31 @@
|
|
|
125
182
|
* The menu only opens in `'edit'` mode.
|
|
126
183
|
*/
|
|
127
184
|
contextMenu?: ContextMenuOptions;
|
|
185
|
+
/**
|
|
186
|
+
* Show the run pill in the canvas toolbar while a run exists (a Console
|
|
187
|
+
* `session run`, an Assistant run). It appears only for an editable
|
|
188
|
+
* canvas and never at rest. In Test mode it shows only while the run is
|
|
189
|
+
* live. Hosts that show runs another way set `false`.
|
|
190
|
+
* @default true
|
|
191
|
+
*/
|
|
192
|
+
showRunBar?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Take the person to the run in Test mode: the run pill's Open button, shown
|
|
195
|
+
* while a run waits for them. Without it the button is not shown.
|
|
196
|
+
*/
|
|
197
|
+
onOpenTest?: () => void;
|
|
198
|
+
/** Current editor mode, shown in the canvas toolbar's Edit | Test switch. @default 'edit' */
|
|
199
|
+
editorMode?: 'edit' | 'test';
|
|
200
|
+
/** Switch the editor mode. The toolbar's Edit | Test switch is shown only when this is set. */
|
|
201
|
+
onEditorModeChange?: (mode: 'edit' | 'test') => void;
|
|
202
|
+
/**
|
|
203
|
+
* How much of the canvas's right side an open sheet covers, in px, read when
|
|
204
|
+
* the view is fitted so the graph lands in the visible part. @default 0
|
|
205
|
+
*/
|
|
206
|
+
fitInset?: () => number;
|
|
128
207
|
}
|
|
129
208
|
|
|
209
|
+
// eslint-disable-next-line svelte/no-unused-props -- `consoleOpen`, `onToggleConsole` and `consoleToggleLabel` are deprecated no-ops kept for hosts
|
|
130
210
|
let props: Props = $props();
|
|
131
211
|
|
|
132
212
|
// Resolve (and provide to children) the per-instance state container.
|
|
@@ -198,9 +278,10 @@
|
|
|
198
278
|
let flowNodes = $state.raw<WorkflowNodeType[]>([]);
|
|
199
279
|
let flowEdges = $state.raw<WorkflowEdge[]>([]);
|
|
200
280
|
|
|
201
|
-
//
|
|
202
|
-
|
|
203
|
-
|
|
281
|
+
// Run status loading. The status itself lives in fd.playground.nodeStatuses
|
|
282
|
+
// (never on the nodes); the editor only decides when to ask fd.runs to load it.
|
|
283
|
+
/** Cancels the scheduled (not yet started) execution-info load, if any. */
|
|
284
|
+
let cancelScheduledExecutionInfo: (() => void) | null = null;
|
|
204
285
|
|
|
205
286
|
/**
|
|
206
287
|
* Key for SvelteFlow component — changes when workflow ID changes.
|
|
@@ -231,8 +312,16 @@
|
|
|
231
312
|
// ---------------------------------------------------------------------------
|
|
232
313
|
/** Add the callbacks every node component can call: open config, commit an in-place edit. */
|
|
233
314
|
function withNodeCallbacks(node: WorkflowNodeType) {
|
|
315
|
+
// Accessible name for xyflow's focusable node wrapper (the inner node
|
|
316
|
+
// components are role-less, so they cannot carry one).
|
|
317
|
+
const title =
|
|
318
|
+
(node.data.config?.instanceTitle as string) || node.data.label || node.data.metadata?.name;
|
|
319
|
+
const componentName = node.data.metadata
|
|
320
|
+
? resolveComponentName(fd.nodes, node.data.metadata, node.data.config?.nodeType as string)
|
|
321
|
+
: 'workflowNode';
|
|
234
322
|
return {
|
|
235
323
|
...node,
|
|
324
|
+
ariaLabel: nodeAriaLabel(getMsgs().nodes.graph, componentName, title ?? node.id),
|
|
236
325
|
data: {
|
|
237
326
|
...node.data,
|
|
238
327
|
onConfigOpen: props.openConfigSidebar,
|
|
@@ -254,6 +343,7 @@
|
|
|
254
343
|
// Helper: sync current flowNodes/flowEdges back to the global store
|
|
255
344
|
// ---------------------------------------------------------------------------
|
|
256
345
|
function syncFlowToStore(): void {
|
|
346
|
+
finishTidyAnimation();
|
|
257
347
|
const storeValue = untrack(() => fd.workflow.current);
|
|
258
348
|
if (!storeValue) return;
|
|
259
349
|
const updatedWorkflow = WorkflowOperationsHelper.updateWorkflow(
|
|
@@ -289,6 +379,9 @@
|
|
|
289
379
|
|
|
290
380
|
const isNewWorkflow = storeValue.id !== previousSyncedWorkflowId;
|
|
291
381
|
|
|
382
|
+
// A different workflow never inherits the previous one's run status.
|
|
383
|
+
if (isNewWorkflow) untrack(() => fd.runs.clearNodeStatuses());
|
|
384
|
+
|
|
292
385
|
if (isNewWorkflow) {
|
|
293
386
|
untrack(() =>
|
|
294
387
|
machine.send(previousSyncedWorkflowId ? 'WORKFLOW_SWITCHED' : 'WORKFLOW_LOADED')
|
|
@@ -297,12 +390,26 @@
|
|
|
297
390
|
|
|
298
391
|
// Derive flowNodes/flowEdges from store
|
|
299
392
|
const derived = buildFlowNodesFromStore(storeValue);
|
|
300
|
-
|
|
393
|
+
// The canvas owns selection. The store only holds the flags of its last
|
|
394
|
+
// structural sync, so rebuilding from it (any config edit) must not bring a
|
|
395
|
+
// stale selection back: two nodes would show the ring while the inspector
|
|
396
|
+
// names one. Nodes the canvas has not seen yet keep the store's flag.
|
|
397
|
+
const canvasSelection = isNewWorkflow
|
|
398
|
+
? null
|
|
399
|
+
: untrack(() => new Map(flowNodes.map((n) => [n.id, !!n.selected])));
|
|
400
|
+
flowNodes = canvasSelection
|
|
401
|
+
? derived.nodes.map((n) => {
|
|
402
|
+
const selected = canvasSelection.get(n.id);
|
|
403
|
+
return selected === undefined || selected === !!n.selected ? n : { ...n, selected };
|
|
404
|
+
})
|
|
405
|
+
: derived.nodes;
|
|
301
406
|
flowEdges = derived.edges;
|
|
302
407
|
previousSyncedWorkflowId = storeValue.id;
|
|
303
408
|
|
|
304
|
-
// Trigger port coordinate rebuild after workflow load
|
|
305
|
-
|
|
409
|
+
// Trigger port coordinate rebuild after workflow load. Untracked: the
|
|
410
|
+
// setting must not re-run this effect, or any settings change (even the
|
|
411
|
+
// theme) would rebuild flowNodes from the store.
|
|
412
|
+
if (untrack(() => getEditorSettings().proximityConnect)) {
|
|
306
413
|
portCoordRebuildTrigger = Date.now();
|
|
307
414
|
}
|
|
308
415
|
|
|
@@ -314,6 +421,11 @@
|
|
|
314
421
|
// ---------------------------------------------------------------------------
|
|
315
422
|
// Execution info effect (separate — async, depends on workflow + pipeline ID)
|
|
316
423
|
// ---------------------------------------------------------------------------
|
|
424
|
+
/** Forget the loaded run status (and any load still in flight). */
|
|
425
|
+
function resetExecutionInfo(): void {
|
|
426
|
+
untrack(() => fd.runs.clearNodeStatuses());
|
|
427
|
+
}
|
|
428
|
+
|
|
317
429
|
let previousExecWorkflowId: string | null = null;
|
|
318
430
|
let previousExecPipelineId: string | undefined = undefined;
|
|
319
431
|
|
|
@@ -321,7 +433,13 @@
|
|
|
321
433
|
const storeValue = fd.workflow.current;
|
|
322
434
|
const pipelineId = props.pipelineId;
|
|
323
435
|
|
|
324
|
-
if (!storeValue || !pipelineId)
|
|
436
|
+
if (!storeValue || !pipelineId) {
|
|
437
|
+
// Nothing to show a run for: forget the previous run entirely.
|
|
438
|
+
resetExecutionInfo();
|
|
439
|
+
previousExecWorkflowId = null;
|
|
440
|
+
previousExecPipelineId = undefined;
|
|
441
|
+
return;
|
|
442
|
+
}
|
|
325
443
|
|
|
326
444
|
const workflowChanged = storeValue.id !== previousExecWorkflowId;
|
|
327
445
|
const pipelineChanged = pipelineId !== previousExecPipelineId;
|
|
@@ -331,31 +449,34 @@
|
|
|
331
449
|
previousExecWorkflowId = storeValue.id;
|
|
332
450
|
previousExecPipelineId = pipelineId;
|
|
333
451
|
|
|
334
|
-
// Cancel any pending
|
|
335
|
-
//
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
loadExecutionInfoTimeout = null;
|
|
339
|
-
}
|
|
452
|
+
// Cancel any pending schedule and any in-flight fetch (it belongs to the
|
|
453
|
+
// previous pipeline), and drop the previous run's status.
|
|
454
|
+
cancelScheduledExecutionInfo?.();
|
|
455
|
+
resetExecutionInfo();
|
|
340
456
|
|
|
341
457
|
// Schedule loading with requestIdleCallback (falls back to setTimeout)
|
|
342
458
|
if (typeof requestIdleCallback !== 'undefined') {
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
loadNodeExecutionInfo();
|
|
346
|
-
},
|
|
347
|
-
{ timeout: 500 }
|
|
348
|
-
) as unknown as number;
|
|
459
|
+
const id = requestIdleCallback(() => loadNodeExecutionInfo(), { timeout: 500 });
|
|
460
|
+
cancelScheduledExecutionInfo = () => cancelIdleCallback(id);
|
|
349
461
|
} else {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
}, 300) as unknown as number;
|
|
462
|
+
const id = setTimeout(() => loadNodeExecutionInfo(), 300);
|
|
463
|
+
cancelScheduledExecutionInfo = () => clearTimeout(id);
|
|
353
464
|
}
|
|
354
465
|
});
|
|
355
466
|
|
|
467
|
+
// On unmount: drop a scheduled load and discard an in-flight one, so
|
|
468
|
+
// nothing writes the store after the editor is gone.
|
|
469
|
+
$effect(() => () => {
|
|
470
|
+
cancelScheduledExecutionInfo?.();
|
|
471
|
+
fd.runs.clearNodeStatuses();
|
|
472
|
+
});
|
|
473
|
+
|
|
356
474
|
// Re-fetch node execution info when the parent bumps refreshTrigger
|
|
357
475
|
// (poll ticks, chat-message arrivals, manual refresh). loadNodeExecutionInfo()
|
|
358
|
-
// is the single
|
|
476
|
+
// is the single loader of run status: fd.runs puts the result in
|
|
477
|
+
// fd.playground.nodeStatuses, which the node overlay reads. Nothing is
|
|
478
|
+
// written onto flowNodes, so a rebuild from the store (any edit, a settings
|
|
479
|
+
// change) never drops the badges. No parallel channel.
|
|
359
480
|
// svelte-ignore state_referenced_locally
|
|
360
481
|
let _prevExecRefreshTrigger = props.refreshTrigger ?? 0;
|
|
361
482
|
$effect(() => {
|
|
@@ -393,52 +514,14 @@
|
|
|
393
514
|
});
|
|
394
515
|
|
|
395
516
|
/**
|
|
396
|
-
*
|
|
397
|
-
*
|
|
398
|
-
*
|
|
517
|
+
* Ask the run controller to load node status for the shown pipeline.
|
|
518
|
+
* A newer call (pipelineId change, refreshTrigger bump) supersedes an
|
|
519
|
+
* in-flight one, so they can't race.
|
|
399
520
|
*/
|
|
400
521
|
async function loadNodeExecutionInfo(): Promise<void> {
|
|
401
522
|
const workflow = untrack(() => fd.workflow.current);
|
|
402
523
|
if (!workflow?.nodes || !props.pipelineId) return;
|
|
403
|
-
|
|
404
|
-
if (executionInfoAbortController) {
|
|
405
|
-
executionInfoAbortController.abort();
|
|
406
|
-
}
|
|
407
|
-
const controller = new AbortController();
|
|
408
|
-
executionInfoAbortController = controller;
|
|
409
|
-
|
|
410
|
-
try {
|
|
411
|
-
const executionInfo = await NodeOperationsHelper.loadNodeExecutionInfo(
|
|
412
|
-
fd.api,
|
|
413
|
-
workflow,
|
|
414
|
-
props.pipelineId
|
|
415
|
-
);
|
|
416
|
-
|
|
417
|
-
if (controller.signal.aborted) return;
|
|
418
|
-
|
|
419
|
-
const defaultExecutionInfo: NodeExecutionInfo = {
|
|
420
|
-
status: 'idle' as const,
|
|
421
|
-
executionCount: 0,
|
|
422
|
-
isExecuting: false
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
// Update flowNodes with execution info (visual-only, no store sync needed)
|
|
426
|
-
flowNodes = flowNodes.map((node) => ({
|
|
427
|
-
...node,
|
|
428
|
-
data: {
|
|
429
|
-
...node.data,
|
|
430
|
-
executionInfo: executionInfo[node.id] || defaultExecutionInfo
|
|
431
|
-
}
|
|
432
|
-
}));
|
|
433
|
-
|
|
434
|
-
if (executionInfoAbortController === controller) {
|
|
435
|
-
executionInfoAbortController = null;
|
|
436
|
-
}
|
|
437
|
-
} catch (error) {
|
|
438
|
-
if (error instanceof Error && error.name !== 'AbortError') {
|
|
439
|
-
logger.error('Failed to load node execution info:', error);
|
|
440
|
-
}
|
|
441
|
-
}
|
|
524
|
+
await fd.runs.loadNodeStatuses(props.pipelineId, workflow);
|
|
442
525
|
}
|
|
443
526
|
|
|
444
527
|
// The global store should be initialized by the parent App component
|
|
@@ -467,23 +550,73 @@
|
|
|
467
550
|
* position updates. SvelteFlow mutates flowNodes directly via bind:nodes.
|
|
468
551
|
*/
|
|
469
552
|
function handleNodeDragStart(): void {
|
|
553
|
+
finishTidyAnimation();
|
|
470
554
|
machine.send('START_DRAG');
|
|
555
|
+
lastMagnet = null;
|
|
556
|
+
straightGuides = [];
|
|
471
557
|
// Clear any leftover proximity previews
|
|
472
558
|
currentProximityCandidates = [];
|
|
473
559
|
}
|
|
474
560
|
|
|
561
|
+
/** Guide lines along the wires a dragged node has snapped straight. */
|
|
562
|
+
let straightGuides = $state.raw<StraightGuide[]>([]);
|
|
563
|
+
/** The last magnetic shift of the running drag, re-applied at drag stop (xyflow rewrites the raw position then). */
|
|
564
|
+
let lastMagnet: { dy: number; ids: Set<string> } | null = null;
|
|
565
|
+
|
|
566
|
+
/** Move nodes vertically (flow units) in the canvas state. */
|
|
567
|
+
function shiftNodes(ids: ReadonlySet<string>, dy: number): void {
|
|
568
|
+
flowNodes = flowNodes.map((n) =>
|
|
569
|
+
ids.has(n.id) ? { ...n, position: { x: n.position.x, y: n.position.y + dy } } : n
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Magnetic alignment: when a wire from a dragged node is within 10px of
|
|
575
|
+
* straight, shift the dragged node(s) so it is exactly straight and show a
|
|
576
|
+
* guide along it. Alt switches it off. xyflow recomputes the position from
|
|
577
|
+
* the pointer on every move, so the shift never accumulates.
|
|
578
|
+
*/
|
|
579
|
+
function applyMagnet(
|
|
580
|
+
dragged: WorkflowNodeType[],
|
|
581
|
+
event: MouseEvent | TouchEvent | null | undefined
|
|
582
|
+
): void {
|
|
583
|
+
const none = (): void => {
|
|
584
|
+
lastMagnet = null;
|
|
585
|
+
if (straightGuides.length > 0) straightGuides = [];
|
|
586
|
+
};
|
|
587
|
+
if (!canvasEditable || !canvasControllerRef || dragged.length === 0) return none();
|
|
588
|
+
const moving = new Set(dragged.map((n) => n.id));
|
|
589
|
+
const wires = canvasControllerRef.canvasWireEnds(
|
|
590
|
+
ProximityConnectHelper.removePreviewEdges(flowEdges)
|
|
591
|
+
);
|
|
592
|
+
const positions = new Map(flowNodes.map((n) => [n.id, n.position]));
|
|
593
|
+
for (const n of dragged) positions.set(n.id, n.position);
|
|
594
|
+
const settings = getEditorSettings();
|
|
595
|
+
const { dy, guides } = snapToStraight(wires, positions, moving, {
|
|
596
|
+
grid: settings.snapToGrid ? settings.gridSize : undefined,
|
|
597
|
+
disabled: !!event && 'altKey' in event && event.altKey
|
|
598
|
+
});
|
|
599
|
+
if (dy === 0 && guides.length === 0) return none();
|
|
600
|
+
lastMagnet = { dy, ids: moving };
|
|
601
|
+
if (dy !== 0) shiftNodes(moving, dy);
|
|
602
|
+
straightGuides = guides;
|
|
603
|
+
}
|
|
604
|
+
|
|
475
605
|
/**
|
|
476
606
|
* Handle node drag - compute proximity connect preview edges
|
|
477
607
|
* Called continuously during drag if proximity connect is enabled.
|
|
478
608
|
* Uses port-to-port distance via the port coordinate store.
|
|
479
609
|
*/
|
|
480
610
|
function handleNodeDrag({
|
|
481
|
-
targetNode
|
|
611
|
+
targetNode,
|
|
612
|
+
nodes: draggedNodes,
|
|
613
|
+
event
|
|
482
614
|
}: {
|
|
483
615
|
targetNode: WorkflowNodeType | null;
|
|
484
616
|
nodes: WorkflowNodeType[];
|
|
485
617
|
event: MouseEvent | TouchEvent;
|
|
486
618
|
}): void {
|
|
619
|
+
applyMagnet(draggedNodes, event);
|
|
487
620
|
if (!getEditorSettings().proximityConnect || !targetNode || !canvasEditable) {
|
|
488
621
|
if (currentProximityCandidates.length > 0) {
|
|
489
622
|
flowEdges = ProximityConnectHelper.removePreviewEdges(flowEdges);
|
|
@@ -535,6 +668,11 @@
|
|
|
535
668
|
function handleNodeDragStop(): void {
|
|
536
669
|
portCoordNodeToUpdate = null;
|
|
537
670
|
|
|
671
|
+
// xyflow wrote the raw pointer position back at drag end: put the snap back.
|
|
672
|
+
if (lastMagnet && lastMagnet.dy !== 0) shiftNodes(lastMagnet.ids, lastMagnet.dy);
|
|
673
|
+
lastMagnet = null;
|
|
674
|
+
straightGuides = [];
|
|
675
|
+
|
|
538
676
|
// Finalize proximity connect if there are candidates
|
|
539
677
|
if (getEditorSettings().proximityConnect && currentProximityCandidates.length > 0) {
|
|
540
678
|
const baseEdges = ProximityConnectHelper.removePreviewEdges(flowEdges);
|
|
@@ -567,6 +705,27 @@
|
|
|
567
705
|
machine.send('STOP_DRAG');
|
|
568
706
|
}
|
|
569
707
|
|
|
708
|
+
/**
|
|
709
|
+
* A wire is dragged out of a port: record its type so every card can light
|
|
710
|
+
* the ports that take it. NodeCard puts the port's data type on the handle.
|
|
711
|
+
*/
|
|
712
|
+
const handleConnectStart: OnConnectStart = (event, { nodeId, handleId, handleType }) => {
|
|
713
|
+
const handle =
|
|
714
|
+
event.target instanceof Element ? event.target.closest('.svelte-flow__handle') : null;
|
|
715
|
+
const dataType = handle instanceof HTMLElement ? handle.dataset.fdPortType : undefined;
|
|
716
|
+
const portId = extractPortId(handleId ?? undefined);
|
|
717
|
+
if (!nodeId || !portId || !handleType || !dataType) {
|
|
718
|
+
fd.connectDrag.set(null);
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
fd.connectDrag.set({
|
|
722
|
+
nodeId,
|
|
723
|
+
direction: handleType === 'source' ? 'output' : 'input',
|
|
724
|
+
portId,
|
|
725
|
+
dataType
|
|
726
|
+
});
|
|
727
|
+
};
|
|
728
|
+
|
|
570
729
|
/**
|
|
571
730
|
* Handle new connections between nodes.
|
|
572
731
|
* The connection details aren't needed — SvelteFlow auto-creates the edge
|
|
@@ -765,6 +924,50 @@
|
|
|
765
924
|
let openMenu = $state.raw<OpenContextMenu | null>(null);
|
|
766
925
|
let canvasEl: HTMLDivElement | undefined = $state();
|
|
767
926
|
|
|
927
|
+
// Canvas width, tracked on the canvas element (not the window): the editor can
|
|
928
|
+
// sit in a narrow column of a wider page. Drives the minimap's 800 px rule.
|
|
929
|
+
let canvasWidth: number | undefined = $state();
|
|
930
|
+
$effect(() => {
|
|
931
|
+
if (!canvasEl) return;
|
|
932
|
+
const el = canvasEl;
|
|
933
|
+
canvasWidth = el.clientWidth;
|
|
934
|
+
const observer = new ResizeObserver((entries) => {
|
|
935
|
+
const entry = entries[entries.length - 1];
|
|
936
|
+
if (entry) canvasWidth = entry.contentRect.width;
|
|
937
|
+
});
|
|
938
|
+
observer.observe(el);
|
|
939
|
+
return () => observer.disconnect();
|
|
940
|
+
});
|
|
941
|
+
|
|
942
|
+
// A message link's node lights up here, and the node under the pointer
|
|
943
|
+
// lights its messages (fd.highlight). A class on xyflow's own node wrapper,
|
|
944
|
+
// so every node type gets it without knowing about it.
|
|
945
|
+
const LINKED_CLASS = 'fd-node-linked';
|
|
946
|
+
$effect(() => {
|
|
947
|
+
const id = fd.highlight.canvasNodeId;
|
|
948
|
+
// Re-run when nodes are (re)rendered so a node that mounts later is lit too.
|
|
949
|
+
void flowNodes;
|
|
950
|
+
if (!id || !canvasEl) return;
|
|
951
|
+
const el = canvasEl.querySelector<HTMLElement>(
|
|
952
|
+
`.svelte-flow__node[data-id="${CSS.escape(id)}"]`
|
|
953
|
+
);
|
|
954
|
+
el?.classList.add(LINKED_CLASS);
|
|
955
|
+
return () => el?.classList.remove(LINKED_CLASS);
|
|
956
|
+
});
|
|
957
|
+
|
|
958
|
+
function nodeIdAt(target: EventTarget | null): string | null {
|
|
959
|
+
const el = (target as Element | null)?.closest?.('.svelte-flow__node');
|
|
960
|
+
return el?.getAttribute('data-id') ?? null;
|
|
961
|
+
}
|
|
962
|
+
function handleCanvasOver(event: MouseEvent): void {
|
|
963
|
+
const id = nodeIdAt(event.target);
|
|
964
|
+
if (id !== null) fd.highlight.hoverNode(id);
|
|
965
|
+
}
|
|
966
|
+
function handleCanvasOut(event: MouseEvent): void {
|
|
967
|
+
const leaving = nodeIdAt(event.target);
|
|
968
|
+
if (leaving !== null && nodeIdAt(event.relatedTarget) !== leaving) fd.highlight.hoverNode(null);
|
|
969
|
+
}
|
|
970
|
+
|
|
768
971
|
/** Whether a node's registered component edits its text in place (the caption). */
|
|
769
972
|
function nodeEditsInPlace(node: WorkflowNodeType): boolean {
|
|
770
973
|
return (
|
|
@@ -853,9 +1056,236 @@
|
|
|
853
1056
|
},
|
|
854
1057
|
editInPlace(id) {
|
|
855
1058
|
fd.inlineEdit.request(id);
|
|
1059
|
+
},
|
|
1060
|
+
duplicateNode(id) {
|
|
1061
|
+
const source = flowNodes.find((n) => n.id === id);
|
|
1062
|
+
if (!source?.data.metadata) return;
|
|
1063
|
+
const grid = getEditorSettings().gridSize;
|
|
1064
|
+
const offset = grid * 2;
|
|
1065
|
+
// The same path as a sidebar drop, so the id, history entry and sync all apply.
|
|
1066
|
+
placeNode(
|
|
1067
|
+
JSON.stringify({
|
|
1068
|
+
type: 'node',
|
|
1069
|
+
nodeData: {
|
|
1070
|
+
label: source.data.label,
|
|
1071
|
+
config: structuredClone($state.snapshot(source.data.config ?? {})),
|
|
1072
|
+
metadata: source.data.metadata
|
|
1073
|
+
}
|
|
1074
|
+
}),
|
|
1075
|
+
{ x: source.position.x + offset, y: source.position.y + offset }
|
|
1076
|
+
);
|
|
1077
|
+
},
|
|
1078
|
+
tidyLayout() {
|
|
1079
|
+
tidyLayout();
|
|
1080
|
+
},
|
|
1081
|
+
tidyNodes(ids) {
|
|
1082
|
+
tidyNodes(ids);
|
|
1083
|
+
},
|
|
1084
|
+
hideUnconnectedPorts(ids) {
|
|
1085
|
+
changePortExposure(ids, 'hide');
|
|
1086
|
+
},
|
|
1087
|
+
countUnconnectedPorts(ids) {
|
|
1088
|
+
return countExposureChanges(ids, 'hide');
|
|
1089
|
+
},
|
|
1090
|
+
showHiddenPorts(ids) {
|
|
1091
|
+
changePortExposure(ids, 'show');
|
|
1092
|
+
},
|
|
1093
|
+
countHiddenPorts(ids) {
|
|
1094
|
+
return countExposureChanges(ids, 'show');
|
|
1095
|
+
},
|
|
1096
|
+
get swapNode() {
|
|
1097
|
+
const swap = props.onSwapNode;
|
|
1098
|
+
return swap ? (id: string) => swap(id) : undefined;
|
|
856
1099
|
}
|
|
857
1100
|
};
|
|
858
1101
|
|
|
1102
|
+
// ---------------------------------------------------------------------------
|
|
1103
|
+
// "Tidy up": the layout commands from the canvas button, the menus and the keys
|
|
1104
|
+
// ---------------------------------------------------------------------------
|
|
1105
|
+
|
|
1106
|
+
/** A command context on this instance, for the layout commands. Null without a workflow. */
|
|
1107
|
+
function layoutContext() {
|
|
1108
|
+
return createStoreCommandContext(fd.nodeTypes.current ?? [], undefined, fd);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
/** The layout counts of a layout command's result, if it has them. */
|
|
1112
|
+
function layoutData(result: CommandResult): LayoutResultData | undefined {
|
|
1113
|
+
return result.ok && result.data && 'changed' in result.data ? result.data : undefined;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
/** Tidy the whole graph (`layout beautify`): one undo step, or "already tidy" and nothing moves. */
|
|
1117
|
+
function tidyLayout(): void {
|
|
1118
|
+
if (!canvasEditable) return;
|
|
1119
|
+
const context = layoutContext();
|
|
1120
|
+
if (!context || flowNodes.length === 0) return;
|
|
1121
|
+
const from = positionsOf(flowNodes);
|
|
1122
|
+
const result = executeCommand({ type: 'beautify_layout' }, context);
|
|
1123
|
+
// A refusal (too many nodes) is not "already tidy": say what it is.
|
|
1124
|
+
if (!result.ok) {
|
|
1125
|
+
showError({
|
|
1126
|
+
title: result.code === 'TOO_LARGE' ? getMsgs().tidy.tooLarge : getMsgs().tidy.button,
|
|
1127
|
+
body: result.error
|
|
1128
|
+
});
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
announceTidy(layoutData(result), from, getMsgs().tidy.alreadyTidy);
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
/**
|
|
1135
|
+
* Tidy these nodes one after another (`layout node beautify`). One node is one command; several
|
|
1136
|
+
* are one transaction, so one undo step, and none at all when nothing moved.
|
|
1137
|
+
*/
|
|
1138
|
+
function tidyNodes(ids: readonly string[]): void {
|
|
1139
|
+
if (!canvasEditable || ids.length === 0) return;
|
|
1140
|
+
const msgs = getMsgs().tidy;
|
|
1141
|
+
const already = ids.length > 1 ? msgs.nodesAlreadyTidy : msgs.nodeAlreadyTidy;
|
|
1142
|
+
const context = layoutContext();
|
|
1143
|
+
if (!context) return;
|
|
1144
|
+
const from = positionsOf(flowNodes);
|
|
1145
|
+
const results: CommandResult[] = [];
|
|
1146
|
+
if (ids.length === 1) {
|
|
1147
|
+
// A beautify that changes nothing writes nothing, so it leaves no undo entry.
|
|
1148
|
+
results.push(executeCommand({ type: 'beautify_node', nodeId: ids[0] }, context));
|
|
1149
|
+
} else {
|
|
1150
|
+
context.dispatch.startTransaction(`Tidy ${ids.length} nodes`);
|
|
1151
|
+
for (const nodeId of ids) {
|
|
1152
|
+
const result = executeCommand({ type: 'beautify_node', nodeId }, context);
|
|
1153
|
+
results.push(result);
|
|
1154
|
+
if (!result.ok) break;
|
|
1155
|
+
}
|
|
1156
|
+
const moved = results.every((r) => r.ok) && results.some((r) => layoutData(r)?.changed);
|
|
1157
|
+
if (moved) context.dispatch.commitTransaction();
|
|
1158
|
+
else context.dispatch.cancelTransaction();
|
|
1159
|
+
}
|
|
1160
|
+
const steps = results.map(layoutData).filter((d): d is LayoutResultData => !!d);
|
|
1161
|
+
const data: LayoutResultData | undefined = steps.length
|
|
1162
|
+
? {
|
|
1163
|
+
changed: steps.some((d) => d.changed),
|
|
1164
|
+
before: steps[0].before,
|
|
1165
|
+
after: steps[steps.length - 1].after
|
|
1166
|
+
}
|
|
1167
|
+
: undefined;
|
|
1168
|
+
announceTidy(data, from, already);
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
function positionsOf(nodes: readonly WorkflowNodeType[]): Map<string, { x: number; y: number }> {
|
|
1172
|
+
return new Map(nodes.map((n) => [n.id, { x: n.position.x, y: n.position.y }]));
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
/** The toast after a tidy, and the cards sliding from where they were. */
|
|
1176
|
+
function announceTidy(
|
|
1177
|
+
data: LayoutResultData | undefined,
|
|
1178
|
+
from: Map<string, { x: number; y: number }>,
|
|
1179
|
+
alreadyTidy: string
|
|
1180
|
+
): void {
|
|
1181
|
+
const msgs = getMsgs().tidy;
|
|
1182
|
+
if (!data?.changed) {
|
|
1183
|
+
showInfo({ title: alreadyTidy, body: msgs.alreadyTidyBody });
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
const parts = describeTidy(data, msgs);
|
|
1187
|
+
showSuccess({
|
|
1188
|
+
title: msgs.done,
|
|
1189
|
+
...(parts.length ? { body: parts.join(' · ') } : {}),
|
|
1190
|
+
action: { label: msgs.undo, onClick: () => fd.historyBindings.undo() }
|
|
1191
|
+
});
|
|
1192
|
+
void animateFrom(from);
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
/**
|
|
1196
|
+
* Slide the cards from `from` to where the store now has them. Only the canvas moves: the
|
|
1197
|
+
* store and the history already hold the end state. Stops when the workflow changes again
|
|
1198
|
+
* (an undo, an edit) and skips the slide under reduced motion.
|
|
1199
|
+
*/
|
|
1200
|
+
async function animateFrom(from: Map<string, { x: number; y: number }>): Promise<void> {
|
|
1201
|
+
if (typeof window === 'undefined' || typeof requestAnimationFrame === 'undefined') return;
|
|
1202
|
+
if (window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) return;
|
|
1203
|
+
await tick();
|
|
1204
|
+
const target = fd.workflow.current;
|
|
1205
|
+
const to = positionsOf(flowNodes);
|
|
1206
|
+
if (tweenPositions(from, to, 0).size === 0) return;
|
|
1207
|
+
const tween = { target, to };
|
|
1208
|
+
tidyTween = tween;
|
|
1209
|
+
const start = performance.now();
|
|
1210
|
+
const frame = (now: number) => {
|
|
1211
|
+
if (tidyTween !== tween) return;
|
|
1212
|
+
if (fd.workflow.current !== target) {
|
|
1213
|
+
tidyTween = null;
|
|
1214
|
+
return;
|
|
1215
|
+
}
|
|
1216
|
+
const t = (now - start) / TIDY_ANIMATION_MS;
|
|
1217
|
+
const at = t >= 1 ? to : tweenPositions(from, to, t);
|
|
1218
|
+
flowNodes = flowNodes.map((n) => {
|
|
1219
|
+
const position = at.get(n.id);
|
|
1220
|
+
return position ? { ...n, position } : n;
|
|
1221
|
+
});
|
|
1222
|
+
if (t < 1) requestAnimationFrame(frame);
|
|
1223
|
+
else tidyTween = null;
|
|
1224
|
+
};
|
|
1225
|
+
requestAnimationFrame(frame);
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1228
|
+
/** The running tidy slide, if any: the workflow it belongs to and where the cards end up. */
|
|
1229
|
+
let tidyTween: {
|
|
1230
|
+
target: unknown;
|
|
1231
|
+
to: Map<string, { x: number; y: number }>;
|
|
1232
|
+
} | null = null;
|
|
1233
|
+
|
|
1234
|
+
/**
|
|
1235
|
+
* Stop a running tidy slide and put the cards at its end positions, so a sync to the store
|
|
1236
|
+
* never commits a half-moved card.
|
|
1237
|
+
*/
|
|
1238
|
+
function finishTidyAnimation(): void {
|
|
1239
|
+
const tween = tidyTween;
|
|
1240
|
+
if (!tween) return;
|
|
1241
|
+
tidyTween = null;
|
|
1242
|
+
if (fd.workflow.current !== tween.target) return;
|
|
1243
|
+
flowNodes = flowNodes.map((n) => {
|
|
1244
|
+
const position = tween.to.get(n.id);
|
|
1245
|
+
return position ? { ...n, position } : n;
|
|
1246
|
+
});
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
/** How many ports a bulk exposure change would touch on these nodes. */
|
|
1250
|
+
function countExposureChanges(ids: readonly string[], mode: PortExposureMode): number {
|
|
1251
|
+
const workflow = fd.workflow.current;
|
|
1252
|
+
if (!workflow) return 0;
|
|
1253
|
+
return workflow.nodes
|
|
1254
|
+
.filter((n) => ids.includes(n.id))
|
|
1255
|
+
.reduce((sum, n) => sum + exposureCandidates(n, workflow, mode).length, 0);
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
/**
|
|
1259
|
+
* "Hide unconnected ports" / "Show hidden ports": a real exposure edit of
|
|
1260
|
+
* each node's `config.ports` (the same one the Ports form's eye makes), as
|
|
1261
|
+
* one undo step. Hidden ports leave the canvas and stop being wireable.
|
|
1262
|
+
*/
|
|
1263
|
+
function changePortExposure(ids: readonly string[], mode: PortExposureMode): void {
|
|
1264
|
+
const workflow = fd.workflow.current;
|
|
1265
|
+
if (!canvasEditable || !workflow) return;
|
|
1266
|
+
const changes = new Map<string, ReturnType<typeof applyPortExposure>>();
|
|
1267
|
+
for (const node of workflow.nodes) {
|
|
1268
|
+
if (!ids.includes(node.id)) continue;
|
|
1269
|
+
if (exposureCandidates(node, workflow, mode).length === 0) continue;
|
|
1270
|
+
changes.set(node.id, applyPortExposure(node, workflow, mode));
|
|
1271
|
+
}
|
|
1272
|
+
if (changes.size === 0) return;
|
|
1273
|
+
flowNodes = flowNodes.map((n) => {
|
|
1274
|
+
if (!changes.has(n.id)) return n;
|
|
1275
|
+
const { ports: _previous, ...rest } = n.data.config ?? {};
|
|
1276
|
+
const ports = changes.get(n.id);
|
|
1277
|
+
return { ...n, data: { ...n.data, config: ports ? { ...rest, ports } : rest } };
|
|
1278
|
+
});
|
|
1279
|
+
syncFlowToStore();
|
|
1280
|
+
const storeValue = fd.workflow.current;
|
|
1281
|
+
if (storeValue) {
|
|
1282
|
+
fd.workflow.pushHistory(
|
|
1283
|
+
mode === 'hide' ? 'Hide unconnected ports' : 'Show hidden ports',
|
|
1284
|
+
storeValue
|
|
1285
|
+
);
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
|
|
859
1289
|
/**
|
|
860
1290
|
* Snap a flow position to the grid cell it falls in (floor, not round), so
|
|
861
1291
|
* a node added from the menu has its top-left on the cell that was clicked.
|
|
@@ -938,10 +1368,162 @@
|
|
|
938
1368
|
node: WorkflowNodeType;
|
|
939
1369
|
}): void {
|
|
940
1370
|
if (!canvasEditable) return;
|
|
1371
|
+
// A port has its own menu (publish it in the workflow interface).
|
|
1372
|
+
const handle =
|
|
1373
|
+
event.target instanceof Element ? event.target.closest('.svelte-flow__handle') : null;
|
|
1374
|
+
if (handle && showPortMenu(handle as HTMLElement, event.clientX, event.clientY)) {
|
|
1375
|
+
event.preventDefault();
|
|
1376
|
+
return;
|
|
1377
|
+
}
|
|
941
1378
|
event.preventDefault();
|
|
942
1379
|
openNodeMenu(node.id, event.clientX, event.clientY);
|
|
943
1380
|
}
|
|
944
1381
|
|
|
1382
|
+
// ---------------------------------------------------------------------------
|
|
1383
|
+
// Workflow interface: the tags beside published ports
|
|
1384
|
+
// ---------------------------------------------------------------------------
|
|
1385
|
+
|
|
1386
|
+
/** The name being typed beside a port (a new entry, or a rename). */
|
|
1387
|
+
let tagEdit = $state.raw<InterfaceTagEdit | null>(null);
|
|
1388
|
+
|
|
1389
|
+
/** Write an interface edit through the store: one undo step, marks the workflow dirty. */
|
|
1390
|
+
function applyInterfaceEdit(
|
|
1391
|
+
result: ReturnType<typeof exposePortAsEntry> | ReturnType<typeof renameInterfaceEntry>
|
|
1392
|
+
): void {
|
|
1393
|
+
if (!result) return;
|
|
1394
|
+
fd.workflow.editInterface(result.interface, result.edit);
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1397
|
+
const interfaceMenuActions: InterfaceMenuActions = {
|
|
1398
|
+
expose(target: PortTarget) {
|
|
1399
|
+
// The port id is the starting name; the person edits it in the ghost tag.
|
|
1400
|
+
tagEdit = { mode: 'expose', ...target, value: target.portId };
|
|
1401
|
+
},
|
|
1402
|
+
rename(target: PortTarget) {
|
|
1403
|
+
const workflow = fd.workflow.current;
|
|
1404
|
+
const entry =
|
|
1405
|
+
workflow && entryAtPort(workflow, target.nodeId, target.direction, target.portId);
|
|
1406
|
+
if (entry) tagEdit = { mode: 'rename', ...target, entryId: entry.id, value: entry.id };
|
|
1407
|
+
},
|
|
1408
|
+
remove(target: PortTarget) {
|
|
1409
|
+
const workflow = fd.workflow.current;
|
|
1410
|
+
const entry =
|
|
1411
|
+
workflow && entryAtPort(workflow, target.nodeId, target.direction, target.portId);
|
|
1412
|
+
if (workflow && entry)
|
|
1413
|
+
applyInterfaceEdit(removeInterfaceEntry(workflow, target.direction, entry.id));
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1416
|
+
|
|
1417
|
+
function commitTagEdit(): void {
|
|
1418
|
+
const edit = tagEdit;
|
|
1419
|
+
const workflow = fd.workflow.current;
|
|
1420
|
+
tagEdit = null;
|
|
1421
|
+
if (!edit || !workflow) return;
|
|
1422
|
+
applyInterfaceEdit(
|
|
1423
|
+
edit.mode === 'expose'
|
|
1424
|
+
? exposePortAsEntry(workflow, edit, edit.value)
|
|
1425
|
+
: renameInterfaceEntry(workflow, edit.direction, edit.entryId ?? '', edit.value)
|
|
1426
|
+
);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
const portMenuActions: PortMenuActions = {
|
|
1430
|
+
...interfaceMenuActions,
|
|
1431
|
+
connectTo(target: PortTarget) {
|
|
1432
|
+
openConnectPicker(target);
|
|
1433
|
+
}
|
|
1434
|
+
};
|
|
1435
|
+
|
|
1436
|
+
/** The "Connect to…" picker, while open. */
|
|
1437
|
+
interface OpenConnectPicker {
|
|
1438
|
+
target: PortTarget;
|
|
1439
|
+
portName: string;
|
|
1440
|
+
candidates: ReturnType<typeof listConnectCandidates>;
|
|
1441
|
+
/** Viewport (client) position; the picker is in the top layer. */
|
|
1442
|
+
x: number;
|
|
1443
|
+
y: number;
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
let connectPicker = $state.raw<OpenConnectPicker | null>(null);
|
|
1447
|
+
/** Where the port menu was opened, which is where its picker opens. */
|
|
1448
|
+
let portMenuAt: { x: number; y: number } | null = null;
|
|
1449
|
+
|
|
1450
|
+
function openConnectPicker(target: PortTarget): void {
|
|
1451
|
+
const workflow = fd.workflow.current;
|
|
1452
|
+
const at = portMenuAt;
|
|
1453
|
+
if (!workflow || !at) return;
|
|
1454
|
+
const node = flowNodes.find((n) => n.id === target.nodeId);
|
|
1455
|
+
const port = node
|
|
1456
|
+
? ProximityConnectHelper.getAllPorts(node, target.direction).find(
|
|
1457
|
+
(p) => p.id === target.portId
|
|
1458
|
+
)
|
|
1459
|
+
: undefined;
|
|
1460
|
+
connectPicker = {
|
|
1461
|
+
target,
|
|
1462
|
+
portName: port?.name ?? target.portId,
|
|
1463
|
+
candidates: listConnectCandidates(workflow, fd.portCompatibility, target),
|
|
1464
|
+
x: at.x,
|
|
1465
|
+
y: at.y
|
|
1466
|
+
};
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
/** A port was picked in "Connect to…": the same edge a drag-connect makes. */
|
|
1470
|
+
function connectToCandidate(candidate: ConnectCandidate): void {
|
|
1471
|
+
const picker = connectPicker;
|
|
1472
|
+
connectPicker = null;
|
|
1473
|
+
if (!picker || !canvasEditable || candidate.connected) return;
|
|
1474
|
+
const edge = buildConnectEdge(picker.target, candidate);
|
|
1475
|
+
const sourceNode = flowNodes.find((n) => n.id === edge.source);
|
|
1476
|
+
const targetNode = flowNodes.find((n) => n.id === edge.target);
|
|
1477
|
+
if (!sourceNode || !targetNode) return;
|
|
1478
|
+
EdgeStylingHelper.applyConnectionStyling(edge, sourceNode, targetNode);
|
|
1479
|
+
flowEdges = [...flowEdges, edge];
|
|
1480
|
+
syncFlowToStore();
|
|
1481
|
+
const storeValue = fd.workflow.current;
|
|
1482
|
+
if (storeValue) fd.workflow.pushHistory('Add connection', storeValue);
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
/** Open the menu of a port (a handle element). False when it has nothing to offer. */
|
|
1486
|
+
function showPortMenu(handle: HTMLElement, clientX: number, clientY: number): boolean {
|
|
1487
|
+
const workflow = fd.workflow.current;
|
|
1488
|
+
const handleId = handle.dataset.handleid;
|
|
1489
|
+
const nodeId = handle.dataset.nodeid;
|
|
1490
|
+
const direction = extractDirection(handleId);
|
|
1491
|
+
const portId = extractPortId(handleId);
|
|
1492
|
+
if (!workflow || !nodeId || !direction || !portId || !canvasControllerRef) return false;
|
|
1493
|
+
return openPortMenuAt({ nodeId, direction, portId }, clientX, clientY);
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
function openPortMenuAt(target: PortTarget, clientX: number, clientY: number): boolean {
|
|
1497
|
+
const workflow = fd.workflow.current;
|
|
1498
|
+
const node = flowNodes.find((n) => n.id === target.nodeId);
|
|
1499
|
+
if (!workflow || !node || !canvasControllerRef) return false;
|
|
1500
|
+
const entries = buildPortMenuEntries(workflow, target, portMenuActions, getMsgs().contextMenu);
|
|
1501
|
+
if (entries.length === 0) return false;
|
|
1502
|
+
portMenuAt = { x: clientX, y: clientY };
|
|
1503
|
+
openMenu = {
|
|
1504
|
+
ctx: {
|
|
1505
|
+
target: 'node',
|
|
1506
|
+
nodes: [node],
|
|
1507
|
+
position: canvasControllerRef.canvasScreenToFlow({ x: clientX, y: clientY }),
|
|
1508
|
+
nodeTypes: fd.nodeTypes.current,
|
|
1509
|
+
actions: contextMenuActions
|
|
1510
|
+
},
|
|
1511
|
+
entries,
|
|
1512
|
+
x: clientX,
|
|
1513
|
+
y: clientY
|
|
1514
|
+
};
|
|
1515
|
+
return true;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
// A name being typed never outlives edit mode, its workflow, or its port (undo).
|
|
1519
|
+
$effect(() => {
|
|
1520
|
+
if (!canvasEditable) tagEdit = null;
|
|
1521
|
+
});
|
|
1522
|
+
$effect(() => {
|
|
1523
|
+
void svelteFlowKey;
|
|
1524
|
+
tagEdit = null;
|
|
1525
|
+
});
|
|
1526
|
+
|
|
945
1527
|
function handleSelectionContextMenu({
|
|
946
1528
|
event,
|
|
947
1529
|
nodes
|
|
@@ -995,11 +1577,15 @@
|
|
|
995
1577
|
|
|
996
1578
|
// Menus never outlive edit mode or the workflow they were opened on.
|
|
997
1579
|
$effect(() => {
|
|
998
|
-
if (!canvasEditable)
|
|
1580
|
+
if (!canvasEditable) {
|
|
1581
|
+
openMenu = null;
|
|
1582
|
+
connectPicker = null;
|
|
1583
|
+
}
|
|
999
1584
|
});
|
|
1000
1585
|
$effect(() => {
|
|
1001
1586
|
void svelteFlowKey;
|
|
1002
1587
|
openMenu = null;
|
|
1588
|
+
connectPicker = null;
|
|
1003
1589
|
pendingNewIds.clear();
|
|
1004
1590
|
fd.inlineEdit.clear();
|
|
1005
1591
|
});
|
|
@@ -1054,6 +1640,18 @@
|
|
|
1054
1640
|
// remounted with the canvas and always talks to the live instance's store.
|
|
1055
1641
|
let canvasControllerRef: CanvasController | undefined = $state();
|
|
1056
1642
|
|
|
1643
|
+
// Let node layout commands (console, assistant, WebMCP) read the canvas's
|
|
1644
|
+
// measurement while the canvas is mounted.
|
|
1645
|
+
$effect(() => {
|
|
1646
|
+
const controller = canvasControllerRef;
|
|
1647
|
+
if (!controller) return;
|
|
1648
|
+
const measure = (nodeId: string) => controller.canvasMeasureNode(nodeId);
|
|
1649
|
+
fd.measureNode = measure;
|
|
1650
|
+
return () => {
|
|
1651
|
+
if (fd.measureNode === measure) fd.measureNode = null;
|
|
1652
|
+
};
|
|
1653
|
+
});
|
|
1654
|
+
|
|
1057
1655
|
/**
|
|
1058
1656
|
* Update a node's data in the local editor state.
|
|
1059
1657
|
* Called by App.svelte AFTER it has already updated the global store via
|
|
@@ -1105,6 +1703,10 @@
|
|
|
1105
1703
|
canvasControllerRef?.canvasFitView();
|
|
1106
1704
|
}
|
|
1107
1705
|
|
|
1706
|
+
export function canvasFocusNode(nodeId: string): void {
|
|
1707
|
+
canvasControllerRef?.canvasFocusNode(nodeId);
|
|
1708
|
+
}
|
|
1709
|
+
|
|
1108
1710
|
export function canvasZoomIn(): void {
|
|
1109
1711
|
canvasControllerRef?.canvasZoomIn();
|
|
1110
1712
|
}
|
|
@@ -1168,6 +1770,40 @@
|
|
|
1168
1770
|
return;
|
|
1169
1771
|
}
|
|
1170
1772
|
|
|
1773
|
+
// Shift+S on the canvas: tidy the selected nodes.
|
|
1774
|
+
if (
|
|
1775
|
+
event.key.toLowerCase() === 's' &&
|
|
1776
|
+
event.shiftKey &&
|
|
1777
|
+
!event.ctrlKey &&
|
|
1778
|
+
!event.metaKey &&
|
|
1779
|
+
!event.altKey &&
|
|
1780
|
+
canvasEditable &&
|
|
1781
|
+
target.closest('.flowdrop-canvas')
|
|
1782
|
+
) {
|
|
1783
|
+
const ids = flowNodes.filter((n) => n.selected).map((n) => n.id);
|
|
1784
|
+
if (ids.length > 0) {
|
|
1785
|
+
event.preventDefault();
|
|
1786
|
+
tidyNodes(ids);
|
|
1787
|
+
}
|
|
1788
|
+
return;
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
// Shift+Alt+T on the canvas, or with nothing focused (a click on the empty canvas leaves the
|
|
1792
|
+
// focus on the body): tidy up the whole graph. By code: Alt changes the key on a Mac.
|
|
1793
|
+
if (
|
|
1794
|
+
event.code === 'KeyT' &&
|
|
1795
|
+
event.shiftKey &&
|
|
1796
|
+
event.altKey &&
|
|
1797
|
+
!event.ctrlKey &&
|
|
1798
|
+
!event.metaKey &&
|
|
1799
|
+
canvasEditable &&
|
|
1800
|
+
(target === document.body || target.closest('.flowdrop-canvas'))
|
|
1801
|
+
) {
|
|
1802
|
+
event.preventDefault();
|
|
1803
|
+
tidyLayout();
|
|
1804
|
+
return;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1171
1807
|
// Check for Ctrl (Windows/Linux) or Cmd (Mac)
|
|
1172
1808
|
const isModifierPressed = event.ctrlKey || event.metaKey;
|
|
1173
1809
|
|
|
@@ -1193,16 +1829,19 @@
|
|
|
1193
1829
|
|
|
1194
1830
|
<svelte:window onkeydown={handleKeydown} />
|
|
1195
1831
|
|
|
1196
|
-
<div class="flowdrop-workflow-editor">
|
|
1832
|
+
<div class="flowdrop-scope flowdrop-workflow-editor">
|
|
1197
1833
|
<!-- Main Editor Area -->
|
|
1198
1834
|
<div class="flowdrop-workflow-editor__main">
|
|
1199
1835
|
<!-- Flow Canvas.
|
|
1200
1836
|
Capture-phase mousedown so dragging from a port never turns into a
|
|
1201
1837
|
WebKit text-selection drag — see suppressPortDragSelection. -->
|
|
1838
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
1202
1839
|
<div
|
|
1203
1840
|
class="flowdrop-canvas"
|
|
1204
1841
|
bind:this={canvasEl}
|
|
1205
1842
|
onmousedowncapture={suppressPortDragSelection}
|
|
1843
|
+
onpointerover={handleCanvasOver}
|
|
1844
|
+
onpointerout={handleCanvasOut}
|
|
1206
1845
|
>
|
|
1207
1846
|
<FlowDropZone
|
|
1208
1847
|
ondrop={handleNodeDrop}
|
|
@@ -1218,8 +1857,20 @@
|
|
|
1218
1857
|
{edgeTypes}
|
|
1219
1858
|
{defaultEdgeOptions}
|
|
1220
1859
|
onconnect={() => void handleConnect()}
|
|
1860
|
+
onconnectstart={handleConnectStart}
|
|
1861
|
+
onconnectend={() => fd.connectDrag.set(null)}
|
|
1862
|
+
isValidConnection={(connection) => !isEventInputConnection(connection, flowNodes)}
|
|
1221
1863
|
onbeforedelete={handleBeforeDelete}
|
|
1222
1864
|
ondelete={handleNodesDelete}
|
|
1865
|
+
onnodeclick={({ node }) => {
|
|
1866
|
+
if (!props.onNodeClick) return;
|
|
1867
|
+
const flowNode = {
|
|
1868
|
+
id: node.id,
|
|
1869
|
+
type: node.data.metadata?.type ?? 'default',
|
|
1870
|
+
data: node.data
|
|
1871
|
+
} as WorkflowNodeType;
|
|
1872
|
+
if (!nodeEditsInPlace(flowNode)) props.onNodeClick(flowNode);
|
|
1873
|
+
}}
|
|
1223
1874
|
onnodedragstart={handleNodeDragStart}
|
|
1224
1875
|
onnodedrag={handleNodeDrag}
|
|
1225
1876
|
onnodedragstop={handleNodeDragStop}
|
|
@@ -1235,7 +1886,7 @@
|
|
|
1235
1886
|
{snapGrid}
|
|
1236
1887
|
{initialViewport}
|
|
1237
1888
|
colorMode={getResolvedTheme() as ColorMode}
|
|
1238
|
-
|
|
1889
|
+
fitViewOptions={{ padding: CANVAS_FIT_PADDING }}
|
|
1239
1890
|
nodesDraggable={canvasEditable}
|
|
1240
1891
|
nodesConnectable={canvasEditable}
|
|
1241
1892
|
elementsSelectable={canvasEditable}
|
|
@@ -1245,26 +1896,53 @@
|
|
|
1245
1896
|
store with an empty one when a SvelteFlow is destroyed, so after
|
|
1246
1897
|
the {#key} remount a helper outside would act on that empty
|
|
1247
1898
|
store (context-menu Delete silently did nothing). -->
|
|
1248
|
-
<
|
|
1899
|
+
<LoopbackLanes nodes={flowNodes} edges={flowEdges} />
|
|
1900
|
+
<CanvasController
|
|
1901
|
+
bind:this={canvasControllerRef}
|
|
1902
|
+
fitOnLoad={getEditorSettings().fitViewOnLoad}
|
|
1903
|
+
fitInset={props.fitInset}
|
|
1904
|
+
tagReserve={() =>
|
|
1905
|
+
fd.workflow.current
|
|
1906
|
+
? interfaceTagReserve(fd.workflow.current)
|
|
1907
|
+
: new Map<string, { left: number; right: number }>()}
|
|
1908
|
+
/>
|
|
1909
|
+
<ZoomTier />
|
|
1910
|
+
<StraightGuides guides={straightGuides} />
|
|
1249
1911
|
<EdgeRefresher {nodeIdToRefresh} onRefreshComplete={handleEdgeRefreshComplete} />
|
|
1250
1912
|
<PortCoordinateTracker
|
|
1251
1913
|
nodeToUpdate={portCoordNodeToUpdate}
|
|
1252
1914
|
rebuildTrigger={portCoordRebuildTrigger}
|
|
1253
1915
|
nodes={flowNodes}
|
|
1254
1916
|
/>
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
{
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1917
|
+
{#if fd.workflow.current}
|
|
1918
|
+
<InterfaceTagLayer
|
|
1919
|
+
workflow={fd.workflow.current}
|
|
1920
|
+
editable={canvasEditable}
|
|
1921
|
+
edit={tagEdit}
|
|
1922
|
+
onedit={(value) => tagEdit && (tagEdit = { ...tagEdit, value })}
|
|
1923
|
+
onsubmit={commitTagEdit}
|
|
1924
|
+
oncancel={() => (tagEdit = null)}
|
|
1925
|
+
onrename={(tag) =>
|
|
1926
|
+
interfaceMenuActions.rename({
|
|
1927
|
+
nodeId: tag.nodeId,
|
|
1928
|
+
direction: tag.direction,
|
|
1929
|
+
portId: tag.portId
|
|
1930
|
+
})}
|
|
1931
|
+
onmenu={(tag, event) =>
|
|
1932
|
+
openPortMenuAt(
|
|
1933
|
+
{ nodeId: tag.nodeId, direction: tag.direction, portId: tag.portId },
|
|
1934
|
+
event.clientX,
|
|
1935
|
+
event.clientY
|
|
1936
|
+
)}
|
|
1937
|
+
/>
|
|
1267
1938
|
{/if}
|
|
1939
|
+
<CanvasZoomControls
|
|
1940
|
+
nodeCount={flowNodes.length}
|
|
1941
|
+
edgeCount={flowEdges.length}
|
|
1942
|
+
{hasCycles}
|
|
1943
|
+
onfit={() => canvasControllerRef?.canvasFitView()}
|
|
1944
|
+
ontidy={canvasEditable ? tidyLayout : undefined}
|
|
1945
|
+
/>
|
|
1268
1946
|
<!-- Always render Background for consistent bg color in dark/light mode -->
|
|
1269
1947
|
<Background
|
|
1270
1948
|
gap={getEditorSettings().gridSize}
|
|
@@ -1275,8 +1953,11 @@
|
|
|
1275
1953
|
? 'var(--fd-grid-pattern-color)'
|
|
1276
1954
|
: 'transparent'}
|
|
1277
1955
|
/>
|
|
1278
|
-
{#if getEditorSettings().showMinimap}
|
|
1279
|
-
<MiniMap
|
|
1956
|
+
{#if shouldShowMinimap(getEditorSettings().showMinimap, canvasWidth)}
|
|
1957
|
+
<MiniMap
|
|
1958
|
+
width={MINIMAP_WIDTH - 2 * MINIMAP_BORDER}
|
|
1959
|
+
height={MINIMAP_HEIGHT - 2 * MINIMAP_BORDER}
|
|
1960
|
+
/>
|
|
1280
1961
|
{/if}
|
|
1281
1962
|
</SvelteFlow>
|
|
1282
1963
|
{/key}
|
|
@@ -1309,6 +1990,18 @@
|
|
|
1309
1990
|
{/if}
|
|
1310
1991
|
</FlowDropZone>
|
|
1311
1992
|
|
|
1993
|
+
{#if canvasEditable}
|
|
1994
|
+
<CanvasToolbar
|
|
1995
|
+
editorMode={props.editorMode}
|
|
1996
|
+
onEditorModeChange={props.onEditorModeChange}
|
|
1997
|
+
onOpenTest={props.onOpenTest}
|
|
1998
|
+
onAskAssistant={props.onAskAssistant}
|
|
1999
|
+
showRun={props.showRunBar ?? true}
|
|
2000
|
+
showRuns={props.showRuns}
|
|
2001
|
+
adminLinks={props.adminLinks}
|
|
2002
|
+
/>
|
|
2003
|
+
{/if}
|
|
2004
|
+
|
|
1312
2005
|
{#if openMenu}
|
|
1313
2006
|
<CanvasContextMenu
|
|
1314
2007
|
entries={openMenu.entries}
|
|
@@ -1318,33 +2011,28 @@
|
|
|
1318
2011
|
onclose={closeContextMenu}
|
|
1319
2012
|
/>
|
|
1320
2013
|
{/if}
|
|
1321
|
-
</div>
|
|
1322
2014
|
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
{
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
>
|
|
1336
|
-
{/if}
|
|
1337
|
-
</div>
|
|
1338
|
-
</div>
|
|
2015
|
+
{#if connectPicker}
|
|
2016
|
+
<ConnectPortPicker
|
|
2017
|
+
portName={connectPicker.portName}
|
|
2018
|
+
fromInput={connectPicker.target.direction === 'input'}
|
|
2019
|
+
groups={connectPickerGroups(connectPicker.candidates, getMsgs().connectTo)}
|
|
2020
|
+
checker={fd.portCompatibility}
|
|
2021
|
+
x={connectPicker.x}
|
|
2022
|
+
y={connectPicker.y}
|
|
2023
|
+
onselect={connectToCandidate}
|
|
2024
|
+
onclose={() => (connectPicker = null)}
|
|
2025
|
+
/>
|
|
2026
|
+
{/if}
|
|
1339
2027
|
</div>
|
|
1340
2028
|
</div>
|
|
1341
2029
|
</div>
|
|
1342
2030
|
|
|
1343
2031
|
<!-- Toast notifications container -->
|
|
1344
2032
|
<!-- aria-live="polite" ensures screen readers announce toast messages without interrupting -->
|
|
1345
|
-
<div aria-live="polite" aria-atomic="true">
|
|
2033
|
+
<div class="flowdrop-scope" aria-live="polite" aria-atomic="true">
|
|
1346
2034
|
<Toaster
|
|
1347
|
-
position="
|
|
2035
|
+
position="top-center"
|
|
1348
2036
|
containerClassName={FLOWDROP_TOASTER_CLASS}
|
|
1349
2037
|
toastOptions={flowdropToastOptions}
|
|
1350
2038
|
/>
|
|
@@ -1366,10 +2054,6 @@
|
|
|
1366
2054
|
transition: margin-left 0.3s ease-in-out;
|
|
1367
2055
|
}
|
|
1368
2056
|
|
|
1369
|
-
.flowdrop-text--error {
|
|
1370
|
-
color: var(--fd-error);
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
2057
|
.flowdrop-canvas {
|
|
1374
2058
|
flex: 1;
|
|
1375
2059
|
min-height: 0;
|
|
@@ -1377,32 +2061,6 @@
|
|
|
1377
2061
|
background: transparent;
|
|
1378
2062
|
}
|
|
1379
2063
|
|
|
1380
|
-
.flowdrop-status-bar {
|
|
1381
|
-
background-color: var(--fd-backdrop);
|
|
1382
|
-
backdrop-filter: var(--fd-backdrop-blur);
|
|
1383
|
-
border-top: 1px solid var(--fd-border);
|
|
1384
|
-
padding: 0.75rem;
|
|
1385
|
-
height: 40px;
|
|
1386
|
-
min-height: 40px;
|
|
1387
|
-
max-height: 40px;
|
|
1388
|
-
display: flex;
|
|
1389
|
-
align-items: center;
|
|
1390
|
-
flex-shrink: 0;
|
|
1391
|
-
}
|
|
1392
|
-
|
|
1393
|
-
.flowdrop-status-bar__content {
|
|
1394
|
-
display: flex;
|
|
1395
|
-
align-items: center;
|
|
1396
|
-
justify-content: space-between;
|
|
1397
|
-
}
|
|
1398
|
-
|
|
1399
|
-
/* Console toggle — placement only; visuals live in CanvasIconButton */
|
|
1400
|
-
:global(.flowdrop-console-toggle) {
|
|
1401
|
-
bottom: 140px;
|
|
1402
|
-
left: 12px;
|
|
1403
|
-
z-index: 5;
|
|
1404
|
-
}
|
|
1405
|
-
|
|
1406
2064
|
:global(.flowdrop-workflow-editor .svelte-flow__node:hover) {
|
|
1407
2065
|
transform: translateY(-2px);
|
|
1408
2066
|
}
|
|
@@ -1426,6 +2084,13 @@
|
|
|
1426
2084
|
stroke-width: 3 !important;
|
|
1427
2085
|
}
|
|
1428
2086
|
|
|
2087
|
+
:global(.flowdrop-workflow-editor .svelte-flow__node.fd-node-linked) {
|
|
2088
|
+
border-radius: var(--fd-radius-lg);
|
|
2089
|
+
outline: 2px solid var(--fd-primary);
|
|
2090
|
+
outline-offset: 3px;
|
|
2091
|
+
box-shadow: 0 0 0 6px color-mix(in srgb, var(--fd-primary) 18%, transparent);
|
|
2092
|
+
}
|
|
2093
|
+
|
|
1429
2094
|
:global(.flowdrop-workflow-editor .svelte-flow__edge.selected) {
|
|
1430
2095
|
stroke: var(--fd-primary) !important;
|
|
1431
2096
|
stroke-width: 3 !important;
|
|
@@ -1514,6 +2179,20 @@
|
|
|
1514
2179
|
stroke-width: 2;
|
|
1515
2180
|
}
|
|
1516
2181
|
|
|
2182
|
+
/* Zoom tiers: wires get thicker as the canvas zooms out, so the topology still
|
|
2183
|
+
reads. Fixed flow px; the canvas scales them. */
|
|
2184
|
+
:global([data-fd-zoom='glyph'] .svelte-flow__edge path.svelte-flow__edge-path) {
|
|
2185
|
+
stroke-width: var(--fd-node-zoom-edge-width-glyph) !important;
|
|
2186
|
+
}
|
|
2187
|
+
|
|
2188
|
+
:global([data-fd-zoom='map'] .svelte-flow__edge path.svelte-flow__edge-path) {
|
|
2189
|
+
stroke-width: var(--fd-node-zoom-edge-width-map) !important;
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2192
|
+
:global([data-fd-zoom='map'] .svelte-flow__edge:not(.selected) path.svelte-flow__edge-path) {
|
|
2193
|
+
stroke: var(--fd-node-zoom-edge-map);
|
|
2194
|
+
}
|
|
2195
|
+
|
|
1517
2196
|
/* Loopback Edge: Dashed gray line for loop iteration connections */
|
|
1518
2197
|
:global(.flowdrop--edge--loopback path.svelte-flow__edge-path) {
|
|
1519
2198
|
stroke: var(--fd-edge-loopback);
|