@flowdrop/flowdrop 2.0.0-beta.1 → 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 +173 -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/commands/executor.js +51 -26
- 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 +167 -562
- 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 +24 -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 +66 -52
- package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
- package/dist/components/chat/AIChatPanel.svelte +7 -2
- 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 +262 -0
- package/dist/components/form/FormPorts.svelte.d.ts +13 -0
- package/dist/components/form/FormRangeField.svelte +61 -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 +0 -4
- 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 +0 -1
- 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 +76 -25
- 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 +23 -0
- package/dist/config/endpoints.js +28 -0
- 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/index.d.ts +1 -1
- package/dist/messages/index.js +1 -1
- package/dist/openapi/v1/openapi.yaml +35 -23
- package/dist/playground/index.d.ts +2 -2
- package/dist/playground/index.js +2 -2
- package/dist/playground/mount.d.ts +19 -5
- package/dist/playground/mount.js +16 -8
- 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/playgroundService.d.ts +9 -8
- package/dist/services/playgroundService.js +23 -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/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/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 +17 -1
- package/dist/types/settings.js +4 -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 +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/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
|
@@ -24,21 +24,20 @@
|
|
|
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';
|
|
@@ -46,9 +45,8 @@
|
|
|
46
45
|
import { provideInstance } from '../stores/getInstance.svelte.js';
|
|
47
46
|
import { getAvailableVariables } from '../services/variableService.js';
|
|
48
47
|
import { logger } from '../utils/logger.js';
|
|
49
|
-
import { getDataTypeColorToken, getPortBackgroundColor } from '../utils/colors.js';
|
|
50
|
-
import { applyPortOrder } from '../utils/portUtils.js';
|
|
51
48
|
import { mergeWithDefaults, cascadeClearAutocompleteDependents } from '../utils/formMerge.js';
|
|
49
|
+
import { applyFetchedSchema } from '../utils/schemaMerge.js';
|
|
52
50
|
|
|
53
51
|
interface Props {
|
|
54
52
|
/** Optional workflow node (if provided, schema and values are derived from it) */
|
|
@@ -64,8 +62,6 @@
|
|
|
64
62
|
uiSchema?: UISchemaElement;
|
|
65
63
|
/** Direct config values (used when node is not provided) */
|
|
66
64
|
values?: Record<string, unknown>;
|
|
67
|
-
/** Whether to show UI extension settings section */
|
|
68
|
-
showUIExtensions?: boolean;
|
|
69
65
|
/** Optional workflow ID for context in external links */
|
|
70
66
|
workflowId?: string;
|
|
71
67
|
/** Whether to also save the workflow when saving config */
|
|
@@ -82,10 +78,29 @@
|
|
|
82
78
|
workflowEdges?: WorkflowEdge[];
|
|
83
79
|
/** Auth provider for API requests (used for template variable API mode) */
|
|
84
80
|
authProvider?: AuthProvider;
|
|
85
|
-
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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;
|
|
89
104
|
/** Callback when form is cancelled */
|
|
90
105
|
onCancel?: () => void;
|
|
91
106
|
}
|
|
@@ -95,12 +110,12 @@
|
|
|
95
110
|
schema,
|
|
96
111
|
uiSchema,
|
|
97
112
|
values,
|
|
98
|
-
showUIExtensions = true,
|
|
99
113
|
workflowId,
|
|
100
114
|
saveWorkflowWhenSavingConfig = false,
|
|
101
115
|
workflowNodes = [],
|
|
102
116
|
workflowEdges = [],
|
|
103
117
|
authProvider,
|
|
118
|
+
commitMode = 'blur',
|
|
104
119
|
onChange,
|
|
105
120
|
onSave,
|
|
106
121
|
onCancel
|
|
@@ -115,7 +130,6 @@
|
|
|
115
130
|
// instance on the server (no cross-request leakage); no destroy here for the
|
|
116
131
|
// same reasons as SchemaForm (shared/default in the browser, no SSR teardown).
|
|
117
132
|
const fd = provideInstance();
|
|
118
|
-
const checker = fd.portCompatibility;
|
|
119
133
|
|
|
120
134
|
// Set context for child components (e.g., FormAutocomplete)
|
|
121
135
|
// Use getter functions to ensure child components always get the current prop value,
|
|
@@ -128,6 +142,9 @@
|
|
|
128
142
|
let dynamicSchemaLoading = $state(false);
|
|
129
143
|
let dynamicSchemaError = $state<string | null>(null);
|
|
130
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);
|
|
131
148
|
|
|
132
149
|
/**
|
|
133
150
|
* Get the admin edit configuration for the node
|
|
@@ -162,38 +179,73 @@
|
|
|
162
179
|
* Priority: fetchedDynamicSchema > direct schema prop > node metadata configSchema
|
|
163
180
|
*/
|
|
164
181
|
const configSchema = $derived.by<ConfigSchema | undefined>(() => {
|
|
165
|
-
|
|
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.
|
|
166
186
|
if (fetchedDynamicSchema) {
|
|
167
|
-
|
|
187
|
+
const endpoint = configEditOptions?.dynamicSchema;
|
|
188
|
+
return endpoint
|
|
189
|
+
? applyFetchedSchema(staticSchema, fetchedDynamicSchema, endpoint)
|
|
190
|
+
: fetchedDynamicSchema;
|
|
168
191
|
}
|
|
169
|
-
|
|
170
|
-
return schema ?? (node?.data.metadata?.configSchema as ConfigSchema | undefined);
|
|
192
|
+
return staticSchema;
|
|
171
193
|
});
|
|
172
194
|
|
|
173
195
|
/**
|
|
174
|
-
* Get the UI schema
|
|
175
|
-
* 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.
|
|
176
205
|
*/
|
|
177
206
|
const configUISchema = $derived.by<UISchemaElement | undefined>(() => {
|
|
178
|
-
|
|
207
|
+
if (uiSchema) return uiSchema;
|
|
208
|
+
if (fetchedDynamicSchema && fetchedDynamicUiSchema) return fetchedDynamicUiSchema;
|
|
209
|
+
return node?.data.metadata?.uiSchema as UISchemaElement | undefined;
|
|
179
210
|
});
|
|
180
211
|
|
|
181
212
|
/**
|
|
182
|
-
*
|
|
183
|
-
*
|
|
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).
|
|
184
218
|
*/
|
|
185
|
-
const
|
|
186
|
-
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;
|
|
187
223
|
const staticSchema = schema ?? node.data.metadata?.configSchema;
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
224
|
+
return !staticSchema || configEditOptions?.preferDynamicSchema === true || layersOntoStatic;
|
|
225
|
+
});
|
|
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);
|
|
195
241
|
});
|
|
196
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
|
+
|
|
197
249
|
/**
|
|
198
250
|
* Get the current configuration from node or direct prop
|
|
199
251
|
*/
|
|
@@ -230,49 +282,6 @@
|
|
|
230
282
|
*/
|
|
231
283
|
let isSavingWorkflow = $state(false);
|
|
232
284
|
|
|
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
285
|
/**
|
|
277
286
|
* Fetch dynamic schema when needed
|
|
278
287
|
*/
|
|
@@ -292,6 +301,7 @@
|
|
|
292
301
|
|
|
293
302
|
if (result.success && result.schema) {
|
|
294
303
|
fetchedDynamicSchema = result.schema;
|
|
304
|
+
fetchedDynamicUiSchema = result.uiSchema ?? null;
|
|
295
305
|
} else {
|
|
296
306
|
dynamicSchemaError =
|
|
297
307
|
result.error ?? configEditOptions.errorMessage ?? 'Failed to load configuration schema';
|
|
@@ -313,8 +323,9 @@
|
|
|
313
323
|
if (!node || !configEditOptions?.dynamicSchema) return;
|
|
314
324
|
|
|
315
325
|
// Invalidate the cache first
|
|
316
|
-
invalidateSchemaCache(node, configEditOptions.dynamicSchema);
|
|
326
|
+
invalidateSchemaCache(node, configEditOptions.dynamicSchema, workflowId);
|
|
317
327
|
fetchedDynamicSchema = null;
|
|
328
|
+
fetchedDynamicUiSchema = null;
|
|
318
329
|
|
|
319
330
|
// Reload the schema
|
|
320
331
|
await loadDynamicSchema();
|
|
@@ -345,94 +356,33 @@
|
|
|
345
356
|
}
|
|
346
357
|
|
|
347
358
|
/**
|
|
348
|
-
*
|
|
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().
|
|
349
376
|
*/
|
|
350
377
|
$effect(() => {
|
|
351
|
-
|
|
352
|
-
|
|
378
|
+
const key = dynamicSchemaKey;
|
|
379
|
+
if (key === null || key === loadedSchemaKey || dynamicSchemaLoading) {
|
|
380
|
+
return;
|
|
353
381
|
}
|
|
382
|
+
loadedSchemaKey = key;
|
|
383
|
+
loadDynamicSchema();
|
|
354
384
|
});
|
|
355
385
|
|
|
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
386
|
/**
|
|
437
387
|
* Check if a field is required based on schema
|
|
438
388
|
*/
|
|
@@ -458,34 +408,70 @@
|
|
|
458
408
|
for (const [depKey, depValue] of Object.entries(dependents)) {
|
|
459
409
|
edits[depKey] = depValue;
|
|
460
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 = {};
|
|
461
451
|
}
|
|
462
452
|
|
|
463
453
|
/**
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
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.
|
|
467
459
|
*/
|
|
468
460
|
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
|
-
}
|
|
461
|
+
commitEdits(commitMode === 'live' ? { commit: true } : undefined);
|
|
478
462
|
}
|
|
479
463
|
|
|
480
464
|
/**
|
|
481
465
|
* Handle form submission
|
|
482
|
-
* Collects
|
|
483
|
-
* Optionally saves the workflow if the option is enabled
|
|
466
|
+
* Collects config values and optionally saves the workflow.
|
|
484
467
|
*/
|
|
485
468
|
async function handleSave(): Promise<void> {
|
|
486
|
-
// 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.
|
|
487
473
|
const form = document.querySelector('.config-form');
|
|
488
|
-
const updatedConfig: Record<string, unknown> = { ...configValues };
|
|
474
|
+
const updatedConfig: Record<string, unknown> = { ...initialConfig, ...configValues };
|
|
489
475
|
|
|
490
476
|
if (form) {
|
|
491
477
|
const inputs = form.querySelectorAll('input, select, textarea');
|
|
@@ -527,13 +513,8 @@
|
|
|
527
513
|
);
|
|
528
514
|
}
|
|
529
515
|
|
|
530
|
-
// Pass UI extensions only if enabled
|
|
531
516
|
if (onSave) {
|
|
532
|
-
|
|
533
|
-
onSave(updatedConfig, uiExtensionValues);
|
|
534
|
-
} else {
|
|
535
|
-
onSave(updatedConfig);
|
|
536
|
-
}
|
|
517
|
+
onSave(updatedConfig);
|
|
537
518
|
}
|
|
538
519
|
|
|
539
520
|
// Save workflow if the option is enabled
|
|
@@ -750,192 +731,6 @@
|
|
|
750
731
|
</div>
|
|
751
732
|
{/if}
|
|
752
733
|
|
|
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
734
|
<!-- Footer Actions - Only shown when onSave is provided and onChange is not -->
|
|
940
735
|
<!-- With onChange (on-blur sync), changes are saved automatically, so no Save button needed -->
|
|
941
736
|
{#if onSave && !onChange}
|
|
@@ -1040,7 +835,7 @@
|
|
|
1040
835
|
justify-content: center;
|
|
1041
836
|
gap: var(--fd-space-xs);
|
|
1042
837
|
padding: 0.625rem var(--fd-space-xl);
|
|
1043
|
-
border-radius: var(--fd-radius
|
|
838
|
+
border-radius: var(--fd-control-radius);
|
|
1044
839
|
font-size: var(--fd-text-sm);
|
|
1045
840
|
font-weight: 600;
|
|
1046
841
|
font-family: inherit;
|
|
@@ -1069,11 +864,6 @@
|
|
|
1069
864
|
color: var(--fd-foreground);
|
|
1070
865
|
}
|
|
1071
866
|
|
|
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
867
|
.config-form__button--primary {
|
|
1078
868
|
background: linear-gradient(135deg, var(--fd-primary) 0%, var(--fd-primary-hover) 100%);
|
|
1079
869
|
color: var(--fd-primary-foreground);
|
|
@@ -1094,184 +884,6 @@
|
|
|
1094
884
|
transform: translateY(0);
|
|
1095
885
|
}
|
|
1096
886
|
|
|
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
887
|
/* ============================================
|
|
1276
888
|
DEBUG SECTION
|
|
1277
889
|
============================================ */
|
|
@@ -1279,7 +891,7 @@
|
|
|
1279
891
|
.config-form__debug {
|
|
1280
892
|
background-color: var(--fd-warning-muted);
|
|
1281
893
|
border: 1px solid var(--fd-warning);
|
|
1282
|
-
border-radius: var(--fd-radius
|
|
894
|
+
border-radius: var(--fd-control-radius);
|
|
1283
895
|
overflow: hidden;
|
|
1284
896
|
}
|
|
1285
897
|
|
|
@@ -1433,7 +1045,7 @@
|
|
|
1433
1045
|
.config-form__error {
|
|
1434
1046
|
background-color: var(--fd-error-muted);
|
|
1435
1047
|
border: 1px solid var(--fd-error);
|
|
1436
|
-
border-radius: var(--fd-radius
|
|
1048
|
+
border-radius: var(--fd-control-radius);
|
|
1437
1049
|
overflow: hidden;
|
|
1438
1050
|
}
|
|
1439
1051
|
|
|
@@ -1555,11 +1167,4 @@
|
|
|
1555
1167
|
.config-form__button--external:active {
|
|
1556
1168
|
transform: translateY(0);
|
|
1557
1169
|
}
|
|
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
1170
|
</style>
|