@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
@@ -1,3 +1,27 @@
1
+ import { isErrorPort } from './colors.js';
2
+ /**
3
+ * Default sort weight applied to reserved ports (the `error` output and the
4
+ * `trigger`/`tool` control-flow ports) that don't set an explicit
5
+ * `displayOrder`. High enough to sink them below author-declared ports, which
6
+ * default to `0`. The single home for the "high weight" the docs refer to — an
7
+ * explicit `displayOrder` on the port still overrides it.
8
+ */
9
+ export const RESERVED_PORT_DISPLAY_ORDER = 100;
10
+ /**
11
+ * Whether a port is a reserved one that should default to the bottom of its
12
+ * direction: the reserved `error` output, or a `trigger`/`tool` control-flow
13
+ * port (identified by data type, mirroring the port config's control types).
14
+ */
15
+ export function isReservedPort(port) {
16
+ return isErrorPort(port) || port.dataType === 'trigger' || port.dataType === 'tool';
17
+ }
18
+ /**
19
+ * The port's effective default sort weight: its explicit `displayOrder` if set,
20
+ * else a high weight for reserved ports, else `0`.
21
+ */
22
+ function defaultWeight(port) {
23
+ return port.displayOrder ?? (isReservedPort(port) ? RESERVED_PORT_DISPLAY_ORDER : 0);
24
+ }
1
25
  /**
2
26
  * Sort ports by an ordered array of port IDs.
3
27
  * Ports not listed appear at the end in their original order.
@@ -13,6 +37,38 @@ export function applyPortOrder(ports, orderedIds) {
13
37
  return aIdx === bIdx ? 0 : aIdx - bIdx;
14
38
  });
15
39
  }
40
+ /**
41
+ * Sort ports by their effective `displayOrder` weight (ascending), breaking ties
42
+ * on declaration order (stable). This is the default order before any
43
+ * instance-level reordering — reserved ports (trigger/tool/error) carry a high
44
+ * default weight so they land at the bottom without authors hand-setting it.
45
+ */
46
+ export function byDefaultOrder(ports) {
47
+ return ports
48
+ .map((port, index) => ({ port, index }))
49
+ .sort((a, b) => defaultWeight(a.port) - defaultWeight(b.port) || a.index - b.index)
50
+ .map(({ port }) => port);
51
+ }
52
+ /**
53
+ * Effective render order for a direction: the metadata default order, then the
54
+ * instance's `ports` config override (listed ports first in their stored order,
55
+ * the rest following in default order).
56
+ */
57
+ export function orderPortsFor(ports, entries) {
58
+ const base = byDefaultOrder(ports);
59
+ return applyPortOrder(base, entries?.map((entry) => entry.id));
60
+ }
61
+ /**
62
+ * Effective exposure for a port: the instance's explicit `exposed` override if
63
+ * present, else the port's metadata `exposedByDefault` (which itself defaults to
64
+ * exposed).
65
+ */
66
+ export function isPortExposed(port, entries) {
67
+ const entry = entries?.find((candidate) => candidate.id === port.id);
68
+ if (entry && entry.exposed !== undefined)
69
+ return entry.exposed;
70
+ return port.exposedByDefault ?? true;
71
+ }
16
72
  /**
17
73
  * Compute the CSS `top` offset (px) for a port handle.
18
74
  * - 1 port: centered at 40px
@@ -24,19 +80,16 @@ export function getPortTop(index, count) {
24
80
  return 20 + index * 40;
25
81
  }
26
82
  /**
27
- * Determine whether a port should be rendered.
83
+ * Whether a port is exposed, and so rendered on the canvas.
28
84
  *
29
- * Priority:
30
- * 1. Manual hide (`hiddenPorts`) — always wins, regardless of connections
31
- * 2. `hideUnconnectedHandles` — hide if not present in the connected handles set
32
- * 3. Default — visible
33
- */
34
- export function isPortVisible(port, direction, hiddenPorts, hideUnconnectedHandles, connectedHandles, nodeId) {
35
- const hiddenList = direction === 'input' ? hiddenPorts.inputs : hiddenPorts.outputs;
36
- if (hiddenList?.includes(port.id))
37
- return false;
38
- if (hideUnconnectedHandles) {
39
- return connectedHandles.has(`${nodeId}-${direction}-${port.id}`);
40
- }
41
- return true;
85
+ * In v2 exposure is semantic, not cosmetic: a not-exposed port is hidden, not
86
+ * wireable, and not runtime-overridable. Effective exposure is the instance's
87
+ * explicit `data.config.ports` override for the port, falling back to the port's
88
+ * metadata `exposedByDefault` (which itself defaults to exposed).
89
+ *
90
+ * @see .claude/plans/exposed-ports.md
91
+ */
92
+ export function isPortVisible(port, direction, ports) {
93
+ const entries = direction === 'input' ? ports?.inputs : ports?.outputs;
94
+ return isPortExposed(port, entries);
42
95
  }
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Svelte action that relocates an element to `document.body` (or another
3
+ * target) for its lifetime, then removes it on destroy.
4
+ *
5
+ * Modals and overlays use `position: fixed` expecting the viewport as their
6
+ * containing block. When any ancestor establishes a containing block — via
7
+ * `transform`, `filter`, `backdrop-filter`, `will-change`, `contain`, etc. —
8
+ * `fixed` resolves against that ancestor instead, causing clipping and
9
+ * mis-centering. Portalling the node to `document.body` sidesteps this by
10
+ * escaping those ancestors entirely.
11
+ *
12
+ * Usage: `<div use:portal>…</div>` or `<div use:portal={targetElement}>…</div>`.
13
+ * No-op during SSR (no `document`).
14
+ */
15
+ export declare function portal(node: HTMLElement, target?: HTMLElement | undefined): {
16
+ update(nextTarget: HTMLElement | undefined): void;
17
+ destroy(): void;
18
+ };
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Svelte action that relocates an element to `document.body` (or another
3
+ * target) for its lifetime, then removes it on destroy.
4
+ *
5
+ * Modals and overlays use `position: fixed` expecting the viewport as their
6
+ * containing block. When any ancestor establishes a containing block — via
7
+ * `transform`, `filter`, `backdrop-filter`, `will-change`, `contain`, etc. —
8
+ * `fixed` resolves against that ancestor instead, causing clipping and
9
+ * mis-centering. Portalling the node to `document.body` sidesteps this by
10
+ * escaping those ancestors entirely.
11
+ *
12
+ * Usage: `<div use:portal>…</div>` or `<div use:portal={targetElement}>…</div>`.
13
+ * No-op during SSR (no `document`).
14
+ */
15
+ export function portal(node, target = undefined) {
16
+ let host = null;
17
+ function mount(to) {
18
+ if (typeof document === 'undefined')
19
+ return;
20
+ host = to ?? document.body;
21
+ host.appendChild(node);
22
+ }
23
+ mount(target);
24
+ return {
25
+ update(nextTarget) {
26
+ mount(nextTarget);
27
+ },
28
+ destroy() {
29
+ if (node.parentNode) {
30
+ node.parentNode.removeChild(node);
31
+ }
32
+ }
33
+ };
34
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Combines a dynamically-fetched config schema with a node's static schema.
3
+ *
4
+ * Dynamic schema used to be all-or-nothing: the fetched schema replaced the
5
+ * whole form, so an endpoint had to re-serve every field even to drive one, and
6
+ * a narrower response silently dropped fields (and their values) the form no
7
+ * longer rendered. `applyFetchedSchema` lets the fetch instead *layer onto* the
8
+ * static schema — merging fields or targeting a single region — so the rest of
9
+ * the form stays exactly as authored.
10
+ *
11
+ * Kept as a standalone pure function so it can be unit-tested directly against
12
+ * the same code `ConfigForm` runs, rather than through the component.
13
+ */
14
+ import type { ConfigSchema, DynamicSchemaEndpoint } from '../types/index.js';
15
+ /**
16
+ * Resolves the schema `ConfigForm` should render from a node's static schema
17
+ * and a freshly-fetched dynamic schema, per the endpoint's `mergeStrategy` and
18
+ * `target`.
19
+ *
20
+ * @param base - The node's static schema (`schema` prop or `metadata.configSchema`), if any
21
+ * @param fetched - The schema returned by the dynamic endpoint
22
+ * @param endpoint - Supplies `mergeStrategy` (default `"replace"`) and optional `target`
23
+ * @returns The effective schema to render
24
+ */
25
+ export declare function applyFetchedSchema(base: ConfigSchema | undefined, fetched: ConfigSchema, endpoint: Pick<DynamicSchemaEndpoint, 'mergeStrategy' | 'target'>): ConfigSchema;
@@ -0,0 +1,61 @@
1
+ /** Union two `required` arrays, dropping duplicates; `undefined` when neither has entries. */
2
+ function unionRequired(a, b) {
3
+ if (!a?.length && !b?.length)
4
+ return undefined;
5
+ return Array.from(new Set([...(a ?? []), ...(b ?? [])]));
6
+ }
7
+ /**
8
+ * Layers `fetched` onto `base`: fetched top-level attributes win, `properties`
9
+ * are shallow-merged per key (a field is wholly static or wholly fetched, never
10
+ * half of each), and `required` is unioned.
11
+ */
12
+ function mergeNodes(base, fetched) {
13
+ const merged = { ...base, ...fetched };
14
+ if (base.properties || fetched.properties) {
15
+ merged.properties = { ...(base.properties ?? {}), ...(fetched.properties ?? {}) };
16
+ }
17
+ const required = unionRequired(base.required, fetched.required);
18
+ if (required)
19
+ merged.required = required;
20
+ else
21
+ delete merged.required;
22
+ return merged;
23
+ }
24
+ /**
25
+ * Places `fetched` at `segments` within `base`, cloning each node along the
26
+ * path so the input is never mutated. At the leaf the strategy decides between
27
+ * replacing the existing node outright and merging into it.
28
+ */
29
+ function spliceAtPath(base, fetched, segments, strategy) {
30
+ if (segments.length === 0) {
31
+ return strategy === 'merge' ? mergeNodes(base, fetched) : fetched;
32
+ }
33
+ const [head, ...rest] = segments;
34
+ const properties = base.properties ?? {};
35
+ const existing = (properties[head] ?? {});
36
+ return {
37
+ ...base,
38
+ properties: {
39
+ ...properties,
40
+ [head]: spliceAtPath(existing, fetched, rest, strategy)
41
+ }
42
+ };
43
+ }
44
+ /**
45
+ * Resolves the schema `ConfigForm` should render from a node's static schema
46
+ * and a freshly-fetched dynamic schema, per the endpoint's `mergeStrategy` and
47
+ * `target`.
48
+ *
49
+ * @param base - The node's static schema (`schema` prop or `metadata.configSchema`), if any
50
+ * @param fetched - The schema returned by the dynamic endpoint
51
+ * @param endpoint - Supplies `mergeStrategy` (default `"replace"`) and optional `target`
52
+ * @returns The effective schema to render
53
+ */
54
+ export function applyFetchedSchema(base, fetched, endpoint) {
55
+ const strategy = endpoint.mergeStrategy ?? 'replace';
56
+ // Nothing to combine with: the fetched schema is the whole form.
57
+ if (!base)
58
+ return fetched;
59
+ const segments = endpoint.target ? endpoint.target.split('.').filter(Boolean) : [];
60
+ return spliceAtPath(base, fetched, segments, strategy);
61
+ }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
4
4
  "license": "MIT",
5
5
  "private": false,
6
- "version": "1.15.0",
6
+ "version": "2.0.0-beta.10",
7
7
  "author": "Shibin Das (D34dMan)",
8
8
  "bugs": {
9
9
  "url": "https://github.com/flowdrop-io/flowdrop/issues"
@@ -47,12 +47,12 @@
47
47
  "dist",
48
48
  "!dist/**/*.test.*",
49
49
  "!dist/**/*.spec.*",
50
- "!dist/**/*.map"
50
+ "!dist/**/*.map",
51
+ "CHANGELOG.md",
52
+ "MIGRATION-2.0.md"
51
53
  ],
52
54
  "sideEffects": [
53
- "**/*.css",
54
- "./dist/styles/base.css",
55
- "./dist/editor/index.js"
55
+ "**/*.css"
56
56
  ],
57
57
  "svelte": "./dist/index.js",
58
58
  "types": "./dist/index.d.ts",
@@ -269,6 +269,7 @@
269
269
  "dependencies": {
270
270
  "diff": "^8.0.3",
271
271
  "dompurify": "^3.3.1",
272
+ "esm-env": "^1.2.2",
272
273
  "marked": "^16.1.1",
273
274
  "svelte-5-french-toast": "^2.0.6",
274
275
  "uuid": "^11.1.0"
@@ -288,6 +289,7 @@
288
289
  "watch:build": "npm-watch build",
289
290
  "preview": "vite preview",
290
291
  "check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
292
+ "check:bundle": "node scripts/check-bundle.mjs",
291
293
  "check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
292
294
  "lint": "eslint . && prettier --check .",
293
295
  "test": "vitest run",
@@ -1,20 +0,0 @@
1
- /**
2
- * One-shot deprecation warning helper for the messages migration.
3
- *
4
- * Components that previously accepted per-string label props (e.g.
5
- * `saveLabel`, `cancelLabel`, `placeholder`, `addLabel`) keep accepting them
6
- * during the v1.x deprecation window. When a consumer passes one explicitly
7
- * we emit a single console.warn per (component, prop) pair so the noise is
8
- * bounded even if the prop is rebound on every render.
9
- *
10
- * Production builds skip the warning entirely.
11
- *
12
- * Removed in v2.0 along with the props themselves.
13
- */
14
- export declare function warnDeprecatedProp(component: string, prop: string, replacement: string): void;
15
- /**
16
- * Test-only: clear the warned-once cache so subsequent renders re-emit the
17
- * warning. Storybook stories and Vitest specs that share a module instance
18
- * need this to assert the warning fires per case.
19
- */
20
- export declare function __resetDeprecationWarningsForTests(): void;
@@ -1,33 +0,0 @@
1
- /**
2
- * One-shot deprecation warning helper for the messages migration.
3
- *
4
- * Components that previously accepted per-string label props (e.g.
5
- * `saveLabel`, `cancelLabel`, `placeholder`, `addLabel`) keep accepting them
6
- * during the v1.x deprecation window. When a consumer passes one explicitly
7
- * we emit a single console.warn per (component, prop) pair so the noise is
8
- * bounded even if the prop is rebound on every render.
9
- *
10
- * Production builds skip the warning entirely.
11
- *
12
- * Removed in v2.0 along with the props themselves.
13
- */
14
- const warned = new Set();
15
- export function warnDeprecatedProp(component, prop, replacement) {
16
- if (import.meta.env.PROD)
17
- return;
18
- const key = `${component}.${prop}`;
19
- if (warned.has(key))
20
- return;
21
- warned.add(key);
22
- // eslint-disable-next-line no-console
23
- console.warn(`[flowdrop] <${component}> prop \`${prop}\` is deprecated and will be removed in v2.0. ` +
24
- `Use \`messages\` on <FlowDrop> instead: ${replacement}`);
25
- }
26
- /**
27
- * Test-only: clear the warned-once cache so subsequent renders re-emit the
28
- * warning. Storybook stories and Vitest specs that share a module instance
29
- * need this to assert the warning fires per case.
30
- */
31
- export function __resetDeprecationWarningsForTests() {
32
- warned.clear();
33
- }
@@ -1,215 +0,0 @@
1
- /**
2
- * FlowDrop Plugin System
3
- * Provides APIs for external libraries to register custom node components.
4
- *
5
- * This enables a plugin ecosystem where:
6
- * - Third-party libraries can provide custom node types
7
- * - Custom nodes are namespaced to avoid conflicts
8
- * - Registration is simplified with a clean API
9
- */
10
- import { type NodeComponentProps, type NodeComponentCategory, type StatusPosition, type StatusSize } from './nodeComponentRegistry.js';
11
- import type { Component } from 'svelte';
12
- /**
13
- * Plugin configuration for external libraries.
14
- * Use this to register multiple node types from a library.
15
- */
16
- export interface FlowDropPluginConfig {
17
- /**
18
- * Unique namespace for this plugin.
19
- * Used to prefix all node types (e.g., "mylib" -> "mylib:nodename").
20
- * Should be lowercase, alphanumeric with optional hyphens.
21
- */
22
- namespace: string;
23
- /** Display name for the plugin (for UI/debugging purposes) */
24
- name: string;
25
- /** Plugin version (optional, for debugging) */
26
- version?: string;
27
- /** Description of what this plugin provides */
28
- description?: string;
29
- /** Node components to register */
30
- nodes: PluginNodeDefinition[];
31
- }
32
- /**
33
- * Simplified node definition for plugins.
34
- * Provides a cleaner API than full NodeComponentRegistration.
35
- */
36
- export interface PluginNodeDefinition {
37
- /**
38
- * Type identifier for this node.
39
- * Will be prefixed with the plugin namespace (e.g., "fancy" -> "mylib:fancy").
40
- */
41
- type: string;
42
- /** Display name shown in UI */
43
- displayName: string;
44
- /** Description of what this node does */
45
- description?: string;
46
- /** The Svelte component to render */
47
- component: Component<NodeComponentProps>;
48
- /** Icon in iconify format (e.g., "mdi:star") */
49
- icon?: string;
50
- /** Category for organizing in UI */
51
- category?: NodeComponentCategory;
52
- /** Status overlay position */
53
- statusPosition?: StatusPosition;
54
- /** Status overlay size */
55
- statusSize?: StatusSize;
56
- }
57
- /**
58
- * Result of plugin registration.
59
- * Contains information about what was registered and any errors.
60
- */
61
- export interface PluginRegistrationResult {
62
- /** Whether all nodes were registered successfully */
63
- success: boolean;
64
- /** The plugin namespace */
65
- namespace: string;
66
- /** Array of successfully registered type identifiers (namespaced) */
67
- registeredTypes: string[];
68
- /** Array of error messages for failed registrations */
69
- errors: string[];
70
- }
71
- /**
72
- * Register a FlowDrop plugin with custom node components.
73
- * All node types are automatically namespaced with the plugin namespace.
74
- *
75
- * @param config - Plugin configuration with namespace and node definitions
76
- * @returns Result object with registered types and any errors
77
- *
78
- * @example
79
- * ```typescript
80
- * import { registerFlowDropPlugin } from "@flowdrop/lib";
81
- * import FancyNode from "./FancyNode.svelte";
82
- * import GlowNode from "./GlowNode.svelte";
83
- *
84
- * const result = registerFlowDropPlugin({
85
- * namespace: "awesome",
86
- * name: "Awesome Nodes",
87
- * version: "1.0.0",
88
- * nodes: [
89
- * {
90
- * type: "fancy",
91
- * displayName: "Fancy Node",
92
- * component: FancyNode,
93
- * icon: "mdi:sparkles"
94
- * },
95
- * {
96
- * type: "glow",
97
- * displayName: "Glowing Node",
98
- * component: GlowNode,
99
- * icon: "mdi:lightbulb"
100
- * }
101
- * ]
102
- * });
103
- *
104
- * // Result:
105
- * // {
106
- * // success: true,
107
- * // namespace: "awesome",
108
- * // registeredTypes: ["awesome:fancy", "awesome:glow"],
109
- * // errors: []
110
- * // }
111
- * ```
112
- */
113
- export declare function registerFlowDropPlugin(config: FlowDropPluginConfig): PluginRegistrationResult;
114
- /**
115
- * Unregister all nodes from a plugin by namespace.
116
- *
117
- * @param namespace - The plugin namespace to unregister
118
- * @returns Array of unregistered type identifiers
119
- *
120
- * @example
121
- * ```typescript
122
- * const removed = unregisterFlowDropPlugin("awesome");
123
- * // Returns ["awesome:fancy", "awesome:glow"]
124
- * ```
125
- */
126
- export declare function unregisterFlowDropPlugin(namespace: string): string[];
127
- /**
128
- * Check if a namespace is valid.
129
- * Must be lowercase alphanumeric with optional hyphens.
130
- *
131
- * @param namespace - The namespace to validate
132
- * @returns true if valid
133
- */
134
- export declare function isValidNamespace(namespace: string): boolean;
135
- /**
136
- * Get all registered plugins (unique namespaces).
137
- *
138
- * @returns Array of namespace strings
139
- */
140
- export declare function getRegisteredPlugins(): string[];
141
- /**
142
- * Get the count of nodes registered by a plugin.
143
- *
144
- * @param namespace - The plugin namespace
145
- * @returns Number of nodes registered by this plugin
146
- */
147
- export declare function getPluginNodeCount(namespace: string): number;
148
- /**
149
- * Register a single custom node without a full plugin.
150
- * Useful for project-specific custom nodes.
151
- *
152
- * @param type - Type identifier (can be namespaced or plain)
153
- * @param displayName - Display name for UI
154
- * @param component - Svelte component
155
- * @param options - Additional options
156
- *
157
- * @example
158
- * ```typescript
159
- * import { registerCustomNode } from "@flowdrop/lib";
160
- * import MyNode from "./MyNode.svelte";
161
- *
162
- * registerCustomNode("myproject:special", "Special Node", MyNode, {
163
- * icon: "mdi:star",
164
- * description: "A special node for my project"
165
- * });
166
- * ```
167
- */
168
- export declare function registerCustomNode(type: string, displayName: string, component: Component<NodeComponentProps>, options?: {
169
- description?: string;
170
- icon?: string;
171
- category?: NodeComponentCategory;
172
- source?: string;
173
- statusPosition?: StatusPosition;
174
- statusSize?: StatusSize;
175
- }): void;
176
- /**
177
- * Create a plugin builder for a fluent API experience.
178
- *
179
- * @param namespace - Plugin namespace
180
- * @param name - Plugin name
181
- * @returns Plugin builder with chainable methods
182
- *
183
- * @example
184
- * ```typescript
185
- * import { createPlugin } from "@flowdrop/lib";
186
- *
187
- * createPlugin("awesome", "Awesome Nodes")
188
- * .version("1.0.0")
189
- * .node("fancy", "Fancy Node", FancyNode)
190
- * .node("glow", "Glowing Node", GlowNode, { icon: "mdi:lightbulb" })
191
- * .register();
192
- * ```
193
- */
194
- export declare function createPlugin(namespace: string, name: string): {
195
- /**
196
- * Set plugin version
197
- */
198
- version(v: string): /*elided*/ any;
199
- /**
200
- * Set plugin description
201
- */
202
- description(desc: string): /*elided*/ any;
203
- /**
204
- * Add a node to the plugin
205
- */
206
- node(type: string, displayName: string, component: Component<NodeComponentProps>, options?: Partial<Omit<PluginNodeDefinition, "type" | "displayName" | "component">>): /*elided*/ any;
207
- /**
208
- * Register the plugin
209
- */
210
- register(): PluginRegistrationResult;
211
- /**
212
- * Get the config without registering (for testing/inspection)
213
- */
214
- getConfig(): FlowDropPluginConfig;
215
- };