@flowdrop/flowdrop 1.15.0 → 2.0.0-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (323) hide show
  1. package/CHANGELOG.md +648 -0
  2. package/MIGRATION-2.0.md +642 -0
  3. package/README.md +28 -28
  4. package/dist/adapters/WorkflowAdapter.d.ts +1 -1
  5. package/dist/adapters/WorkflowAdapter.js +18 -13
  6. package/dist/adapters/agentspec/AgentSpecAdapter.js +10 -10
  7. package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
  8. package/dist/api/enhanced-client.js +6 -11
  9. package/dist/chat/batchFeedback.d.ts +39 -0
  10. package/dist/chat/batchFeedback.js +51 -0
  11. package/dist/commands/executor.js +66 -27
  12. package/dist/commands/storeIntegration.svelte.d.ts +4 -1
  13. package/dist/commands/storeIntegration.svelte.js +36 -21
  14. package/dist/commands/types.d.ts +2 -0
  15. package/dist/commands/types.js +5 -5
  16. package/dist/components/App.svelte +696 -565
  17. package/dist/components/App.svelte.d.ts +63 -16
  18. package/dist/components/Button.stories.svelte +65 -0
  19. package/dist/components/Button.stories.svelte.d.ts +19 -0
  20. package/dist/components/Button.svelte +62 -0
  21. package/dist/components/Button.svelte.d.ts +24 -0
  22. package/dist/components/CanvasIconButton.svelte +76 -0
  23. package/dist/components/CanvasIconButton.svelte.d.ts +18 -0
  24. package/dist/components/ConfigForm.svelte +181 -552
  25. package/dist/components/ConfigForm.svelte.d.ts +24 -7
  26. package/dist/components/ConfigModal.svelte +16 -3
  27. package/dist/components/ConfigPanel.svelte +234 -15
  28. package/dist/components/ConfigPanel.svelte.d.ts +6 -0
  29. package/dist/components/ConnectionLine.svelte +4 -2
  30. package/dist/components/EditorStatusBar.stories.svelte +44 -0
  31. package/dist/components/EditorStatusBar.stories.svelte.d.ts +27 -0
  32. package/dist/components/EditorStatusBar.svelte +99 -0
  33. package/dist/components/EditorStatusBar.svelte.d.ts +15 -0
  34. package/dist/components/IconButton.svelte +80 -0
  35. package/dist/components/IconButton.svelte.d.ts +30 -0
  36. package/dist/components/Input.svelte +74 -0
  37. package/dist/components/Input.svelte.d.ts +17 -0
  38. package/dist/components/LogoWordmark.svelte +113 -0
  39. package/dist/components/LogoWordmark.svelte.d.ts +26 -0
  40. package/dist/components/Navbar.svelte +78 -64
  41. package/dist/components/Navbar.svelte.d.ts +3 -0
  42. package/dist/components/NodeSidebar.svelte +48 -171
  43. package/dist/components/NodeStatusOverlay.svelte +94 -6
  44. package/dist/components/NodeSwapPicker.svelte +22 -38
  45. package/dist/components/PipelineStatus.svelte +22 -68
  46. package/dist/components/PipelineStatus.svelte.d.ts +3 -0
  47. package/dist/components/PortCoordinateTracker.svelte +5 -6
  48. package/dist/components/PortMappingRow.svelte +0 -2
  49. package/dist/components/SchemaForm.stories.svelte +1 -3
  50. package/dist/components/SchemaForm.svelte +22 -39
  51. package/dist/components/SchemaForm.svelte.d.ts +0 -8
  52. package/dist/components/Select.svelte +53 -0
  53. package/dist/components/Select.svelte.d.ts +15 -0
  54. package/dist/components/SettingsModal.svelte +8 -8
  55. package/dist/components/SettingsPanel.svelte +44 -10
  56. package/dist/components/SwapMappingEditor.svelte +67 -49
  57. package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
  58. package/dist/components/Textarea.svelte +39 -0
  59. package/dist/components/Textarea.svelte.d.ts +12 -0
  60. package/dist/components/ThemeToggle.svelte +15 -94
  61. package/dist/components/UniversalNode.svelte +45 -11
  62. package/dist/components/UniversalNode.svelte.d.ts +1 -1
  63. package/dist/components/WorkflowEditor.svelte +183 -162
  64. package/dist/components/WorkflowEditor.svelte.d.ts +39 -10
  65. package/dist/components/chat/AIChatPanel.svelte +99 -90
  66. package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
  67. package/dist/components/chat/CommandPreview.svelte +2 -1
  68. package/dist/components/console/CommandConsole.svelte +7 -5
  69. package/dist/components/console/ConsoleAutocomplete.svelte +11 -12
  70. package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
  71. package/dist/components/console/ConsoleInput.svelte +18 -9
  72. package/dist/components/console/ConsoleOutput.svelte +4 -3
  73. package/dist/components/form/FormArray.svelte +42 -182
  74. package/dist/components/form/FormArray.svelte.d.ts +2 -1
  75. package/dist/components/form/FormAutocomplete.svelte +26 -21
  76. package/dist/components/form/FormCheckboxGroup.svelte +1 -5
  77. package/dist/components/form/FormCodeEditor.svelte +9 -7
  78. package/dist/components/form/FormField.svelte +22 -44
  79. package/dist/components/form/FormFieldLight.svelte +56 -50
  80. package/dist/components/form/FormFieldLight.svelte.d.ts +12 -0
  81. package/dist/components/form/FormFieldset.svelte +45 -11
  82. package/dist/components/form/FormMarkdownEditor.svelte +17 -9
  83. package/dist/components/form/FormNumberField.svelte +4 -36
  84. package/dist/components/form/FormPorts.svelte +262 -0
  85. package/dist/components/form/FormPorts.svelte.d.ts +13 -0
  86. package/dist/components/form/FormRangeField.svelte +62 -30
  87. package/dist/components/form/FormSelect.svelte +13 -75
  88. package/dist/components/form/FormTemplateEditor.svelte +17 -7
  89. package/dist/components/form/FormTextField.svelte +3 -35
  90. package/dist/components/form/FormTextarea.svelte +4 -39
  91. package/dist/components/form/FormToggle.svelte +5 -16
  92. package/dist/components/form/FormToggle.svelte.d.ts +4 -2
  93. package/dist/components/form/FormUISchemaRenderer.svelte +3 -1
  94. package/dist/components/form/resolveFieldType.d.ts +24 -0
  95. package/dist/components/form/resolveFieldType.js +55 -0
  96. package/dist/components/form/templateAutocomplete.js +1 -5
  97. package/dist/components/form/types.d.ts +1 -14
  98. package/dist/components/icons/CloseIcon.svelte +6 -0
  99. package/dist/components/icons/CloseIcon.svelte.d.ts +26 -0
  100. package/dist/components/icons/CommandLineIcon.svelte +15 -0
  101. package/dist/components/icons/CommandLineIcon.svelte.d.ts +26 -0
  102. package/dist/components/icons/MenuIcon.svelte +4 -0
  103. package/dist/components/icons/MenuIcon.svelte.d.ts +26 -0
  104. package/dist/components/icons/MenuOpenIcon.svelte +6 -0
  105. package/dist/components/icons/MenuOpenIcon.svelte.d.ts +26 -0
  106. package/dist/components/interrupt/ChoicePrompt.svelte +0 -10
  107. package/dist/components/interrupt/ConfirmationPrompt.svelte +0 -5
  108. package/dist/components/interrupt/FormPrompt.svelte +3 -2
  109. package/dist/components/interrupt/InterruptBubble.svelte +25 -27
  110. package/dist/components/interrupt/ReviewPrompt.svelte +10 -23
  111. package/dist/components/interrupt/TextInputPrompt.svelte +2 -7
  112. package/dist/components/layouts/MainLayout.svelte +24 -18
  113. package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
  114. package/dist/components/nodes/AtomNode.svelte +70 -72
  115. package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
  116. package/dist/components/nodes/GatewayNode.svelte +134 -172
  117. package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
  118. package/dist/components/nodes/IdeaNode.svelte +79 -98
  119. package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
  120. package/dist/components/nodes/NodeConfigButton.svelte +86 -0
  121. package/dist/components/nodes/NodeConfigButton.svelte.d.ts +15 -0
  122. package/dist/components/nodes/NotesNode.svelte +76 -85
  123. package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
  124. package/dist/components/nodes/SimpleNode.svelte +68 -137
  125. package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
  126. package/dist/components/nodes/SquareNode.svelte +122 -169
  127. package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
  128. package/dist/components/nodes/TerminalNode.svelte +70 -127
  129. package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
  130. package/dist/components/nodes/ToolNode.svelte +99 -104
  131. package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
  132. package/dist/components/nodes/WorkflowNode.svelte +145 -195
  133. package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
  134. package/dist/components/playground/ChatInput.svelte +11 -15
  135. package/dist/components/playground/ChatPanel.svelte +6 -49
  136. package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
  137. package/dist/components/playground/ControlPanel.svelte +134 -123
  138. package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
  139. package/dist/components/playground/ExecutionLogs.svelte +11 -9
  140. package/dist/components/playground/InputCollector.svelte +22 -57
  141. package/dist/components/playground/MessageStream.svelte +17 -23
  142. package/dist/components/playground/PipelineKanbanView.svelte +69 -8
  143. package/dist/components/playground/PipelineKanbanView.svelte.d.ts +2 -0
  144. package/dist/components/playground/PipelinePanel.svelte +31 -8
  145. package/dist/components/playground/PipelinePanel.svelte.d.ts +2 -0
  146. package/dist/components/playground/PipelineTableView.svelte +188 -44
  147. package/dist/components/playground/PipelineTableView.svelte.d.ts +2 -0
  148. package/dist/components/playground/Playground.svelte +154 -105
  149. package/dist/components/playground/Playground.svelte.d.ts +5 -0
  150. package/dist/components/playground/PlaygroundApp.svelte +12 -2
  151. package/dist/components/playground/PlaygroundApp.svelte.d.ts +6 -0
  152. package/dist/components/playground/PlaygroundModal.svelte +18 -3
  153. package/dist/components/playground/PlaygroundModal.svelte.d.ts +6 -0
  154. package/dist/components/playground/PlaygroundStudio.svelte +40 -37
  155. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +6 -0
  156. package/dist/components/playground/SessionManager.svelte +9 -12
  157. package/dist/components/playground/pipelineViewUtils.svelte.d.ts +30 -1
  158. package/dist/components/playground/pipelineViewUtils.svelte.js +40 -3
  159. package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
  160. package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
  161. package/dist/components/surfaces/TabbedSurface.svelte +133 -0
  162. package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
  163. package/dist/config/endpoints.d.ts +23 -7
  164. package/dist/config/endpoints.js +30 -10
  165. package/dist/core/index.d.ts +6 -7
  166. package/dist/core/index.js +8 -12
  167. package/dist/display/index.d.ts +6 -3
  168. package/dist/display/index.js +7 -5
  169. package/dist/editor/index.d.ts +20 -21
  170. package/dist/editor/index.js +26 -36
  171. package/dist/form/code.d.ts +25 -15
  172. package/dist/form/code.js +44 -41
  173. package/dist/form/fieldRegistry.d.ts +17 -13
  174. package/dist/form/fieldRegistry.js +32 -12
  175. package/dist/form/full.d.ts +19 -14
  176. package/dist/form/full.js +26 -28
  177. package/dist/form/index.d.ts +3 -4
  178. package/dist/form/index.js +6 -5
  179. package/dist/form/markdown.d.ts +13 -8
  180. package/dist/form/markdown.js +22 -23
  181. package/dist/helpers/proximityConnect.d.ts +3 -2
  182. package/dist/helpers/proximityConnect.js +2 -5
  183. package/dist/helpers/workflowEditorHelper.d.ts +14 -5
  184. package/dist/helpers/workflowEditorHelper.js +32 -30
  185. package/dist/index.d.ts +28 -24
  186. package/dist/index.js +27 -50
  187. package/dist/messages/defaults.d.ts +2 -5
  188. package/dist/messages/defaults.js +3 -6
  189. package/dist/messages/index.d.ts +1 -2
  190. package/dist/messages/index.js +1 -2
  191. package/dist/mocks/app-forms.d.ts +6 -2
  192. package/dist/mocks/app-forms.js +11 -4
  193. package/dist/openapi/v1/openapi.yaml +38 -26
  194. package/dist/playground/index.d.ts +4 -5
  195. package/dist/playground/index.js +4 -32
  196. package/dist/playground/mount.d.ts +34 -5
  197. package/dist/playground/mount.js +58 -24
  198. package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
  199. package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
  200. package/dist/registry/builtinFormats.d.ts +9 -18
  201. package/dist/registry/builtinFormats.js +9 -39
  202. package/dist/registry/builtinNodeTypes.d.ts +53 -0
  203. package/dist/registry/builtinNodeTypes.js +67 -0
  204. package/dist/registry/builtinNodes.d.ts +2 -64
  205. package/dist/registry/builtinNodes.js +7 -103
  206. package/dist/registry/index.d.ts +3 -4
  207. package/dist/registry/index.js +4 -6
  208. package/dist/registry/nodeComponentRegistry.d.ts +184 -16
  209. package/dist/registry/nodeComponentRegistry.js +235 -17
  210. package/dist/registry/workflowFormatRegistry.d.ts +14 -9
  211. package/dist/registry/workflowFormatRegistry.js +24 -8
  212. package/dist/{schema → schemas}/index.d.ts +2 -2
  213. package/dist/{schema → schemas}/index.js +2 -2
  214. package/dist/schemas/v1/workflow.schema.json +19 -17
  215. package/dist/services/agentSpecExecutionService.d.ts +0 -2
  216. package/dist/services/agentSpecExecutionService.js +0 -3
  217. package/dist/services/apiVariableService.d.ts +2 -1
  218. package/dist/services/apiVariableService.js +16 -47
  219. package/dist/services/autoSaveService.d.ts +7 -0
  220. package/dist/services/autoSaveService.js +6 -4
  221. package/dist/services/categoriesApi.js +3 -6
  222. package/dist/services/chatService.d.ts +9 -4
  223. package/dist/services/chatService.js +23 -28
  224. package/dist/services/draftStorage.d.ts +129 -13
  225. package/dist/services/draftStorage.js +185 -37
  226. package/dist/services/dynamicSchemaService.d.ts +33 -5
  227. package/dist/services/dynamicSchemaService.js +67 -55
  228. package/dist/services/globalSave.d.ts +13 -12
  229. package/dist/services/globalSave.js +29 -51
  230. package/dist/services/historyService.d.ts +39 -11
  231. package/dist/services/historyService.js +60 -18
  232. package/dist/services/interruptService.d.ts +15 -9
  233. package/dist/services/interruptService.js +35 -37
  234. package/dist/services/nodeExecutionService.d.ts +18 -3
  235. package/dist/services/nodeExecutionService.js +71 -45
  236. package/dist/services/playgroundService.d.ts +16 -10
  237. package/dist/services/playgroundService.js +42 -43
  238. package/dist/services/portConfigApi.js +3 -6
  239. package/dist/services/settingsService.d.ts +9 -4
  240. package/dist/services/settingsService.js +23 -12
  241. package/dist/services/variableService.d.ts +2 -1
  242. package/dist/services/variableService.js +2 -2
  243. package/dist/services/workflowStorage.js +6 -6
  244. package/dist/skins/drafter.d.ts +30 -0
  245. package/dist/skins/drafter.js +198 -0
  246. package/dist/skins/index.d.ts +2 -1
  247. package/dist/skins/index.js +4 -2
  248. package/dist/stores/apiContext.d.ts +56 -0
  249. package/dist/stores/apiContext.js +80 -0
  250. package/dist/stores/categoriesStore.svelte.d.ts +28 -23
  251. package/dist/stores/categoriesStore.svelte.js +69 -64
  252. package/dist/stores/getInstance.svelte.d.ts +39 -0
  253. package/dist/stores/getInstance.svelte.js +65 -0
  254. package/dist/stores/historyStore.svelte.d.ts +89 -91
  255. package/dist/stores/historyStore.svelte.js +159 -158
  256. package/dist/stores/instanceContainer.svelte.d.ts +111 -0
  257. package/dist/stores/instanceContainer.svelte.js +119 -0
  258. package/dist/stores/interruptStore.svelte.d.ts +112 -82
  259. package/dist/stores/interruptStore.svelte.js +253 -226
  260. package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
  261. package/dist/stores/pipelinePanelStore.svelte.js +61 -14
  262. package/dist/stores/playgroundStore.svelte.d.ts +169 -222
  263. package/dist/stores/playgroundStore.svelte.js +513 -580
  264. package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
  265. package/dist/stores/portCoordinateStore.svelte.js +109 -98
  266. package/dist/stores/settingsStore.svelte.d.ts +17 -1
  267. package/dist/stores/settingsStore.svelte.js +79 -12
  268. package/dist/stores/workflowStore.svelte.d.ts +212 -210
  269. package/dist/stores/workflowStore.svelte.js +527 -502
  270. package/dist/stories/EdgeDecorator.svelte +5 -2
  271. package/dist/stories/NodeDecorator.svelte +5 -3
  272. package/dist/styles/base.css +285 -14
  273. package/dist/styles/tokens.css +60 -2
  274. package/dist/svelte-app.d.ts +78 -11
  275. package/dist/svelte-app.js +210 -141
  276. package/dist/themes/drafter.d.ts +2 -0
  277. package/dist/themes/drafter.js +15 -0
  278. package/dist/themes/index.d.ts +2 -1
  279. package/dist/themes/index.js +8 -2
  280. package/dist/types/auth.d.ts +9 -51
  281. package/dist/types/auth.js +4 -54
  282. package/dist/types/events.d.ts +24 -3
  283. package/dist/types/events.js +2 -1
  284. package/dist/types/index.d.ts +117 -32
  285. package/dist/types/index.js +0 -1
  286. package/dist/types/navbar.d.ts +7 -0
  287. package/dist/types/playground.d.ts +18 -3
  288. package/dist/types/settings.d.ts +30 -1
  289. package/dist/types/settings.js +5 -2
  290. package/dist/types/skin.d.ts +1 -1
  291. package/dist/types/theme.d.ts +16 -2
  292. package/dist/types/uischema.d.ts +5 -0
  293. package/dist/utils/colors.d.ts +74 -21
  294. package/dist/utils/colors.js +92 -68
  295. package/dist/utils/connections.d.ts +9 -15
  296. package/dist/utils/connections.js +33 -88
  297. package/dist/utils/duration.d.ts +13 -0
  298. package/dist/utils/duration.js +45 -0
  299. package/dist/utils/edgeStyling.js +9 -5
  300. package/dist/utils/fetchWithAuth.d.ts +36 -15
  301. package/dist/utils/fetchWithAuth.js +53 -23
  302. package/dist/utils/icons.d.ts +5 -2
  303. package/dist/utils/icons.js +6 -5
  304. package/dist/utils/nodeIds.d.ts +1 -1
  305. package/dist/utils/nodeIds.js +1 -1
  306. package/dist/utils/nodeSwap.d.ts +6 -2
  307. package/dist/utils/nodeSwap.js +62 -129
  308. package/dist/utils/nodeTypes.d.ts +17 -8
  309. package/dist/utils/nodeTypes.js +27 -20
  310. package/dist/utils/performanceUtils.js +7 -0
  311. package/dist/utils/portUtils.d.ts +47 -11
  312. package/dist/utils/portUtils.js +67 -14
  313. package/dist/utils/portal.d.ts +18 -0
  314. package/dist/utils/portal.js +34 -0
  315. package/dist/utils/schemaMerge.d.ts +25 -0
  316. package/dist/utils/schemaMerge.js +61 -0
  317. package/package.json +7 -5
  318. package/dist/messages/deprecation.d.ts +0 -20
  319. package/dist/messages/deprecation.js +0 -33
  320. package/dist/registry/plugin.d.ts +0 -215
  321. package/dist/registry/plugin.js +0 -249
  322. package/dist/services/api.d.ts +0 -129
  323. package/dist/services/api.js +0 -217
