@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.
Files changed (228) hide show
  1. package/CHANGELOG.md +173 -0
  2. package/MIGRATION-2.0.md +173 -3
  3. package/README.md +5 -5
  4. package/dist/adapters/WorkflowAdapter.js +4 -5
  5. package/dist/adapters/agentspec/AgentSpecAdapter.js +3 -3
  6. package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
  7. package/dist/api/enhanced-client.js +6 -11
  8. package/dist/commands/executor.js +51 -26
  9. package/dist/commands/storeIntegration.svelte.js +11 -1
  10. package/dist/commands/types.js +5 -5
  11. package/dist/components/App.svelte +547 -386
  12. package/dist/components/App.svelte.d.ts +16 -8
  13. package/dist/components/Button.stories.svelte +65 -0
  14. package/dist/components/Button.stories.svelte.d.ts +19 -0
  15. package/dist/components/Button.svelte +62 -0
  16. package/dist/components/Button.svelte.d.ts +24 -0
  17. package/dist/components/CanvasIconButton.svelte +76 -0
  18. package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
  19. package/dist/components/ConfigForm.svelte +167 -562
  20. package/dist/components/ConfigForm.svelte.d.ts +24 -7
  21. package/dist/components/ConfigModal.svelte +9 -1
  22. package/dist/components/ConfigPanel.svelte +234 -15
  23. package/dist/components/ConfigPanel.svelte.d.ts +6 -0
  24. package/dist/components/EditorStatusBar.stories.svelte +44 -0
  25. package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
  26. package/dist/components/EditorStatusBar.svelte +99 -0
  27. package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
  28. package/dist/components/IconButton.svelte +80 -0
  29. package/dist/components/IconButton.svelte.d.ts +30 -0
  30. package/dist/components/Input.svelte +74 -0
  31. package/dist/components/Input.svelte.d.ts +17 -0
  32. package/dist/components/LogoWordmark.svelte +113 -0
  33. package/dist/components/LogoWordmark.svelte.d.ts +26 -0
  34. package/dist/components/Navbar.svelte +17 -63
  35. package/dist/components/Navbar.svelte.d.ts +3 -0
  36. package/dist/components/NodeSidebar.svelte +21 -126
  37. package/dist/components/NodeSwapPicker.svelte +12 -30
  38. package/dist/components/PipelineStatus.svelte +6 -1
  39. package/dist/components/PipelineStatus.svelte.d.ts +3 -0
  40. package/dist/components/PortMappingRow.svelte +0 -2
  41. package/dist/components/SchemaForm.svelte +4 -14
  42. package/dist/components/Select.svelte +53 -0
  43. package/dist/components/Select.svelte.d.ts +15 -0
  44. package/dist/components/SettingsModal.svelte +0 -5
  45. package/dist/components/SettingsPanel.svelte +24 -6
  46. package/dist/components/Textarea.svelte +39 -0
  47. package/dist/components/Textarea.svelte.d.ts +12 -0
  48. package/dist/components/ThemeToggle.svelte +15 -94
  49. package/dist/components/UniversalNode.svelte +36 -4
  50. package/dist/components/UniversalNode.svelte.d.ts +1 -1
  51. package/dist/components/WorkflowEditor.svelte +66 -52
  52. package/dist/components/WorkflowEditor.svelte.d.ts +21 -0
  53. package/dist/components/chat/AIChatPanel.svelte +7 -2
  54. package/dist/components/console/ConsoleAutocomplete.svelte +1 -1
  55. package/dist/components/console/ConsoleInput.svelte +3 -3
  56. package/dist/components/console/ConsoleOutput.svelte +2 -2
  57. package/dist/components/form/FormArray.svelte +37 -173
  58. package/dist/components/form/FormAutocomplete.svelte +18 -15
  59. package/dist/components/form/FormCheckboxGroup.svelte +1 -5
  60. package/dist/components/form/FormCodeEditor.svelte +9 -7
  61. package/dist/components/form/FormField.svelte +18 -42
  62. package/dist/components/form/FormFieldLight.svelte +52 -48
  63. package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
  64. package/dist/components/form/FormFieldset.svelte +45 -11
  65. package/dist/components/form/FormMarkdownEditor.svelte +8 -5
  66. package/dist/components/form/FormNumberField.svelte +4 -36
  67. package/dist/components/form/FormPorts.svelte +262 -0
  68. package/dist/components/form/FormPorts.svelte.d.ts +13 -0
  69. package/dist/components/form/FormRangeField.svelte +61 -30
  70. package/dist/components/form/FormSelect.svelte +13 -75
  71. package/dist/components/form/FormTemplateEditor.svelte +6 -4
  72. package/dist/components/form/FormTextField.svelte +3 -35
  73. package/dist/components/form/FormTextarea.svelte +4 -39
  74. package/dist/components/form/FormToggle.svelte +0 -4
  75. package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
  76. package/dist/components/form/resolveFieldType.d.ts +24 -0
  77. package/dist/components/form/resolveFieldType.js +55 -0
  78. package/dist/components/icons/CloseIcon.svelte +6 -0
  79. package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
  80. package/dist/components/icons/CommandLineIcon.svelte +15 -0
  81. package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
  82. package/dist/components/icons/MenuIcon.svelte +4 -0
  83. package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
  84. package/dist/components/icons/MenuOpenIcon.svelte +6 -0
  85. package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
  86. package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
  87. package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
  88. package/dist/components/interrupt/InterruptBubble.svelte +11 -12
  89. package/dist/components/interrupt/ReviewPrompt.svelte +0 -20
  90. package/dist/components/interrupt/TextInputPrompt.svelte +0 -6
  91. package/dist/components/layouts/MainLayout.svelte +4 -5
  92. package/dist/components/nodes/AtomNode.svelte +62 -76
  93. package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
  94. package/dist/components/nodes/GatewayNode.svelte +117 -164
  95. package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
  96. package/dist/components/nodes/IdeaNode.svelte +72 -98
  97. package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
  98. package/dist/components/nodes/NodeConfigButton.svelte +86 -0
  99. package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
  100. package/dist/components/nodes/NotesNode.svelte +76 -85
  101. package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
  102. package/dist/components/nodes/SimpleNode.svelte +59 -133
  103. package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
  104. package/dist/components/nodes/SquareNode.svelte +110 -164
  105. package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
  106. package/dist/components/nodes/TerminalNode.svelte +62 -124
  107. package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
  108. package/dist/components/nodes/ToolNode.svelte +92 -103
  109. package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
  110. package/dist/components/nodes/WorkflowNode.svelte +132 -191
  111. package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
  112. package/dist/components/playground/ChatInput.svelte +0 -1
  113. package/dist/components/playground/InputCollector.svelte +11 -48
  114. package/dist/components/playground/PipelineKanbanView.svelte +6 -4
  115. package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
  116. package/dist/components/playground/PipelinePanel.svelte +20 -3
  117. package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
  118. package/dist/components/playground/PipelineTableView.svelte +6 -4
  119. package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
  120. package/dist/components/playground/Playground.svelte +76 -25
  121. package/dist/components/playground/Playground.svelte.d.ts +3 -0
  122. package/dist/components/playground/PlaygroundApp.svelte +6 -1
  123. package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
  124. package/dist/components/playground/PlaygroundModal.svelte +5 -0
  125. package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
  126. package/dist/components/playground/PlaygroundStudio.svelte +7 -6
  127. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
  128. package/dist/components/playground/pipelineViewUtils.svelte.d.ts +2 -1
  129. package/dist/components/playground/pipelineViewUtils.svelte.js +2 -2
  130. package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
  131. package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
  132. package/dist/components/surfaces/TabbedSurface.svelte +133 -0
  133. package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
  134. package/dist/config/endpoints.d.ts +23 -0
  135. package/dist/config/endpoints.js +28 -0
  136. package/dist/core/index.d.ts +2 -3
  137. package/dist/core/index.js +2 -6
  138. package/dist/display/index.d.ts +6 -1
  139. package/dist/display/index.js +9 -1
  140. package/dist/editor/index.d.ts +1 -1
  141. package/dist/editor/index.js +1 -1
  142. package/dist/form/full.d.ts +2 -1
  143. package/dist/form/full.js +4 -1
  144. package/dist/form/index.d.ts +0 -1
  145. package/dist/form/index.js +3 -2
  146. package/dist/helpers/workflowEditorHelper.d.ts +4 -2
  147. package/dist/helpers/workflowEditorHelper.js +8 -8
  148. package/dist/messages/index.d.ts +1 -1
  149. package/dist/messages/index.js +1 -1
  150. package/dist/openapi/v1/openapi.yaml +35 -23
  151. package/dist/playground/index.d.ts +2 -2
  152. package/dist/playground/index.js +2 -2
  153. package/dist/playground/mount.d.ts +19 -5
  154. package/dist/playground/mount.js +16 -8
  155. package/dist/registry/builtinNodeTypes.d.ts +53 -0
  156. package/dist/registry/builtinNodeTypes.js +67 -0
  157. package/dist/registry/builtinNodes.d.ts +2 -39
  158. package/dist/registry/builtinNodes.js +6 -53
  159. package/dist/registry/nodeComponentRegistry.d.ts +2 -1
  160. package/dist/schemas/v1/workflow.schema.json +16 -14
  161. package/dist/services/agentSpecExecutionService.d.ts +0 -2
  162. package/dist/services/agentSpecExecutionService.js +0 -2
  163. package/dist/services/apiVariableService.js +12 -26
  164. package/dist/services/categoriesApi.js +3 -6
  165. package/dist/services/chatService.d.ts +4 -3
  166. package/dist/services/chatService.js +13 -18
  167. package/dist/services/dynamicSchemaService.d.ts +31 -4
  168. package/dist/services/dynamicSchemaService.js +62 -33
  169. package/dist/services/historyService.d.ts +30 -8
  170. package/dist/services/historyService.js +51 -15
  171. package/dist/services/interruptService.d.ts +7 -6
  172. package/dist/services/interruptService.js +19 -21
  173. package/dist/services/playgroundService.d.ts +9 -8
  174. package/dist/services/playgroundService.js +23 -25
  175. package/dist/services/portConfigApi.js +3 -6
  176. package/dist/services/settingsService.d.ts +9 -4
  177. package/dist/services/settingsService.js +23 -12
  178. package/dist/skins/drafter.d.ts +30 -0
  179. package/dist/skins/drafter.js +198 -0
  180. package/dist/skins/index.d.ts +2 -1
  181. package/dist/skins/index.js +4 -2
  182. package/dist/stores/apiContext.d.ts +11 -0
  183. package/dist/stores/apiContext.js +15 -0
  184. package/dist/stores/categoriesStore.svelte.js +0 -1
  185. package/dist/stores/historyStore.svelte.d.ts +17 -3
  186. package/dist/stores/historyStore.svelte.js +30 -3
  187. package/dist/stores/instanceContainer.svelte.js +5 -0
  188. package/dist/stores/playgroundStore.svelte.js +1 -3
  189. package/dist/stores/settingsStore.svelte.d.ts +13 -0
  190. package/dist/stores/settingsStore.svelte.js +32 -0
  191. package/dist/stores/workflowStore.svelte.d.ts +42 -5
  192. package/dist/stores/workflowStore.svelte.js +109 -32
  193. package/dist/styles/base.css +285 -14
  194. package/dist/styles/tokens.css +60 -2
  195. package/dist/svelte-app.d.ts +18 -1
  196. package/dist/svelte-app.js +75 -110
  197. package/dist/themes/drafter.d.ts +2 -0
  198. package/dist/themes/drafter.js +15 -0
  199. package/dist/themes/index.d.ts +2 -1
  200. package/dist/themes/index.js +8 -2
  201. package/dist/types/auth.d.ts +9 -51
  202. package/dist/types/auth.js +4 -54
  203. package/dist/types/events.d.ts +18 -0
  204. package/dist/types/events.js +2 -1
  205. package/dist/types/index.d.ts +84 -29
  206. package/dist/types/index.js +0 -1
  207. package/dist/types/settings.d.ts +17 -1
  208. package/dist/types/settings.js +4 -2
  209. package/dist/types/skin.d.ts +1 -1
  210. package/dist/types/theme.d.ts +16 -2
  211. package/dist/types/uischema.d.ts +5 -0
  212. package/dist/utils/colors.d.ts +27 -0
  213. package/dist/utils/colors.js +23 -0
  214. package/dist/utils/connections.js +20 -56
  215. package/dist/utils/edgeStyling.js +9 -5
  216. package/dist/utils/fetchWithAuth.d.ts +36 -15
  217. package/dist/utils/fetchWithAuth.js +53 -23
  218. package/dist/utils/nodeIds.d.ts +1 -1
  219. package/dist/utils/nodeIds.js +1 -1
  220. package/dist/utils/nodeSwap.js +3 -6
  221. package/dist/utils/nodeTypes.js +1 -1
  222. package/dist/utils/portUtils.d.ts +47 -11
  223. package/dist/utils/portUtils.js +67 -14
  224. package/dist/utils/portal.d.ts +18 -0
  225. package/dist/utils/portal.js +34 -0
  226. package/dist/utils/schemaMerge.d.ts +25 -0
  227. package/dist/utils/schemaMerge.js +61 -0
  228. package/package.json +2 -1
