@flowdrop/flowdrop 2.0.0-beta.1 → 2.0.0-beta.11
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 +210 -0
- package/MIGRATION-2.0.md +173 -3
- package/README.md +5 -5
- package/dist/adapters/WorkflowAdapter.js +4 -5
- package/dist/adapters/agentspec/AgentSpecAdapter.js +3 -3
- package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
- package/dist/api/enhanced-client.js +6 -11
- package/dist/chat/batchFeedback.js +1 -1
- package/dist/chat/commandClassifier.d.ts +11 -0
- package/dist/chat/commandClassifier.js +20 -0
- package/dist/chat/historyBuilder.d.ts +39 -0
- package/dist/chat/historyBuilder.js +82 -0
- package/dist/chat/index.d.ts +2 -1
- package/dist/chat/index.js +2 -1
- package/dist/chat/responseParser.js +16 -12
- package/dist/commands/executor.js +51 -26
- package/dist/commands/parser.d.ts +12 -0
- package/dist/commands/parser.js +33 -6
- package/dist/commands/storeIntegration.svelte.js +11 -1
- package/dist/commands/types.js +5 -5
- package/dist/components/App.svelte +547 -386
- package/dist/components/App.svelte.d.ts +16 -8
- 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 +194 -565
- package/dist/components/ConfigForm.svelte.d.ts +24 -7
- package/dist/components/ConfigModal.svelte +9 -1
- package/dist/components/ConfigPanel.svelte +234 -15
- package/dist/components/ConfigPanel.svelte.d.ts +6 -0
- 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 +17 -63
- package/dist/components/Navbar.svelte.d.ts +3 -0
- package/dist/components/NodeSidebar.svelte +21 -126
- package/dist/components/NodeSwapPicker.svelte +12 -30
- package/dist/components/PipelineStatus.svelte +6 -1
- package/dist/components/PipelineStatus.svelte.d.ts +3 -0
- package/dist/components/PortMappingRow.svelte +0 -2
- package/dist/components/SchemaForm.svelte +4 -14
- package/dist/components/Select.svelte +53 -0
- package/dist/components/Select.svelte.d.ts +15 -0
- package/dist/components/SettingsModal.svelte +0 -5
- package/dist/components/SettingsPanel.svelte +33 -6
- 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 +36 -4
- package/dist/components/UniversalNode.svelte.d.ts +1 -1
- package/dist/components/WorkflowEditor.svelte +71 -54
- package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
- package/dist/components/chat/AIChatPanel.svelte +49 -8
- package/dist/components/chat/CommandPreview.svelte +10 -1
- package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
- package/dist/components/console/ConsoleInput.svelte +3 -3
- package/dist/components/console/ConsoleOutput.svelte +2 -2
- package/dist/components/form/FormArray.svelte +37 -173
- package/dist/components/form/FormAutocomplete.svelte +18 -15
- package/dist/components/form/FormCheckboxGroup.svelte +1 -5
- package/dist/components/form/FormCodeEditor.svelte +9 -7
- package/dist/components/form/FormField.svelte +18 -42
- package/dist/components/form/FormFieldLight.svelte +52 -48
- package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
- package/dist/components/form/FormFieldset.svelte +45 -11
- package/dist/components/form/FormMarkdownEditor.svelte +8 -5
- package/dist/components/form/FormNumberField.svelte +4 -36
- package/dist/components/form/FormPorts.svelte +280 -0
- package/dist/components/form/FormPorts.svelte.d.ts +13 -0
- package/dist/components/form/FormRangeField.svelte +63 -30
- package/dist/components/form/FormSelect.svelte +13 -75
- package/dist/components/form/FormTemplateEditor.svelte +6 -4
- package/dist/components/form/FormTextField.svelte +3 -35
- package/dist/components/form/FormTextarea.svelte +4 -39
- package/dist/components/form/FormToggle.svelte +27 -6
- package/dist/components/form/FormToggle.svelte.d.ts +5 -0
- 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/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/InterruptBubble.svelte +11 -12
- package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
- package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
- package/dist/components/layouts/MainLayout.svelte +4 -5
- package/dist/components/nodes/AtomNode.svelte +62 -76
- package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
- package/dist/components/nodes/GatewayNode.svelte +117 -164
- package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
- package/dist/components/nodes/IdeaNode.svelte +72 -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 +59 -133
- package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
- package/dist/components/nodes/SquareNode.svelte +110 -164
- package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
- package/dist/components/nodes/TerminalNode.svelte +62 -124
- package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
- package/dist/components/nodes/ToolNode.svelte +92 -103
- package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
- package/dist/components/nodes/WorkflowNode.svelte +132 -191
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
- package/dist/components/playground/ChatInput.svelte +316 -27
- package/dist/components/playground/ChatInput.svelte.d.ts +31 -1
- package/dist/components/playground/ControlPanel.svelte +22 -0
- package/dist/components/playground/ControlPanel.svelte.d.ts +13 -0
- package/dist/components/playground/InputCollector.svelte +11 -48
- package/dist/components/playground/PipelineKanbanView.svelte +6 -4
- package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
- package/dist/components/playground/PipelinePanel.svelte +20 -3
- package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
- package/dist/components/playground/PipelineTableView.svelte +6 -4
- package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
- package/dist/components/playground/Playground.svelte +292 -28
- package/dist/components/playground/Playground.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundApp.svelte +6 -1
- package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundModal.svelte +5 -0
- package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
- package/dist/components/playground/PlaygroundStudio.svelte +7 -6
- package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
- package/dist/components/playground/pipelineViewUtils.svelte.d.ts +2 -1
- package/dist/components/playground/pipelineViewUtils.svelte.js +2 -2
- 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 +71 -1
- package/dist/config/endpoints.js +46 -5
- package/dist/core/index.d.ts +2 -3
- package/dist/core/index.js +2 -6
- package/dist/display/index.d.ts +6 -1
- package/dist/display/index.js +9 -1
- package/dist/editor/index.d.ts +1 -1
- package/dist/editor/index.js +1 -1
- package/dist/form/full.d.ts +2 -1
- package/dist/form/full.js +4 -1
- package/dist/form/index.d.ts +0 -1
- package/dist/form/index.js +3 -2
- package/dist/helpers/workflowEditorHelper.d.ts +4 -2
- package/dist/helpers/workflowEditorHelper.js +8 -8
- package/dist/messages/defaults.d.ts +98 -0
- package/dist/messages/defaults.js +58 -1
- package/dist/messages/index.d.ts +1 -1
- package/dist/messages/index.js +1 -1
- package/dist/openapi/v1/openapi.yaml +35 -23
- package/dist/playground/commands/args.d.ts +32 -0
- package/dist/playground/commands/args.js +50 -0
- package/dist/playground/commands/dispatch.d.ts +143 -0
- package/dist/playground/commands/dispatch.js +162 -0
- package/dist/playground/commands/index.d.ts +14 -0
- package/dist/playground/commands/index.js +10 -0
- package/dist/playground/commands/parser.d.ts +38 -0
- package/dist/playground/commands/parser.js +163 -0
- package/dist/playground/commands/registry.d.ts +42 -0
- package/dist/playground/commands/registry.js +122 -0
- package/dist/playground/commands/suggest.d.ts +37 -0
- package/dist/playground/commands/suggest.js +46 -0
- package/dist/playground/commands/types.d.ts +111 -0
- package/dist/playground/commands/types.js +15 -0
- package/dist/playground/index.d.ts +21 -2
- package/dist/playground/index.js +27 -2
- package/dist/playground/mount.d.ts +19 -5
- package/dist/playground/mount.js +16 -8
- package/dist/playground/runAction.d.ts +48 -0
- package/dist/playground/runAction.js +31 -0
- package/dist/registry/builtinNodeTypes.d.ts +53 -0
- package/dist/registry/builtinNodeTypes.js +67 -0
- package/dist/registry/builtinNodes.d.ts +2 -39
- package/dist/registry/builtinNodes.js +6 -53
- package/dist/registry/nodeComponentRegistry.d.ts +2 -1
- package/dist/schemas/v1/workflow.schema.json +16 -14
- package/dist/services/agentSpecExecutionService.d.ts +0 -2
- package/dist/services/agentSpecExecutionService.js +0 -2
- package/dist/services/apiVariableService.js +12 -26
- package/dist/services/categoriesApi.js +3 -6
- package/dist/services/chatService.d.ts +4 -3
- package/dist/services/chatService.js +13 -18
- package/dist/services/dynamicSchemaService.d.ts +31 -4
- package/dist/services/dynamicSchemaService.js +62 -33
- package/dist/services/historyService.d.ts +30 -8
- package/dist/services/historyService.js +51 -15
- package/dist/services/interruptService.d.ts +7 -6
- package/dist/services/interruptService.js +19 -21
- package/dist/services/pipelineSignalService.d.ts +97 -0
- package/dist/services/pipelineSignalService.js +94 -0
- package/dist/services/playgroundService.d.ts +21 -8
- package/dist/services/playgroundService.js +45 -25
- 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/workflowLaunchService.d.ts +74 -0
- package/dist/services/workflowLaunchService.js +74 -0
- 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 +11 -0
- package/dist/stores/apiContext.js +15 -0
- package/dist/stores/categoriesStore.svelte.js +0 -1
- package/dist/stores/historyStore.svelte.d.ts +17 -3
- package/dist/stores/historyStore.svelte.js +30 -3
- package/dist/stores/instanceContainer.svelte.js +5 -0
- package/dist/stores/playgroundStore.svelte.js +1 -3
- package/dist/stores/settingsStore.svelte.d.ts +13 -0
- package/dist/stores/settingsStore.svelte.js +32 -0
- package/dist/stores/workflowStore.svelte.d.ts +42 -5
- package/dist/stores/workflowStore.svelte.js +109 -32
- package/dist/styles/base.css +285 -14
- package/dist/styles/tokens.css +60 -2
- package/dist/svelte-app.d.ts +18 -1
- package/dist/svelte-app.js +75 -110
- 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/chat.d.ts +5 -1
- package/dist/types/events.d.ts +18 -0
- package/dist/types/events.js +2 -1
- package/dist/types/index.d.ts +84 -29
- package/dist/types/index.js +0 -1
- package/dist/types/settings.d.ts +28 -1
- package/dist/types/settings.js +6 -3
- 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/canvasSelection.d.ts +25 -0
- package/dist/utils/canvasSelection.js +37 -0
- package/dist/utils/colors.d.ts +27 -0
- package/dist/utils/colors.js +23 -0
- package/dist/utils/connections.js +20 -56
- 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/nodeFormSchema.d.ts +51 -0
- package/dist/utils/nodeFormSchema.js +87 -0
- package/dist/utils/nodeIds.d.ts +1 -1
- package/dist/utils/nodeIds.js +1 -1
- package/dist/utils/nodeSwap.js +3 -6
- package/dist/utils/nodeTypes.js +1 -1
- 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 +2 -1
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
Features:
|
|
8
8
|
- Dynamic form generation from JSON Schema using modular form components
|
|
9
|
-
-
|
|
9
|
+
- Node-level settings the editor contributes for every node (port order +
|
|
10
|
+
exposure), rendered even when the node type declares no config schema
|
|
10
11
|
- Extensible architecture for complex schema types (array, object)
|
|
11
12
|
- Admin/Edit support for external configuration links and dynamic schema fetching
|
|
12
13
|
|
|
@@ -24,21 +25,20 @@
|
|
|
24
25
|
ConfigSchema,
|
|
25
26
|
WorkflowNode,
|
|
26
27
|
WorkflowEdge,
|
|
27
|
-
NodeUIExtensions,
|
|
28
|
-
NodePort,
|
|
29
|
-
DynamicPort,
|
|
30
28
|
ConfigEditOptions,
|
|
31
29
|
AuthProvider
|
|
32
30
|
} from '../types/index.js';
|
|
33
|
-
import { dynamicPortToNodePort } from '../types/index.js';
|
|
34
31
|
import type { UISchemaElement } from '../types/uischema.js';
|
|
35
|
-
|
|
32
|
+
// Import the light, registry-based field factory and light fields directly
|
|
33
|
+
// (not via the form barrel, which aggregates the heavy CodeMirror editors).
|
|
34
|
+
import FormField from './form/FormFieldLight.svelte';
|
|
36
35
|
import FormUISchemaRenderer from './form/FormUISchemaRenderer.svelte';
|
|
37
|
-
import type { FieldSchema } from './form/
|
|
36
|
+
import type { FieldSchema } from './form/types.js';
|
|
38
37
|
import {
|
|
39
38
|
getEffectiveConfigEditOptions,
|
|
40
39
|
fetchDynamicSchema,
|
|
41
40
|
resolveExternalEditUrl,
|
|
41
|
+
resolveDynamicSchemaKey,
|
|
42
42
|
invalidateSchemaCache,
|
|
43
43
|
type DynamicSchemaResult
|
|
44
44
|
} from '../services/dynamicSchemaService.js';
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
import { provideInstance } from '../stores/getInstance.svelte.js';
|
|
47
47
|
import { getAvailableVariables } from '../services/variableService.js';
|
|
48
48
|
import { logger } from '../utils/logger.js';
|
|
49
|
-
import { getDataTypeColorToken, getPortBackgroundColor } from '../utils/colors.js';
|
|
50
|
-
import { applyPortOrder } from '../utils/portUtils.js';
|
|
51
49
|
import { mergeWithDefaults, cascadeClearAutocompleteDependents } from '../utils/formMerge.js';
|
|
50
|
+
import { applyFetchedSchema } from '../utils/schemaMerge.js';
|
|
51
|
+
import { PORTS_CONFIG_KEY, withPortsControl, withPortsField } from '../utils/nodeFormSchema.js';
|
|
52
52
|
|
|
53
53
|
interface Props {
|
|
54
54
|
/** Optional workflow node (if provided, schema and values are derived from it) */
|
|
@@ -64,8 +64,6 @@
|
|
|
64
64
|
uiSchema?: UISchemaElement;
|
|
65
65
|
/** Direct config values (used when node is not provided) */
|
|
66
66
|
values?: Record<string, unknown>;
|
|
67
|
-
/** Whether to show UI extension settings section */
|
|
68
|
-
showUIExtensions?: boolean;
|
|
69
67
|
/** Optional workflow ID for context in external links */
|
|
70
68
|
workflowId?: string;
|
|
71
69
|
/** Whether to also save the workflow when saving config */
|
|
@@ -82,10 +80,29 @@
|
|
|
82
80
|
workflowEdges?: WorkflowEdge[];
|
|
83
81
|
/** Auth provider for API requests (used for template variable API mode) */
|
|
84
82
|
authProvider?: AuthProvider;
|
|
85
|
-
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
/**
|
|
84
|
+
* How edits are committed to the parent via `onChange`:
|
|
85
|
+
* - `'blur'` (default): committed on focus-out. Discrete controls
|
|
86
|
+
* (checkbox/enum) additionally commit immediately, because WebKit doesn't
|
|
87
|
+
* focus them on click so no focus-out fires (see handleFieldChange).
|
|
88
|
+
* - `'live'`: committed on every change, with the edited `fieldKey` in the
|
|
89
|
+
* `onChange` meta, plus a final `{ commit: true }` on focus-out. Lets the
|
|
90
|
+
* parent coalesce a field-editing session into one undo step without
|
|
91
|
+
* depending on focus events at all.
|
|
92
|
+
*/
|
|
93
|
+
commitMode?: 'blur' | 'live';
|
|
94
|
+
/**
|
|
95
|
+
* Callback when field values change.
|
|
96
|
+
* @param config - The current merged config values.
|
|
97
|
+
* @param meta - `fieldKey` names the changed field (live mode); `commit`
|
|
98
|
+
* marks the end-of-session flush fired on focus-out (live mode).
|
|
99
|
+
*/
|
|
100
|
+
onChange?: (
|
|
101
|
+
config: Record<string, unknown>,
|
|
102
|
+
meta?: { fieldKey?: string; commit?: boolean }
|
|
103
|
+
) => void;
|
|
104
|
+
/** Callback when form is saved */
|
|
105
|
+
onSave?: (config: Record<string, unknown>) => void;
|
|
89
106
|
/** Callback when form is cancelled */
|
|
90
107
|
onCancel?: () => void;
|
|
91
108
|
}
|
|
@@ -95,12 +112,12 @@
|
|
|
95
112
|
schema,
|
|
96
113
|
uiSchema,
|
|
97
114
|
values,
|
|
98
|
-
showUIExtensions = true,
|
|
99
115
|
workflowId,
|
|
100
116
|
saveWorkflowWhenSavingConfig = false,
|
|
101
117
|
workflowNodes = [],
|
|
102
118
|
workflowEdges = [],
|
|
103
119
|
authProvider,
|
|
120
|
+
commitMode = 'blur',
|
|
104
121
|
onChange,
|
|
105
122
|
onSave,
|
|
106
123
|
onCancel
|
|
@@ -115,7 +132,6 @@
|
|
|
115
132
|
// instance on the server (no cross-request leakage); no destroy here for the
|
|
116
133
|
// same reasons as SchemaForm (shared/default in the browser, no SSR teardown).
|
|
117
134
|
const fd = provideInstance();
|
|
118
|
-
const checker = fd.portCompatibility;
|
|
119
135
|
|
|
120
136
|
// Set context for child components (e.g., FormAutocomplete)
|
|
121
137
|
// Use getter functions to ensure child components always get the current prop value,
|
|
@@ -128,6 +144,9 @@
|
|
|
128
144
|
let dynamicSchemaLoading = $state(false);
|
|
129
145
|
let dynamicSchemaError = $state<string | null>(null);
|
|
130
146
|
let fetchedDynamicSchema = $state<ConfigSchema | null>(null);
|
|
147
|
+
// A uiSchema the endpoint returned alongside the schema (server-hydrated
|
|
148
|
+
// forms). Held next to fetchedDynamicSchema and cleared in lockstep with it.
|
|
149
|
+
let fetchedDynamicUiSchema = $state<UISchemaElement | null>(null);
|
|
131
150
|
|
|
132
151
|
/**
|
|
133
152
|
* Get the admin edit configuration for the node
|
|
@@ -158,42 +177,99 @@
|
|
|
158
177
|
});
|
|
159
178
|
|
|
160
179
|
/**
|
|
161
|
-
*
|
|
180
|
+
* The node type's own configuration schema: direct prop, node metadata, or a
|
|
181
|
+
* dynamically fetched one layered on top.
|
|
162
182
|
* Priority: fetchedDynamicSchema > direct schema prop > node metadata configSchema
|
|
163
183
|
*/
|
|
164
|
-
const
|
|
165
|
-
|
|
184
|
+
const typeConfigSchema = $derived.by<ConfigSchema | undefined>(() => {
|
|
185
|
+
const staticSchema = schema ?? (node?.data.metadata?.configSchema as ConfigSchema | undefined);
|
|
186
|
+
// A fetched dynamic schema is layered onto the static one per the endpoint's
|
|
187
|
+
// mergeStrategy/target (default 'replace' → fetched wins wholesale). With no
|
|
188
|
+
// static schema, the fetched schema is the form.
|
|
166
189
|
if (fetchedDynamicSchema) {
|
|
167
|
-
|
|
190
|
+
const endpoint = configEditOptions?.dynamicSchema;
|
|
191
|
+
return endpoint
|
|
192
|
+
? applyFetchedSchema(staticSchema, fetchedDynamicSchema, endpoint)
|
|
193
|
+
: fetchedDynamicSchema;
|
|
168
194
|
}
|
|
169
|
-
|
|
170
|
-
return schema ?? (node?.data.metadata?.configSchema as ConfigSchema | undefined);
|
|
195
|
+
return staticSchema;
|
|
171
196
|
});
|
|
172
197
|
|
|
173
198
|
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
199
|
+
* The schema the form actually renders: the node type's, plus the node-level
|
|
200
|
+
* fields the editor contributes for every node (the reserved `ports` widget).
|
|
201
|
+
*
|
|
202
|
+
* The injection is what keeps a node type that declares no `configSchema` from
|
|
203
|
+
* falling through to the empty state and losing its node-level settings with
|
|
204
|
+
* it (#34) — it now has a schema of exactly those settings. Purely a display
|
|
205
|
+
* concern: nothing is written to the node until the user edits a field.
|
|
206
|
+
*/
|
|
207
|
+
const configSchema = $derived(withPortsField(typeConfigSchema, node));
|
|
208
|
+
|
|
209
|
+
/** Whether the ports field above was contributed by us rather than authored. */
|
|
210
|
+
const portsFieldInjected = $derived(
|
|
211
|
+
configSchema !== typeConfigSchema && configSchema?.properties?.[PORTS_CONFIG_KEY] !== undefined
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Get the UI schema for the active configSchema.
|
|
216
|
+
* Priority: direct uiSchema prop > fetched dynamic uiSchema > node metadata.
|
|
217
|
+
*
|
|
218
|
+
* When the dynamic fetch returned a uiSchema, it wins over the node's static
|
|
219
|
+
* metadata uiSchema: the static one references only the static schema's
|
|
220
|
+
* properties, so it can't lay out a server-provided (hydrated) schema — its
|
|
221
|
+
* controls would point at fields that aren't rendered while the fetched
|
|
222
|
+
* fields would have no controls at all. The endpoint is expected to return a
|
|
223
|
+
* uiSchema describing the schema it served.
|
|
176
224
|
*/
|
|
177
225
|
const configUISchema = $derived.by<UISchemaElement | undefined>(() => {
|
|
178
|
-
|
|
226
|
+
const authored = uiSchema
|
|
227
|
+
? uiSchema
|
|
228
|
+
: fetchedDynamicSchema && fetchedDynamicUiSchema
|
|
229
|
+
? fetchedDynamicUiSchema
|
|
230
|
+
: (node?.data.metadata?.uiSchema as UISchemaElement | undefined);
|
|
231
|
+
// An authored tree lists only the author's own controls, so the injected
|
|
232
|
+
// ports field needs a control of its own or it would never render.
|
|
233
|
+
return withPortsControl(authored, portsFieldInjected);
|
|
179
234
|
});
|
|
180
235
|
|
|
181
236
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
237
|
+
* Whether this node sources its schema dynamically: dynamic schema is
|
|
238
|
+
* configured and used, and it actually contributes to the form — either there
|
|
239
|
+
* is no static schema to fall back on, it is explicitly preferred, or it is
|
|
240
|
+
* configured to merge/target (in which case it layers onto the static schema
|
|
241
|
+
* rather than replacing it, so we fetch even when a static schema exists).
|
|
184
242
|
*/
|
|
185
|
-
const
|
|
186
|
-
if (!node) return false;
|
|
243
|
+
const wantsDynamicSchema = $derived.by(() => {
|
|
244
|
+
if (!node || !useDynamicSchema) return false;
|
|
245
|
+
const endpoint = configEditOptions?.dynamicSchema;
|
|
246
|
+
const layersOntoStatic = endpoint?.mergeStrategy === 'merge' || endpoint?.target != null;
|
|
187
247
|
const staticSchema = schema ?? node.data.metadata?.configSchema;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
248
|
+
return !staticSchema || configEditOptions?.preferDynamicSchema === true || layersOntoStatic;
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Resolved fetch key for the dynamic schema endpoint. Read from the committed
|
|
253
|
+
* `node.data.config` (not the in-flight `edits`/`configValues`), so it moves
|
|
254
|
+
* at the commit boundary: a field edit reaches it only once `handleFormBlur`
|
|
255
|
+
* fires `onChange` and the parent writes the value back onto the node. It
|
|
256
|
+
* therefore recomputes when a committed config value the endpoint's
|
|
257
|
+
* parameterMapping references changes (e.g. a trigger node's event_type),
|
|
258
|
+
* driving the auto-refetch effect below. Relies on `node` being a deep
|
|
259
|
+
* reactive proxy whose `.data.config` is mutated in place; a replaced node or
|
|
260
|
+
* a plain snapshot would not re-run this derived.
|
|
261
|
+
*/
|
|
262
|
+
const dynamicSchemaKey = $derived.by<string | null>(() => {
|
|
263
|
+
if (!node || !configEditOptions?.dynamicSchema || !wantsDynamicSchema) return null;
|
|
264
|
+
return resolveDynamicSchemaKey(configEditOptions.dynamicSchema, node, workflowId);
|
|
195
265
|
});
|
|
196
266
|
|
|
267
|
+
/**
|
|
268
|
+
* Key of the schema currently loaded or in flight. Guards the effect from
|
|
269
|
+
* re-fetching a schema whose inputs have not changed.
|
|
270
|
+
*/
|
|
271
|
+
let loadedSchemaKey = $state<string | null>(null);
|
|
272
|
+
|
|
197
273
|
/**
|
|
198
274
|
* Get the current configuration from node or direct prop
|
|
199
275
|
*/
|
|
@@ -230,49 +306,6 @@
|
|
|
230
306
|
*/
|
|
231
307
|
let isSavingWorkflow = $state(false);
|
|
232
308
|
|
|
233
|
-
/**
|
|
234
|
-
* Get initial UI extensions from node (instance level overrides type level)
|
|
235
|
-
*/
|
|
236
|
-
const initialUIExtensions = $derived.by<NodeUIExtensions>(() => {
|
|
237
|
-
if (!node) return {};
|
|
238
|
-
// Merge type-level defaults with instance-level overrides
|
|
239
|
-
const typeDefaults = node.data.metadata?.extensions?.ui ?? {};
|
|
240
|
-
const instanceOverrides = node.data.extensions?.ui ?? {};
|
|
241
|
-
return { ...typeDefaults, ...instanceOverrides };
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
/**
|
|
245
|
-
* UI Extension values for display settings.
|
|
246
|
-
* Writable derived: recomputes from the node when it changes (covering both
|
|
247
|
-
* "different node opened" and the post-save round-trip through node.data),
|
|
248
|
-
* while local port-management edits overwrite it wholesale via reassignment.
|
|
249
|
-
* NOTE: the derived value is not a deep $state proxy — update it only by
|
|
250
|
-
* reassigning the whole object, never by mutating a property.
|
|
251
|
-
*/
|
|
252
|
-
let uiExtensionValues = $derived.by<NodeUIExtensions>(() => ({
|
|
253
|
-
hideUnconnectedHandles: initialUIExtensions.hideUnconnectedHandles ?? false,
|
|
254
|
-
portOrder: initialUIExtensions.portOrder
|
|
255
|
-
? {
|
|
256
|
-
inputs: initialUIExtensions.portOrder.inputs
|
|
257
|
-
? [...initialUIExtensions.portOrder.inputs]
|
|
258
|
-
: undefined,
|
|
259
|
-
outputs: initialUIExtensions.portOrder.outputs
|
|
260
|
-
? [...initialUIExtensions.portOrder.outputs]
|
|
261
|
-
: undefined
|
|
262
|
-
}
|
|
263
|
-
: undefined,
|
|
264
|
-
hiddenPorts: initialUIExtensions.hiddenPorts
|
|
265
|
-
? {
|
|
266
|
-
inputs: initialUIExtensions.hiddenPorts.inputs
|
|
267
|
-
? [...initialUIExtensions.hiddenPorts.inputs]
|
|
268
|
-
: undefined,
|
|
269
|
-
outputs: initialUIExtensions.hiddenPorts.outputs
|
|
270
|
-
? [...initialUIExtensions.hiddenPorts.outputs]
|
|
271
|
-
: undefined
|
|
272
|
-
}
|
|
273
|
-
: undefined
|
|
274
|
-
}));
|
|
275
|
-
|
|
276
309
|
/**
|
|
277
310
|
* Fetch dynamic schema when needed
|
|
278
311
|
*/
|
|
@@ -292,6 +325,7 @@
|
|
|
292
325
|
|
|
293
326
|
if (result.success && result.schema) {
|
|
294
327
|
fetchedDynamicSchema = result.schema;
|
|
328
|
+
fetchedDynamicUiSchema = result.uiSchema ?? null;
|
|
295
329
|
} else {
|
|
296
330
|
dynamicSchemaError =
|
|
297
331
|
result.error ?? configEditOptions.errorMessage ?? 'Failed to load configuration schema';
|
|
@@ -313,8 +347,9 @@
|
|
|
313
347
|
if (!node || !configEditOptions?.dynamicSchema) return;
|
|
314
348
|
|
|
315
349
|
// Invalidate the cache first
|
|
316
|
-
invalidateSchemaCache(node, configEditOptions.dynamicSchema);
|
|
350
|
+
invalidateSchemaCache(node, configEditOptions.dynamicSchema, workflowId);
|
|
317
351
|
fetchedDynamicSchema = null;
|
|
352
|
+
fetchedDynamicUiSchema = null;
|
|
318
353
|
|
|
319
354
|
// Reload the schema
|
|
320
355
|
await loadDynamicSchema();
|
|
@@ -345,94 +380,33 @@
|
|
|
345
380
|
}
|
|
346
381
|
|
|
347
382
|
/**
|
|
348
|
-
*
|
|
383
|
+
* Load — and reload — the dynamic schema when its resolved key changes.
|
|
384
|
+
*
|
|
385
|
+
* Covers both the initial fetch (loadedSchemaKey starts null) and refetching
|
|
386
|
+
* after a config value the endpoint depends on changes (e.g. picking a
|
|
387
|
+
* different trigger event_type). A load already in flight is left to finish;
|
|
388
|
+
* the effect re-runs when it settles and picks up any newer key then.
|
|
389
|
+
*
|
|
390
|
+
* The `dynamicSchemaLoading` read is load-bearing in both directions: it
|
|
391
|
+
* guards against re-entering while a fetch is in flight, AND — because it is
|
|
392
|
+
* a tracked read — flipping back to false on settle is what re-runs this
|
|
393
|
+
* effect to pick up a newer key. Don't hoist or drop it; the settle-and-
|
|
394
|
+
* refetch depends on it.
|
|
395
|
+
*
|
|
396
|
+
* loadedSchemaKey is set BEFORE the fetch (not after success) on purpose: a
|
|
397
|
+
* failed load consumes the key so a persistent error can't loop the effect
|
|
398
|
+
* into a refetch storm. Recovery from an error is manual, via
|
|
399
|
+
* refreshDynamicSchema().
|
|
349
400
|
*/
|
|
350
401
|
$effect(() => {
|
|
351
|
-
|
|
352
|
-
|
|
402
|
+
const key = dynamicSchemaKey;
|
|
403
|
+
if (key === null || key === loadedSchemaKey || dynamicSchemaLoading) {
|
|
404
|
+
return;
|
|
353
405
|
}
|
|
406
|
+
loadedSchemaKey = key;
|
|
407
|
+
loadDynamicSchema();
|
|
354
408
|
});
|
|
355
409
|
|
|
356
|
-
/**
|
|
357
|
-
* All input ports in current display order for the port management UI.
|
|
358
|
-
* Combines static metadata inputs + dynamic config inputs, sorted by portOrder.
|
|
359
|
-
*/
|
|
360
|
-
const allInputPortsForUI = $derived.by<NodePort[]>(() => {
|
|
361
|
-
if (!node) return [];
|
|
362
|
-
const staticInputs = node.data.metadata.inputs ?? [];
|
|
363
|
-
const dynInputs = ((node.data.config?.dynamicInputs as DynamicPort[]) || []).map((p) =>
|
|
364
|
-
dynamicPortToNodePort(p, 'input')
|
|
365
|
-
);
|
|
366
|
-
return applyPortOrder([...staticInputs, ...dynInputs], uiExtensionValues.portOrder?.inputs);
|
|
367
|
-
});
|
|
368
|
-
|
|
369
|
-
/**
|
|
370
|
-
* All output ports in current display order for the port management UI.
|
|
371
|
-
* Combines static metadata outputs + dynamic config outputs, sorted by portOrder.
|
|
372
|
-
*/
|
|
373
|
-
const allOutputPortsForUI = $derived.by<NodePort[]>(() => {
|
|
374
|
-
if (!node) return [];
|
|
375
|
-
const staticOutputs = node.data.metadata.outputs ?? [];
|
|
376
|
-
const dynOutputs = ((node.data.config?.dynamicOutputs as DynamicPort[]) || []).map((p) =>
|
|
377
|
-
dynamicPortToNodePort(p, 'output')
|
|
378
|
-
);
|
|
379
|
-
return applyPortOrder([...staticOutputs, ...dynOutputs], uiExtensionValues.portOrder?.outputs);
|
|
380
|
-
});
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Move a port one position up or down in the display order.
|
|
384
|
-
*/
|
|
385
|
-
function movePort(direction: 'inputs' | 'outputs', portId: string, delta: -1 | 1): void {
|
|
386
|
-
const list = direction === 'inputs' ? allInputPortsForUI : allOutputPortsForUI;
|
|
387
|
-
const idx = list.findIndex((p) => p.id === portId);
|
|
388
|
-
if (idx === -1) return;
|
|
389
|
-
const newIdx = idx + delta;
|
|
390
|
-
if (newIdx < 0 || newIdx >= list.length) return;
|
|
391
|
-
const newOrder = list.map((p) => p.id);
|
|
392
|
-
[newOrder[idx], newOrder[newIdx]] = [newOrder[newIdx], newOrder[idx]];
|
|
393
|
-
uiExtensionValues = {
|
|
394
|
-
...uiExtensionValues,
|
|
395
|
-
portOrder: {
|
|
396
|
-
...uiExtensionValues.portOrder,
|
|
397
|
-
[direction]: newOrder
|
|
398
|
-
}
|
|
399
|
-
};
|
|
400
|
-
handleFormBlur();
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Toggle manual visibility of a port. Required ports cannot be hidden.
|
|
405
|
-
*/
|
|
406
|
-
function togglePortHidden(direction: 'inputs' | 'outputs', portId: string): void {
|
|
407
|
-
const current = uiExtensionValues.hiddenPorts?.[direction] ?? [];
|
|
408
|
-
const isHidden = current.includes(portId);
|
|
409
|
-
const next = isHidden ? current.filter((id) => id !== portId) : [...current, portId];
|
|
410
|
-
uiExtensionValues = {
|
|
411
|
-
...uiExtensionValues,
|
|
412
|
-
hiddenPorts: {
|
|
413
|
-
...uiExtensionValues.hiddenPorts,
|
|
414
|
-
[direction]: next.length > 0 ? next : undefined
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
handleFormBlur();
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
/**
|
|
421
|
-
* Reset all port customizations (order + hidden) for a direction back to defaults.
|
|
422
|
-
*/
|
|
423
|
-
function resetPortCustomizations(direction: 'inputs' | 'outputs'): void {
|
|
424
|
-
const order = { ...uiExtensionValues.portOrder };
|
|
425
|
-
const hidden = { ...uiExtensionValues.hiddenPorts };
|
|
426
|
-
delete order[direction];
|
|
427
|
-
delete hidden[direction];
|
|
428
|
-
uiExtensionValues = {
|
|
429
|
-
...uiExtensionValues,
|
|
430
|
-
portOrder: Object.keys(order).length > 0 ? order : undefined,
|
|
431
|
-
hiddenPorts: Object.keys(hidden).length > 0 ? hidden : undefined
|
|
432
|
-
};
|
|
433
|
-
handleFormBlur();
|
|
434
|
-
}
|
|
435
|
-
|
|
436
410
|
/**
|
|
437
411
|
* Check if a field is required based on schema
|
|
438
412
|
*/
|
|
@@ -458,34 +432,70 @@
|
|
|
458
432
|
for (const [depKey, depValue] of Object.entries(dependents)) {
|
|
459
433
|
edits[depKey] = depValue;
|
|
460
434
|
}
|
|
435
|
+
|
|
436
|
+
if (commitMode === 'live') {
|
|
437
|
+
// Commit every change, tagging the field so the parent can coalesce a
|
|
438
|
+
// whole field-editing session into one undo step. Nothing depends on a
|
|
439
|
+
// focus event, so WebKit not focusing checkboxes/selects on click (#38)
|
|
440
|
+
// is a non-issue. Keep the edits buffer until the session ends (blur) so
|
|
441
|
+
// fast typing never briefly reverts on the parent's value round-trip.
|
|
442
|
+
commitEdits({ fieldKey: key }, false);
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
// Blur mode: text/number fields commit on focus-out (one store write per
|
|
447
|
+
// field, not per keystroke). Discrete controls (checkbox/toggle, enum)
|
|
448
|
+
// commit immediately — WebKit doesn't focus them on click, so no focus-out
|
|
449
|
+
// ever fires and the edit would otherwise be lost on save (#38).
|
|
450
|
+
const prop = configSchema?.properties?.[key];
|
|
451
|
+
if (prop && (prop.type === 'boolean' || Array.isArray(prop.enum))) {
|
|
452
|
+
commitEdits();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Emit the current merged config to the parent.
|
|
458
|
+
*
|
|
459
|
+
* @param meta - Passed through to `onChange` (live mode: `fieldKey` /
|
|
460
|
+
* `commit`).
|
|
461
|
+
* @param clearBuffer - Discharge the local `edits` buffer after emitting, so
|
|
462
|
+
* subsequent prop changes (parent absorbing the commit, undo/redo,
|
|
463
|
+
* collaboration) flow through `initialConfig` cleanly instead of being
|
|
464
|
+
* shadowed by a stale local edit. Done at every commit boundary in blur
|
|
465
|
+
* mode, but only at session end (blur) in live mode.
|
|
466
|
+
*/
|
|
467
|
+
function commitEdits(meta?: { fieldKey?: string; commit?: boolean }, clearBuffer = true): void {
|
|
468
|
+
if (!onChange) return;
|
|
469
|
+
// Spread `initialConfig` first so config keys the active schema doesn't own
|
|
470
|
+
// (e.g. after a dynamic schema narrows the field set) pass through untouched
|
|
471
|
+
// instead of being silently dropped; `configValues` then wins for every
|
|
472
|
+
// field the schema actually renders.
|
|
473
|
+
onChange({ ...initialConfig, ...configValues }, meta);
|
|
474
|
+
if (clearBuffer) edits = {};
|
|
461
475
|
}
|
|
462
476
|
|
|
463
477
|
/**
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
478
|
+
* Focus-out handler (bubbles from child fields).
|
|
479
|
+
*
|
|
480
|
+
* Blur mode: the primary commit. Live mode: edits are already committed per
|
|
481
|
+
* change, so this just signals end-of-session (`commit: true`) so the parent
|
|
482
|
+
* can finalize the coalesced undo step, and discharges the edits buffer.
|
|
467
483
|
*/
|
|
468
484
|
function handleFormBlur(): void {
|
|
469
|
-
|
|
470
|
-
const extensions = showUIExtensions && node ? uiExtensionValues : undefined;
|
|
471
|
-
onChange({ ...configValues }, extensions);
|
|
472
|
-
// Discharge the edits buffer at the commit boundary. Subsequent prop
|
|
473
|
-
// changes (parent absorbing the commit, undo/redo, collaboration) then
|
|
474
|
-
// flow through `initialConfig` cleanly instead of being shadowed by a
|
|
475
|
-
// stale local edit.
|
|
476
|
-
edits = {};
|
|
477
|
-
}
|
|
485
|
+
commitEdits(commitMode === 'live' ? { commit: true } : undefined);
|
|
478
486
|
}
|
|
479
487
|
|
|
480
488
|
/**
|
|
481
489
|
* Handle form submission
|
|
482
|
-
* Collects
|
|
483
|
-
* Optionally saves the workflow if the option is enabled
|
|
490
|
+
* Collects config values and optionally saves the workflow.
|
|
484
491
|
*/
|
|
485
492
|
async function handleSave(): Promise<void> {
|
|
486
|
-
// Collect all form values including hidden fields
|
|
493
|
+
// Collect all form values including hidden fields. Start from
|
|
494
|
+
// `initialConfig` so keys the active schema doesn't own survive the save
|
|
495
|
+
// (see handleFormBlur); `configValues` and the DOM scrape below then take
|
|
496
|
+
// precedence for every field the schema renders.
|
|
487
497
|
const form = document.querySelector('.config-form');
|
|
488
|
-
const updatedConfig: Record<string, unknown> = { ...configValues };
|
|
498
|
+
const updatedConfig: Record<string, unknown> = { ...initialConfig, ...configValues };
|
|
489
499
|
|
|
490
500
|
if (form) {
|
|
491
501
|
const inputs = form.querySelectorAll('input, select, textarea');
|
|
@@ -527,13 +537,8 @@
|
|
|
527
537
|
);
|
|
528
538
|
}
|
|
529
539
|
|
|
530
|
-
// Pass UI extensions only if enabled
|
|
531
540
|
if (onSave) {
|
|
532
|
-
|
|
533
|
-
onSave(updatedConfig, uiExtensionValues);
|
|
534
|
-
} else {
|
|
535
|
-
onSave(updatedConfig);
|
|
536
|
-
}
|
|
541
|
+
onSave(updatedConfig);
|
|
537
542
|
}
|
|
538
543
|
|
|
539
544
|
// Save workflow if the option is enabled
|
|
@@ -750,192 +755,6 @@
|
|
|
750
755
|
</div>
|
|
751
756
|
{/if}
|
|
752
757
|
|
|
753
|
-
<!-- UI Extensions Section -->
|
|
754
|
-
{#if showUIExtensions && node}
|
|
755
|
-
<div class="config-form__extensions">
|
|
756
|
-
<div class="config-form__extensions-header">
|
|
757
|
-
<Icon icon="heroicons:adjustments-horizontal" class="config-form__extensions-icon" />
|
|
758
|
-
<span>Display Settings</span>
|
|
759
|
-
</div>
|
|
760
|
-
<div class="config-form__extensions-content">
|
|
761
|
-
<!-- Hide Unconnected Handles Toggle -->
|
|
762
|
-
<FormFieldWrapper
|
|
763
|
-
id="ext-hideUnconnectedHandles"
|
|
764
|
-
label="Hide Unconnected Ports"
|
|
765
|
-
description="Hide input and output ports that are not connected to reduce visual clutter"
|
|
766
|
-
>
|
|
767
|
-
<FormToggle
|
|
768
|
-
id="ext-hideUnconnectedHandles"
|
|
769
|
-
value={Boolean(uiExtensionValues.hideUnconnectedHandles)}
|
|
770
|
-
onLabel="Hidden"
|
|
771
|
-
offLabel="Visible"
|
|
772
|
-
ariaDescribedBy="ext-hideUnconnectedHandles-description"
|
|
773
|
-
onChange={(val) => {
|
|
774
|
-
uiExtensionValues = { ...uiExtensionValues, hideUnconnectedHandles: val };
|
|
775
|
-
handleFormBlur();
|
|
776
|
-
}}
|
|
777
|
-
/>
|
|
778
|
-
</FormFieldWrapper>
|
|
779
|
-
|
|
780
|
-
<!-- Input Port Order & Visibility -->
|
|
781
|
-
{#if allInputPortsForUI.length > 0}
|
|
782
|
-
<div class="config-form__port-order">
|
|
783
|
-
<div class="config-form__port-order-header">
|
|
784
|
-
<span class="config-form__port-order-label">Input Ports</span>
|
|
785
|
-
{#if uiExtensionValues.portOrder?.inputs?.length || uiExtensionValues.hiddenPorts?.inputs?.length}
|
|
786
|
-
<button
|
|
787
|
-
type="button"
|
|
788
|
-
class="config-form__port-order-reset"
|
|
789
|
-
onclick={() => resetPortCustomizations('inputs')}
|
|
790
|
-
title="Reset to default order and visibility"
|
|
791
|
-
>
|
|
792
|
-
<Icon icon="heroicons:arrow-uturn-left" />
|
|
793
|
-
Reset
|
|
794
|
-
</button>
|
|
795
|
-
{/if}
|
|
796
|
-
</div>
|
|
797
|
-
<ul class="config-form__port-order-list">
|
|
798
|
-
{#each allInputPortsForUI as port, i (port.id)}
|
|
799
|
-
{@const isHidden =
|
|
800
|
-
uiExtensionValues.hiddenPorts?.inputs?.includes(port.id) ?? false}
|
|
801
|
-
{@const isRequired = port.required ?? false}
|
|
802
|
-
<li
|
|
803
|
-
class="config-form__port-order-item"
|
|
804
|
-
class:config-form__port-order-item--hidden={isHidden}
|
|
805
|
-
>
|
|
806
|
-
<span class="config-form__port-order-name">{port.name}</span>
|
|
807
|
-
<span
|
|
808
|
-
class="config-form__port-order-badge"
|
|
809
|
-
style="background-color:{getPortBackgroundColor(
|
|
810
|
-
checker,
|
|
811
|
-
port.dataType,
|
|
812
|
-
15
|
|
813
|
-
)};color:{getDataTypeColorToken(
|
|
814
|
-
checker,
|
|
815
|
-
port.dataType
|
|
816
|
-
)};border:1px solid {getPortBackgroundColor(checker, port.dataType, 30)}"
|
|
817
|
-
>
|
|
818
|
-
{port.dataType}
|
|
819
|
-
</span>
|
|
820
|
-
<div class="config-form__port-order-actions">
|
|
821
|
-
<button
|
|
822
|
-
type="button"
|
|
823
|
-
disabled={isRequired}
|
|
824
|
-
title={isRequired
|
|
825
|
-
? 'Required ports cannot be hidden'
|
|
826
|
-
: isHidden
|
|
827
|
-
? 'Show port'
|
|
828
|
-
: 'Hide port'}
|
|
829
|
-
class:active={isHidden}
|
|
830
|
-
onclick={() => togglePortHidden('inputs', port.id)}
|
|
831
|
-
>
|
|
832
|
-
<Icon icon={isHidden ? 'heroicons:eye-slash' : 'heroicons:eye'} />
|
|
833
|
-
</button>
|
|
834
|
-
<button
|
|
835
|
-
type="button"
|
|
836
|
-
disabled={i === 0 || allInputPortsForUI.length === 1}
|
|
837
|
-
onclick={() => movePort('inputs', port.id, -1)}
|
|
838
|
-
title="Move up"
|
|
839
|
-
>
|
|
840
|
-
<Icon icon="heroicons:chevron-up" />
|
|
841
|
-
</button>
|
|
842
|
-
<button
|
|
843
|
-
type="button"
|
|
844
|
-
disabled={i === allInputPortsForUI.length - 1 ||
|
|
845
|
-
allInputPortsForUI.length === 1}
|
|
846
|
-
onclick={() => movePort('inputs', port.id, 1)}
|
|
847
|
-
title="Move down"
|
|
848
|
-
>
|
|
849
|
-
<Icon icon="heroicons:chevron-down" />
|
|
850
|
-
</button>
|
|
851
|
-
</div>
|
|
852
|
-
</li>
|
|
853
|
-
{/each}
|
|
854
|
-
</ul>
|
|
855
|
-
</div>
|
|
856
|
-
{/if}
|
|
857
|
-
|
|
858
|
-
<!-- Output Port Order & Visibility -->
|
|
859
|
-
{#if allOutputPortsForUI.length > 0}
|
|
860
|
-
<div class="config-form__port-order">
|
|
861
|
-
<div class="config-form__port-order-header">
|
|
862
|
-
<span class="config-form__port-order-label">Output Ports</span>
|
|
863
|
-
{#if uiExtensionValues.portOrder?.outputs?.length || uiExtensionValues.hiddenPorts?.outputs?.length}
|
|
864
|
-
<button
|
|
865
|
-
type="button"
|
|
866
|
-
class="config-form__port-order-reset"
|
|
867
|
-
onclick={() => resetPortCustomizations('outputs')}
|
|
868
|
-
title="Reset to default order and visibility"
|
|
869
|
-
>
|
|
870
|
-
<Icon icon="heroicons:arrow-uturn-left" />
|
|
871
|
-
Reset
|
|
872
|
-
</button>
|
|
873
|
-
{/if}
|
|
874
|
-
</div>
|
|
875
|
-
<ul class="config-form__port-order-list">
|
|
876
|
-
{#each allOutputPortsForUI as port, i (port.id)}
|
|
877
|
-
{@const isHidden =
|
|
878
|
-
uiExtensionValues.hiddenPorts?.outputs?.includes(port.id) ?? false}
|
|
879
|
-
{@const isRequired = port.required ?? false}
|
|
880
|
-
<li
|
|
881
|
-
class="config-form__port-order-item"
|
|
882
|
-
class:config-form__port-order-item--hidden={isHidden}
|
|
883
|
-
>
|
|
884
|
-
<span class="config-form__port-order-name">{port.name}</span>
|
|
885
|
-
<span
|
|
886
|
-
class="config-form__port-order-badge"
|
|
887
|
-
style="background-color:{getPortBackgroundColor(
|
|
888
|
-
checker,
|
|
889
|
-
port.dataType,
|
|
890
|
-
15
|
|
891
|
-
)};color:{getDataTypeColorToken(
|
|
892
|
-
checker,
|
|
893
|
-
port.dataType
|
|
894
|
-
)};border:1px solid {getPortBackgroundColor(checker, port.dataType, 30)}"
|
|
895
|
-
>
|
|
896
|
-
{port.dataType}
|
|
897
|
-
</span>
|
|
898
|
-
<div class="config-form__port-order-actions">
|
|
899
|
-
<button
|
|
900
|
-
type="button"
|
|
901
|
-
disabled={isRequired}
|
|
902
|
-
title={isRequired
|
|
903
|
-
? 'Required ports cannot be hidden'
|
|
904
|
-
: isHidden
|
|
905
|
-
? 'Show port'
|
|
906
|
-
: 'Hide port'}
|
|
907
|
-
class:active={isHidden}
|
|
908
|
-
onclick={() => togglePortHidden('outputs', port.id)}
|
|
909
|
-
>
|
|
910
|
-
<Icon icon={isHidden ? 'heroicons:eye-slash' : 'heroicons:eye'} />
|
|
911
|
-
</button>
|
|
912
|
-
<button
|
|
913
|
-
type="button"
|
|
914
|
-
disabled={i === 0 || allOutputPortsForUI.length === 1}
|
|
915
|
-
onclick={() => movePort('outputs', port.id, -1)}
|
|
916
|
-
title="Move up"
|
|
917
|
-
>
|
|
918
|
-
<Icon icon="heroicons:chevron-up" />
|
|
919
|
-
</button>
|
|
920
|
-
<button
|
|
921
|
-
type="button"
|
|
922
|
-
disabled={i === allOutputPortsForUI.length - 1 ||
|
|
923
|
-
allOutputPortsForUI.length === 1}
|
|
924
|
-
onclick={() => movePort('outputs', port.id, 1)}
|
|
925
|
-
title="Move down"
|
|
926
|
-
>
|
|
927
|
-
<Icon icon="heroicons:chevron-down" />
|
|
928
|
-
</button>
|
|
929
|
-
</div>
|
|
930
|
-
</li>
|
|
931
|
-
{/each}
|
|
932
|
-
</ul>
|
|
933
|
-
</div>
|
|
934
|
-
{/if}
|
|
935
|
-
</div>
|
|
936
|
-
</div>
|
|
937
|
-
{/if}
|
|
938
|
-
|
|
939
758
|
<!-- Footer Actions - Only shown when onSave is provided and onChange is not -->
|
|
940
759
|
<!-- With onChange (on-blur sync), changes are saved automatically, so no Save button needed -->
|
|
941
760
|
{#if onSave && !onChange}
|
|
@@ -1040,7 +859,7 @@
|
|
|
1040
859
|
justify-content: center;
|
|
1041
860
|
gap: var(--fd-space-xs);
|
|
1042
861
|
padding: 0.625rem var(--fd-space-xl);
|
|
1043
|
-
border-radius: var(--fd-radius
|
|
862
|
+
border-radius: var(--fd-control-radius);
|
|
1044
863
|
font-size: var(--fd-text-sm);
|
|
1045
864
|
font-weight: 600;
|
|
1046
865
|
font-family: inherit;
|
|
@@ -1069,11 +888,6 @@
|
|
|
1069
888
|
color: var(--fd-foreground);
|
|
1070
889
|
}
|
|
1071
890
|
|
|
1072
|
-
.config-form__button--secondary:focus-visible {
|
|
1073
|
-
outline: none;
|
|
1074
|
-
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
1075
|
-
}
|
|
1076
|
-
|
|
1077
891
|
.config-form__button--primary {
|
|
1078
892
|
background: linear-gradient(135deg, var(--fd-primary) 0%, var(--fd-primary-hover) 100%);
|
|
1079
893
|
color: var(--fd-primary-foreground);
|
|
@@ -1094,184 +908,6 @@
|
|
|
1094
908
|
transform: translateY(0);
|
|
1095
909
|
}
|
|
1096
910
|
|
|
1097
|
-
.config-form__button--primary:focus-visible {
|
|
1098
|
-
outline: none;
|
|
1099
|
-
box-shadow:
|
|
1100
|
-
0 0 0 3px rgba(59, 130, 246, 0.4),
|
|
1101
|
-
0 4px 12px rgba(59, 130, 246, 0.35);
|
|
1102
|
-
}
|
|
1103
|
-
|
|
1104
|
-
/* ============================================
|
|
1105
|
-
UI EXTENSIONS SECTION
|
|
1106
|
-
============================================ */
|
|
1107
|
-
|
|
1108
|
-
.config-form__extensions {
|
|
1109
|
-
background-color: var(--fd-muted);
|
|
1110
|
-
border: 1px solid var(--fd-border);
|
|
1111
|
-
border-radius: var(--fd-radius-lg);
|
|
1112
|
-
overflow: hidden;
|
|
1113
|
-
margin-top: var(--fd-space-xs);
|
|
1114
|
-
}
|
|
1115
|
-
|
|
1116
|
-
.config-form__extensions-header {
|
|
1117
|
-
display: flex;
|
|
1118
|
-
align-items: center;
|
|
1119
|
-
gap: var(--fd-space-xs);
|
|
1120
|
-
padding: var(--fd-space-md) var(--fd-space-xl);
|
|
1121
|
-
background-color: var(--fd-subtle);
|
|
1122
|
-
border-bottom: 1px solid var(--fd-border);
|
|
1123
|
-
font-size: 0.8125rem;
|
|
1124
|
-
font-weight: 600;
|
|
1125
|
-
color: var(--fd-foreground);
|
|
1126
|
-
}
|
|
1127
|
-
|
|
1128
|
-
.config-form__extensions-header :global(svg) {
|
|
1129
|
-
width: 1rem;
|
|
1130
|
-
height: 1rem;
|
|
1131
|
-
color: var(--fd-muted-foreground);
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
.config-form__extensions-content {
|
|
1135
|
-
padding: var(--fd-space-xl);
|
|
1136
|
-
display: flex;
|
|
1137
|
-
flex-direction: column;
|
|
1138
|
-
gap: var(--fd-space-xl);
|
|
1139
|
-
}
|
|
1140
|
-
|
|
1141
|
-
/* ============================================
|
|
1142
|
-
PORT ORDER & VISIBILITY
|
|
1143
|
-
============================================ */
|
|
1144
|
-
|
|
1145
|
-
.config-form__port-order {
|
|
1146
|
-
border-top: 1px solid var(--fd-border-muted);
|
|
1147
|
-
padding-top: var(--fd-space-md);
|
|
1148
|
-
margin-top: calc(var(--fd-space-xl) * -0.25);
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
.config-form__port-order-header {
|
|
1152
|
-
display: flex;
|
|
1153
|
-
align-items: center;
|
|
1154
|
-
justify-content: space-between;
|
|
1155
|
-
margin-bottom: var(--fd-space-xs);
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
|
-
.config-form__port-order-label {
|
|
1159
|
-
font-size: var(--fd-text-xs);
|
|
1160
|
-
font-weight: 600;
|
|
1161
|
-
color: var(--fd-muted-foreground);
|
|
1162
|
-
text-transform: uppercase;
|
|
1163
|
-
letter-spacing: 0.05em;
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
.config-form__port-order-reset {
|
|
1167
|
-
background: none;
|
|
1168
|
-
border: none;
|
|
1169
|
-
font-size: var(--fd-text-xs);
|
|
1170
|
-
color: var(--fd-muted-foreground);
|
|
1171
|
-
cursor: pointer;
|
|
1172
|
-
display: inline-flex;
|
|
1173
|
-
align-items: center;
|
|
1174
|
-
gap: var(--fd-space-3xs);
|
|
1175
|
-
padding: 0;
|
|
1176
|
-
transition: color var(--fd-transition-fast);
|
|
1177
|
-
}
|
|
1178
|
-
|
|
1179
|
-
.config-form__port-order-reset:hover {
|
|
1180
|
-
color: var(--fd-foreground);
|
|
1181
|
-
}
|
|
1182
|
-
|
|
1183
|
-
.config-form__port-order-reset :global(svg) {
|
|
1184
|
-
width: 0.75rem;
|
|
1185
|
-
height: 0.75rem;
|
|
1186
|
-
}
|
|
1187
|
-
|
|
1188
|
-
.config-form__port-order-list {
|
|
1189
|
-
list-style: none;
|
|
1190
|
-
margin: 0;
|
|
1191
|
-
padding: 0;
|
|
1192
|
-
display: flex;
|
|
1193
|
-
flex-direction: column;
|
|
1194
|
-
gap: var(--fd-space-3xs);
|
|
1195
|
-
}
|
|
1196
|
-
|
|
1197
|
-
.config-form__port-order-item {
|
|
1198
|
-
display: flex;
|
|
1199
|
-
align-items: center;
|
|
1200
|
-
gap: var(--fd-space-xs);
|
|
1201
|
-
padding: var(--fd-space-3xs) var(--fd-space-xs);
|
|
1202
|
-
background: var(--fd-muted);
|
|
1203
|
-
border-radius: var(--fd-radius-sm);
|
|
1204
|
-
border: 1px solid var(--fd-border-muted);
|
|
1205
|
-
transition: opacity var(--fd-transition-fast);
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
.config-form__port-order-item--hidden {
|
|
1209
|
-
opacity: 0.4;
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
.config-form__port-order-name {
|
|
1213
|
-
flex: 1;
|
|
1214
|
-
font-size: var(--fd-text-xs);
|
|
1215
|
-
font-weight: 500;
|
|
1216
|
-
color: var(--fd-foreground);
|
|
1217
|
-
min-width: 0;
|
|
1218
|
-
overflow: hidden;
|
|
1219
|
-
text-overflow: ellipsis;
|
|
1220
|
-
white-space: nowrap;
|
|
1221
|
-
}
|
|
1222
|
-
|
|
1223
|
-
.config-form__port-order-badge {
|
|
1224
|
-
padding: 0.125rem var(--fd-space-3xs);
|
|
1225
|
-
border-radius: var(--fd-radius-sm);
|
|
1226
|
-
font-size: 0.625rem;
|
|
1227
|
-
font-weight: 500;
|
|
1228
|
-
text-transform: uppercase;
|
|
1229
|
-
letter-spacing: 0.04em;
|
|
1230
|
-
flex-shrink: 0;
|
|
1231
|
-
}
|
|
1232
|
-
|
|
1233
|
-
.config-form__port-order-actions {
|
|
1234
|
-
display: flex;
|
|
1235
|
-
gap: var(--fd-space-3xs);
|
|
1236
|
-
flex-shrink: 0;
|
|
1237
|
-
}
|
|
1238
|
-
|
|
1239
|
-
.config-form__port-order-actions button {
|
|
1240
|
-
width: 1.25rem;
|
|
1241
|
-
height: 1.25rem;
|
|
1242
|
-
display: flex;
|
|
1243
|
-
align-items: center;
|
|
1244
|
-
justify-content: center;
|
|
1245
|
-
background: var(--fd-card);
|
|
1246
|
-
border: 1px solid var(--fd-border);
|
|
1247
|
-
border-radius: var(--fd-radius-sm);
|
|
1248
|
-
color: var(--fd-muted-foreground);
|
|
1249
|
-
cursor: pointer;
|
|
1250
|
-
padding: 0;
|
|
1251
|
-
transition: all var(--fd-transition-fast);
|
|
1252
|
-
}
|
|
1253
|
-
|
|
1254
|
-
.config-form__port-order-actions button:hover:not(:disabled) {
|
|
1255
|
-
background: var(--fd-backdrop);
|
|
1256
|
-
color: var(--fd-foreground);
|
|
1257
|
-
border-color: var(--fd-border-strong);
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1260
|
-
.config-form__port-order-actions button:disabled {
|
|
1261
|
-
opacity: 0.3;
|
|
1262
|
-
cursor: not-allowed;
|
|
1263
|
-
}
|
|
1264
|
-
|
|
1265
|
-
.config-form__port-order-actions button.active {
|
|
1266
|
-
color: var(--fd-foreground);
|
|
1267
|
-
border-color: var(--fd-border-strong);
|
|
1268
|
-
}
|
|
1269
|
-
|
|
1270
|
-
.config-form__port-order-actions button :global(svg) {
|
|
1271
|
-
width: 0.75rem;
|
|
1272
|
-
height: 0.75rem;
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
911
|
/* ============================================
|
|
1276
912
|
DEBUG SECTION
|
|
1277
913
|
============================================ */
|
|
@@ -1279,7 +915,7 @@
|
|
|
1279
915
|
.config-form__debug {
|
|
1280
916
|
background-color: var(--fd-warning-muted);
|
|
1281
917
|
border: 1px solid var(--fd-warning);
|
|
1282
|
-
border-radius: var(--fd-radius
|
|
918
|
+
border-radius: var(--fd-control-radius);
|
|
1283
919
|
overflow: hidden;
|
|
1284
920
|
}
|
|
1285
921
|
|
|
@@ -1433,7 +1069,7 @@
|
|
|
1433
1069
|
.config-form__error {
|
|
1434
1070
|
background-color: var(--fd-error-muted);
|
|
1435
1071
|
border: 1px solid var(--fd-error);
|
|
1436
|
-
border-radius: var(--fd-radius
|
|
1072
|
+
border-radius: var(--fd-control-radius);
|
|
1437
1073
|
overflow: hidden;
|
|
1438
1074
|
}
|
|
1439
1075
|
|
|
@@ -1555,11 +1191,4 @@
|
|
|
1555
1191
|
.config-form__button--external:active {
|
|
1556
1192
|
transform: translateY(0);
|
|
1557
1193
|
}
|
|
1558
|
-
|
|
1559
|
-
.config-form__button--external:focus-visible {
|
|
1560
|
-
outline: none;
|
|
1561
|
-
box-shadow:
|
|
1562
|
-
0 0 0 3px rgba(99, 102, 241, 0.4),
|
|
1563
|
-
0 4px 12px rgba(99, 102, 241, 0.35);
|
|
1564
|
-
}
|
|
1565
1194
|
</style>
|