@@ -0,0 +1,262 @@
1
+ <!--
2
+ Unified port widget — order + exposure
3
+
4
+ Renders one row per port of the node being configured, each carrying a
5
+ reorder control (up/down) and an expose/hide toggle. Binds to the injected
6
+ `ports` reserved config property (a PortsConfig: a per-direction ordered list
7
+ of {id, exposed?} entries).
8
+
9
+ Order is cosmetic — the engine ignores it. Exposure is semantic in v2: a
10
+ not-exposed port is hidden on the canvas, not wireable, and not
11
+ runtime-overridable.
12
+
13
+ The stored value is materialized as the FULL ordered list on the first edit
14
+ (so order + exposure stay independent inside one positional array), and reset
15
+ to `undefined` when it lands back on the metadata default order with no
16
+ exposure override.
17
+
18
+ @see .claude/plans/exposed-ports.md
19
+ -->
20
+
21
+ <script lang="ts">
22
+ import type {
23
+ DynamicPort,
24
+ NodePort,
25
+ PortConfigEntry,
26
+ PortsConfig,
27
+ WorkflowNode
28
+ } from '../../types/index.js';
29
+ import { dynamicPortToNodePort } from '../../types/index.js';
30
+ import { getInstance } from '../../stores/getInstance.svelte.js';
31
+ import { getPortColorToken, getPortBackgroundColorForPort } from '../../utils/colors.js';
32
+ import { byDefaultOrder, isPortExposed, orderPortsFor } from '../../utils/portUtils.js';
33
+ import FormToggle from './FormToggle.svelte';
34
+ import Icon from '@iconify/svelte';
35
+
36
+ interface Props {
37
+ id: string;
38
+ value: unknown;
39
+ ariaDescribedBy?: string;
40
+ disabled?: boolean;
41
+ onChange: (value: unknown) => void;
42
+ /** The node being configured, source of the port list + metadata defaults. */
43
+ node?: WorkflowNode;
44
+ }
45
+
46
+ let { id, value, ariaDescribedBy, disabled = false, onChange, node }: Props = $props();
47
+
48
+ const fd = getInstance();
49
+ const checker = fd.portCompatibility;
50
+
51
+ const portsConfig = $derived((value as PortsConfig | undefined) ?? {});
52
+
53
+ // Mirror the canvas: static metadata ports plus user-defined dynamic ports.
54
+ const inputPorts = $derived<NodePort[]>([
55
+ ...(node?.data.metadata?.inputs ?? []),
56
+ ...((node?.data.config?.dynamicInputs as DynamicPort[]) ?? []).map((p) =>
57
+ dynamicPortToNodePort(p, 'input')
58
+ )
59
+ ]);
60
+ const outputPorts = $derived<NodePort[]>([
61
+ ...(node?.data.metadata?.outputs ?? []),
62
+ ...((node?.data.config?.dynamicOutputs as DynamicPort[]) ?? []).map((p) =>
63
+ dynamicPortToNodePort(p, 'output')
64
+ )
65
+ ]);
66
+
67
+ type Direction = 'inputs' | 'outputs';
68
+
69
+ function portsFor(direction: Direction): NodePort[] {
70
+ return direction === 'inputs' ? inputPorts : outputPorts;
71
+ }
72
+
73
+ /** Ports in the order the widget renders them (default order, then override). */
74
+ function orderedPorts(direction: Direction): NodePort[] {
75
+ return orderPortsFor(portsFor(direction), portsConfig[direction]);
76
+ }
77
+
78
+ /**
79
+ * Write a direction's desired ordered list (each port carrying its effective
80
+ * exposure) back to the bound value, keeping it minimal: an entry's `exposed`
81
+ * flag is dropped when it equals the port's default, the whole direction is
82
+ * dropped when it carries neither a reorder nor an exposure override, and the
83
+ * value collapses to `undefined` when empty — so an untouched node stores
84
+ * nothing.
85
+ */
86
+ function commit(
87
+ direction: Direction,
88
+ ordered: NodePort[],
89
+ exposureOf: (port: NodePort) => boolean
90
+ ): void {
91
+ const entries: PortConfigEntry[] = ordered.map((port) => {
92
+ const entry: PortConfigEntry = { id: port.id };
93
+ const exposed = exposureOf(port);
94
+ if (exposed !== (port.exposedByDefault ?? true)) entry.exposed = exposed;
95
+ return entry;
96
+ });
97
+
98
+ const defaultOrder = byDefaultOrder(portsFor(direction)).map((p) => p.id);
99
+ const orderChanged = entries.some((e, i) => e.id !== defaultOrder[i]);
100
+ const hasExposureOverride = entries.some((e) => e.exposed !== undefined);
101
+
102
+ const next: PortsConfig = { ...portsConfig };
103
+ if (orderChanged || hasExposureOverride) next[direction] = entries;
104
+ else delete next[direction];
105
+
106
+ // We carry the untouched direction over verbatim from `portsConfig`, but an
107
+ // earlier edit there may have left an empty array; prune it so an all-default
108
+ // node collapses to `undefined` below rather than persisting `{inputs: []}`.
109
+ const other: Direction = direction === 'inputs' ? 'outputs' : 'inputs';
110
+ if (!next[other] || next[other]?.length === 0) delete next[other];
111
+ onChange(Object.keys(next).length === 0 ? undefined : next);
112
+ }
113
+
114
+ function setExposed(direction: Direction, portId: string, exposed: boolean): void {
115
+ commit(direction, orderedPorts(direction), (port) =>
116
+ port.id === portId ? exposed : isPortExposed(port, portsConfig[direction])
117
+ );
118
+ }
119
+
120
+ function move(direction: Direction, index: number, delta: -1 | 1): void {
121
+ const ordered = orderedPorts(direction);
122
+ const target = index + delta;
123
+ if (target < 0 || target >= ordered.length) return;
124
+ [ordered[index], ordered[target]] = [ordered[target], ordered[index]];
125
+ commit(direction, ordered, (port) => isPortExposed(port, portsConfig[direction]));
126
+ }
127
+ </script>
128
+
129
+ <div class="fd-ports" {id} aria-describedby={ariaDescribedBy}>
130
+ {#each [{ key: 'inputs', label: 'Inputs' }, { key: 'outputs', label: 'Outputs' }] as group (group.key)}
131
+ {@const direction = group.key as Direction}
132
+ {@const ordered = orderedPorts(direction)}
133
+ {#if ordered.length > 0}
134
+ <div class="fd-ports__group">
135
+ <span class="fd-ports__group-label">{group.label}</span>
136
+ <ul class="fd-ports__list">
137
+ {#each ordered as port, i (port.id)}
138
+ <li class="fd-ports__item">
139
+ <div class="fd-ports__reorder">
140
+ <button
141
+ type="button"
142
+ disabled={disabled || i === 0}
143
+ onclick={() => move(direction, i, -1)}
144
+ title="Move up"
145
+ aria-label={`Move ${port.name} up`}
146
+ >
147
+ <Icon icon="heroicons:chevron-up" />
148
+ </button>
149
+ <button
150
+ type="button"
151
+ disabled={disabled || i === ordered.length - 1}
152
+ onclick={() => move(direction, i, 1)}
153
+ title="Move down"
154
+ aria-label={`Move ${port.name} down`}
155
+ >
156
+ <Icon icon="heroicons:chevron-down" />
157
+ </button>
158
+ </div>
159
+ <span class="fd-ports__name">{port.name}</span>
160
+ <span
161
+ class="fd-ports__badge"
162
+ style="background-color:{getPortBackgroundColorForPort(
163
+ checker,
164
+ port,
165
+ 15
166
+ )};color:{getPortColorToken(
167
+ checker,
168
+ port
169
+ )};border:1px solid {getPortBackgroundColorForPort(checker, port, 30)}"
170
+ >
171
+ {port.dataType}
172
+ </span>
173
+ <FormToggle
174
+ id={`${id}-${direction}-${port.id}`}
175
+ value={isPortExposed(port, portsConfig[direction])}
176
+ onLabel="Exposed"
177
+ offLabel="Hidden"
178
+ {disabled}
179
+ onChange={(exposed) => setExposed(direction, port.id, exposed)}
180
+ />
181
+ </li>
182
+ {/each}
183
+ </ul>
184
+ </div>
185
+ {/if}
186
+ {/each}
187
+ </div>
188
+
189
+ <style>
190
+ .fd-ports {
191
+ display: flex;
192
+ flex-direction: column;
193
+ gap: var(--fd-space-3, 0.75rem);
194
+ }
195
+
196
+ .fd-ports__group {
197
+ display: flex;
198
+ flex-direction: column;
199
+ gap: var(--fd-space-1, 0.25rem);
200
+ }
201
+
202
+ .fd-ports__group-label {
203
+ font-size: var(--fd-text-xs);
204
+ font-weight: 600;
205
+ color: var(--fd-text-muted);
206
+ text-transform: uppercase;
207
+ letter-spacing: 0.04em;
208
+ }
209
+
210
+ .fd-ports__list {
211
+ list-style: none;
212
+ margin: 0;
213
+ padding: 0;
214
+ display: flex;
215
+ flex-direction: column;
216
+ gap: var(--fd-space-1, 0.25rem);
217
+ }
218
+
219
+ .fd-ports__item {
220
+ display: flex;
221
+ align-items: center;
222
+ gap: var(--fd-space-2, 0.5rem);
223
+ padding: var(--fd-space-1, 0.25rem) var(--fd-space-2, 0.5rem);
224
+ border-radius: var(--fd-radius-md, 6px);
225
+ border: 1px solid var(--fd-border-muted);
226
+ }
227
+
228
+ .fd-ports__reorder {
229
+ display: flex;
230
+ flex-direction: column;
231
+ }
232
+
233
+ .fd-ports__reorder button {
234
+ display: flex;
235
+ align-items: center;
236
+ justify-content: center;
237
+ padding: 0;
238
+ border: none;
239
+ background: none;
240
+ color: var(--fd-text-muted);
241
+ cursor: pointer;
242
+ line-height: 1;
243
+ }
244
+
245
+ .fd-ports__reorder button:disabled {
246
+ opacity: 0.3;
247
+ cursor: default;
248
+ }
249
+
250
+ .fd-ports__name {
251
+ flex: 1;
252
+ font-size: var(--fd-text-xs);
253
+ font-weight: 500;
254
+ }
255
+
256
+ .fd-ports__badge {
257
+ font-size: var(--fd-text-2xs, 0.625rem);
258
+ padding: 0 var(--fd-space-1, 0.25rem);
259
+ border-radius: var(--fd-radius-sm, 4px);
260
+ white-space: nowrap;
261
+ }
262
+ </style>
@@ -0,0 +1,13 @@
1
+ import type { WorkflowNode } from '../../types/index.js';
2
+ interface Props {
3
+ id: string;
4
+ value: unknown;
5
+ ariaDescribedBy?: string;
6
+ disabled?: boolean;
7
+ onChange: (value: unknown) => void;
8
+ /** The node being configured, source of the port list + metadata defaults. */
9
+ node?: WorkflowNode;
10
+ }
11
+ declare const FormPorts: import("svelte").Component<Props, {}, "">;
12
+ type FormPorts = ReturnType<typeof FormPorts>;
13
+ export default FormPorts;
@@ -37,7 +37,7 @@
37
37
  value = 0,
38
38
  min = 0,
39
39
  max = 100,
40
- step = 1,
40
+ step,
41
41
  required = false,
42
42
  disabled = false,
43
43
  ariaDescribedBy,
@@ -56,6 +56,40 @@
56
56
  return isNaN(parsed) ? min : parsed;
57
57
  });
