@flowdrop/flowdrop 2.0.0-beta.7 → 2.0.0-beta.9
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 +18 -0
- package/dist/components/App.svelte +467 -182
- package/dist/components/App.svelte.d.ts +14 -1
- package/dist/components/ConfigPanel.svelte +230 -12
- package/dist/components/ConfigPanel.svelte.d.ts +6 -0
- package/dist/components/SettingsPanel.svelte +22 -0
- 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/stores/settingsStore.svelte.d.ts +13 -0
- package/dist/stores/settingsStore.svelte.js +32 -0
- package/dist/svelte-app.d.ts +12 -1
- package/dist/svelte-app.js +3 -1
- package/dist/types/settings.d.ts +16 -0
- package/dist/types/settings.js +3 -1
- package/dist/utils/portal.d.ts +18 -0
- package/dist/utils/portal.js +34 -0
- package/package.json +1 -1
|
@@ -15,8 +15,12 @@
|
|
|
15
15
|
import MenuOpenIcon from './icons/MenuOpenIcon.svelte';
|
|
16
16
|
import ConfigForm from './ConfigForm.svelte';
|
|
17
17
|
import ConfigPanel from './ConfigPanel.svelte';
|
|
18
|
+
import ReadOnlyDetails from './ReadOnlyDetails.svelte';
|
|
18
19
|
import CommandConsole from './console/CommandConsole.svelte';
|
|
19
20
|
import AIChatPanel from './chat/AIChatPanel.svelte';
|
|
21
|
+
import TabbedSurface from './surfaces/TabbedSurface.svelte';
|
|
22
|
+
import type { SurfaceTab } from './surfaces/TabbedSurface.svelte';
|
|
23
|
+
import SurfaceOverlay from './surfaces/SurfaceOverlay.svelte';
|
|
20
24
|
import type { UIAction } from '../commands/index.js';
|
|
21
25
|
import NodeSwapPicker from './NodeSwapPicker.svelte';
|
|
22
26
|
import SwapMappingEditor from './SwapMappingEditor.svelte';
|
|
@@ -48,11 +52,12 @@
|
|
|
48
52
|
import {
|
|
49
53
|
getUiSettings,
|
|
50
54
|
updateSettings,
|
|
55
|
+
seedUiDefaults,
|
|
51
56
|
initializeTheme
|
|
52
57
|
} from '../stores/settingsStore.svelte.js';
|
|
53
58
|
import { logger } from '../utils/logger.js';
|
|
54
59
|
import { validateWorkflowData } from '../utils/validation.js';
|
|
55
|
-
import type { SettingsCategory } from '../types/settings.js';
|
|
60
|
+
import type { SettingsCategory, SurfacePlacement } from '../types/settings.js';
|
|
56
61
|
import { defaultMessages, mergeMessages, setMessages } from '../messages/index.js';
|
|
57
62
|
import type { MessagesOverride } from '../messages/index.js';
|
|
58
63
|
|
|
@@ -72,6 +77,19 @@
|
|
|
72
77
|
showNavbar?: boolean;
|
|
73
78
|
/** Disable the node sidebar */
|
|
74
79
|
disableSidebar?: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Default host for the node/workflow configuration panel: `sidebar` (right
|
|
82
|
+
* rail), `modal` (centered overlay), or `below` (bottom panel). Seeds the
|
|
83
|
+
* user setting on first load — a value the user later changes wins.
|
|
84
|
+
* @default 'sidebar'
|
|
85
|
+
*/
|
|
86
|
+
configPlacement?: SurfacePlacement;
|
|
87
|
+
/**
|
|
88
|
+
* Default host for the console / AI Assistant group. Seeds the user setting
|
|
89
|
+
* on first load — a value the user later changes wins.
|
|
90
|
+
* @default 'below'
|
|
91
|
+
*/
|
|
92
|
+
consolePlacement?: SurfacePlacement;
|
|
75
93
|
/**
|
|
76
94
|
* Editor interaction mode. Replaces the former `readOnly` + `lockWorkflow`
|
|
77
95
|
* boolean pair (2.0 breaking change).
|
|
@@ -167,6 +185,8 @@
|
|
|
167
185
|
width = '100%',
|
|
168
186
|
showNavbar = false,
|
|
169
187
|
disableSidebar = false,
|
|
188
|
+
configPlacement: configPlacementProp,
|
|
189
|
+
consolePlacement: consolePlacementProp,
|
|
170
190
|
mode = 'edit',
|
|
171
191
|
pipelineId,
|
|
172
192
|
refreshTrigger = 0,
|
|
@@ -331,6 +351,12 @@
|
|
|
331
351
|
// Workflow settings sidebar state
|
|
332
352
|
let isWorkflowSettingsOpen = $state(false);
|
|
333
353
|
|
|
354
|
+
// Which surface (`config` | `console` | `chat`) is focused in its host. A
|
|
355
|
+
// single selector across hosts: each TabbedSurface highlights this id when it
|
|
356
|
+
// hosts that surface, else falls back to its own first tab. Opening config
|
|
357
|
+
// focuses it wherever it lives (sidebar/modal/below).
|
|
358
|
+
let activeSurface = $state<string>(getUiSettings().bottomPanelTab);
|
|
359
|
+
|
|
334
360
|
// Node swap state
|
|
335
361
|
let swapMode = $state<'idle' | 'picking' | 'mapping'>('idle');
|
|
336
362
|
let swapInteractiveState = $state<InteractiveSwapState | null>(null);
|
|
@@ -556,6 +582,7 @@
|
|
|
556
582
|
}
|
|
557
583
|
selectedNodeId = node.id;
|
|
558
584
|
isConfigSidebarOpen = true;
|
|
585
|
+
activeSurface = 'config';
|
|
559
586
|
// Reset swap state when switching nodes
|
|
560
587
|
swapMode = 'idle';
|
|
561
588
|
swapInteractiveState = null;
|
|
@@ -577,6 +604,7 @@
|
|
|
577
604
|
// Close config sidebar if opening workflow settings
|
|
578
605
|
if (isWorkflowSettingsOpen) {
|
|
579
606
|
closeConfigSidebar();
|
|
607
|
+
activeSurface = 'config';
|
|
580
608
|
}
|
|
581
609
|
}
|
|
582
610
|
|
|
@@ -804,6 +832,13 @@
|
|
|
804
832
|
// choice was otherwise never restored on reload).
|
|
805
833
|
initializeTheme();
|
|
806
834
|
|
|
835
|
+
// Seed placement defaults from mount props without clobbering a returning
|
|
836
|
+
// user's persisted choices (host default < user snapshot).
|
|
837
|
+
seedUiDefaults({
|
|
838
|
+
configPlacement: configPlacementProp,
|
|
839
|
+
consolePlacement: consolePlacementProp
|
|
840
|
+
});
|
|
841
|
+
|
|
807
842
|
(async () => {
|
|
808
843
|
try {
|
|
809
844
|
await initializeApiEndpoints();
|
|
@@ -873,14 +908,83 @@
|
|
|
873
908
|
};
|
|
874
909
|
});
|
|
875
910
|
|
|
911
|
+
// =========================================================================
|
|
912
|
+
// Surface placement — where the config panel and console/chat are hosted.
|
|
913
|
+
// =========================================================================
|
|
914
|
+
|
|
915
|
+
const configPlacement = $derived(getUiSettings().configPlacement);
|
|
916
|
+
const consolePlacement = $derived(getUiSettings().consolePlacement);
|
|
917
|
+
|
|
918
|
+
/** Config surface has something to show (node config or workflow settings). */
|
|
919
|
+
const configActive = $derived(isWorkflowSettingsOpen || !!selectedNodeForConfig);
|
|
920
|
+
/** Console/chat group is available (editable canvas, console toggled open). */
|
|
921
|
+
const consoleActive = $derived(getUiSettings().consoleOpen && canvasEditable);
|
|
922
|
+
/** Node-swap sub-flow occupies the right sidebar regardless of placement. */
|
|
923
|
+
const swapActive = $derived(swapMode !== 'idle');
|
|
924
|
+
|
|
925
|
+
const configHere = (loc: SurfacePlacement) => configActive && configPlacement === loc;
|
|
926
|
+
const consoleHere = (loc: SurfacePlacement) => consoleActive && consolePlacement === loc;
|
|
927
|
+
|
|
928
|
+
/** Any surface routed to a given host location is present there. */
|
|
929
|
+
const anyHere = (loc: SurfacePlacement) => configHere(loc) || consoleHere(loc);
|
|
930
|
+
|
|
876
931
|
/**
|
|
877
|
-
*
|
|
878
|
-
*
|
|
932
|
+
* Metadata for the active config surface, independent of its host. The form
|
|
933
|
+
* itself is rendered by the host via the `configBody` snippet.
|
|
879
934
|
*/
|
|
880
|
-
const
|
|
881
|
-
isWorkflowSettingsOpen
|
|
935
|
+
const activeConfig = $derived.by(() => {
|
|
936
|
+
if (isWorkflowSettingsOpen) {
|
|
937
|
+
return {
|
|
938
|
+
kind: 'workflow' as const,
|
|
939
|
+
title: mergedMessages.navigation.workflowSettingsPanelTitle,
|
|
940
|
+
id: fd.workflow.current?.id,
|
|
941
|
+
description: undefined as string | undefined,
|
|
942
|
+
details: [
|
|
943
|
+
{ label: 'Nodes', value: String(fd.workflow.current?.nodes?.length ?? 0) },
|
|
944
|
+
{ label: 'Connections', value: String(fd.workflow.current?.edges?.length ?? 0) }
|
|
945
|
+
],
|
|
946
|
+
configTitle: mergedMessages.navigation.workflowSettingsPanelSubtitle
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
const node = selectedNodeForConfig;
|
|
950
|
+
if (node) {
|
|
951
|
+
return {
|
|
952
|
+
kind: 'node' as const,
|
|
953
|
+
node,
|
|
954
|
+
title: node.data.label,
|
|
955
|
+
id: node.id,
|
|
956
|
+
description:
|
|
957
|
+
node.data.metadata?.description || mergedMessages.navigation.nodeConfigDescription,
|
|
958
|
+
details: [
|
|
959
|
+
{ label: 'Type', value: node.data.metadata?.type || node.type },
|
|
960
|
+
{ label: 'Category', value: node.data.metadata?.category || 'general' }
|
|
961
|
+
],
|
|
962
|
+
configTitle: undefined as string | undefined
|
|
963
|
+
};
|
|
964
|
+
}
|
|
965
|
+
return null;
|
|
966
|
+
});
|
|
967
|
+
|
|
968
|
+
/** Close whichever config surface is currently open. */
|
|
969
|
+
function closeActiveConfig(): void {
|
|
970
|
+
if (isWorkflowSettingsOpen) {
|
|
971
|
+
isWorkflowSettingsOpen = false;
|
|
972
|
+
} else {
|
|
973
|
+
closeConfigSidebar();
|
|
974
|
+
}
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
/** Select a surface tab; console/chat also persist as the last bottom tab. */
|
|
978
|
+
function selectSurface(id: string): void {
|
|
979
|
+
activeSurface = id;
|
|
980
|
+
if (id === 'console' || id === 'chat') {
|
|
981
|
+
updateSettings({ ui: { bottomPanelTab: id } });
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
const showRightPanel = $derived(
|
|
986
|
+
!disableSidebar && (swapActive || configHere('sidebar') || consoleHere('sidebar'))
|
|
882
987
|
);
|
|
883
|
-
const showRightPanel = $derived(!disableSidebar && hasConfigPanelOpen);
|
|
884
988
|
|
|
885
989
|
/**
|
|
886
990
|
* Calculate left sidebar width based on collapsed state
|
|
@@ -965,6 +1069,11 @@
|
|
|
965
1069
|
}
|
|
966
1070
|
});
|
|
967
1071
|
}
|
|
1072
|
+
|
|
1073
|
+
/** Close the console/chat group (used by the modal host's close button). */
|
|
1074
|
+
function closeConsole(): void {
|
|
1075
|
+
updateSettings({ ui: { consoleOpen: false } });
|
|
1076
|
+
}
|
|
968
1077
|
</script>
|
|
969
1078
|
|
|
970
1079
|
<svelte:window onkeydown={handleGlobalKeydown} />
|
|
@@ -983,6 +1092,194 @@
|
|
|
983
1092
|
onchange={handleImportFileChange}
|
|
984
1093
|
/>
|
|
985
1094
|
|
|
1095
|
+
<!--
|
|
1096
|
+
Surface content snippets — each rendered by exactly one host (a surface has a
|
|
1097
|
+
single placement), so the once-per-render Snippet constraint always holds.
|
|
1098
|
+
-->
|
|
1099
|
+
|
|
1100
|
+
{#snippet nodeConfigFormEl(node: WorkflowNode)}
|
|
1101
|
+
<ConfigForm
|
|
1102
|
+
{authProvider}
|
|
1103
|
+
{node}
|
|
1104
|
+
workflowId={fd.workflow.current?.id}
|
|
1105
|
+
workflowNodes={fd.workflow.current?.nodes}
|
|
1106
|
+
workflowEdges={fd.workflow.current?.edges}
|
|
1107
|
+
onChange={async (updatedConfig) => {
|
|
1108
|
+
// Sync config changes to workflow immediately on field blur
|
|
1109
|
+
if (node.id) {
|
|
1110
|
+
const updatedData = {
|
|
1111
|
+
...node.data,
|
|
1112
|
+
config: updatedConfig
|
|
1113
|
+
};
|
|
1114
|
+
const nodeUpdates: Record<string, unknown> = { data: updatedData };
|
|
1115
|
+
|
|
1116
|
+
fd.workflow.updateNode(node.id, nodeUpdates);
|
|
1117
|
+
|
|
1118
|
+
// Reflect config changes immediately (needed for nodeType changes)
|
|
1119
|
+
workflowEditorRef?.updateNodeData(node.id, updatedData);
|
|
1120
|
+
|
|
1121
|
+
// Refresh edge positions in case config changes affect handles
|
|
1122
|
+
await workflowEditorRef?.refreshEdgePositions(node.id);
|
|
1123
|
+
}
|
|
1124
|
+
}}
|
|
1125
|
+
/>
|
|
1126
|
+
{/snippet}
|
|
1127
|
+
|
|
1128
|
+
{#snippet workflowConfigFormEl()}
|
|
1129
|
+
<ConfigForm
|
|
1130
|
+
{authProvider}
|
|
1131
|
+
schema={workflowConfigSchema}
|
|
1132
|
+
values={workflowConfigValues}
|
|
1133
|
+
onChange={(config) => {
|
|
1134
|
+
// Sync workflow settings changes immediately on field blur
|
|
1135
|
+
const wf = fd.workflow.current;
|
|
1136
|
+
if (wf) {
|
|
1137
|
+
const newFormat = (config.format as string) || DEFAULT_WORKFLOW_FORMAT;
|
|
1138
|
+
const currentFormat = wf.metadata?.format || DEFAULT_WORKFLOW_FORMAT;
|
|
1139
|
+
|
|
1140
|
+
// Warn about incompatible nodes when format changes
|
|
1141
|
+
if (newFormat !== currentFormat) {
|
|
1142
|
+
const incompatibleNodes = wf.nodes?.filter((node) => {
|
|
1143
|
+
const formats = node.data?.metadata?.formats;
|
|
1144
|
+
return formats && formats.length > 0 && !formats.includes(newFormat);
|
|
1145
|
+
});
|
|
1146
|
+
if (incompatibleNodes && incompatibleNodes.length > 0) {
|
|
1147
|
+
logger.warn(
|
|
1148
|
+
`Format changed to '${newFormat}'. ${incompatibleNodes.length} node(s) are not compatible with this format and may not export correctly:`,
|
|
1149
|
+
incompatibleNodes.map((n) => n.data?.label || n.type)
|
|
1150
|
+
);
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
// Extract built-in fields; everything else belongs in workflow.config
|
|
1155
|
+
const { name, description, format: _format, ...customConfig } = config;
|
|
1156
|
+
fd.workflow.batchUpdate({
|
|
1157
|
+
name: name as string,
|
|
1158
|
+
description: description as string | undefined,
|
|
1159
|
+
metadata: {
|
|
1160
|
+
...wf.metadata,
|
|
1161
|
+
format: newFormat
|
|
1162
|
+
},
|
|
1163
|
+
...(workflowSettingsSchema && { config: customConfig as Record<string, unknown> })
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
}}
|
|
1167
|
+
/>
|
|
1168
|
+
{/snippet}
|
|
1169
|
+
|
|
1170
|
+
<!--
|
|
1171
|
+
Chromeless config body for tabbed/overlay hosts. `showHeader` draws a slim
|
|
1172
|
+
title + close bar when the host doesn't provide one (bottom / shared sidebar);
|
|
1173
|
+
the modal host supplies its own header, so it passes `false`.
|
|
1174
|
+
-->
|
|
1175
|
+
{#snippet configBody(showHeader: boolean)}
|
|
1176
|
+
{#if activeConfig}
|
|
1177
|
+
<div class="config-surface">
|
|
1178
|
+
{#if showHeader}
|
|
1179
|
+
<div class="config-surface__header">
|
|
1180
|
+
<h2 class="config-surface__title">{activeConfig.title}</h2>
|
|
1181
|
+
<button
|
|
1182
|
+
class="config-surface__close"
|
|
1183
|
+
onclick={closeActiveConfig}
|
|
1184
|
+
aria-label={mergedMessages.layout.closeConfigPanel}
|
|
1185
|
+
>
|
|
1186
|
+
×
|
|
1187
|
+
</button>
|
|
1188
|
+
</div>
|
|
1189
|
+
{/if}
|
|
1190
|
+
{#if activeConfig.id}
|
|
1191
|
+
<div class="config-surface__details">
|
|
1192
|
+
<ReadOnlyDetails
|
|
1193
|
+
id={activeConfig.id}
|
|
1194
|
+
description={activeConfig.description}
|
|
1195
|
+
details={activeConfig.details}
|
|
1196
|
+
/>
|
|
1197
|
+
</div>
|
|
1198
|
+
{/if}
|
|
1199
|
+
<div class="config-surface__content">
|
|
1200
|
+
<div class="config-surface__section">
|
|
1201
|
+
<h3 class="config-surface__section-title">
|
|
1202
|
+
{activeConfig.configTitle ?? 'Configuration'}
|
|
1203
|
+
</h3>
|
|
1204
|
+
{#if activeConfig.kind === 'node'}
|
|
1205
|
+
{@render nodeConfigFormEl(activeConfig.node)}
|
|
1206
|
+
{:else}
|
|
1207
|
+
{@render workflowConfigFormEl()}
|
|
1208
|
+
{/if}
|
|
1209
|
+
</div>
|
|
1210
|
+
</div>
|
|
1211
|
+
</div>
|
|
1212
|
+
{/if}
|
|
1213
|
+
{/snippet}
|
|
1214
|
+
|
|
1215
|
+
{#snippet configTabContent()}
|
|
1216
|
+
{@render configBody(true)}
|
|
1217
|
+
{/snippet}
|
|
1218
|
+
|
|
1219
|
+
{#snippet configBareContent()}
|
|
1220
|
+
{@render configBody(false)}
|
|
1221
|
+
{/snippet}
|
|
1222
|
+
|
|
1223
|
+
{#snippet consoleSurfaceBody()}
|
|
1224
|
+
<CommandConsole nodeTypes={nodes} onUIAction={handleConsoleUIAction} />
|
|
1225
|
+
{/snippet}
|
|
1226
|
+
|
|
1227
|
+
{#snippet chatSurfaceBody()}
|
|
1228
|
+
<AIChatPanel
|
|
1229
|
+
nodeTypes={nodes}
|
|
1230
|
+
workflowId={fd.workflow.current?.id}
|
|
1231
|
+
onUIAction={handleConsoleUIAction}
|
|
1232
|
+
{endpointConfig}
|
|
1233
|
+
/>
|
|
1234
|
+
{/snippet}
|
|
1235
|
+
|
|
1236
|
+
<!--
|
|
1237
|
+
Console + chat tabs, shared by whichever host the console group is routed to.
|
|
1238
|
+
-->
|
|
1239
|
+
{#snippet consoleChatTabs()}
|
|
1240
|
+
{@const tabs = [
|
|
1241
|
+
{
|
|
1242
|
+
id: 'console',
|
|
1243
|
+
label: mergedMessages.navigation.bottomPanel.console,
|
|
1244
|
+
content: consoleSurfaceBody,
|
|
1245
|
+
display: 'contents' as const
|
|
1246
|
+
},
|
|
1247
|
+
{
|
|
1248
|
+
id: 'chat',
|
|
1249
|
+
label: mergedMessages.navigation.bottomPanel.chat,
|
|
1250
|
+
content: chatSurfaceBody
|
|
1251
|
+
}
|
|
1252
|
+
]}
|
|
1253
|
+
<TabbedSurface {tabs} activeId={activeSurface} onSelect={selectSurface} />
|
|
1254
|
+
{/snippet}
|
|
1255
|
+
|
|
1256
|
+
<!--
|
|
1257
|
+
Rich config panel for the common case: config is the sole occupant of the
|
|
1258
|
+
right sidebar. Keeps ConfigPanel's full chrome (swap, ad-hoc pop-out, details)
|
|
1259
|
+
so the default experience is unchanged.
|
|
1260
|
+
-->
|
|
1261
|
+
{#snippet configPanelSidebar()}
|
|
1262
|
+
{#if activeConfig}
|
|
1263
|
+
<ConfigPanel
|
|
1264
|
+
title={activeConfig.title}
|
|
1265
|
+
id={activeConfig.id}
|
|
1266
|
+
description={activeConfig.description}
|
|
1267
|
+
details={activeConfig.details}
|
|
1268
|
+
configTitle={activeConfig.configTitle ?? 'Configuration'}
|
|
1269
|
+
onClose={closeActiveConfig}
|
|
1270
|
+
onSwap={activeConfig.kind === 'node' && canvasEditable && features.enableNodeSwap
|
|
1271
|
+
? startSwap
|
|
1272
|
+
: undefined}
|
|
1273
|
+
>
|
|
1274
|
+
{#if activeConfig.kind === 'node'}
|
|
1275
|
+
{@render nodeConfigFormEl(activeConfig.node)}
|
|
1276
|
+
{:else}
|
|
1277
|
+
{@render workflowConfigFormEl()}
|
|
1278
|
+
{/if}
|
|
1279
|
+
</ConfigPanel>
|
|
1280
|
+
{/if}
|
|
1281
|
+
{/snippet}
|
|
1282
|
+
|
|
986
1283
|
<!-- MainLayout wrapper for workflow editor -->
|
|
987
1284
|
<div class="flowdrop-root">
|
|
988
1285
|
<MainLayout
|
|
@@ -991,7 +1288,7 @@
|
|
|
991
1288
|
showHeader={showNavbar}
|
|
992
1289
|
showLeftSidebar={!disableSidebar}
|
|
993
1290
|
showRightSidebar={showRightPanel}
|
|
994
|
-
showBottomPanel={
|
|
1291
|
+
showBottomPanel={anyHere('below')}
|
|
995
1292
|
bottomPanelHeight={getUiSettings().consoleHeight}
|
|
996
1293
|
showFooter={false}
|
|
997
1294
|
headerHeight={60}
|
|
@@ -1028,7 +1325,11 @@
|
|
|
1028
1325
|
/>
|
|
1029
1326
|
{/snippet}
|
|
1030
1327
|
|
|
1031
|
-
<!--
|
|
1328
|
+
<!--
|
|
1329
|
+
Right Sidebar. Node-swap sub-flow takes over when active. Otherwise the
|
|
1330
|
+
rail hosts whichever surfaces are placed `sidebar`: a lone config surface
|
|
1331
|
+
keeps the rich ConfigPanel; anything shared coexists as tabs.
|
|
1332
|
+
-->
|
|
1032
1333
|
{#snippet rightSidebar()}
|
|
1033
1334
|
{#if swapMode === 'mapping' && swapInteractiveState && selectedNodeForConfig}
|
|
1034
1335
|
<SwapMappingEditor
|
|
@@ -1048,159 +1349,71 @@
|
|
|
1048
1349
|
onSelect={handleSwapSelect}
|
|
1049
1350
|
onCancel={cancelSwap}
|
|
1050
1351
|
/>
|
|
1051
|
-
{:else if
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
label: 'Connections',
|
|
1062
|
-
value: String(fd.workflow.current?.edges?.length ?? 0)
|
|
1063
|
-
}
|
|
1064
|
-
]}
|
|
1065
|
-
configTitle={mergedMessages.navigation.workflowSettingsPanelSubtitle}
|
|
1066
|
-
onClose={() => (isWorkflowSettingsOpen = false)}
|
|
1067
|
-
>
|
|
1068
|
-
<ConfigForm
|
|
1069
|
-
{authProvider}
|
|
1070
|
-
schema={workflowConfigSchema}
|
|
1071
|
-
values={workflowConfigValues}
|
|
1072
|
-
onChange={(config) => {
|
|
1073
|
-
// Sync workflow settings changes immediately on field blur
|
|
1074
|
-
const wf = fd.workflow.current;
|
|
1075
|
-
if (wf) {
|
|
1076
|
-
const newFormat = (config.format as string) || DEFAULT_WORKFLOW_FORMAT;
|
|
1077
|
-
const currentFormat = wf.metadata?.format || DEFAULT_WORKFLOW_FORMAT;
|
|
1078
|
-
|
|
1079
|
-
// Warn about incompatible nodes when format changes
|
|
1080
|
-
if (newFormat !== currentFormat) {
|
|
1081
|
-
const incompatibleNodes = wf.nodes?.filter((node) => {
|
|
1082
|
-
const formats = node.data?.metadata?.formats;
|
|
1083
|
-
return formats && formats.length > 0 && !formats.includes(newFormat);
|
|
1084
|
-
});
|
|
1085
|
-
if (incompatibleNodes && incompatibleNodes.length > 0) {
|
|
1086
|
-
logger.warn(
|
|
1087
|
-
`Format changed to '${newFormat}'. ${incompatibleNodes.length} node(s) are not compatible with this format and may not export correctly:`,
|
|
1088
|
-
incompatibleNodes.map((n) => n.data?.label || n.type)
|
|
1089
|
-
);
|
|
1090
|
-
}
|
|
1352
|
+
{:else if configHere('sidebar') && !consoleHere('sidebar')}
|
|
1353
|
+
{@render configPanelSidebar()}
|
|
1354
|
+
{:else if configHere('sidebar') || consoleHere('sidebar')}
|
|
1355
|
+
{@const tabs = [
|
|
1356
|
+
...(configHere('sidebar')
|
|
1357
|
+
? [
|
|
1358
|
+
{
|
|
1359
|
+
id: 'config',
|
|
1360
|
+
label: activeConfig?.title ?? 'Configuration',
|
|
1361
|
+
content: configTabContent
|
|
1091
1362
|
}
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
<
|
|
1111
|
-
title={currentNode.data.label}
|
|
1112
|
-
id={currentNode.id}
|
|
1113
|
-
description={currentNode.data.metadata?.description ||
|
|
1114
|
-
mergedMessages.navigation.nodeConfigDescription}
|
|
1115
|
-
details={[
|
|
1116
|
-
{
|
|
1117
|
-
label: 'Type',
|
|
1118
|
-
value: currentNode.data.metadata?.type || currentNode.type
|
|
1119
|
-
},
|
|
1120
|
-
{
|
|
1121
|
-
label: 'Category',
|
|
1122
|
-
value: currentNode.data.metadata?.category || 'general'
|
|
1123
|
-
}
|
|
1124
|
-
]}
|
|
1125
|
-
onClose={closeConfigSidebar}
|
|
1126
|
-
onSwap={canvasEditable && features.enableNodeSwap ? startSwap : undefined}
|
|
1127
|
-
>
|
|
1128
|
-
<ConfigForm
|
|
1129
|
-
{authProvider}
|
|
1130
|
-
node={currentNode}
|
|
1131
|
-
workflowId={fd.workflow.current?.id}
|
|
1132
|
-
workflowNodes={fd.workflow.current?.nodes}
|
|
1133
|
-
workflowEdges={fd.workflow.current?.edges}
|
|
1134
|
-
onChange={async (updatedConfig) => {
|
|
1135
|
-
// Sync config changes to workflow immediately on field blur
|
|
1136
|
-
if (selectedNodeId && currentNode) {
|
|
1137
|
-
// Build the updated node data
|
|
1138
|
-
const updatedData = {
|
|
1139
|
-
...currentNode.data,
|
|
1140
|
-
config: updatedConfig
|
|
1141
|
-
};
|
|
1142
|
-
|
|
1143
|
-
// Update the node in the workflow store
|
|
1144
|
-
const nodeUpdates: Record<string, unknown> = {
|
|
1145
|
-
data: updatedData
|
|
1146
|
-
};
|
|
1147
|
-
|
|
1148
|
-
fd.workflow.updateNode(selectedNodeId, nodeUpdates);
|
|
1149
|
-
|
|
1150
|
-
// Update the local editor state to reflect config changes immediately
|
|
1151
|
-
// This is needed for nodeType changes to take effect visually
|
|
1152
|
-
workflowEditorRef?.updateNodeData(selectedNodeId, updatedData);
|
|
1153
|
-
|
|
1154
|
-
// Refresh edge positions in case config changes affect handles
|
|
1155
|
-
await workflowEditorRef?.refreshEdgePositions(selectedNodeId);
|
|
1156
|
-
}
|
|
1157
|
-
}}
|
|
1158
|
-
/>
|
|
1159
|
-
</ConfigPanel>
|
|
1363
|
+
]
|
|
1364
|
+
: []),
|
|
1365
|
+
...(consoleHere('sidebar')
|
|
1366
|
+
? [
|
|
1367
|
+
{
|
|
1368
|
+
id: 'console',
|
|
1369
|
+
label: mergedMessages.navigation.bottomPanel.console,
|
|
1370
|
+
content: consoleSurfaceBody,
|
|
1371
|
+
display: 'contents' as const
|
|
1372
|
+
},
|
|
1373
|
+
{
|
|
1374
|
+
id: 'chat',
|
|
1375
|
+
label: mergedMessages.navigation.bottomPanel.chat,
|
|
1376
|
+
content: chatSurfaceBody
|
|
1377
|
+
}
|
|
1378
|
+
]
|
|
1379
|
+
: [])
|
|
1380
|
+
] as SurfaceTab[]}
|
|
1381
|
+
<TabbedSurface {tabs} activeId={activeSurface} onSelect={selectSurface} />
|
|
1160
1382
|
{/if}
|
|
1161
1383
|
{/snippet}
|
|
1162
1384
|
|
|
1163
|
-
<!--
|
|
1385
|
+
<!--
|
|
1386
|
+
Bottom Panel. Hosts whichever surfaces are placed `below` — config,
|
|
1387
|
+
console, chat — as a single tab strip (hidden when only one is present).
|
|
1388
|
+
-->
|
|
1164
1389
|
{#snippet bottomPanel()}
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
class="bottom-panel-tabs__panel"
|
|
1193
|
-
style:display={getUiSettings().bottomPanelTab === 'chat' ? 'flex' : 'none'}
|
|
1194
|
-
>
|
|
1195
|
-
<AIChatPanel
|
|
1196
|
-
nodeTypes={nodes}
|
|
1197
|
-
workflowId={fd.workflow.current?.id}
|
|
1198
|
-
onUIAction={handleConsoleUIAction}
|
|
1199
|
-
{endpointConfig}
|
|
1200
|
-
/>
|
|
1201
|
-
</div>
|
|
1202
|
-
</div>
|
|
1203
|
-
</div>
|
|
1390
|
+
{@const tabs = [
|
|
1391
|
+
...(configHere('below')
|
|
1392
|
+
? [
|
|
1393
|
+
{
|
|
1394
|
+
id: 'config',
|
|
1395
|
+
label: activeConfig?.title ?? 'Configuration',
|
|
1396
|
+
content: configTabContent
|
|
1397
|
+
}
|
|
1398
|
+
]
|
|
1399
|
+
: []),
|
|
1400
|
+
...(consoleHere('below')
|
|
1401
|
+
? [
|
|
1402
|
+
{
|
|
1403
|
+
id: 'console',
|
|
1404
|
+
label: mergedMessages.navigation.bottomPanel.console,
|
|
1405
|
+
content: consoleSurfaceBody,
|
|
1406
|
+
display: 'contents' as const
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
id: 'chat',
|
|
1410
|
+
label: mergedMessages.navigation.bottomPanel.chat,
|
|
1411
|
+
content: chatSurfaceBody
|
|
1412
|
+
}
|
|
1413
|
+
]
|
|
1414
|
+
: [])
|
|
1415
|
+
] as SurfaceTab[]}
|
|
1416
|
+
<TabbedSurface {tabs} activeId={activeSurface} onSelect={selectSurface} />
|
|
1204
1417
|
{/snippet}
|
|
1205
1418
|
|
|
1206
1419
|
<!-- Main Content: Workflow Editor with Error Status -->
|
|
@@ -1270,6 +1483,52 @@
|
|
|
1270
1483
|
</MainLayout>
|
|
1271
1484
|
</div>
|
|
1272
1485
|
|
|
1486
|
+
<!--
|
|
1487
|
+
Modal host — floats surfaces routed to `modal` above the canvas. Portalled to
|
|
1488
|
+
<body> by SurfaceOverlay. When both config and console are modal they coexist
|
|
1489
|
+
as tabs inside one overlay.
|
|
1490
|
+
-->
|
|
1491
|
+
{#if configHere('modal') && consoleHere('modal')}
|
|
1492
|
+
<SurfaceOverlay
|
|
1493
|
+
title={activeConfig?.title ?? mergedMessages.navigation.workflowSettingsPanelTitle}
|
|
1494
|
+
closeLabel={mergedMessages.layout.closeConfigPanel}
|
|
1495
|
+
onClose={() => {
|
|
1496
|
+
closeActiveConfig();
|
|
1497
|
+
closeConsole();
|
|
1498
|
+
}}
|
|
1499
|
+
>
|
|
1500
|
+
{@const tabs = [
|
|
1501
|
+
{ id: 'config', label: activeConfig?.title ?? 'Configuration', content: configBareContent },
|
|
1502
|
+
{
|
|
1503
|
+
id: 'console',
|
|
1504
|
+
label: mergedMessages.navigation.bottomPanel.console,
|
|
1505
|
+
content: consoleSurfaceBody,
|
|
1506
|
+
display: 'contents' as const
|
|
1507
|
+
},
|
|
1508
|
+
{ id: 'chat', label: mergedMessages.navigation.bottomPanel.chat, content: chatSurfaceBody }
|
|
1509
|
+
] as SurfaceTab[]}
|
|
1510
|
+
<TabbedSurface {tabs} activeId={activeSurface} onSelect={selectSurface} />
|
|
1511
|
+
</SurfaceOverlay>
|
|
1512
|
+
{:else if configHere('modal')}
|
|
1513
|
+
<SurfaceOverlay
|
|
1514
|
+
title={activeConfig?.title ?? 'Configuration'}
|
|
1515
|
+
closeLabel={mergedMessages.layout.closeConfigPanel}
|
|
1516
|
+
onClose={closeActiveConfig}
|
|
1517
|
+
>
|
|
1518
|
+
{@render configBareContent()}
|
|
1519
|
+
</SurfaceOverlay>
|
|
1520
|
+
{:else if consoleHere('modal')}
|
|
1521
|
+
<SurfaceOverlay
|
|
1522
|
+
title={activeSurface === 'chat'
|
|
1523
|
+
? mergedMessages.navigation.bottomPanel.chat
|
|
1524
|
+
: mergedMessages.navigation.bottomPanel.console}
|
|
1525
|
+
closeLabel={mergedMessages.layout.closeConfigPanel}
|
|
1526
|
+
onClose={closeConsole}
|
|
1527
|
+
>
|
|
1528
|
+
{@render consoleChatTabs()}
|
|
1529
|
+
</SurfaceOverlay>
|
|
1530
|
+
{/if}
|
|
1531
|
+
|
|
1273
1532
|
<style>
|
|
1274
1533
|
.flowdrop-root {
|
|
1275
1534
|
display: contents;
|
|
@@ -1292,55 +1551,81 @@
|
|
|
1292
1551
|
background: var(--fd-layout-background);
|
|
1293
1552
|
}
|
|
1294
1553
|
|
|
1295
|
-
/*
|
|
1296
|
-
|
|
1554
|
+
/*
|
|
1555
|
+
Chromeless config surface (bottom / modal / shared-sidebar hosts). Mirrors
|
|
1556
|
+
ConfigPanel's inner layout; the host owns any outer chrome.
|
|
1557
|
+
*/
|
|
1558
|
+
.config-surface {
|
|
1297
1559
|
display: flex;
|
|
1298
1560
|
flex-direction: column;
|
|
1299
1561
|
height: 100%;
|
|
1300
|
-
|
|
1562
|
+
min-height: 0;
|
|
1563
|
+
background-color: var(--fd-panel-bg);
|
|
1564
|
+
backdrop-filter: var(--fd-panel-backdrop-filter);
|
|
1301
1565
|
}
|
|
1302
1566
|
|
|
1303
|
-
.
|
|
1567
|
+
.config-surface__header {
|
|
1304
1568
|
display: flex;
|
|
1305
|
-
|
|
1306
|
-
|
|
1569
|
+
justify-content: space-between;
|
|
1570
|
+
align-items: center;
|
|
1571
|
+
padding: 0.875rem 1rem;
|
|
1307
1572
|
border-bottom: 1px solid var(--fd-border);
|
|
1573
|
+
background-color: var(--fd-card);
|
|
1308
1574
|
flex-shrink: 0;
|
|
1309
1575
|
}
|
|
1310
1576
|
|
|
1311
|
-
.
|
|
1312
|
-
|
|
1313
|
-
font-size:
|
|
1314
|
-
font-weight:
|
|
1315
|
-
|
|
1577
|
+
.config-surface__title {
|
|
1578
|
+
margin: 0;
|
|
1579
|
+
font-size: 1rem;
|
|
1580
|
+
font-weight: 600;
|
|
1581
|
+
color: var(--fd-foreground);
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
.config-surface__close {
|
|
1585
|
+
background: none;
|
|
1316
1586
|
border: none;
|
|
1317
|
-
|
|
1318
|
-
|
|
1587
|
+
font-size: 1.25rem;
|
|
1588
|
+
line-height: 1;
|
|
1589
|
+
cursor: pointer;
|
|
1319
1590
|
color: var(--fd-muted-foreground);
|
|
1320
|
-
|
|
1591
|
+
padding: 0.25rem;
|
|
1592
|
+
border-radius: var(--fd-radius-sm);
|
|
1593
|
+
transition:
|
|
1594
|
+
color var(--fd-transition-fast),
|
|
1595
|
+
background-color var(--fd-transition-fast);
|
|
1321
1596
|
}
|
|
1322
1597
|
|
|
1323
|
-
.
|
|
1598
|
+
.config-surface__close:hover {
|
|
1324
1599
|
color: var(--fd-foreground);
|
|
1325
|
-
background: var(--fd-
|
|
1600
|
+
background-color: var(--fd-subtle);
|
|
1326
1601
|
}
|
|
1327
1602
|
|
|
1328
|
-
.
|
|
1329
|
-
|
|
1330
|
-
border-bottom
|
|
1331
|
-
background: var(--fd-
|
|
1603
|
+
.config-surface__details {
|
|
1604
|
+
padding: 0.75rem 1rem;
|
|
1605
|
+
border-bottom: 1px solid var(--fd-border-muted);
|
|
1606
|
+
background-color: var(--fd-card);
|
|
1607
|
+
flex-shrink: 0;
|
|
1332
1608
|
}
|
|
1333
1609
|
|
|
1334
|
-
.
|
|
1610
|
+
.config-surface__content {
|
|
1335
1611
|
flex: 1;
|
|
1336
|
-
|
|
1612
|
+
min-height: 0;
|
|
1613
|
+
overflow-y: auto;
|
|
1614
|
+
padding: 1rem;
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
.config-surface__section {
|
|
1337
1618
|
display: flex;
|
|
1338
1619
|
flex-direction: column;
|
|
1620
|
+
gap: 0.75rem;
|
|
1339
1621
|
}
|
|
1340
1622
|
|
|
1341
|
-
.
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1623
|
+
.config-surface__section-title {
|
|
1624
|
+
margin: 0;
|
|
1625
|
+
font-size: var(--fd-text-xs);
|
|
1626
|
+
font-weight: 600;
|
|
1627
|
+
color: var(--fd-muted-foreground);
|
|
1628
|
+
text-transform: uppercase;
|
|
1629
|
+
letter-spacing: 0.05em;
|
|
1345
1630
|
}
|
|
1346
1631
|
</style>
|