@@ -5,19 +5,27 @@
5
5
  -->
6
6
 
7
7
  <script lang="ts">
8
- import { onMount, tick } from 'svelte';
8
+ import { onMount, tick, untrack } from 'svelte';
9
9
  import MainLayout from './layouts/MainLayout.svelte';
10
10
  import WorkflowEditor from './WorkflowEditor.svelte';
11
11
  import NodeSidebar from './NodeSidebar.svelte';
12
- import Icon from '@iconify/svelte';
12
+ import CanvasIconButton from './CanvasIconButton.svelte';
13
+ import EditorStatusBar from './EditorStatusBar.svelte';
14
+ import MenuIcon from './icons/MenuIcon.svelte';
15
+ import MenuOpenIcon from './icons/MenuOpenIcon.svelte';
13
16
  import ConfigForm from './ConfigForm.svelte';
14
17
  import ConfigPanel from './ConfigPanel.svelte';
18
+ import ReadOnlyDetails from './ReadOnlyDetails.svelte';
15
19
  import CommandConsole from './console/CommandConsole.svelte';
16
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';
17
24
  import type { UIAction } from '../commands/index.js';
18
25
  import NodeSwapPicker from './NodeSwapPicker.svelte';
19
26
  import SwapMappingEditor from './SwapMappingEditor.svelte';
20
27
  import Navbar from './Navbar.svelte';
28
+ import type { NavbarAction } from '../types/navbar.js';
21
29
  import type { NodeMetadata, Workflow, WorkflowNode, ConfigSchema } from '../types/index.js';
22
30
  import type { InteractiveSwapState, SwapEventContext } from '../utils/nodeSwap.js';