58
58
 
59
+ /** Count the decimal places of a finite number (e.g. 0.7 -> 1, 3 -> 0). */
60
+ function decimalPlaces(n: number): number {
61
+ if (!Number.isFinite(n)) return 0;
62
+ const text = String(n);
63
+ const dot = text.indexOf('.');
64
+ return dot === -1 ? 0 : text.length - dot - 1;
65
+ }
66
+
67
+ /**
68
+ * Resolve the step the native input should use.
69
+ *
70
+ * The backend often omits `step`, and a default of 1 makes the browser snap a
71
+ * fractional value (0.7) to the nearest integer (1) — the thumb jumps to that
72
+ * snapped position while our fill/label still show the raw value, so they
73
+ * disagree on load. When no step is given, infer one from the precision of the
74
+ * initial value/min/max so a value like 0.7 yields a step of 0.1.
75
+ *
76
+ * Granularity is a property of the field, not the live value, so it is captured
77
+ * ONCE. Recomputing from the live value would coarsen the step back to 1 the
78
+ * instant the user drags onto a whole number (e.g. 1.0), stranding the slider
79
+ * on integer increments.
80
+ */
81
+ const initialNumeric = typeof value === 'number' ? value : Number(value);
82
+ const inferredStep = ((): number => {
83
+ const places = Math.max(
84
+ decimalPlaces(Number.isNaN(initialNumeric) ? min : initialNumeric),
85
+ decimalPlaces(min),
86
+ decimalPlaces(max)
87
+ );
88
+ return places > 0 ? Math.pow(10, -places) : 1;
89
+ })();
90
+
91
+ const effectiveStep = $derived(typeof step === 'number' && step > 0 ? step : inferredStep);
92
+
59
93
  /**
60
94
  * Compute the percentage position for the filled track
61
95
  * Used to show visual progress of the slider
@@ -79,21 +113,28 @@
79
113
 
80
114
  <div class="form-range-container">
81
115
  <div class="form-range-slider">
116
+ <!--
117
+ Order matters: min/max/step must be applied BEFORE value. A range input
118
+ defaults to step=1, so setting value=0.7 first snaps it to 1, and the later
119
+ step=0.1 does not re-validate the already-snapped value. Setting the bounds
120
+ and step first lets the value land truthfully.
121
+ -->
82
122
  <input
83
123
  {id}
84
124
  type="range"
85
125
  class="form-range-field"
86
- value={numericValue}
87
126
  {min}
88
127
  {max}
89
- {step}
128
+ step={effectiveStep}
129
+ value={numericValue}
90
130
  {disabled}
131
+ {required}
91
132
  aria-describedby={ariaDescribedBy}
92
133
  aria-valuemin={min}
93
134
  aria-valuemax={max}
94
135
  aria-valuenow={numericValue}
95
136
  oninput={handleInput}
96
- style="--progress: {progressPercentage}%"
137
+ style="--progress: {progressPercentage}"
97
138
  />
98
139
  </div>
99
140
  <div class="form-range-values">
@@ -118,6 +159,16 @@
118
159
  }
119
160
 
120
161
  .form-range-field {
162
+ /* Thumb width; the fill edge is offset by half of this so it tracks the
163
+ thumb centre instead of the raw 0–100% of the track. */
164
+ --fd-range-thumb-size: 18px;
165
+ /* `--progress` is a unitless 0–100 set inline. The browser keeps the thumb
166
+ inside the track, so its centre travels from thumb/2 to (100% − thumb/2);
167
+ mirror that here so the colour fill lines up at every value, on load too. */
168
+ --fd-range-fill: calc(
169
+ var(--fd-range-thumb-size) / 2 + (100% - var(--fd-range-thumb-size)) * var(--progress, 0) /
170
+ 100
171
+ );
121
172
  width: 100%;
