@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
|
@@ -24,30 +24,29 @@
|
|
|
24
24
|
ConfigSchema,
|
|
25
25
|
WorkflowNode,
|
|
26
26
|
WorkflowEdge,
|
|
27
|
-
NodeUIExtensions,
|
|
28
|
-
NodePort,
|
|
29
|
-
DynamicPort,
|
|
30
27
|
ConfigEditOptions,
|
|
31
28
|
AuthProvider
|
|
32
29
|
} from '../types/index.js';
|
|
33
|
-
import { dynamicPortToNodePort } from '../types/index.js';
|
|
34
30
|
import type { UISchemaElement } from '../types/uischema.js';
|
|
35
|
-
|
|
31
|
+
// Import the light, registry-based field factory and light fields directly
|
|
32
|
+
// (not via the form barrel, which aggregates the heavy CodeMirror editors).
|
|
33
|
+
import FormField from './form/FormFieldLight.svelte';
|
|
36
34
|
import FormUISchemaRenderer from './form/FormUISchemaRenderer.svelte';
|
|
37
|
-
import type { FieldSchema } from './form/
|
|
35
|
+
import type { FieldSchema } from './form/types.js';
|
|
38
36
|
import {
|
|
39
37
|
getEffectiveConfigEditOptions,
|
|
40
38
|
fetchDynamicSchema,
|
|
41
39
|
resolveExternalEditUrl,
|
|
40
|
+
resolveDynamicSchemaKey,
|
|
42
41
|
invalidateSchemaCache,
|
|
43
42
|
type DynamicSchemaResult
|
|
44
43
|
} from '../services/dynamicSchemaService.js';
|
|
45
44
|
import { globalSaveWorkflow } from '../services/globalSave.js';
|
|
45
|
+
import { provideInstance } from '../stores/getInstance.svelte.js';
|
|
46
46
|
import { getAvailableVariables } from '../services/variableService.js';
|
|
47
47
|
import { logger } from '../utils/logger.js';
|
|
48
|
-
import { getDataTypeColorToken, getPortBackgroundColor } from '../utils/colors.js';
|
|
49
|
-
import { applyPortOrder } from '../utils/portUtils.js';
|
|
50
48
|
import { mergeWithDefaults, cascadeClearAutocompleteDependents } from '../utils/formMerge.js';
|
|
49
|
+
import { applyFetchedSchema } from '../utils/schemaMerge.js';
|
|
51
50
|
|
|
52
51
|
interface Props {
|
|
53
52
|
/** Optional workflow node (if provided, schema and values are derived from it) */
|
|
@@ -63,8 +62,6 @@
|
|
|
63
62
|
uiSchema?: UISchemaElement;
|
|
64
63
|
/** Direct config values (used when node is not provided) */
|
|
65
64
|
values?: Record<string, unknown>;
|
|
66
|
-
/** Whether to show UI extension settings section */
|
|
67
|
-
showUIExtensions?: boolean;
|
|
68
65
|
/** Optional workflow ID for context in external links */
|
|
69
66
|
workflowId?: string;
|
|
70
67
|
/** Whether to also save the workflow when saving config */
|
|
@@ -81,10 +78,29 @@
|
|
|
81
78
|
workflowEdges?: WorkflowEdge[];
|
|
82
79
|
/** Auth provider for API requests (used for template variable API mode) */
|
|
83
80
|
authProvider?: AuthProvider;
|
|
84
|
-
/**
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
81
|
+
/**
|
|
82
|
+
* How edits are committed to the parent via `onChange`:
|
|
83
|
+
* - `'blur'` (default): committed on focus-out. Discrete controls
|
|
84
|
+
* (checkbox/enum) additionally commit immediately, because WebKit doesn't
|
|
85
|
+
* focus them on click so no focus-out fires (see handleFieldChange).
|
|
86
|
+
* - `'live'`: committed on every change, with the edited `fieldKey` in the
|
|
87
|
+
* `onChange` meta, plus a final `{ commit: true }` on focus-out. Lets the
|
|
88
|
+
* parent coalesce a field-editing session into one undo step without
|
|
89
|
+
* depending on focus events at all.
|
|
90
|
+
*/
|
|
91
|
+
commitMode?: 'blur' | 'live';
|
|
92
|
+
/**
|
|
93
|
+
* Callback when field values change.
|
|
94
|
+
* @param config - The current merged config values.
|
|
95
|
+
* @param meta - `fieldKey` names the changed field (live mode); `commit`
|
|
96
|
+
* marks the end-of-session flush fired on focus-out (live mode).
|
|
97
|
+
*/
|
|
98
|
+
onChange?: (
|
|
99
|
+
config: Record<string, unknown>,
|
|
100
|
+
meta?: { fieldKey?: string; commit?: boolean }
|
|
101
|
+
) => void;
|
|
102
|
+
/** Callback when form is saved */
|
|
103
|
+
onSave?: (config: Record<string, unknown>) => void;
|
|
88
104
|
/** Callback when form is cancelled */
|
|
89
105
|
onCancel?: () => void;
|
|
90
106
|
}
|
|
@@ -94,17 +110,27 @@
|
|
|
94
110
|
schema,
|
|
95
111
|
uiSchema,
|
|
96
112
|
values,
|
|
97
|
-
showUIExtensions = true,
|
|
98
113
|
workflowId,
|
|
99
114
|
saveWorkflowWhenSavingConfig = false,
|
|
100
115
|
workflowNodes = [],
|
|
101
116
|
workflowEdges = [],
|
|
102
117
|
authProvider,
|
|
118
|
+
commitMode = 'blur',
|
|
103
119
|
onChange,
|
|
104
120
|
onSave,
|
|
105
121
|
onCancel
|
|
106
122
|
}: Props = $props();
|
|
107
123
|
|
|
124
|
+
// Resolve the active instance for endpoint configuration (dynamic schema fetch).
|
|
125
|
+
// ConfigForm is a standalone-capable container (exported from /editor and able
|
|
126
|
+
// to render bare, e.g. with a direct `schema`/`values`). Self-provide so its
|
|
127
|
+
// leaf <FormField>s resolve and SSR doesn't throw. provideInstance() reuses an
|
|
128
|
+
// ancestor's context instance when nested in <App>/<WorkflowEditor>, returns
|
|
129
|
+
// the shared page-default in the browser, and creates a fresh per-render
|
|
130
|
+
// instance on the server (no cross-request leakage); no destroy here for the
|
|
131
|
+
// same reasons as SchemaForm (shared/default in the browser, no SSR teardown).
|
|
132
|
+
const fd = provideInstance();
|
|
133
|
+
|
|
108
134
|
// Set context for child components (e.g., FormAutocomplete)
|
|
109
135
|
// Use getter functions to ensure child components always get the current prop value,
|
|
110
136
|
// even if the prop changes after initial mount
|
|
@@ -116,6 +142,9 @@
|
|
|
116
142
|
let dynamicSchemaLoading = $state(false);
|
|
117
143
|
let dynamicSchemaError = $state<string | null>(null);
|
|
118
144
|
let fetchedDynamicSchema = $state<ConfigSchema | null>(null);
|
|
145
|
+
// A uiSchema the endpoint returned alongside the schema (server-hydrated
|
|
146
|
+
// forms). Held next to fetchedDynamicSchema and cleared in lockstep with it.
|
|
147
|
+
let fetchedDynamicUiSchema = $state<UISchemaElement | null>(null);
|
|
119
148
|
|
|
120
149
|
/**
|
|
121
150
|
* Get the admin edit configuration for the node
|
|
@@ -150,38 +179,73 @@
|
|
|
150
179
|
* Priority: fetchedDynamicSchema > direct schema prop > node metadata configSchema
|
|
151
180
|
*/
|
|
152
181
|
const configSchema = $derived.by<ConfigSchema | undefined>(() => {
|
|
153
|
-
|
|
182
|
+
const staticSchema = schema ?? (node?.data.metadata?.configSchema as ConfigSchema | undefined);
|
|
183
|
+
// A fetched dynamic schema is layered onto the static one per the endpoint's
|
|
184
|
+
// mergeStrategy/target (default 'replace' → fetched wins wholesale). With no
|
|
185
|
+
// static schema, the fetched schema is the form.
|
|
154
186
|
if (fetchedDynamicSchema) {
|
|
155
|
-
|
|
187
|
+
const endpoint = configEditOptions?.dynamicSchema;
|
|
188
|
+
return endpoint
|
|
189
|
+
? applyFetchedSchema(staticSchema, fetchedDynamicSchema, endpoint)
|
|
190
|
+
: fetchedDynamicSchema;
|
|
156
191
|
}
|
|
157
|
-
|
|
158
|
-
return schema ?? (node?.data.metadata?.configSchema as ConfigSchema | undefined);
|
|
192
|
+
return staticSchema;
|
|
159
193
|
});
|
|
160
194
|
|
|
161
195
|
/**
|
|
162
|
-
* Get the UI schema
|
|
163
|
-
* Priority: direct uiSchema prop > node metadata
|
|
196
|
+
* Get the UI schema for the active configSchema.
|
|
197
|
+
* Priority: direct uiSchema prop > fetched dynamic uiSchema > node metadata.
|
|
198
|
+
*
|
|
199
|
+
* When the dynamic fetch returned a uiSchema, it wins over the node's static
|
|
200
|
+
* metadata uiSchema: the static one references only the static schema's
|
|
201
|
+
* properties, so it can't lay out a server-provided (hydrated) schema — its
|
|
202
|
+
* controls would point at fields that aren't rendered while the fetched
|
|
203
|
+
* fields would have no controls at all. The endpoint is expected to return a
|
|
204
|
+
* uiSchema describing the schema it served.
|
|
164
205
|
*/
|
|
165
206
|
const configUISchema = $derived.by<UISchemaElement | undefined>(() => {
|
|
166
|
-
|
|
207
|
+
if (uiSchema) return uiSchema;
|
|
208
|
+
if (fetchedDynamicSchema && fetchedDynamicUiSchema) return fetchedDynamicUiSchema;
|
|
209
|
+
return node?.data.metadata?.uiSchema as UISchemaElement | undefined;
|
|
167
210
|
});
|
|
168
211
|
|
|
169
212
|
/**
|
|
170
|
-
*
|
|
171
|
-
*
|
|
213
|
+
* Whether this node sources its schema dynamically: dynamic schema is
|
|
214
|
+
* configured and used, and it actually contributes to the form — either there
|
|
215
|
+
* is no static schema to fall back on, it is explicitly preferred, or it is
|
|
216
|
+
* configured to merge/target (in which case it layers onto the static schema
|
|
217
|
+
* rather than replacing it, so we fetch even when a static schema exists).
|
|
172
218
|
*/
|
|
173
|
-
const
|
|
174
|
-
if (!node) return false;
|
|
219
|
+
const wantsDynamicSchema = $derived.by(() => {
|
|
220
|
+
if (!node || !useDynamicSchema) return false;
|
|
221
|
+
const endpoint = configEditOptions?.dynamicSchema;
|
|
222
|
+
const layersOntoStatic = endpoint?.mergeStrategy === 'merge' || endpoint?.target != null;
|
|
175
223
|
const staticSchema = schema ?? node.data.metadata?.configSchema;
|
|
176
|
-
|
|
177
|
-
return (
|
|
178
|
-
(!staticSchema || configEditOptions?.preferDynamicSchema === true) &&
|
|
179
|
-
useDynamicSchema &&
|
|
180
|
-
!fetchedDynamicSchema &&
|
|
181
|
-
!dynamicSchemaLoading
|
|
182
|
-
);
|
|
224
|
+
return !staticSchema || configEditOptions?.preferDynamicSchema === true || layersOntoStatic;
|
|
183
225
|
});
|
|
184
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Resolved fetch key for the dynamic schema endpoint. Read from the committed
|
|
229
|
+
* `node.data.config` (not the in-flight `edits`/`configValues`), so it moves
|
|
230
|
+
* at the commit boundary: a field edit reaches it only once `handleFormBlur`
|
|
231
|
+
* fires `onChange` and the parent writes the value back onto the node. It
|
|
232
|
+
* therefore recomputes when a committed config value the endpoint's
|
|
233
|
+
* parameterMapping references changes (e.g. a trigger node's event_type),
|
|
234
|
+
* driving the auto-refetch effect below. Relies on `node` being a deep
|
|
235
|
+
* reactive proxy whose `.data.config` is mutated in place; a replaced node or
|
|
236
|
+
* a plain snapshot would not re-run this derived.
|
|
237
|
+
*/
|
|
238
|
+
const dynamicSchemaKey = $derived.by<string | null>(() => {
|
|
239
|
+
if (!node || !configEditOptions?.dynamicSchema || !wantsDynamicSchema) return null;
|
|
240
|
+
return resolveDynamicSchemaKey(configEditOptions.dynamicSchema, node, workflowId);
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Key of the schema currently loaded or in flight. Guards the effect from
|
|
245
|
+
* re-fetching a schema whose inputs have not changed.
|
|
246
|
+
*/
|
|
247
|
+
let loadedSchemaKey = $state<string | null>(null);
|
|
248
|
+
|
|
185
249
|
/**
|
|
186
250
|
* Get the current configuration from node or direct prop
|
|
187
251
|
*/
|
|
@@ -203,7 +267,8 @@
|
|
|
203
267
|
// (configSchema flips from undefined → loaded) and "different node opened"
|
|
204
268
|
// (node prop change → metadata.configSchema reference change). Identity
|
|
205
269
|
// comparison only — value churn in `initialConfig` preserves in-flight edits.
|
|
206
|
-
//
|
|
270
|
+
// capturing the initial derived reference is intentional; later changes are picked up by the effect below
|
|
271
|
+
// svelte-ignore state_referenced_locally
|
|
207
272
|
let prevSchemaRef = configSchema;
|
|
208
273
|
$effect.pre(() => {
|
|
209
274
|
if (configSchema !== prevSchemaRef) {
|
|
@@ -212,28 +277,11 @@
|
|
|
212
277
|
}
|
|
213
278
|
});
|
|
214
279
|
|
|
215
|
-
/**
|
|
216
|
-
* UI Extension values for display settings
|
|
217
|
-
* Merges node type defaults with instance overrides
|
|
218
|
-
*/
|
|
219
|
-
let uiExtensionValues = $state<NodeUIExtensions>({});
|
|
220
|
-
|
|
221
280
|
/**
|
|
222
281
|
* Flag to track if workflow save is in progress
|
|
223
282
|
*/
|
|
224
283
|
let isSavingWorkflow = $state(false);
|
|
225
284
|
|
|
226
|
-
/**
|
|
227
|
-
* Get initial UI extensions from node (instance level overrides type level)
|
|
228
|
-
*/
|
|
229
|
-
const initialUIExtensions = $derived.by<NodeUIExtensions>(() => {
|
|
230
|
-
if (!node) return {};
|
|
231
|
-
// Merge type-level defaults with instance-level overrides
|
|
232
|
-
const typeDefaults = node.data.metadata?.extensions?.ui ?? {};
|
|
233
|
-
const instanceOverrides = node.data.extensions?.ui ?? {};
|
|
234
|
-
return { ...typeDefaults, ...instanceOverrides };
|
|
235
|
-
});
|
|
236
|
-
|
|
237
285
|
/**
|
|
238
286
|
* Fetch dynamic schema when needed
|
|
239
287
|
*/
|
|
@@ -245,6 +293,7 @@
|
|
|
245
293
|
|
|
246
294
|
try {
|
|
247
295
|
const result: DynamicSchemaResult = await fetchDynamicSchema(
|
|
296
|
+
fd.api.config,
|
|
248
297
|
configEditOptions.dynamicSchema,
|
|
249
298
|
node,
|
|
250
299
|
workflowId
|
|
@@ -252,6 +301,7 @@
|
|
|
252
301
|
|
|
253
302
|
if (result.success && result.schema) {
|
|
254
303
|
fetchedDynamicSchema = result.schema;
|
|
304
|
+
fetchedDynamicUiSchema = result.uiSchema ?? null;
|
|
255
305
|
} else {
|
|
256
306
|
dynamicSchemaError =
|
|
257
307
|
result.error ?? configEditOptions.errorMessage ?? 'Failed to load configuration schema';
|
|
@@ -273,8 +323,9 @@
|
|
|
273
323
|
if (!node || !configEditOptions?.dynamicSchema) return;
|
|
274
324
|
|
|
275
325
|
// Invalidate the cache first
|
|
276
|
-
invalidateSchemaCache(node, configEditOptions.dynamicSchema);
|
|
326
|
+
invalidateSchemaCache(node, configEditOptions.dynamicSchema, workflowId);
|
|
277
327
|
fetchedDynamicSchema = null;
|
|
328
|
+
fetchedDynamicUiSchema = null;
|
|
278
329
|
|
|
279
330
|
// Reload the schema
|
|
280
331
|
await loadDynamicSchema();
|
|
@@ -305,114 +356,33 @@
|
|
|
305
356
|
}
|
|
306
357
|
|
|
307
358
|
/**
|
|
308
|
-
*
|
|
359
|
+
* Load — and reload — the dynamic schema when its resolved key changes.
|
|
360
|
+
*
|
|
361
|
+
* Covers both the initial fetch (loadedSchemaKey starts null) and refetching
|
|
362
|
+
* after a config value the endpoint depends on changes (e.g. picking a
|
|
363
|
+
* different trigger event_type). A load already in flight is left to finish;
|
|
364
|
+
* the effect re-runs when it settles and picks up any newer key then.
|
|
365
|
+
*
|
|
366
|
+
* The `dynamicSchemaLoading` read is load-bearing in both directions: it
|
|
367
|
+
* guards against re-entering while a fetch is in flight, AND — because it is
|
|
368
|
+
* a tracked read — flipping back to false on settle is what re-runs this
|
|
369
|
+
* effect to pick up a newer key. Don't hoist or drop it; the settle-and-
|
|
370
|
+
* refetch depends on it.
|
|
371
|
+
*
|
|
372
|
+
* loadedSchemaKey is set BEFORE the fetch (not after success) on purpose: a
|
|
373
|
+
* failed load consumes the key so a persistent error can't loop the effect
|
|
374
|
+
* into a refetch storm. Recovery from an error is manual, via
|
|
375
|
+
* refreshDynamicSchema().
|
|
309
376
|
*/
|
|
310
377
|
$effect(() => {
|
|
311
|
-
|
|
312
|
-
|
|
378
|
+
const key = dynamicSchemaKey;
|
|
379
|
+
if (key === null || key === loadedSchemaKey || dynamicSchemaLoading) {
|
|
380
|
+
return;
|
|
313
381
|
}
|
|
382
|
+
loadedSchemaKey = key;
|
|
383
|
+
loadDynamicSchema();
|
|
314
384
|
});
|
|
315
385
|
|
|
316
|
-
/**
|
|
317
|
-
* Initialize UI extension values when node changes
|
|
318
|
-
*/
|
|
319
|
-
$effect(() => {
|
|
320
|
-
uiExtensionValues = {
|
|
321
|
-
hideUnconnectedHandles: initialUIExtensions.hideUnconnectedHandles ?? false,
|
|
322
|
-
portOrder: initialUIExtensions.portOrder
|
|
323
|
-
? {
|
|
324
|
-
inputs: initialUIExtensions.portOrder.inputs
|
|
325
|
-
? [...initialUIExtensions.portOrder.inputs]
|
|
326
|
-
: undefined,
|
|
327
|
-
outputs: initialUIExtensions.portOrder.outputs
|
|
328
|
-
? [...initialUIExtensions.portOrder.outputs]
|
|
329
|
-
: undefined
|
|
330
|
-
}
|
|
331
|
-
: undefined,
|
|
332
|
-
hiddenPorts: initialUIExtensions.hiddenPorts
|
|
333
|
-
? {
|
|
334
|
-
inputs: initialUIExtensions.hiddenPorts.inputs
|
|
335
|
-
? [...initialUIExtensions.hiddenPorts.inputs]
|
|
336
|
-
: undefined,
|
|
337
|
-
outputs: initialUIExtensions.hiddenPorts.outputs
|
|
338
|
-
? [...initialUIExtensions.hiddenPorts.outputs]
|
|
339
|
-
: undefined
|
|
340
|
-
}
|
|
341
|
-
: undefined
|
|
342
|
-
};
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* All input ports in current display order for the port management UI.
|
|
347
|
-
* Combines static metadata inputs + dynamic config inputs, sorted by portOrder.
|
|
348
|
-
*/
|
|
349
|
-
const allInputPortsForUI = $derived.by<NodePort[]>(() => {
|
|
350
|
-
if (!node) return [];
|
|
351
|
-
const staticInputs = node.data.metadata.inputs ?? [];
|
|
352
|
-
const dynInputs = ((node.data.config?.dynamicInputs as DynamicPort[]) || []).map((p) =>
|
|
353
|
-
dynamicPortToNodePort(p, 'input')
|
|
354
|
-
);
|
|
355
|
-
return applyPortOrder([...staticInputs, ...dynInputs], uiExtensionValues.portOrder?.inputs);
|
|
356
|
-
});
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* All output ports in current display order for the port management UI.
|
|
360
|
-
* Combines static metadata outputs + dynamic config outputs, sorted by portOrder.
|
|
361
|
-
*/
|
|
362
|
-
const allOutputPortsForUI = $derived.by<NodePort[]>(() => {
|
|
363
|
-
if (!node) return [];
|
|
364
|
-
const staticOutputs = node.data.metadata.outputs ?? [];
|
|
365
|
-
const dynOutputs = ((node.data.config?.dynamicOutputs as DynamicPort[]) || []).map((p) =>
|
|
366
|
-
dynamicPortToNodePort(p, 'output')
|
|
367
|
-
);
|
|
368
|
-
return applyPortOrder([...staticOutputs, ...dynOutputs], uiExtensionValues.portOrder?.outputs);
|
|
369
|
-
});
|
|
370
|
-
|
|
371
|
-
/**
|
|
372
|
-
* Move a port one position up or down in the display order.
|
|
373
|
-
*/
|
|
374
|
-
function movePort(direction: 'inputs' | 'outputs', portId: string, delta: -1 | 1): void {
|
|
375
|
-
const list = direction === 'inputs' ? allInputPortsForUI : allOutputPortsForUI;
|
|
376
|
-
const idx = list.findIndex((p) => p.id === portId);
|
|
377
|
-
if (idx === -1) return;
|
|
378
|
-
const newIdx = idx + delta;
|
|
379
|
-
if (newIdx < 0 || newIdx >= list.length) return;
|
|
380
|
-
const newOrder = list.map((p) => p.id);
|
|
381
|
-
[newOrder[idx], newOrder[newIdx]] = [newOrder[newIdx], newOrder[idx]];
|
|
382
|
-
uiExtensionValues.portOrder = {
|
|
383
|
-
...uiExtensionValues.portOrder,
|
|
384
|
-
[direction]: newOrder
|
|
385
|
-
};
|
|
386
|
-
handleFormBlur();
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Toggle manual visibility of a port. Required ports cannot be hidden.
|
|
391
|
-
*/
|
|
392
|
-
function togglePortHidden(direction: 'inputs' | 'outputs', portId: string): void {
|
|
393
|
-
const current = uiExtensionValues.hiddenPorts?.[direction] ?? [];
|
|
394
|
-
const isHidden = current.includes(portId);
|
|
395
|
-
const next = isHidden ? current.filter((id) => id !== portId) : [...current, portId];
|
|
396
|
-
uiExtensionValues.hiddenPorts = {
|
|
397
|
-
...uiExtensionValues.hiddenPorts,
|
|
398
|
-
[direction]: next.length > 0 ? next : undefined
|
|
399
|
-
};
|
|
400
|
-
handleFormBlur();
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Reset all port customizations (order + hidden) for a direction back to defaults.
|
|
405
|
-
*/
|
|
406
|
-
function resetPortCustomizations(direction: 'inputs' | 'outputs'): void {
|
|
407
|
-
const order = { ...uiExtensionValues.portOrder };
|
|
408
|
-
const hidden = { ...uiExtensionValues.hiddenPorts };
|
|
409
|
-
delete order[direction];
|
|
410
|
-
delete hidden[direction];
|
|
411
|
-
uiExtensionValues.portOrder = Object.keys(order).length > 0 ? order : undefined;
|
|
412
|
-
uiExtensionValues.hiddenPorts = Object.keys(hidden).length > 0 ? hidden : undefined;
|
|
413
|
-
handleFormBlur();
|
|
414
|
-
}
|
|
415
|
-
|
|
416
386
|
/**
|
|
417
387
|
* Check if a field is required based on schema
|
|
418
388
|
*/
|
|
@@ -438,34 +408,70 @@
|
|
|
438
408
|
for (const [depKey, depValue] of Object.entries(dependents)) {
|
|
439
409
|
edits[depKey] = depValue;
|
|
440
410
|
}
|
|
411
|
+
|
|
412
|
+
if (commitMode === 'live') {
|
|
413
|
+
// Commit every change, tagging the field so the parent can coalesce a
|
|
414
|
+
// whole field-editing session into one undo step. Nothing depends on a
|
|
415
|
+
// focus event, so WebKit not focusing checkboxes/selects on click (#38)
|
|
416
|
+
// is a non-issue. Keep the edits buffer until the session ends (blur) so
|
|
417
|
+
// fast typing never briefly reverts on the parent's value round-trip.
|
|
418
|
+
commitEdits({ fieldKey: key }, false);
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// Blur mode: text/number fields commit on focus-out (one store write per
|
|
423
|
+
// field, not per keystroke). Discrete controls (checkbox/toggle, enum)
|
|
424
|
+
// commit immediately — WebKit doesn't focus them on click, so no focus-out
|
|
425
|
+
// ever fires and the edit would otherwise be lost on save (#38).
|
|
426
|
+
const prop = configSchema?.properties?.[key];
|
|
427
|
+
if (prop && (prop.type === 'boolean' || Array.isArray(prop.enum))) {
|
|
428
|
+
commitEdits();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Emit the current merged config to the parent.
|
|
434
|
+
*
|
|
435
|
+
* @param meta - Passed through to `onChange` (live mode: `fieldKey` /
|
|
436
|
+
* `commit`).
|
|
437
|
+
* @param clearBuffer - Discharge the local `edits` buffer after emitting, so
|
|
438
|
+
* subsequent prop changes (parent absorbing the commit, undo/redo,
|
|
439
|
+
* collaboration) flow through `initialConfig` cleanly instead of being
|
|
440
|
+
* shadowed by a stale local edit. Done at every commit boundary in blur
|
|
441
|
+
* mode, but only at session end (blur) in live mode.
|
|
442
|
+
*/
|
|
443
|
+
function commitEdits(meta?: { fieldKey?: string; commit?: boolean }, clearBuffer = true): void {
|
|
444
|
+
if (!onChange) return;
|
|
445
|
+
// Spread `initialConfig` first so config keys the active schema doesn't own
|
|
446
|
+
// (e.g. after a dynamic schema narrows the field set) pass through untouched
|
|
447
|
+
// instead of being silently dropped; `configValues` then wins for every
|
|
448
|
+
// field the schema actually renders.
|
|
449
|
+
onChange({ ...initialConfig, ...configValues }, meta);
|
|
450
|
+
if (clearBuffer) edits = {};
|
|
441
451
|
}
|
|
442
452
|
|
|
443
453
|
/**
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
454
|
+
* Focus-out handler (bubbles from child fields).
|
|
455
|
+
*
|
|
456
|
+
* Blur mode: the primary commit. Live mode: edits are already committed per
|
|
457
|
+
* change, so this just signals end-of-session (`commit: true`) so the parent
|
|
458
|
+
* can finalize the coalesced undo step, and discharges the edits buffer.
|
|
447
459
|
*/
|
|
448
460
|
function handleFormBlur(): void {
|
|
449
|
-
|
|
450
|
-
const extensions = showUIExtensions && node ? uiExtensionValues : undefined;
|
|
451
|
-
onChange({ ...configValues }, extensions);
|
|
452
|
-
// Discharge the edits buffer at the commit boundary. Subsequent prop
|
|
453
|
-
// changes (parent absorbing the commit, undo/redo, collaboration) then
|
|
454
|
-
// flow through `initialConfig` cleanly instead of being shadowed by a
|
|
455
|
-
// stale local edit.
|
|
456
|
-
edits = {};
|
|
457
|
-
}
|
|
461
|
+
commitEdits(commitMode === 'live' ? { commit: true } : undefined);
|
|
458
462
|
}
|
|
459
463
|
|
|
460
464
|
/**
|
|
461
465
|
* Handle form submission
|
|
462
|
-
* Collects
|
|
463
|
-
* Optionally saves the workflow if the option is enabled
|
|
466
|
+
* Collects config values and optionally saves the workflow.
|
|
464
467
|
*/
|
|
465
468
|
async function handleSave(): Promise<void> {
|
|
466
|
-
// Collect all form values including hidden fields
|
|
469
|
+
// Collect all form values including hidden fields. Start from
|
|
470
|
+
// `initialConfig` so keys the active schema doesn't own survive the save
|
|
471
|
+
// (see handleFormBlur); `configValues` and the DOM scrape below then take
|
|
472
|
+
// precedence for every field the schema renders.
|
|
467
473
|
const form = document.querySelector('.config-form');
|
|
468
|
-
const updatedConfig: Record<string, unknown> = { ...configValues };
|
|
474
|
+
const updatedConfig: Record<string, unknown> = { ...initialConfig, ...configValues };
|
|
469
475
|
|
|
470
476
|
if (form) {
|
|
471
477
|
const inputs = form.querySelectorAll('input, select, textarea');
|
|
@@ -507,13 +513,8 @@
|
|
|
507
513
|
);
|
|
508
514
|
}
|
|
509
515
|
|
|
510
|
-
// Pass UI extensions only if enabled
|
|
511
516
|
if (onSave) {
|
|
512
|
-
|
|
513
|
-
onSave(updatedConfig, uiExtensionValues);
|
|
514
|
-
} else {
|
|
515
|
-
onSave(updatedConfig);
|
|
516
|
-
}
|
|
517
|
+
onSave(updatedConfig);
|
|
517
518
|
}
|
|
518
519
|
|
|
519
520
|
// Save workflow if the option is enabled
|
|
@@ -730,188 +731,6 @@
|
|
|
730
731
|
</div>
|
|
731
732
|
{/if}
|
|
732
733
|
|
|
733
|
-
<!-- UI Extensions Section -->
|
|
734
|
-
{#if showUIExtensions && node}
|
|
735
|
-
<div class="config-form__extensions">
|
|
736
|
-
<div class="config-form__extensions-header">
|
|
737
|
-
<Icon icon="heroicons:adjustments-horizontal" class="config-form__extensions-icon" />
|
|
738
|
-
<span>Display Settings</span>
|
|
739
|
-
</div>
|
|
740
|
-
<div class="config-form__extensions-content">
|
|
741
|
-
<!-- Hide Unconnected Handles Toggle -->
|
|
742
|
-
<FormFieldWrapper
|
|
743
|
-
id="ext-hideUnconnectedHandles"
|
|
744
|
-
label="Hide Unconnected Ports"
|
|
745
|
-
description="Hide input and output ports that are not connected to reduce visual clutter"
|
|
746
|
-
>
|
|
747
|
-
<FormToggle
|
|
748
|
-
id="ext-hideUnconnectedHandles"
|
|
749
|
-
value={Boolean(uiExtensionValues.hideUnconnectedHandles)}
|
|
750
|
-
onLabel="Hidden"
|
|
751
|
-
offLabel="Visible"
|
|
752
|
-
ariaDescribedBy="ext-hideUnconnectedHandles-description"
|
|
753
|
-
onChange={(val) => {
|
|
754
|
-
uiExtensionValues.hideUnconnectedHandles = val;
|
|
755
|
-
handleFormBlur();
|
|
756
|
-
}}
|
|
757
|
-
/>
|
|
758
|
-
</FormFieldWrapper>
|
|
759
|
-
|
|
760
|
-
<!-- Input Port Order & Visibility -->
|
|
761
|
-
{#if allInputPortsForUI.length > 0}
|
|
762
|
-
<div class="config-form__port-order">
|
|
763
|
-
<div class="config-form__port-order-header">
|
|
764
|
-
<span class="config-form__port-order-label">Input Ports</span>
|
|
765
|
-
{#if uiExtensionValues.portOrder?.inputs?.length || uiExtensionValues.hiddenPorts?.inputs?.length}
|
|
766
|
-
<button
|
|
767
|
-
type="button"
|
|
768
|
-
class="config-form__port-order-reset"
|
|
769
|
-
onclick={() => resetPortCustomizations('inputs')}
|
|
770
|
-
title="Reset to default order and visibility"
|
|
771
|
-
>
|
|
772
|
-
<Icon icon="heroicons:arrow-uturn-left" />
|
|
773
|
-
Reset
|
|
774
|
-
</button>
|
|
775
|
-
{/if}
|
|
776
|
-
</div>
|
|
777
|
-
<ul class="config-form__port-order-list">
|
|
778
|
-
{#each allInputPortsForUI as port, i (port.id)}
|
|
779
|
-
{@const isHidden =
|
|
780
|
-
uiExtensionValues.hiddenPorts?.inputs?.includes(port.id) ?? false}
|
|
781
|
-
{@const isRequired = port.required ?? false}
|
|
782
|
-
<li
|
|
783
|
-
class="config-form__port-order-item"
|
|
784
|
-
class:config-form__port-order-item--hidden={isHidden}
|
|
785
|
-
>
|
|
786
|
-
<span class="config-form__port-order-name">{port.name}</span>
|
|
787
|
-
<span
|
|
788
|
-
class="config-form__port-order-badge"
|
|
789
|
-
style="background-color:{getPortBackgroundColor(
|
|
790
|
-
port.dataType,
|
|
791
|
-
15
|
|
792
|
-
)};color:{getDataTypeColorToken(
|
|
793
|
-
port.dataType
|
|
794
|
-
)};border:1px solid {getPortBackgroundColor(port.dataType, 30)}"
|
|
795
|
-
>
|
|
796
|
-
{port.dataType}
|
|
797
|
-
</span>
|
|
798
|
-
<div class="config-form__port-order-actions">
|
|
799
|
-
<button
|
|
800
|
-
type="button"
|
|
801
|
-
disabled={isRequired}
|
|
802
|
-
title={isRequired
|
|
803
|
-
? 'Required ports cannot be hidden'
|
|
804
|
-
: isHidden
|
|
805
|
-
? 'Show port'
|
|
806
|
-
: 'Hide port'}
|
|
807
|
-
class:active={isHidden}
|
|
808
|
-
onclick={() => togglePortHidden('inputs', port.id)}
|
|
809
|
-
>
|
|
810
|
-
<Icon icon={isHidden ? 'heroicons:eye-slash' : 'heroicons:eye'} />
|
|
811
|
-
</button>
|
|
812
|
-
<button
|
|
813
|
-
type="button"
|
|
814
|
-
disabled={i === 0 || allInputPortsForUI.length === 1}
|
|
815
|
-
onclick={() => movePort('inputs', port.id, -1)}
|
|
816
|
-
title="Move up"
|
|
817
|
-
>
|
|
818
|
-
<Icon icon="heroicons:chevron-up" />
|
|
819
|
-
</button>
|
|
820
|
-
<button
|
|
821
|
-
type="button"
|
|
822
|
-
disabled={i === allInputPortsForUI.length - 1 ||
|
|
823
|
-
allInputPortsForUI.length === 1}
|
|
824
|
-
onclick={() => movePort('inputs', port.id, 1)}
|
|
825
|
-
title="Move down"
|
|
826
|
-
>
|
|
827
|
-
<Icon icon="heroicons:chevron-down" />
|
|
828
|
-
</button>
|
|
829
|
-
</div>
|
|
830
|
-
</li>
|
|
831
|
-
{/each}
|
|
832
|
-
</ul>
|
|
833
|
-
</div>
|
|
834
|
-
{/if}
|
|
835
|
-
|
|
836
|
-
<!-- Output Port Order & Visibility -->
|
|
837
|
-
{#if allOutputPortsForUI.length > 0}
|
|
838
|
-
<div class="config-form__port-order">
|
|
839
|
-
<div class="config-form__port-order-header">
|
|
840
|
-
<span class="config-form__port-order-label">Output Ports</span>
|
|
841
|
-
{#if uiExtensionValues.portOrder?.outputs?.length || uiExtensionValues.hiddenPorts?.outputs?.length}
|
|
842
|
-
<button
|
|
843
|
-
type="button"
|
|
844
|
-
class="config-form__port-order-reset"
|
|
845
|
-
onclick={() => resetPortCustomizations('outputs')}
|
|
846
|
-
title="Reset to default order and visibility"
|
|
847
|
-
>
|
|
848
|
-
<Icon icon="heroicons:arrow-uturn-left" />
|
|
849
|
-
Reset
|
|
850
|
-
</button>
|
|
851
|
-
{/if}
|
|
852
|
-
</div>
|
|
853
|
-
<ul class="config-form__port-order-list">
|
|
854
|
-
{#each allOutputPortsForUI as port, i (port.id)}
|
|
855
|
-
{@const isHidden =
|
|
856
|
-
uiExtensionValues.hiddenPorts?.outputs?.includes(port.id) ?? false}
|
|
857
|
-
{@const isRequired = port.required ?? false}
|
|
858
|
-
<li
|
|
859
|
-
class="config-form__port-order-item"
|
|
860
|
-
class:config-form__port-order-item--hidden={isHidden}
|
|
861
|
-
>
|
|
862
|
-
<span class="config-form__port-order-name">{port.name}</span>
|
|
863
|
-
<span
|
|
864
|
-
class="config-form__port-order-badge"
|
|
865
|
-
style="background-color:{getPortBackgroundColor(
|
|
866
|
-
port.dataType,
|
|
867
|
-
15
|
|
868
|
-
)};color:{getDataTypeColorToken(
|
|
869
|
-
port.dataType
|
|
870
|
-
)};border:1px solid {getPortBackgroundColor(port.dataType, 30)}"
|
|
871
|
-
>
|
|
872
|
-
{port.dataType}
|
|
873
|
-
</span>
|
|
874
|
-
<div class="config-form__port-order-actions">
|
|
875
|
-
<button
|
|
876
|
-
type="button"
|
|
877
|
-
disabled={isRequired}
|
|
878
|
-
title={isRequired
|
|
879
|
-
? 'Required ports cannot be hidden'
|
|
880
|
-
: isHidden
|
|
881
|
-
? 'Show port'
|
|
882
|
-
: 'Hide port'}
|
|
883
|
-
class:active={isHidden}
|
|
884
|
-
onclick={() => togglePortHidden('outputs', port.id)}
|
|
885
|
-
>
|
|
886
|
-
<Icon icon={isHidden ? 'heroicons:eye-slash' : 'heroicons:eye'} />
|
|
887
|
-
</button>
|
|
888
|
-
<button
|
|
889
|
-
type="button"
|
|
890
|
-
disabled={i === 0 || allOutputPortsForUI.length === 1}
|
|
891
|
-
onclick={() => movePort('outputs', port.id, -1)}
|
|
892
|
-
title="Move up"
|
|
893
|
-
>
|
|
894
|
-
<Icon icon="heroicons:chevron-up" />
|
|
895
|
-
</button>
|
|
896
|
-
<button
|
|
897
|
-
type="button"
|
|
898
|
-
disabled={i === allOutputPortsForUI.length - 1 ||
|
|
899
|
-
allOutputPortsForUI.length === 1}
|
|
900
|
-
onclick={() => movePort('outputs', port.id, 1)}
|
|
901
|
-
title="Move down"
|
|
902
|
-
>
|
|
903
|
-
<Icon icon="heroicons:chevron-down" />
|
|
904
|
-
</button>
|
|
905
|
-
</div>
|
|
906
|
-
</li>
|
|
907
|
-
{/each}
|
|
908
|
-
</ul>
|
|
909
|
-
</div>
|
|
910
|
-
{/if}
|
|
911
|
-
</div>
|
|
912
|
-
</div>
|
|
913
|
-
{/if}
|
|
914
|
-
|
|
915
734
|
<!-- Footer Actions - Only shown when onSave is provided and onChange is not -->
|
|
916
735
|
<!-- With onChange (on-blur sync), changes are saved automatically, so no Save button needed -->
|
|
917
736
|
{#if onSave && !onChange}
|
|
@@ -1016,7 +835,7 @@
|
|
|
1016
835
|
justify-content: center;
|
|
1017
836
|
gap: var(--fd-space-xs);
|
|
1018
837
|
padding: 0.625rem var(--fd-space-xl);
|
|
1019
|
-
border-radius: var(--fd-radius
|
|
838
|
+
border-radius: var(--fd-control-radius);
|
|
1020
839
|
font-size: var(--fd-text-sm);
|
|
1021
840
|
font-weight: 600;
|
|
1022
841
|
font-family: inherit;
|
|
@@ -1045,11 +864,6 @@
|
|
|
1045
864
|
color: var(--fd-foreground);
|
|
1046
865
|
}
|
|
1047
866
|
|
|
1048
|
-
.config-form__button--secondary:focus-visible {
|
|
1049
|
-
outline: none;
|
|
1050
|
-
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
1051
|
-
}
|
|
1052
|
-
|
|
1053
867
|
.config-form__button--primary {
|
|
1054
868
|
background: linear-gradient(135deg, var(--fd-primary) 0%, var(--fd-primary-hover) 100%);
|
|
1055
869
|
color: var(--fd-primary-foreground);
|
|
@@ -1070,184 +884,6 @@
|
|
|
1070
884
|
transform: translateY(0);
|
|
1071
885
|
}
|
|
1072
886
|
|
|
1073
|
-
.config-form__button--primary:focus-visible {
|
|
1074
|
-
outline: none;
|
|
1075
|
-
box-shadow:
|
|
1076
|
-
0 0 0 3px rgba(59, 130, 246, 0.4),
|
|
1077
|
-
0 4px 12px rgba(59, 130, 246, 0.35);
|
|
1078
|
-
}
|
|
1079
|
-
|
|
1080
|
-
/* ============================================
|
|
1081
|
-
UI EXTENSIONS SECTION
|
|
1082
|
-
============================================ */
|
|
1083
|
-
|
|
1084
|
-
.config-form__extensions {
|
|
1085
|
-
background-color: var(--fd-muted);
|
|
1086
|
-
border: 1px solid var(--fd-border);
|
|
1087
|
-
border-radius: var(--fd-radius-lg);
|
|
1088
|
-
overflow: hidden;
|
|
1089
|
-
margin-top: var(--fd-space-xs);
|
|
1090
|
-
}
|
|
1091
|
-
|
|
1092
|
-
.config-form__extensions-header {
|
|
1093
|
-
display: flex;
|
|
1094
|
-
align-items: center;
|
|
1095
|
-
gap: var(--fd-space-xs);
|
|
1096
|
-
padding: var(--fd-space-md) var(--fd-space-xl);
|
|
1097
|
-
background-color: var(--fd-subtle);
|
|
1098
|
-
border-bottom: 1px solid var(--fd-border);
|
|
1099
|
-
font-size: 0.8125rem;
|
|
1100
|
-
font-weight: 600;
|
|
1101
|
-
color: var(--fd-foreground);
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
.config-form__extensions-header :global(svg) {
|
|
1105
|
-
width: 1rem;
|
|
1106
|
-
height: 1rem;
|
|
1107
|
-
color: var(--fd-muted-foreground);
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
.config-form__extensions-content {
|
|
1111
|
-
padding: var(--fd-space-xl);
|
|
1112
|
-
display: flex;
|
|
1113
|
-
flex-direction: column;
|
|
1114
|
-
gap: var(--fd-space-xl);
|
|
1115
|
-
}
|
|
1116
|
-
|
|
1117
|
-
/* ============================================
|
|
1118
|
-
PORT ORDER & VISIBILITY
|
|
1119
|
-
============================================ */
|
|
1120
|
-
|
|
1121
|
-
.config-form__port-order {
|
|
1122
|
-
border-top: 1px solid var(--fd-border-muted);
|
|
1123
|
-
padding-top: var(--fd-space-md);
|
|
1124
|
-
margin-top: calc(var(--fd-space-xl) * -0.25);
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
.config-form__port-order-header {
|
|
1128
|
-
display: flex;
|
|
1129
|
-
align-items: center;
|
|
1130
|
-
justify-content: space-between;
|
|
1131
|
-
margin-bottom: var(--fd-space-xs);
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
.config-form__port-order-label {
|
|
1135
|
-
font-size: var(--fd-text-xs);
|
|
1136
|
-
font-weight: 600;
|
|
1137
|
-
color: var(--fd-muted-foreground);
|
|
1138
|
-
text-transform: uppercase;
|
|
1139
|
-
letter-spacing: 0.05em;
|
|
1140
|
-
}
|
|
1141
|
-
|
|
1142
|
-
.config-form__port-order-reset {
|
|
1143
|
-
background: none;
|
|
1144
|
-
border: none;
|
|
1145
|
-
font-size: var(--fd-text-xs);
|
|
1146
|
-
color: var(--fd-muted-foreground);
|
|
1147
|
-
cursor: pointer;
|
|
1148
|
-
display: inline-flex;
|
|
1149
|
-
align-items: center;
|
|
1150
|
-
gap: var(--fd-space-3xs);
|
|
1151
|
-
padding: 0;
|
|
1152
|
-
transition: color var(--fd-transition-fast);
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
.config-form__port-order-reset:hover {
|
|
1156
|
-
color: var(--fd-foreground);
|
|
1157
|
-
}
|
|
1158
|
-
|
|
1159
|
-
.config-form__port-order-reset :global(svg) {
|
|
1160
|
-
width: 0.75rem;
|
|
1161
|
-
height: 0.75rem;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
.config-form__port-order-list {
|
|
1165
|
-
list-style: none;
|
|
1166
|
-
margin: 0;
|
|
1167
|
-
padding: 0;
|
|
1168
|
-
display: flex;
|
|
1169
|
-
flex-direction: column;
|
|
1170
|
-
gap: var(--fd-space-3xs);
|
|
1171
|
-
}
|
|
1172
|
-
|
|
1173
|
-
.config-form__port-order-item {
|
|
1174
|
-
display: flex;
|
|
1175
|
-
align-items: center;
|
|
1176
|
-
gap: var(--fd-space-xs);
|
|
1177
|
-
padding: var(--fd-space-3xs) var(--fd-space-xs);
|
|
1178
|
-
background: var(--fd-muted);
|
|
1179
|
-
border-radius: var(--fd-radius-sm);
|
|
1180
|
-
border: 1px solid var(--fd-border-muted);
|
|
1181
|
-
transition: opacity var(--fd-transition-fast);
|
|
1182
|
-
}
|
|
1183
|
-
|
|
1184
|
-
.config-form__port-order-item--hidden {
|
|
1185
|
-
opacity: 0.4;
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
.config-form__port-order-name {
|
|
1189
|
-
flex: 1;
|
|
1190
|
-
font-size: var(--fd-text-xs);
|
|
1191
|
-
font-weight: 500;
|
|
1192
|
-
color: var(--fd-foreground);
|
|
1193
|
-
min-width: 0;
|
|
1194
|
-
overflow: hidden;
|
|
1195
|
-
text-overflow: ellipsis;
|
|
1196
|
-
white-space: nowrap;
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
.config-form__port-order-badge {
|
|
1200
|
-
padding: 0.125rem var(--fd-space-3xs);
|
|
1201
|
-
border-radius: var(--fd-radius-sm);
|
|
1202
|
-
font-size: 0.625rem;
|
|
1203
|
-
font-weight: 500;
|
|
1204
|
-
text-transform: uppercase;
|
|
1205
|
-
letter-spacing: 0.04em;
|
|
1206
|
-
flex-shrink: 0;
|
|
1207
|
-
}
|
|
1208
|
-
|
|
1209
|
-
.config-form__port-order-actions {
|
|
1210
|
-
display: flex;
|
|
1211
|
-
gap: var(--fd-space-3xs);
|
|
1212
|
-
flex-shrink: 0;
|
|
1213
|
-
}
|
|
1214
|
-
|
|
1215
|
-
.config-form__port-order-actions button {
|
|
1216
|
-
width: 1.25rem;
|
|
1217
|
-
height: 1.25rem;
|
|
1218
|
-
display: flex;
|
|
1219
|
-
align-items: center;
|
|
1220
|
-
justify-content: center;
|
|
1221
|
-
background: var(--fd-card);
|
|
1222
|
-
border: 1px solid var(--fd-border);
|
|
1223
|
-
border-radius: var(--fd-radius-sm);
|
|
1224
|
-
color: var(--fd-muted-foreground);
|
|
1225
|
-
cursor: pointer;
|
|
1226
|
-
padding: 0;
|
|
1227
|
-
transition: all var(--fd-transition-fast);
|
|
1228
|
-
}
|
|
1229
|
-
|
|
1230
|
-
.config-form__port-order-actions button:hover:not(:disabled) {
|
|
1231
|
-
background: var(--fd-backdrop);
|
|
1232
|
-
color: var(--fd-foreground);
|
|
1233
|
-
border-color: var(--fd-border-strong);
|
|
1234
|
-
}
|
|
1235
|
-
|
|
1236
|
-
.config-form__port-order-actions button:disabled {
|
|
1237
|
-
opacity: 0.3;
|
|
1238
|
-
cursor: not-allowed;
|
|
1239
|
-
}
|
|
1240
|
-
|
|
1241
|
-
.config-form__port-order-actions button.active {
|
|
1242
|
-
color: var(--fd-foreground);
|
|
1243
|
-
border-color: var(--fd-border-strong);
|
|
1244
|
-
}
|
|
1245
|
-
|
|
1246
|
-
.config-form__port-order-actions button :global(svg) {
|
|
1247
|
-
width: 0.75rem;
|
|
1248
|
-
height: 0.75rem;
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
887
|
/* ============================================
|
|
1252
888
|
DEBUG SECTION
|
|
1253
889
|
============================================ */
|
|
@@ -1255,7 +891,7 @@
|
|
|
1255
891
|
.config-form__debug {
|
|
1256
892
|
background-color: var(--fd-warning-muted);
|
|
1257
893
|
border: 1px solid var(--fd-warning);
|
|
1258
|
-
border-radius: var(--fd-radius
|
|
894
|
+
border-radius: var(--fd-control-radius);
|
|
1259
895
|
overflow: hidden;
|
|
1260
896
|
}
|
|
1261
897
|
|
|
@@ -1409,7 +1045,7 @@
|
|
|
1409
1045
|
.config-form__error {
|
|
1410
1046
|
background-color: var(--fd-error-muted);
|
|
1411
1047
|
border: 1px solid var(--fd-error);
|
|
1412
|
-
border-radius: var(--fd-radius
|
|
1048
|
+
border-radius: var(--fd-control-radius);
|
|
1413
1049
|
overflow: hidden;
|
|
1414
1050
|
}
|
|
1415
1051
|
|
|
@@ -1531,11 +1167,4 @@
|
|
|
1531
1167
|
.config-form__button--external:active {
|
|
1532
1168
|
transform: translateY(0);
|
|
1533
1169
|
}
|
|
1534
|
-
|
|
1535
|
-
.config-form__button--external:focus-visible {
|
|
1536
|
-
outline: none;
|
|
1537
|
-
box-shadow:
|
|
1538
|
-
0 0 0 3px rgba(99, 102, 241, 0.4),
|
|
1539
|
-
0 4px 12px rgba(99, 102, 241, 0.35);
|
|
1540
|
-
}
|
|
1541
1170
|
</style>
|