23
31
  import {
@@ -44,11 +52,12 @@
44
52
  import {
45
53
  getUiSettings,
46
54
  updateSettings,
55
+ seedUiDefaults,
47
56
  initializeTheme
48
57
  } from '../stores/settingsStore.svelte.js';
49
58
  import { logger } from '../utils/logger.js';
50
59
  import { validateWorkflowData } from '../utils/validation.js';
51
- import type { SettingsCategory } from '../types/settings.js';
60
+ import type { SettingsCategory, SurfacePlacement } from '../types/settings.js';
52
61
  import { defaultMessages, mergeMessages, setMessages } from '../messages/index.js';
53
62
  import type { MessagesOverride } from '../messages/index.js';
54
63
 
@@ -68,6 +77,19 @@
68
77
  showNavbar?: boolean;
69
78
  /** Disable the node sidebar */
70
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;
71
93
  /**
72
94
  * Editor interaction mode. Replaces the former `readOnly` + `lockWorkflow`
73
95
  * boolean pair (2.0 breaking change).
@@ -98,13 +120,7 @@
98
120
  /** Custom navbar title */
99
121
  navbarTitle?: string;
100
122
  /** Custom navbar actions */
101
- navbarActions?: Array<{
102
- label: string;
103
- href: string;
104
- icon?: string;
105
- variant?: 'primary' | 'secondary' | 'outline';
106
- onclick?: (event: Event) => void;
107
- }>;
123
+ navbarActions?: NavbarAction[];
108
124
  /** Show settings gear icon in navbar */
109
125
  showSettings?: boolean;
110
126
  /** Show the "Connected" status indicator in the navbar (default: true) */
@@ -169,6 +185,8 @@
169
185
  width = '100%',
170
186
  showNavbar = false,
171
187
  disableSidebar = false,
188
+ configPlacement: configPlacementProp,
189
+ consolePlacement: consolePlacementProp,
172
190
  mode = 'edit',
173
191
  pipelineId,
174
192
  refreshTrigger = 0,
@@ -333,6 +351,12 @@
333
351
  // Workflow settings sidebar state
334
352
  let isWorkflowSettingsOpen = $state(false);
335
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
+
336
360
  // Node swap state
337
361
  let swapMode = $state<'idle' | 'picking' | 'mapping'>('idle');
338
362
  let swapInteractiveState = $state<InteractiveSwapState | null>(null);
@@ -414,8 +438,8 @@
414
438
  if (propNodes && propNodes.length > 0) {
415
439
  // Merge format-provided nodes with prop nodes (deduplicate by ID, props take priority)
416
440
  const formatNodes = fd.formats.getAllFormatNodes();
417
- const existingIds = new Set(propNodes.map((n) => n.id));
418
- const uniqueFormatNodes = formatNodes.filter((n) => !existingIds.has(n.id));
441
+ const existingIds = new Set(propNodes.map((n) => n.node_type_id));
442
+ const uniqueFormatNodes = formatNodes.filter((n) => !existingIds.has(n.node_type_id));
419
443
  nodes = [...propNodes, ...uniqueFormatNodes];
420
444
  nodeTypesLoading = false;
421
445
  return;
@@ -431,8 +455,8 @@
431
455
 
432
456
  // Merge format-provided nodes with API nodes (deduplicate by ID, API takes priority)
433
457
  const formatNodes = fd.formats.getAllFormatNodes();
434
- const existingIds = new Set(fetchedNodes.map((n) => n.id));
435
- const uniqueFormatNodes = formatNodes.filter((n) => !existingIds.has(n.id));
458
+ const existingIds = new Set(fetchedNodes.map((n) => n.node_type_id));
459
+ const uniqueFormatNodes = formatNodes.filter((n) => !existingIds.has(n.node_type_id));
436
460
  nodes = [...fetchedNodes, ...uniqueFormatNodes];
437
461
  error = null;
438
462
  nodeTypesLoading = false;
@@ -558,6 +582,7 @@
558
582
  }
559
583
  selectedNodeId = node.id;
560
584
  isConfigSidebarOpen = true;
585
+ activeSurface = 'config';
561
586
  // Reset swap state when switching nodes
562
587
  swapMode = 'idle';
563
588
  swapInteractiveState = null;
@@ -579,6 +604,7 @@
579
604
  // Close config sidebar if opening workflow settings
580
605
  if (isWorkflowSettingsOpen) {
581
606
  closeConfigSidebar();
607
+ activeSurface = 'config';
582
608
  }
583
609
  }
584
610
 
@@ -706,7 +732,43 @@
706
732
  * All save logic (blur flush, metadata construction, API call, event hooks,
707
733
  * toast notifications) lives in globalSave.ts — the single source of truth.
708
734
  */