122
173
  height: 6px;
123
174
  border-radius: 3px;
@@ -126,8 +177,8 @@
126
177
  background: linear-gradient(
127
178
  to right,
128
179
  var(--fd-primary) 0%,
129
- var(--fd-primary) var(--progress, 0%),
130
- var(--fd-border) var(--progress, 0%),
180
+ var(--fd-primary) var(--fd-range-fill),
181
+ var(--fd-border) var(--fd-range-fill),
131
182
  var(--fd-border) 100%
132
183
  );
133
184
  cursor: pointer;
@@ -144,8 +195,8 @@
144
195
  .form-range-field::-webkit-slider-thumb {
145
196
  -webkit-appearance: none;
146
197
  appearance: none;
147
- width: 18px;
148
- height: 18px;
198
+ width: var(--fd-range-thumb-size);
199
+ height: var(--fd-range-thumb-size);
149
200
  border-radius: 50%;
150
201
  background: linear-gradient(135deg, var(--fd-background) 0%, var(--fd-muted) 100%);
151
202
  border: 2px solid var(--fd-primary);
@@ -164,12 +215,6 @@
164
215
  0 2px 4px rgba(0, 0, 0, 0.1);
165
216
  }
166
217
 
167
- .form-range-field:focus::-webkit-slider-thumb {
168
- box-shadow:
169
- 0 0 0 3px rgba(59, 130, 246, 0.2),
170
- 0 4px 12px rgba(59, 130, 246, 0.35);
171
- }
172
-
173
218
  /* Firefox - Track */
174
219
  .form-range-field::-moz-range-track {
175
220
  height: 6px;
@@ -185,8 +230,8 @@
185
230
 
186
231
  /* Firefox - Thumb */
187
232
  .form-range-field::-moz-range-thumb {
188
- width: 18px;
189
- height: 18px;
233
+ width: var(--fd-range-thumb-size);
234
+ height: var(--fd-range-thumb-size);
190
235
  border-radius: 50%;
191
236
  background: linear-gradient(135deg, var(--fd-background) 0%, var(--fd-muted) 100%);
192
237
  border: 2px solid var(--fd-primary);
@@ -204,20 +249,7 @@
204
249
  0 2px 4px rgba(0, 0, 0, 0.1);
205
250
  }
206
251
 
207
- .form-range-field:focus::-moz-range-thumb {
208
- box-shadow:
209
- 0 0 0 3px rgba(59, 130, 246, 0.2),
210
- 0 4px 12px rgba(59, 130, 246, 0.35);
211
- }
212
-
213
- /* Focus styles */
214
- .form-range-field:focus {
215
- outline: none;
216
- }
217
-
218
- .form-range-field:focus-visible {
219
- outline: none;
220
- }
252
+ /* Focus ring is centralized in base.css (outline on the range input). */
221
253
 
222
254
  /* Value display row */
223
255
  .form-range-values {
@@ -9,7 +9,7 @@
9
9
  -->
10
10
 
11
11
  <script lang="ts">
12
- import Icon from '@iconify/svelte';
12
+ import Select from '../Select.svelte';
13
13
  import { normalizeOptions, type FieldOption } from './types.js';
14
14
 
15
15
  interface Props {
@@ -53,77 +53,15 @@
53
53
  }
54
54
  </script>
55
55
 
56
- <div class="form-select-wrapper">
57
- <select
58
- {id}
59
- class="form-select"
60
- value={value ?? ''}
61
- {disabled}
62
- aria-describedby={ariaDescribedBy}
63
- aria-required={required}
64
- onchange={handleChange}
65
- >
66
- {#each normalizedOptions as option (option.value)}
67
- <option value={option.value}>{option.label}</option>
68
- {/each}
69
- </select>
70
- <span class="form-select__icon" aria-hidden="true">
71
- <Icon icon="heroicons:chevron-down" />
72
- </span>
73
- </div>
74
-
75
- <style>
76
- .form-select-wrapper {
77
- position: relative;
78
- }
79
-
80
- .form-select {
81
- width: 100%;
82
- padding: 0.625rem 2.5rem 0.625rem 0.875rem;
83
- border: 1px solid var(--fd-border);
84
- border-radius: var(--fd-radius-lg);
85
- font-size: var(--fd-text-sm);
86
- font-family: inherit;
87
- color: var(--fd-foreground);
88
- background-color: var(--fd-muted);
89
- transition: all var(--fd-transition-normal);
90
- box-shadow: var(--fd-shadow-sm);
91
- cursor: pointer;
92
- appearance: none;
93
- }
94
-
95
- .form-select:hover {
96
- border-color: var(--fd-border-strong);
97
- background-color: var(--fd-background);
98
- }
99
-
100
- .form-select:focus {
101
- outline: none;
102
- border-color: var(--fd-primary);
103
- background-color: var(--fd-background);
104
- box-shadow:
105
- 0 0 0 3px rgba(59, 130, 246, 0.12),
106
- var(--fd-shadow-sm);
107
- }
108
-
109
- .form-select__icon {
110
- position: absolute;
111
- right: 0.75rem;
112
- top: 50%;
113
- transform: translateY(-50%);
114
- pointer-events: none;
115
- color: var(--fd-muted-foreground);
116
- display: flex;
117
- align-items: center;
118
- transition: color var(--fd-transition-normal);
119
- }
120
-
121
- .form-select__icon :global(svg) {
122
- width: 1rem;
123
- height: 1rem;
124
- }
125
-
126
- .form-select:focus + .form-select__icon {
127
- color: var(--fd-primary);
128
- }
129
- </style>
56
+ <Select
57
+ {id}
58
+ value={value ?? ''}
59
+ {disabled}
60
+ aria-describedby={ariaDescribedBy}
61
+ aria-required={required}
62
+ onchange={handleChange}
63
+ >
64
+ {#each normalizedOptions as option (option.value)}
65
+ <option value={option.value}>{option.label}</option>
66
+ {/each}
67
+ </Select>
@@ -30,7 +30,8 @@
30
30
  tooltips,
31
31
  Decoration,
32
32
  ViewPlugin,
33
- MatchDecorator
33
+ MatchDecorator,
34
+ placeholder as cmPlaceholder
34
35
  } from '@codemirror/view';
35
36
  import { EditorState, Compartment } from '@codemirror/state';
36
37
  import { history, historyKeymap, defaultKeymap, indentWithTab } from '@codemirror/commands';
@@ -45,6 +46,7 @@
45
46
  } from '../../types/index.js';
46
47
  import { createTemplateAutocomplete } from './templateAutocomplete.js';
47
48
  import { getVariableSchema } from '../../services/variableService.js';
49
+ import { getInstance } from '../../stores/getInstance.svelte.js';
48
50
  import { logger } from '../../utils/logger.js';
49
51
  import { m } from '../../messages/index.js';
50
52
 
@@ -105,6 +107,9 @@
105
107
  authProvider
106
108
  }: Props = $props();
107
109
 
110
+ // Active instance — supplies endpoint configuration for API variable fetching.
111
+ const fd = getInstance();
112
+
108
113
  /** Loading state for API variable fetching */
109
114
  let isLoadingVariables = $state(false);
110
115
 
@@ -139,6 +144,7 @@
139
144
  try {
140
145
  isLoadingVariables = true;
141
146
  effectiveVariableSchema = await getVariableSchema(
147
+ fd.api.config,
142
148
  node,
143
149
  nodes,
144
150
  edges,
@@ -350,7 +356,9 @@
350
356
  }
351
357
  }),