735
+ // --- Node config live-edit sessions --------------------------------------
736
+ // Config fields commit live (per change) into the store via
737
+ // fd.workflow.updateNodeConfig(), which coalesces a field-editing session
738
+ // into a single undo step and defers the external change event. We finalize
739
+ // that session — commit the undo step, fire the deferred event, and refresh
740
+ // edge geometry ONCE — on blur, panel close, node switch, and save. Edges are
741
+ // refreshed only here, never per keystroke (that per-change recompute, plus a
742
+ // full-workflow history clone per keystroke, was the original editor freeze).
743
+ let pendingConfigNodeId: string | null = null;
744
+
745
+ function flushNodeConfigEdit(): void {
746
+ const nodeId = pendingConfigNodeId;
747
+ pendingConfigNodeId = null;
748
+ fd.workflow.finalizeNodeConfig();
749
+ if (nodeId) {
750
+ // Handle geometry can only have changed via config (e.g. gateway
751
+ // branches); refresh once now that the session is done.
752
+ void workflowEditorRef?.refreshEdgePositions(nodeId);
753
+ }
754
+ }
755
+
756
+ // Finalize the previous field session when the open config node changes
757
+ // (switching nodes, or closing the panel). Tracks the node id reactively;
758
+ // the flush itself is untracked so it can't feed back into the effect.
759
+ let lastConfigNodeId: string | null = null;
760
+ $effect(() => {
761
+ const id = activeConfig?.kind === 'node' ? activeConfig.node.id : null;
762
+ if (id !== lastConfigNodeId) {
763
+ lastConfigNodeId = id;
764
+ untrack(() => flushNodeConfigEdit());
765
+ }
766
+ });
767
+
709
768
  async function saveWorkflow(): Promise<void> {
769
+ // Commit any in-flight config edit so the save and its history are
770
+ // consistent (the value itself is already live in the store).
771
+ flushNodeConfigEdit();
710
772
  await globalSaveWorkflow({
711
773
  eventHandlers: { onBeforeSave, onAfterSave, onSaveError, onApiError },
712
774
  features,
@@ -806,6 +868,13 @@
806
868
  // choice was otherwise never restored on reload).
807
869
  initializeTheme();
808
870
 
871
+ // Seed placement defaults from mount props without clobbering a returning
872
+ // user's persisted choices (host default < user snapshot).
873
+ seedUiDefaults({
874
+ configPlacement: configPlacementProp,
875
+ consolePlacement: consolePlacementProp
876
+ });
877
+
809
878
  (async () => {
810
879
  try {
811
880
  await initializeApiEndpoints();
@@ -875,14 +944,83 @@
875
944
  };
876
945
  });
877
946
 
947
+ // =========================================================================
948
+ // Surface placement — where the config panel and console/chat are hosted.
949
+ // =========================================================================
950
+
951
+ const configPlacement = $derived(getUiSettings().configPlacement);
952
+ const consolePlacement = $derived(getUiSettings().consolePlacement);
953
+
954
+ /** Config surface has something to show (node config or workflow settings). */
955
+ const configActive = $derived(isWorkflowSettingsOpen || !!selectedNodeForConfig);
956
+ /** Console/chat group is available (editable canvas, console toggled open). */
957
+ const consoleActive = $derived(getUiSettings().consoleOpen && canvasEditable);
958
+ /** Node-swap sub-flow occupies the right sidebar regardless of placement. */
959
+ const swapActive = $derived(swapMode !== 'idle');
960
+
961
+ const configHere = (loc: SurfacePlacement) => configActive && configPlacement === loc;
962
+ const consoleHere = (loc: SurfacePlacement) => consoleActive && consolePlacement === loc;
963
+
964
+ /** Any surface routed to a given host location is present there. */
965
+ const anyHere = (loc: SurfacePlacement) => configHere(loc) || consoleHere(loc);
966
+
878
967
  /**
879
- * Derived value for showing the right config panel
880
- * Config panel always appears on the right side
968
+ * Metadata for the active config surface, independent of its host. The form
969
+ * itself is rendered by the host via the `configBody` snippet.
881
970
  */
882
- const hasConfigPanelOpen = $derived(
883
- isWorkflowSettingsOpen || !!selectedNodeForConfig || swapMode !== 'idle'
971
+ const activeConfig = $derived.by(() => {
972
+ if (isWorkflowSettingsOpen) {
973
+ return {
974
+ kind: 'workflow' as const,
975
+ title: mergedMessages.navigation.workflowSettingsPanelTitle,
976
+ id: fd.workflow.current?.id,
977
+ description: undefined as string | undefined,
978
+ details: [
979
+ { label: 'Nodes', value: String(fd.workflow.current?.nodes?.length ?? 0) },
980
+ { label: 'Connections', value: String(fd.workflow.current?.edges?.length ?? 0) }
981
+ ],
982
+ configTitle: mergedMessages.navigation.workflowSettingsPanelSubtitle
983
+ };
984
+ }
985
+ const node = selectedNodeForConfig;
986
+ if (node) {
987
+ return {
988
+ kind: 'node' as const,
989
+ node,
990
+ title: node.data.label,
991
+ id: node.id,
992
+ description:
993
+ node.data.metadata?.description || mergedMessages.navigation.nodeConfigDescription,
994
+ details: [
995
+ { label: 'Type', value: node.data.metadata?.type || node.type },
996
+ { label: 'Category', value: node.data.metadata?.category || 'general' }
997
+ ],
998
+ configTitle: undefined as string | undefined
999
+ };
1000
+ }
1001
+ return null;
1002
+ });
1003
+
1004
+ /** Close whichever config surface is currently open. */
1005
+ function closeActiveConfig(): void {
1006
+ if (isWorkflowSettingsOpen) {
1007
+ isWorkflowSettingsOpen = false;
1008
+ } else {
1009
+ closeConfigSidebar();
1010
+ }
1011
+ }
1012
+
1013
+ /** Select a surface tab; console/chat also persist as the last bottom tab. */
1014
+ function selectSurface(id: string): void {
1015
+ activeSurface = id;
1016
+ if (id === 'console' || id === 'chat') {
1017
+ updateSettings({ ui: { bottomPanelTab: id } });
1018
+ }
1019
+ }
1020
+
1021
+ const showRightPanel = $derived(
1022
+ !disableSidebar && (swapActive || configHere('sidebar') || consoleHere('sidebar'))
884
1023
  );
885
- const showRightPanel = $derived(!disableSidebar && hasConfigPanelOpen);
886
1024
 
887
1025
  /**
888
1026
  * Calculate left sidebar width based on collapsed state
@@ -967,6 +1105,11 @@
967
1105
  }
968
1106
  });
969
1107
  }
1108
+
1109
+ /** Close the console/chat group (used by the modal host's close button). */
1110
+ function closeConsole(): void {
1111
+ updateSettings({ ui: { consoleOpen: false } });
1112
+ }
970
1113
  </script>
971
1114
 
972
1115
  <svelte:window onkeydown={handleGlobalKeydown} />
@@ -985,6 +1128,197 @@
985
1128
  onchange={handleImportFileChange}
986
1129
  />
987
1130
 
1131
+ <!--
1132
+ Surface content snippets — each rendered by exactly one host (a surface has a
1133
+ single placement), so the once-per-render Snippet constraint always holds.
1134
+ -->
1135
+
1136
+ {#snippet nodeConfigFormEl(node: WorkflowNode)}
1137
+ <ConfigForm
1138
+ {authProvider}
1139
+ {node}
1140
+ commitMode="live"
1141
+ workflowId={fd.workflow.current?.id}
1142
+ workflowNodes={fd.workflow.current?.nodes}
1143
+ workflowEdges={fd.workflow.current?.edges}
1144
+ onChange={(updatedConfig, meta) => {
1145
+ if (!node.id) return;
1146
+ const updatedData = { ...node.data, config: updatedConfig };
1147
+
1148
+ // Blur / end-of-session: commit the coalesced undo step + fire the
1149
+ // change event once, and refresh edges once.
1150
+ if (meta?.commit) {
1151
+ pendingConfigNodeId = node.id;
1152
+ flushNodeConfigEdit();
1153
+ return;
1154
+ }
1155
+
1156
+ // Live edit (every change): update the store cheaply — no history clone,
1157
+ // no external event; both are deferred to the session flush above. Also
1158
+ // reflect the change on the canvas immediately (e.g. nodeType changes).
1159
+ pendingConfigNodeId = node.id;
1160
+ fd.workflow.updateNodeConfig(node.id, { data: updatedData }, { fieldKey: meta?.fieldKey });
1161
+ workflowEditorRef?.updateNodeData(node.id, updatedData);
1162
+ }}
1163
+ />
1164
+ {/snippet}
1165
+
1166
+ {#snippet workflowConfigFormEl()}
1167
+ <ConfigForm
1168
+ {authProvider}
1169
+ schema={workflowConfigSchema}
1170
+ values={workflowConfigValues}
1171
+ commitMode="blur"
1172
+ onChange={(config) => {
1173
+ // Sync workflow settings changes immediately on field blur
1174
+ const wf = fd.workflow.current;
1175
+ if (wf) {
1176
+ const newFormat = (config.format as string) || DEFAULT_WORKFLOW_FORMAT;
1177
+ const currentFormat = wf.metadata?.format || DEFAULT_WORKFLOW_FORMAT;
1178
+
1179
+ // Warn about incompatible nodes when format changes
1180
+ if (newFormat !== currentFormat) {
1181
+ const incompatibleNodes = wf.nodes?.filter((node) => {
1182
+ const formats = node.data?.metadata?.formats;
1183
+ return formats && formats.length > 0 && !formats.includes(newFormat);
1184
+ });
1185
+ if (incompatibleNodes && incompatibleNodes.length > 0) {
1186
+ logger.warn(
1187
+ `Format changed to '${newFormat}'. ${incompatibleNodes.length} node(s) are not compatible with this format and may not export correctly:`,
1188
+ incompatibleNodes.map((n) => n.data?.label || n.type)
1189
+ );
1190
+ }
1191
+ }
1192
+
1193
+ // Extract built-in fields; everything else belongs in workflow.config
1194
+ const { name, description, format: _format, ...customConfig } = config;
1195
+ fd.workflow.batchUpdate({
1196
+ name: name as string,
1197
+ description: description as string | undefined,
1198
+ metadata: {
1199
+ ...wf.metadata,
1200
+ format: newFormat
1201
+ },
1202
+ ...(workflowSettingsSchema && { config: customConfig as Record<string, unknown> })
1203
+ });
1204
+ }
1205
+ }}
1206
+ />
1207
+ {/snippet}
1208
+
1209
+ <!--
1210
+ Chromeless config body for tabbed/overlay hosts. `showHeader` draws a slim
1211
+ title + close bar when the host doesn't provide one (bottom / shared sidebar);
1212
+ the modal host supplies its own header, so it passes `false`.
1213
+ -->
1214
+ {#snippet configBody(showHeader: boolean)}
1215
+ {#if activeConfig}
1216
+ <div class="config-surface">
1217
+ {#if showHeader}
1218
+ <div class="config-surface__header">
1219
+ <h2 class="config-surface__title">{activeConfig.title}</h2>
1220
+ <button
1221
+ class="config-surface__close"
1222
+ onclick={closeActiveConfig}
1223
+ aria-label={mergedMessages.layout.closeConfigPanel}
1224
+ >
1225
+ ×
1226
+ </button>
1227
+ </div>
1228
+ {/if}
1229
+ {#if activeConfig.id}
1230
+ <div class="config-surface__details">
1231
+ <ReadOnlyDetails
1232
+ id={activeConfig.id}
1233
+ description={activeConfig.description}
1234
+ details={activeConfig.details}
1235
+ />
1236
+ </div>
1237
+ {/if}
1238
+ <div class="config-surface__content">
1239
+ <div class="config-surface__section">
1240
+ <h3 class="config-surface__section-title">
1241
+ {activeConfig.configTitle ?? 'Configuration'}
1242
+ </h3>
1243
+ {#if activeConfig.kind === 'node'}
1244
+ {@render nodeConfigFormEl(activeConfig.node)}
1245
+ {:else}
1246
+ {@render workflowConfigFormEl()}
1247
+ {/if}
1248
+ </div>
1249
+ </div>
1250
+ </div>
1251
+ {/if}
1252
+ {/snippet}
1253
+
1254
+ {#snippet configTabContent()}
1255
+ {@render configBody(true)}
1256
+ {/snippet}
1257
+
1258
+ {#snippet configBareContent()}
1259
+ {@render configBody(false)}
1260
+ {/snippet}
1261
+
1262
+ {#snippet consoleSurfaceBody()}
1263
+ <CommandConsole nodeTypes={nodes} onUIAction={handleConsoleUIAction} />
1264
+ {/snippet}
1265
+
1266
+ {#snippet chatSurfaceBody()}
1267
+ <AIChatPanel
1268
+ nodeTypes={nodes}
1269
+ workflowId={fd.workflow.current?.id}
1270
+ onUIAction={handleConsoleUIAction}
1271
+ {endpointConfig}
1272
+ />
1273
+ {/snippet}
1274
+
1275
+ <!--
1276
+ Console + chat tabs, shared by whichever host the console group is routed to.
1277
+ -->
1278
+ {#snippet consoleChatTabs()}
1279
+ {@const tabs = [
1280
+ {
1281
+ id: 'console',
1282
+ label: mergedMessages.navigation.bottomPanel.console,
1283
+ content: consoleSurfaceBody,
1284
+ display: 'contents' as const
1285
+ },
1286
+ {
1287
+ id: 'chat',
1288
+ label: mergedMessages.navigation.bottomPanel.chat,
1289
+ content: chatSurfaceBody
1290
+ }
1291
+ ]}
1292
+ <TabbedSurface {tabs} activeId={activeSurface} onSelect={selectSurface} />
1293
+ {/snippet}
1294
+
1295
+ <!--
1296
+ Rich config panel for the common case: config is the sole occupant of the
1297
+ right sidebar. Keeps ConfigPanel's full chrome (swap, ad-hoc pop-out, details)
1298
+ so the default experience is unchanged.
1299
+ -->
1300
+ {#snippet configPanelSidebar()}
1301
+ {#if activeConfig}
1302
+ <ConfigPanel
1303
+ title={activeConfig.title}
1304
+ id={activeConfig.id}
1305
+ description={activeConfig.description}
1306
+ details={activeConfig.details}
1307
+ configTitle={activeConfig.configTitle ?? 'Configuration'}
1308
+ onClose={closeActiveConfig}
1309
+ onSwap={activeConfig.kind === 'node' && canvasEditable && features.enableNodeSwap
1310
+ ? startSwap
1311
+ : undefined}
1312
+ >
1313
+ {#if activeConfig.kind === 'node'}
1314
+ {@render nodeConfigFormEl(activeConfig.node)}
1315
+ {:else}
1316
+ {@render workflowConfigFormEl()}
1317
+ {/if}
1318
+ </ConfigPanel>
1319
+ {/if}
1320
+ {/snippet}
1321
+
988
1322
  <!-- MainLayout wrapper for workflow editor -->
989
1323
  <div class="flowdrop-root">
990
1324
  <MainLayout
@@ -993,7 +1327,7 @@
993
1327
  showHeader={showNavbar}
994
1328
  showLeftSidebar={!disableSidebar}
995
1329
  showRightSidebar={showRightPanel}
996
- showBottomPanel={getUiSettings().consoleOpen && canvasEditable}
1330
+ showBottomPanel={anyHere('below')}
997
1331
  bottomPanelHeight={getUiSettings().consoleHeight}
998
1332
  showFooter={false}
999
1333
  headerHeight={60}
@@ -1030,7 +1364,11 @@
1030
1364
  />
1031
1365
  {/snippet}
1032
1366
 
1033
- <!-- Right Sidebar: Configuration, Swap, or Workflow Settings -->
1367
+ <!--
1368
+ Right Sidebar. Node-swap sub-flow takes over when active. Otherwise the
1369
+ rail hosts whichever surfaces are placed `sidebar`: a lone config surface
1370
+ keeps the rich ConfigPanel; anything shared coexists as tabs.
1371
+ -->
1034
1372
  {#snippet rightSidebar()}
1035
1373
  {#if swapMode === 'mapping' && swapInteractiveState && selectedNodeForConfig}
1036
1374
  <SwapMappingEditor
@@ -1050,218 +1388,89 @@
1050
1388
  onSelect={handleSwapSelect}
1051
1389
  onCancel={cancelSwap}
1052
1390
  />
1053
- {:else if isWorkflowSettingsOpen}
1054
- <ConfigPanel
1055
- title={mergedMessages.navigation.workflowSettingsPanelTitle}
1056
- id={fd.workflow.current?.id}
1057
- details={[
1058
- {
1059
- label: 'Nodes',
1060
- value: String(fd.workflow.current?.nodes?.length ?? 0)
1061
- },
1062
- {
1063
- label: 'Connections',
1064
- value: String(fd.workflow.current?.edges?.length ?? 0)
1065
- }
1066
- ]}
1067
- configTitle={mergedMessages.navigation.workflowSettingsPanelSubtitle}
1068
- onClose={() => (isWorkflowSettingsOpen = false)}
1069
- >
1070
- <ConfigForm
1071
- {authProvider}
1072
- schema={workflowConfigSchema}
1073
- values={workflowConfigValues}
1074
- showUIExtensions={false}
1075
- onChange={(config) => {
1076
- // Sync workflow settings changes immediately on field blur
1077
- const wf = fd.workflow.current;
1078
- if (wf) {
1079
- const newFormat = (config.format as string) || DEFAULT_WORKFLOW_FORMAT;
1080
- const currentFormat = wf.metadata?.format || DEFAULT_WORKFLOW_FORMAT;
1081
-
1082
- // Warn about incompatible nodes when format changes
1083
- if (newFormat !== currentFormat) {
1084
- const incompatibleNodes = wf.nodes?.filter((node) => {
1085
- const formats = node.data?.metadata?.formats;
1086
- return formats && formats.length > 0 && !formats.includes(newFormat);
1087
- });
1088
- if (incompatibleNodes && incompatibleNodes.length > 0) {
1089
- logger.warn(
1090
- `Format changed to '${newFormat}'. ${incompatibleNodes.length} node(s) are not compatible with this format and may not export correctly:`,
1091
- incompatibleNodes.map((n) => n.data?.label || n.type)
1092
- );
1093
- }
1391
+ {:else if configHere('sidebar') && !consoleHere('sidebar')}
1392
+ {@render configPanelSidebar()}
1393
+ {:else if configHere('sidebar') || consoleHere('sidebar')}
1394
+ {@const tabs = [
1395
+ ...(configHere('sidebar')
1396
+ ? [
1397
+ {
1398
+ id: 'config',
1399
+ label: activeConfig?.title ?? 'Configuration',
1400
+ content: configTabContent
1094
1401
  }
1095
-
1096
- // Extract built-in fields; everything else belongs in workflow.config
1097
- const { name, description, format: _format, ...customConfig } = config;
1098
- fd.workflow.batchUpdate({
1099
- name: name as string,
1100
- description: description as string | undefined,
1101
- metadata: {
1102
- ...wf.metadata,
1103
- format: newFormat
1104
- },
1105
- ...(workflowSettingsSchema && { config: customConfig as Record<string, unknown> })
1106
- });
1107
- }
1108
- }}
1109
- />
1110
- </ConfigPanel>
1111
- {:else if selectedNodeForConfig}
1112
- {@const currentNode = selectedNodeForConfig}
1113
- <ConfigPanel
1114
- title={currentNode.data.label}
1115
- id={currentNode.id}
1116
- description={currentNode.data.metadata?.description ||
1117
- mergedMessages.navigation.nodeConfigDescription}
1118
- details={[
1119
- {
1120
- label: 'Type',
1121
- value: currentNode.data.metadata?.type || currentNode.type
1122
- },
1123
- {
1124
- label: 'Category',
1125
- value: currentNode.data.metadata?.category || 'general'
1126
- }
1127
- ]}
1128
- onClose={closeConfigSidebar}
1129
- onSwap={canvasEditable && features.enableNodeSwap ? startSwap : undefined}
1130
- >
1131
- <ConfigForm
1132
- {authProvider}
1133
- node={currentNode}
1134
- workflowId={fd.workflow.current?.id}
1135
- workflowNodes={fd.workflow.current?.nodes}
1136
- workflowEdges={fd.workflow.current?.edges}
1137
- onChange={async (updatedConfig, uiExtensions) => {
1138
- // Sync config changes to workflow immediately on field blur
1139
- if (selectedNodeId && currentNode) {
1140
- // Build the updated node data
1141
- const updatedData = {
1142
- ...currentNode.data,
1143
- config: updatedConfig
1144
- };
1145
-
1146
- // Include UI extensions if provided
1147
- if (uiExtensions) {
1148
- updatedData.extensions = {
1149
- ...currentNode.data.extensions,
1150
- ui: uiExtensions
1151
- };
1402
+ ]
1403
+ : []),
1404
+ ...(consoleHere('sidebar')
1405
+ ? [
1406
+ {
1407
+ id: 'console',
1408
+ label: mergedMessages.navigation.bottomPanel.console,
1409
+ content: consoleSurfaceBody,
1410
+ display: 'contents' as const
1411
+ },
1412
+ {
1413
+ id: 'chat',
1414
+ label: mergedMessages.navigation.bottomPanel.chat,
1415
+ content: chatSurfaceBody
1152
1416
  }
1153
-
1154
- // Update the node in the workflow store
1155
- const nodeUpdates: Record<string, unknown> = {
1156
- data: updatedData
1157
- };
1158
-
1159
- fd.workflow.updateNode(selectedNodeId, nodeUpdates);
1160
-
1161
- // Update the local editor state to reflect config changes immediately
1162
- // This is needed for nodeType changes to take effect visually
1163
- workflowEditorRef?.updateNodeData(selectedNodeId, updatedData);
1164
-
1165
- // Refresh edge positions in case config changes affect handles
1166
- await workflowEditorRef?.refreshEdgePositions(selectedNodeId);
1167
- }
1168
- }}
1169
- />
1170
- </ConfigPanel>
1417
+ ]
1418
+ : [])
1419
+ ] as SurfaceTab[]}
1420
+ <TabbedSurface {tabs} activeId={activeSurface} onSelect={selectSurface} />
1171
1421
  {/if}
1172
1422
  {/snippet}
1173
1423
 
1174
- <!-- Bottom Panel: Tabbed Console / AI Assistant -->
1424
+ <!--
1425
+ Bottom Panel. Hosts whichever surfaces are placed `below` — config,
1426
+ console, chat — as a single tab strip (hidden when only one is present).
1427
+ -->
1175
1428
  {#snippet bottomPanel()}
1176
- <div class="bottom-panel-tabs">
1177
- <div class="bottom-panel-tabs__bar">
1178
- <button
1179
- class="bottom-panel-tabs__tab {getUiSettings().bottomPanelTab === 'console'
1180
- ? 'bottom-panel-tabs__tab--active'
1181
- : ''}"
1182
- onclick={() => updateSettings({ ui: { bottomPanelTab: 'console' } })}
1183
- >
1184
- {mergedMessages.navigation.bottomPanel.console}
1185
- </button>
1186
- <button
1187
- class="bottom-panel-tabs__tab {getUiSettings().bottomPanelTab === 'chat'
1188
- ? 'bottom-panel-tabs__tab--active'
1189
- : ''}"
1190
- onclick={() => updateSettings({ ui: { bottomPanelTab: 'chat' } })}
1191
- >
1192
- {mergedMessages.navigation.bottomPanel.chat}
1193
- </button>
1194
- </div>
1195
- <div class="bottom-panel-tabs__content">
1196
- <div
1197
- class="bottom-panel-tabs__panel"
1198
- style:display={getUiSettings().bottomPanelTab === 'console' ? 'contents' : 'none'}
1199
- >
1200
- <CommandConsole nodeTypes={nodes} onUIAction={handleConsoleUIAction} />
1201
- </div>
1202
- <div
1203
- class="bottom-panel-tabs__panel"
1204
- style:display={getUiSettings().bottomPanelTab === 'chat' ? 'flex' : 'none'}
1205
- >
1206
- <AIChatPanel
1207
- nodeTypes={nodes}
1208
- workflowId={fd.workflow.current?.id}
1209
- onUIAction={handleConsoleUIAction}
1210
- {endpointConfig}
1211
- />
1212
- </div>
1213
- </div>
1214
- </div>
1429
+ {@const tabs = [
1430
+ ...(configHere('below')
1431
+ ? [
1432
+ {
1433
+ id: 'config',
1434
+ label: activeConfig?.title ?? 'Configuration',
1435
+ content: configTabContent
1436
+ }
1437
+ ]
1438
+ : []),
1439
+ ...(consoleHere('below')
1440
+ ? [
1441
+ {
1442
+ id: 'console',
1443
+ label: mergedMessages.navigation.bottomPanel.console,
1444
+ content: consoleSurfaceBody,
1445
+ display: 'contents' as const
1446
+ },
1447
+ {
1448
+ id: 'chat',
1449
+ label: mergedMessages.navigation.bottomPanel.chat,
1450
+ content: chatSurfaceBody
1451
+ }
1452
+ ]
1453
+ : [])
1454
+ ] as SurfaceTab[]}
1455
+ <TabbedSurface {tabs} activeId={activeSurface} onSelect={selectSurface} />
1215
1456
  {/snippet}
1216
1457
 
1217
1458
  <!-- Main Content: Workflow Editor with Error Status -->
1218
- <!-- Status Display: aria-live announces API errors dynamically without requiring focus -->
1219
1459
  {#if error}
1220
- <div class="flowdrop-status flowdrop-status--error" aria-live="polite" aria-atomic="true">
1221
- <div class="flowdrop-status__content">
1222
- <div class="flowdrop-flex flowdrop-gap--3">
1223
- <div class="flowdrop-status__indicator flowdrop-status__indicator--error"></div>
1224
- <span class="flowdrop-text--sm flowdrop-font--medium">Error: {error}</span>
1225
- </div>
1226
- <div class="flowdrop-flex flowdrop-gap--2">
1227
- <button
1228
- class="flowdrop-btn flowdrop-btn--sm flowdrop-btn--primary"
1229
- onclick={retryLoad}
1230
- type="button"
1231
- >
1232
- Retry
1233
- </button>
1234
- <button
1235
- class="flowdrop-btn flowdrop-btn--sm flowdrop-btn--outline"
1236
- onclick={() => {
1237
- const defaultUrl = '/api/flowdrop';
1238
- const newUrl = prompt('Enter Backend API URL:', defaultUrl);
1239
- if (newUrl) {
1240
- configureApi(createEndpointConfig(newUrl));
1241
- fetchNodeTypes();
1242
- }
1243
- }}
1244
- type="button"
1245
- >
1246
- Set API URL
1247
- </button>
1248
- <button
1249
- class="flowdrop-btn flowdrop-btn--sm flowdrop-btn--outline"
1250
- onclick={testApiConnection}
1251
- type="button"
1252
- >
1253
- Test API
1254
- </button>
1255
- <button
1256
- class="flowdrop-btn flowdrop-btn--ghost flowdrop-btn--sm"
1257
- onclick={() => (error = null)}
1258
- type="button"
1259
- >
1260
- ✕
1261
- </button>
1262
- </div>
1263
- </div>
1264
- </div>
1460
+ <EditorStatusBar
1461
+ {error}
1462
+ onRetry={retryLoad}
1463
+ onSetApiUrl={() => {
1464
+ const defaultUrl = '/api/flowdrop';
1465
+ const newUrl = prompt('Enter Backend API URL:', defaultUrl);
1466
+ if (newUrl) {
1467
+ configureApi(createEndpointConfig(newUrl));
1468
+ fetchNodeTypes();
1469
+ }
1470
+ }}
1471
+ onTestApi={testApiConnection}
1472
+ onDismiss={() => (error = null)}
1473
+ />
1265
1474
  {/if}
1266
1475
 
1267
1476
  <!-- Main Editor Area -->
@@ -1278,27 +1487,34 @@
1278
1487
  >
1279
1488
  <!-- Floating sidebar toggle — always visible on the canvas top-left -->
1280
1489
  {#if !disableSidebar}
1281
- <button
1490
+ <CanvasIconButton
1282
1491
  class="flowdrop-sidebar-fab"
1283
- onclick={toggleSidebar}
1284
- aria-label={isSidebarCollapsed
1285
- ? mergedMessages.layout.expandSidebar
1286
- : mergedMessages.layout.collapseSidebar}
1287
- title={isSidebarCollapsed
1492
+ label={isSidebarCollapsed
1288
1493
  ? mergedMessages.layout.expandSidebar
1289
1494
  : mergedMessages.layout.collapseSidebar}
1495
+ active={!isSidebarCollapsed}
1496
+ onclick={toggleSidebar}
1290
1497
  >
1291
- <Icon icon={isSidebarCollapsed ? 'mdi:menu' : 'mdi:menu-open'} />
1292
- </button>
1498
+ {#snippet icon()}
1499
+ {#if isSidebarCollapsed}
1500
+ <MenuIcon />
1501
+ {:else}
1502
+ <MenuOpenIcon />
1503
+ {/if}
1504
+ {/snippet}
1505
+ </CanvasIconButton>
1293
1506
  {/if}
1294
1507
 
1295
1508
  <WorkflowEditor
1296
1509
  bind:this={workflowEditorRef}
1297
1510
  endpointConfig={endpointConfig ?? undefined}
1511
+ {authProvider}
1298
1512
  {openConfigSidebar}
1299
1513
  {mode}
1300
1514
  {pipelineId}
1301
1515
  {refreshTrigger}
1516
+ builtinEditors={features.builtinEditors}
1517
+ gridVariant={themeConfig?.canvas?.grid ?? 'dots'}
1302
1518
  consoleOpen={getUiSettings().consoleOpen}
1303
1519
  onToggleConsole={toggleConsole}
1304
1520
  />
@@ -1306,143 +1522,62 @@
1306
1522
  </MainLayout>
1307
1523
  </div>
1308
1524
 
1525
+ <!--
1526
+ Modal host — floats surfaces routed to `modal` above the canvas. Portalled to
1527
+ <body> by SurfaceOverlay. When both config and console are modal they coexist
1528
+ as tabs inside one overlay.
1529
+ -->
1530
+ {#if configHere('modal') && consoleHere('modal')}
1531
+ <SurfaceOverlay
1532
+ title={activeConfig?.title ?? mergedMessages.navigation.workflowSettingsPanelTitle}
1533
+ closeLabel={mergedMessages.layout.closeConfigPanel}
1534
+ onClose={() => {
1535
+ closeActiveConfig();
1536
+ closeConsole();
1537
+ }}
1538
+ >
1539
+ {@const tabs = [
1540
+ { id: 'config', label: activeConfig?.title ?? 'Configuration', content: configBareContent },
1541
+ {
1542
+ id: 'console',
1543
+ label: mergedMessages.navigation.bottomPanel.console,
1544
+ content: consoleSurfaceBody,
1545
+ display: 'contents' as const
1546
+ },
1547
+ { id: 'chat', label: mergedMessages.navigation.bottomPanel.chat, content: chatSurfaceBody }
1548
+ ] as SurfaceTab[]}
1549
+ <TabbedSurface {tabs} activeId={activeSurface} onSelect={selectSurface} />
1550
+ </SurfaceOverlay>
1551
+ {:else if configHere('modal')}
1552
+ <SurfaceOverlay
1553
+ title={activeConfig?.title ?? 'Configuration'}
1554
+ closeLabel={mergedMessages.layout.closeConfigPanel}
1555
+ onClose={closeActiveConfig}
1556
+ >
1557
+ {@render configBareContent()}
1558
+ </SurfaceOverlay>
1559
+ {:else if consoleHere('modal')}
1560
+ <SurfaceOverlay
1561
+ title={activeSurface === 'chat'
1562
+ ? mergedMessages.navigation.bottomPanel.chat
1563
+ : mergedMessages.navigation.bottomPanel.console}
1564
+ closeLabel={mergedMessages.layout.closeConfigPanel}
1565
+ onClose={closeConsole}
1566
+ >
1567
+ {@render consoleChatTabs()}
1568
+ </SurfaceOverlay>
1569
+ {/if}
1570
+
1309
1571
  <style>
1310
1572
  .flowdrop-root {
1311
1573
  display: contents;
1312
1574
  }
1313
- /* Status bar styles */
1314
- .flowdrop-status {
1315
- background-color: var(--fd-info-muted);
1316
- border-bottom: 1px solid var(--fd-info);
1317
- padding: 1rem;
1318
- }
1319
-
1320
- .flowdrop-status--error {
1321
- background-color: var(--fd-error-muted);
1322
- border-bottom: 1px solid var(--fd-error);
1323
- }
1324
1575
 
1325
- .flowdrop-status__content {
1326
- max-width: 80rem;
1327
- margin: 0 auto;
1328
- display: flex;
1329
- align-items: center;
1330
- justify-content: space-between;
1331
- }
1332
-
1333
- .flowdrop-status__indicator {
1334
- width: 0.5rem;
1335
- height: 0.5rem;
1336
- border-radius: 50%;
1337
- }
1338
-
1339
- .flowdrop-status__indicator--error {
1340
- background-color: var(--fd-error);
1341
- }
1342
-
1343
- /* Button styles */
1344
- .flowdrop-btn {
1345
- padding: 0.375rem 0.75rem;
1346
- border-radius: var(--fd-radius-md);
1347
- font-size: 0.75rem;
1348
- font-weight: 500;
1349
- cursor: pointer;
1350
- border: 1px solid transparent;
1351
- transition: all var(--fd-transition-fast);
1352
- }
1353
-
1354
- .flowdrop-btn--sm {
1355
- padding: 0.25rem 0.5rem;
1356
- font-size: 0.625rem;
1357
- }
1358
-
1359
- .flowdrop-btn--outline {
1360
- background-color: transparent;
1361
- border-color: var(--fd-border);
1362
- color: var(--fd-foreground);
1363
- }
1364
-
1365
- .flowdrop-btn--outline:hover {
1366
- background-color: var(--fd-muted);
1367
- border-color: var(--fd-border-strong);
1368
- }
1369
-
1370
- .flowdrop-btn--primary {
1371
- background-color: var(--fd-primary);
1372
- border-color: var(--fd-primary);
1373
- color: var(--fd-primary-foreground);
1374
- }
1375
-
1376
- .flowdrop-btn--primary:hover {
1377
- background-color: var(--fd-primary-hover);
1378
- border-color: var(--fd-primary-hover);
1379
- }
1380
-
1381
- .flowdrop-btn--ghost {
1382
- background-color: transparent;
1383
- border-color: transparent;
1384
- color: var(--fd-muted-foreground);
1385
- }
1386
-
1387
- .flowdrop-btn--ghost:hover {
1388
- background-color: var(--fd-muted);
1389
- color: var(--fd-foreground);
1390
- }
1391
-
1392
- /* Utility classes */
1393
- .flowdrop-flex {
1394
- display: flex;
1395
- }
1396
-
1397
- .flowdrop-gap--2 {
1398
- gap: 0.5rem;
1399
- }
1400
-
1401
- .flowdrop-gap--3 {
1402
- gap: 0.75rem;
1403
- }
1404
-
1405
- .flowdrop-text--sm {
1406
- font-size: 0.875rem;
1407
- line-height: 1.25rem;
1408
- }
1409
-
1410
- .flowdrop-font--medium {
1411
- font-weight: 500;
1412
- }
1413
-
1414
- /* Floating sidebar toggle button */
1415
- .flowdrop-sidebar-fab {
1416
- position: absolute;
1576
+ /* Floating sidebar toggle button — placement only; visuals live in CanvasIconButton */
1577
+ :global(.flowdrop-sidebar-fab) {
1417
1578
  top: 12px;
1418
1579
  left: 12px;
1419
1580
  z-index: 50;
1420
- display: flex;
1421
- align-items: center;
1422
- justify-content: center;
1423
- width: 2.25rem;
1424
- height: 2.25rem;
1425
- border: 1px solid var(--fd-border);
1426
- border-radius: var(--fd-radius-md);
1427
- background-color: var(--fd-background);
1428
- color: var(--fd-muted-foreground);
1429
- cursor: pointer;
1430
- box-shadow: var(--fd-shadow-md);
1431
- transition:
1432
- color var(--fd-transition-fast),
1433
- background-color var(--fd-transition-fast),
1434
- box-shadow var(--fd-transition-fast);
1435
- }
1436
-
1437
- .flowdrop-sidebar-fab:hover {
1438
- color: var(--fd-foreground);
1439
- background-color: var(--fd-subtle);
1440
- box-shadow: var(--fd-shadow-lg);
1441
- }
1442
-
1443
- .flowdrop-sidebar-fab:focus {
1444
- outline: none;
1445
- box-shadow: 0 0 0 2px var(--fd-ring);
1446
1581
  }
1447
1582
 
1448
1583
  /* Main editor area */
@@ -1455,55 +1590,81 @@
1455
1590
  background: var(--fd-layout-background);
1456
1591
  }
1457
1592
 
1458
- /* Bottom panel tab system */
1459
- .bottom-panel-tabs {
1593
+ /*
1594
+ Chromeless config surface (bottom / modal / shared-sidebar hosts). Mirrors
1595
+ ConfigPanel's inner layout; the host owns any outer chrome.
1596
+ */
1597
+ .config-surface {
1460
1598
  display: flex;
1461
1599
  flex-direction: column;
1462
1600
  height: 100%;
1463
- overflow: hidden;
1601
+ min-height: 0;
1602
+ background-color: var(--fd-panel-bg);
1603
+ backdrop-filter: var(--fd-panel-backdrop-filter);
1464
1604
  }
1465
1605
 
1466
- .bottom-panel-tabs__bar {
1606
+ .config-surface__header {
1467
1607
  display: flex;
1468
- gap: 0;
1469
- background: var(--fd-muted);
1608
+ justify-content: space-between;
1609
+ align-items: center;
1610
+ padding: 0.875rem 1rem;
1470
1611
  border-bottom: 1px solid var(--fd-border);
1612
+ background-color: var(--fd-card);
1471
1613
  flex-shrink: 0;
1472
1614
  }
1473
1615
 
1474
- .bottom-panel-tabs__tab {
1475
- padding: 0.375rem 0.75rem;
1476
- font-size: 0.75rem;
1477
- font-weight: 500;
1478
- cursor: pointer;
1616
+ .config-surface__title {
1617
+ margin: 0;
1618
+ font-size: 1rem;
1619
+ font-weight: 600;
1620
+ color: var(--fd-foreground);
1621
+ }
1622
+
1623
+ .config-surface__close {
1624
+ background: none;
1479
1625
  border: none;
1480
- border-bottom: 2px solid transparent;
1481
- background: transparent;
1626
+ font-size: 1.25rem;
1627
+ line-height: 1;
1628
+ cursor: pointer;
1482
1629
  color: var(--fd-muted-foreground);
1483
- transition: all var(--fd-transition-fast);
1630
+ padding: 0.25rem;
1631
+ border-radius: var(--fd-radius-sm);
1632
+ transition:
1633
+ color var(--fd-transition-fast),
1634
+ background-color var(--fd-transition-fast);
1484
1635
  }
1485
1636
 
1486
- .bottom-panel-tabs__tab:hover {
1637
+ .config-surface__close:hover {
1487
1638
  color: var(--fd-foreground);
1488
- background: var(--fd-background);
1639
+ background-color: var(--fd-subtle);
1489
1640
  }
1490
1641
 
1491
- .bottom-panel-tabs__tab--active {
1492
- color: var(--fd-foreground);
1493
- border-bottom-color: var(--fd-primary);
1494
- background: var(--fd-background);
1642
+ .config-surface__details {
1643
+ padding: 0.75rem 1rem;
1644
+ border-bottom: 1px solid var(--fd-border-muted);
1645
+ background-color: var(--fd-card);
1646
+ flex-shrink: 0;
1495
1647
  }
1496
1648
 
1497
- .bottom-panel-tabs__content {
1649
+ .config-surface__content {
1498
1650
  flex: 1;
1499
- overflow: hidden;
1651
+ min-height: 0;
1652
+ overflow-y: auto;
1653
+ padding: 1rem;
1654
+ }
1655
+
1656
+ .config-surface__section {
1500
1657
  display: flex;
1501
1658
  flex-direction: column;
1659
+ gap: 0.75rem;
1502
1660
  }
1503
1661
 
1504
- .bottom-panel-tabs__panel {
1505
- flex: 1;
1506
- overflow: hidden;
1507
- flex-direction: column;
1662
+ .config-surface__section-title {
1663
+ margin: 0;
1664
+ font-size: var(--fd-text-xs);
1665
+ font-weight: 600;
1666
+ color: var(--fd-muted-foreground);
1667
+ text-transform: uppercase;
1668
+ letter-spacing: 0.05em;
1508
1669
  }
1509
1670
  </style>