352
358
  EditorView.lineWrapping,
353
- EditorState.tabSize.of(2)
359
+ EditorState.tabSize.of(2),
360
+ // Shown inside the editor while the document is empty
361
+ cmPlaceholder(placeholder)
354
362
  ];
355
363
 
356
364
  // Add autocomplete compartment (can be reconfigured dynamically)
@@ -570,7 +578,7 @@
570
578
  onclick={() => insertVariable(varName)}
571
579
  title={`Insert {{ ${varName} }}`}
572
580
  >
573
- <code>{'{{ '}{varName}{' }}'}</code>
581
+ <code>{`{{ ${varName} }}`}</code>
574
582
  </button>
575
583
  {/each}
576
584
  </div>
@@ -615,7 +623,8 @@
615
623
  border: 1px solid var(--fd-border);
616
624
  border-radius: var(--fd-radius-lg);
617
625
  overflow: hidden;
618
- background-color: var(--fd-muted);
626
+ /* Match plain form fields: rest on the input surface, not --fd-muted. */
627
+ background-color: var(--fd-background);
619
628
  transition: all var(--fd-transition-normal);
620
629
  box-shadow: var(--fd-shadow-sm);
621
630
  }
@@ -625,12 +634,13 @@
625
634
  background-color: var(--fd-background);
626
635
  }
627
636
 
637
+ /* Compound widget: ring drawn on the container via :focus-within, using the
638
+ standard --fd-ring tokens (outline isn't clipped by the container overflow). */
628
639
  .form-template-editor__container:focus-within {
629
640
  border-color: var(--fd-accent);
630
641
  background-color: var(--fd-background);
631
- box-shadow:
632
- 0 0 0 3px rgba(168, 85, 247, 0.12),
633
- var(--fd-shadow-sm);
642
+ outline: var(--fd-ring-width) solid var(--fd-ring);
643
+ outline-offset: var(--fd-ring-offset);
634
644
  }
635
645
 
636
646
  /* Dark theme overrides */
@@ -9,6 +9,8 @@
9
9
  -->
10
10
 
11
11
  <script lang="ts">
12
+ import Input from '../Input.svelte';
13
+
12
14
  interface Props {
13
15
  /** Field identifier */
14
16
  id: string;
@@ -45,10 +47,9 @@
45
47
  }
46
48
  </script>
47
49
 
48
- <input
50
+ <Input
49
51
  {id}
50
52
  type="text"
51
- class="form-text-field"
52
53
  value={value ?? ''}
53
54
  {placeholder}
54
55
  {disabled}
@@ -56,36 +57,3 @@
56
57
  aria-required={required}
57
58
  oninput={handleInput}
58
59
  />
59
-
60
- <style>
61
- .form-text-field {
62
- width: 100%;
63
- padding: 0.625rem 0.875rem;
64
- border: 1px solid var(--fd-border);
65
- border-radius: var(--fd-radius-lg);
66
- font-size: var(--fd-text-sm);
67
- font-family: inherit;
68
- color: var(--fd-foreground);
69
- background-color: var(--fd-muted);
70
- transition: all var(--fd-transition-normal);
71
- box-shadow: var(--fd-shadow-sm);
72
- }
73
-
74
- .form-text-field::placeholder {
75
- color: var(--fd-muted-foreground);
76
- }
77
-
78
- .form-text-field:hover {
79
- border-color: var(--fd-border-strong);
80
- background-color: var(--fd-background);
81
- }
82
-
83
- .form-text-field:focus {
84
- outline: none;
85
- border-color: var(--fd-primary);
86
- background-color: var(--fd-background);
87
- box-shadow:
88
- 0 0 0 3px rgba(59, 130, 246, 0.12),
89
- var(--fd-shadow-sm);
90
- }
91
- </style>