@flowdrop/flowdrop 1.15.0 → 2.0.0-beta.1

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 (215) hide show
  1. package/CHANGELOG.md +475 -0
  2. package/MIGRATION-2.0.md +472 -0
  3. package/README.md +23 -23
  4. package/dist/adapters/WorkflowAdapter.d.ts +1 -1
  5. package/dist/adapters/WorkflowAdapter.js +14 -8
  6. package/dist/adapters/agentspec/AgentSpecAdapter.js +7 -7
  7. package/dist/chat/batchFeedback.d.ts +39 -0
  8. package/dist/chat/batchFeedback.js +51 -0
  9. package/dist/commands/executor.js +15 -1
  10. package/dist/commands/storeIntegration.svelte.d.ts +4 -1
  11. package/dist/commands/storeIntegration.svelte.js +26 -21
  12. package/dist/commands/types.d.ts +2 -0
  13. package/dist/components/App.svelte +162 -192
  14. package/dist/components/App.svelte.d.ts +47 -8
  15. package/dist/components/ConfigForm.svelte +71 -47
  16. package/dist/components/ConfigModal.svelte +7 -2
  17. package/dist/components/ConnectionLine.svelte +4 -2
  18. package/dist/components/Navbar.svelte +61 -1
  19. package/dist/components/NodeSidebar.svelte +27 -45
  20. package/dist/components/NodeStatusOverlay.svelte +94 -6
  21. package/dist/components/NodeSwapPicker.svelte +10 -8
  22. package/dist/components/PipelineStatus.svelte +16 -67
  23. package/dist/components/PortCoordinateTracker.svelte +5 -6
  24. package/dist/components/SchemaForm.stories.svelte +1 -3
  25. package/dist/components/SchemaForm.svelte +18 -25
  26. package/dist/components/SchemaForm.svelte.d.ts +0 -8
  27. package/dist/components/SettingsModal.svelte +8 -3
  28. package/dist/components/SettingsPanel.svelte +20 -4
  29. package/dist/components/SwapMappingEditor.svelte +67 -49
  30. package/dist/components/SwapMappingEditor.svelte.d.ts +0 -2
  31. package/dist/components/UniversalNode.svelte +9 -7
  32. package/dist/components/WorkflowEditor.svelte +118 -111
  33. package/dist/components/WorkflowEditor.svelte.d.ts +18 -10
  34. package/dist/components/chat/AIChatPanel.svelte +93 -89
  35. package/dist/components/chat/AIChatPanel.svelte.d.ts +0 -4
  36. package/dist/components/chat/CommandPreview.svelte +2 -1
  37. package/dist/components/console/CommandConsole.svelte +7 -5
  38. package/dist/components/console/ConsoleAutocomplete.svelte +10 -11
  39. package/dist/components/console/ConsoleAutocomplete.svelte.d.ts +6 -0
  40. package/dist/components/console/ConsoleInput.svelte +15 -6
  41. package/dist/components/console/ConsoleOutput.svelte +2 -1
  42. package/dist/components/form/FormArray.svelte +5 -9
  43. package/dist/components/form/FormArray.svelte.d.ts +2 -1
  44. package/dist/components/form/FormAutocomplete.svelte +8 -6
  45. package/dist/components/form/FormField.svelte +4 -2
  46. package/dist/components/form/FormFieldLight.svelte +4 -2
  47. package/dist/components/form/FormMarkdownEditor.svelte +9 -4
  48. package/dist/components/form/FormRangeField.svelte +1 -0
  49. package/dist/components/form/FormTemplateEditor.svelte +11 -3
  50. package/dist/components/form/FormToggle.svelte +5 -12
  51. package/dist/components/form/FormToggle.svelte.d.ts +4 -2
  52. package/dist/components/form/templateAutocomplete.js +1 -5
  53. package/dist/components/form/types.d.ts +1 -14
  54. package/dist/components/interrupt/FormPrompt.svelte +3 -2
  55. package/dist/components/interrupt/InterruptBubble.svelte +16 -17
  56. package/dist/components/interrupt/ReviewPrompt.svelte +10 -3
  57. package/dist/components/interrupt/TextInputPrompt.svelte +2 -1
  58. package/dist/components/layouts/MainLayout.svelte +20 -13
  59. package/dist/components/layouts/MainLayout.svelte.d.ts +4 -0
  60. package/dist/components/nodes/AtomNode.svelte +17 -5
  61. package/dist/components/nodes/GatewayNode.svelte +19 -10
  62. package/dist/components/nodes/IdeaNode.svelte +7 -0
  63. package/dist/components/nodes/SimpleNode.svelte +11 -6
  64. package/dist/components/nodes/SquareNode.svelte +15 -8
  65. package/dist/components/nodes/TerminalNode.svelte +9 -4
  66. package/dist/components/nodes/ToolNode.svelte +7 -1
  67. package/dist/components/nodes/WorkflowNode.svelte +16 -7
  68. package/dist/components/playground/ChatInput.svelte +11 -14
  69. package/dist/components/playground/ChatPanel.svelte +6 -49
  70. package/dist/components/playground/ChatPanel.svelte.d.ts +0 -14
  71. package/dist/components/playground/ControlPanel.svelte +134 -123
  72. package/dist/components/playground/ControlPanel.svelte.d.ts +3 -0
  73. package/dist/components/playground/ExecutionLogs.svelte +11 -9
  74. package/dist/components/playground/InputCollector.svelte +11 -9
  75. package/dist/components/playground/MessageStream.svelte +17 -23
  76. package/dist/components/playground/PipelineKanbanView.svelte +65 -6
  77. package/dist/components/playground/PipelinePanel.svelte +11 -5
  78. package/dist/components/playground/PipelineTableView.svelte +186 -44
  79. package/dist/components/playground/Playground.svelte +90 -92
  80. package/dist/components/playground/Playground.svelte.d.ts +2 -0
  81. package/dist/components/playground/PlaygroundApp.svelte +6 -1
  82. package/dist/components/playground/PlaygroundApp.svelte.d.ts +3 -0
  83. package/dist/components/playground/PlaygroundModal.svelte +13 -3
  84. package/dist/components/playground/PlaygroundModal.svelte.d.ts +3 -0
  85. package/dist/components/playground/PlaygroundStudio.svelte +34 -32
  86. package/dist/components/playground/PlaygroundStudio.svelte.d.ts +3 -0
  87. package/dist/components/playground/SessionManager.svelte +9 -12
  88. package/dist/components/playground/pipelineViewUtils.svelte.d.ts +28 -0
  89. package/dist/components/playground/pipelineViewUtils.svelte.js +38 -1
  90. package/dist/config/endpoints.d.ts +0 -7
  91. package/dist/config/endpoints.js +2 -10
  92. package/dist/core/index.d.ts +4 -4
  93. package/dist/core/index.js +6 -6
  94. package/dist/display/index.d.ts +0 -2
  95. package/dist/display/index.js +0 -6
  96. package/dist/editor/index.d.ts +19 -20
  97. package/dist/editor/index.js +25 -35
  98. package/dist/form/code.d.ts +25 -15
  99. package/dist/form/code.js +44 -41
  100. package/dist/form/fieldRegistry.d.ts +17 -13
  101. package/dist/form/fieldRegistry.js +32 -12
  102. package/dist/form/full.d.ts +17 -13
  103. package/dist/form/full.js +22 -27
  104. package/dist/form/index.d.ts +3 -3
  105. package/dist/form/index.js +3 -3
  106. package/dist/form/markdown.d.ts +13 -8
  107. package/dist/form/markdown.js +22 -23
  108. package/dist/helpers/proximityConnect.d.ts +3 -2
  109. package/dist/helpers/proximityConnect.js +2 -5
  110. package/dist/helpers/workflowEditorHelper.d.ts +12 -5
  111. package/dist/helpers/workflowEditorHelper.js +27 -25
  112. package/dist/index.d.ts +28 -24
  113. package/dist/index.js +27 -50
  114. package/dist/messages/defaults.d.ts +2 -5
  115. package/dist/messages/defaults.js +3 -6
  116. package/dist/messages/index.d.ts +0 -1
  117. package/dist/messages/index.js +0 -1
  118. package/dist/mocks/app-forms.d.ts +6 -2
  119. package/dist/mocks/app-forms.js +11 -4
  120. package/dist/openapi/v1/openapi.yaml +3 -3
  121. package/dist/playground/index.d.ts +2 -3
  122. package/dist/playground/index.js +2 -30
  123. package/dist/playground/mount.d.ts +15 -0
  124. package/dist/playground/mount.js +46 -20
  125. package/dist/registry/{BaseRegistry.d.ts → BaseRegistry.svelte.d.ts} +22 -1
  126. package/dist/registry/{BaseRegistry.js → BaseRegistry.svelte.js} +37 -1
  127. package/dist/registry/builtinFormats.d.ts +9 -18
  128. package/dist/registry/builtinFormats.js +9 -39
  129. package/dist/registry/builtinNodes.d.ts +0 -25
  130. package/dist/registry/builtinNodes.js +1 -50
  131. package/dist/registry/index.d.ts +3 -4
  132. package/dist/registry/index.js +4 -6
  133. package/dist/registry/nodeComponentRegistry.d.ts +182 -15
  134. package/dist/registry/nodeComponentRegistry.js +235 -17
  135. package/dist/registry/workflowFormatRegistry.d.ts +14 -9
  136. package/dist/registry/workflowFormatRegistry.js +24 -8
  137. package/dist/{schema → schemas}/index.d.ts +2 -2
  138. package/dist/{schema → schemas}/index.js +2 -2
  139. package/dist/schemas/v1/workflow.schema.json +3 -3
  140. package/dist/services/agentSpecExecutionService.js +0 -1
  141. package/dist/services/apiVariableService.d.ts +2 -1
  142. package/dist/services/apiVariableService.js +5 -22
  143. package/dist/services/autoSaveService.d.ts +7 -0
  144. package/dist/services/autoSaveService.js +6 -4
  145. package/dist/services/chatService.d.ts +8 -4
  146. package/dist/services/chatService.js +15 -15
  147. package/dist/services/draftStorage.d.ts +129 -13
  148. package/dist/services/draftStorage.js +185 -37
  149. package/dist/services/dynamicSchemaService.d.ts +2 -1
  150. package/dist/services/dynamicSchemaService.js +5 -22
  151. package/dist/services/globalSave.d.ts +13 -12
  152. package/dist/services/globalSave.js +29 -51
  153. package/dist/services/historyService.d.ts +9 -3
  154. package/dist/services/historyService.js +9 -3
  155. package/dist/services/interruptService.d.ts +14 -9
  156. package/dist/services/interruptService.js +27 -27
  157. package/dist/services/nodeExecutionService.d.ts +18 -3
  158. package/dist/services/nodeExecutionService.js +71 -45
  159. package/dist/services/playgroundService.d.ts +14 -9
  160. package/dist/services/playgroundService.js +31 -30
  161. package/dist/services/variableService.d.ts +2 -1
  162. package/dist/services/variableService.js +2 -2
  163. package/dist/services/workflowStorage.js +6 -6
  164. package/dist/stores/apiContext.d.ts +45 -0
  165. package/dist/stores/apiContext.js +65 -0
  166. package/dist/stores/categoriesStore.svelte.d.ts +28 -23
  167. package/dist/stores/categoriesStore.svelte.js +70 -64
  168. package/dist/stores/getInstance.svelte.d.ts +39 -0
  169. package/dist/stores/getInstance.svelte.js +65 -0
  170. package/dist/stores/historyStore.svelte.d.ts +77 -93
  171. package/dist/stores/historyStore.svelte.js +134 -160
  172. package/dist/stores/instanceContainer.svelte.d.ts +111 -0
  173. package/dist/stores/instanceContainer.svelte.js +114 -0
  174. package/dist/stores/interruptStore.svelte.d.ts +112 -82
  175. package/dist/stores/interruptStore.svelte.js +253 -226
  176. package/dist/stores/pipelinePanelStore.svelte.d.ts +27 -3
  177. package/dist/stores/pipelinePanelStore.svelte.js +61 -14
  178. package/dist/stores/playgroundStore.svelte.d.ts +169 -222
  179. package/dist/stores/playgroundStore.svelte.js +515 -580
  180. package/dist/stores/portCoordinateStore.svelte.d.ts +57 -51
  181. package/dist/stores/portCoordinateStore.svelte.js +109 -98
  182. package/dist/stores/settingsStore.svelte.d.ts +4 -1
  183. package/dist/stores/settingsStore.svelte.js +47 -12
  184. package/dist/stores/workflowStore.svelte.d.ts +178 -213
  185. package/dist/stores/workflowStore.svelte.js +449 -501
  186. package/dist/stories/EdgeDecorator.svelte +5 -2
  187. package/dist/stories/NodeDecorator.svelte +5 -3
  188. package/dist/svelte-app.d.ts +60 -10
  189. package/dist/svelte-app.js +157 -53
  190. package/dist/types/events.d.ts +6 -3
  191. package/dist/types/index.d.ts +33 -3
  192. package/dist/types/navbar.d.ts +7 -0
  193. package/dist/types/playground.d.ts +18 -3
  194. package/dist/types/settings.d.ts +13 -0
  195. package/dist/types/settings.js +1 -0
  196. package/dist/utils/colors.d.ts +47 -21
  197. package/dist/utils/colors.js +69 -68
  198. package/dist/utils/connections.d.ts +9 -15
  199. package/dist/utils/connections.js +13 -32
  200. package/dist/utils/duration.d.ts +13 -0
  201. package/dist/utils/duration.js +45 -0
  202. package/dist/utils/icons.d.ts +5 -2
  203. package/dist/utils/icons.js +6 -5
  204. package/dist/utils/nodeSwap.d.ts +6 -2
  205. package/dist/utils/nodeSwap.js +62 -126
  206. package/dist/utils/nodeTypes.d.ts +17 -8
  207. package/dist/utils/nodeTypes.js +26 -19
  208. package/dist/utils/performanceUtils.js +7 -0
  209. package/package.json +6 -5
  210. package/dist/messages/deprecation.d.ts +0 -20
  211. package/dist/messages/deprecation.js +0 -33
  212. package/dist/registry/plugin.d.ts +0 -215
  213. package/dist/registry/plugin.js +0 -249
  214. package/dist/services/api.d.ts +0 -129
  215. package/dist/services/api.js +0 -217
@@ -376,11 +376,26 @@ export interface PlaygroundConfig {
376
376
  */
377
377
  showSidebar?: boolean;
378
378
  /**
379
- * Whether to show the session header bar (default: true)
380
- * When false, the header with session name and close button is hidden.
381
- * Typically used together with showSidebar: false for minimal UI.
379
+ * Whether to show the ControlPanel header bar (default: true)
380
+ * When false, hides the entire header row: session label, session chip
381
+ * (with its New Session / session list popover) and the toolbar actions
382
+ * (Pipeline / Refresh / Logs). Use for a minimal, locked-down playground.
382
383
  */
383
384
  showSessionHeader?: boolean;
385
+ /**
386
+ * Whether to show the "New Session" entry in the session chip popover
387
+ * (default: true). When false, users cannot create additional sessions
388
+ * from the UI — useful for single-session playground embeds.
389
+ * No effect when showSessionHeader is false.
390
+ */
391
+ showNewSessionButton?: boolean;
392
+ /**
393
+ * Whether to show the session chip selector and its session list (default:
394
+ * true). When false, the chip dropdown is hidden entirely — users cannot
395
+ * switch sessions or see other sessions. Useful for locking a playground
396
+ * embed to a single session. No effect when showSessionHeader is false.
397
+ */
398
+ showSessionList?: boolean;
384
399
  /**
385
400
  * Determines if polling should stop for a given session status.
386
401
  * Override to customize which statuses pause polling.
@@ -72,6 +72,19 @@ export interface BehaviorSettings {
72
72
  autoSave: boolean;
73
73
  /** Auto-save interval in milliseconds */
74
74
  autoSaveInterval: number;
75
+ /**
76
+ * Persist workflow drafts in browser storage.
77
+ *
78
+ * When enabled (default), unsaved changes are written to browser storage
79
+ * so they survive page reloads. On the default `localStorage` backend,
80
+ * drafts remain stored on the device even after the tab or browser is
81
+ * closed, until they are saved or cleared. Turning this off stops draft
82
+ * writes and removes the current draft.
83
+ *
84
+ * Caveat: the toggle applies per tab. Other tabs that are already open
85
+ * read settings at load time and keep writing drafts until reloaded.
86
+ */
87
+ storeDraftsInBrowser: boolean;
75
88
  /** Maximum number of undo history entries */
76
89
  undoHistoryLimit: number;
77
90
  /** Show confirmation dialog before deleting nodes */
@@ -70,6 +70,7 @@ export const DEFAULT_UI_SETTINGS = {
70
70
  export const DEFAULT_BEHAVIOR_SETTINGS = {
71
71
  autoSave: false,
72
72
  autoSaveInterval: 30000,
73
+ storeDraftsInBrowser: true,
73
74
  undoHistoryLimit: 50,
74
75
  confirmDelete: false,
75
76
  chatAutoRetry: true
@@ -4,6 +4,8 @@
4
4
  * Uses BEM syntax for CSS classes
5
5
  */
6
6
  import type { NodeCategory, PortDataTypeConfig } from '../types/index.js';
7
+ import type { PortCompatibilityChecker } from './connections.js';
8
+ import type { CategoriesStore } from '../stores/categoriesStore.svelte.js';
7
9
  /**
8
10
  * Category color mapping to design tokens (CSS variables)
9
11
  * Uses --fd-node-* tokens from tokens.css
@@ -14,20 +16,27 @@ export declare const CATEGORY_COLOR_TOKENS: Record<string, string>;
14
16
  * Get the design token for a category color.
15
17
  * Checks the categories store first (which includes API overrides),
16
18
  * then falls back to the static CATEGORY_COLOR_TOKENS map, then to slate.
19
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
20
+ * @param category - The node category
17
21
  */
18
- export declare function getCategoryColorToken(category: NodeCategory): string;
22
+ export declare function getCategoryColorToken(categories: CategoriesStore, category: NodeCategory): string;
19
23
  /**
20
24
  * Get the reference color token for a data type (configurable version)
25
+ * @param checker - The instance's port compatibility checker (provides data-type config)
26
+ * @param dataType - The data type
21
27
  */
22
- export declare function getDataTypeColorToken(dataType: string): string;
28
+ export declare function getDataTypeColorToken(checker: PortCompatibilityChecker, dataType: string): string;
23
29
  /**
24
30
  * Get data type configuration from port config
31
+ * @param checker - The instance's port compatibility checker
32
+ * @param dataType - The data type
25
33
  */
26
- export declare function getDataTypeConfig(dataType: string): PortDataTypeConfig | undefined;
34
+ export declare function getDataTypeConfig(checker: PortCompatibilityChecker, dataType: string): PortDataTypeConfig | undefined;
27
35
  /**
28
36
  * Get all available data types from port configuration
37
+ * @param checker - The instance's port compatibility checker
29
38
  */
30
- export declare function getAvailableDataTypes(): PortDataTypeConfig[];
39
+ export declare function getAvailableDataTypes(checker: PortCompatibilityChecker): PortDataTypeConfig[];
31
40
  /**
32
41
  * Default colors for fallback cases
33
42
  */
@@ -39,43 +48,49 @@ export declare const DEFAULT_COLORS: {
39
48
  };
40
49
  /**
41
50
  * Get category colors
51
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
42
52
  * @param category - The node category
43
53
  * @returns The color configuration for the category
44
54
  */
45
- export declare function getCategoryColors(category: NodeCategory): string;
55
+ export declare function getCategoryColors(categories: CategoriesStore, category: NodeCategory): string;
46
56
  /**
47
57
  * Get category background color
58
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
48
59
  * @param category - The node category
49
60
  * @returns The background color class
50
61
  */
51
- export declare function getCategoryBackground(category: NodeCategory): string;
62
+ export declare function getCategoryBackground(categories: CategoriesStore, category: NodeCategory): string;
52
63
  /**
53
64
  * Get category accent color
65
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
54
66
  * @param category - The node category
55
67
  * @returns The accent color class
56
68
  */
57
- export declare function getCategoryAccent(category: NodeCategory): string;
69
+ export declare function getCategoryAccent(categories: CategoriesStore, category: NodeCategory): string;
58
70
  /**
59
71
  * Get category text color
72
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
60
73
  * @param category - The node category
61
74
  * @returns The text color class
62
75
  */
63
- export declare function getCategoryText(category: NodeCategory): string;
76
+ export declare function getCategoryText(categories: CategoriesStore, category: NodeCategory): string;
64
77
  /**
65
78
  * Get category border color
79
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
66
80
  * @param category - The node category
67
81
  * @returns The border color class
68
82
  */
69
- export declare function getCategoryBorder(category: NodeCategory): string;
83
+ export declare function getCategoryBorder(categories: CategoriesStore, category: NodeCategory): string;
70
84
  /**
71
85
  * Get node colors based on category and state
86
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
72
87
  * @param category - The node category
73
88
  * @param isError - Whether the node is in error state
74
89
  * @param isProcessing - Whether the node is processing
75
90
  * @param isSelected - Whether the node is selected
76
91
  * @returns The color configuration object
77
92
  */
78
- export declare function getNodeColors(category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): {
93
+ export declare function getNodeColors(categories: CategoriesStore, category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): {
79
94
  background: string;
80
95
  accent: string;
81
96
  text: string;
@@ -83,52 +98,58 @@ export declare function getNodeColors(category: NodeCategory, isError?: boolean,
83
98
  };
84
99
  /**
85
100
  * Get node background color
101
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
86
102
  * @param category - The node category
87
103
  * @param isError - Whether the node is in error state
88
104
  * @param isProcessing - Whether the node is processing
89
105
  * @param isSelected - Whether the node is selected
90
106
  * @returns The background color
91
107
  */
92
- export declare function getNodeBackground(category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
108
+ export declare function getNodeBackground(categories: CategoriesStore, category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
93
109
  /**
94
110
  * Get node accent color
111
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
95
112
  * @param category - The node category
96
113
  * @param isError - Whether the node is in error state
97
114
  * @param isProcessing - Whether the node is processing
98
115
  * @param isSelected - Whether the node is selected
99
116
  * @returns The accent color
100
117
  */
101
- export declare function getNodeAccent(category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
118
+ export declare function getNodeAccent(categories: CategoriesStore, category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
102
119
  /**
103
120
  * Get node text color
121
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
104
122
  * @param category - The node category
105
123
  * @param isError - Whether the node is in error state
106
124
  * @param isProcessing - Whether the node is processing
107
125
  * @param isSelected - Whether the node is selected
108
126
  * @returns The text color
109
127
  */
110
- export declare function getNodeText(category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
128
+ export declare function getNodeText(categories: CategoriesStore, category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
111
129
  /**
112
130
  * Get node border color
131
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
113
132
  * @param category - The node category
114
133
  * @param isError - Whether the node is in error state
115
134
  * @param isProcessing - Whether the node is processing
116
135
  * @param isSelected - Whether the node is selected
117
136
  * @returns The border color
118
137
  */
119
- export declare function getNodeBorder(category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
138
+ export declare function getNodeBorder(categories: CategoriesStore, category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
120
139
  /**
121
140
  * Get data type color
141
+ * @param checker - The instance's port compatibility checker
122
142
  * @param dataType - The data type
123
143
  * @returns The color for the data type
124
144
  */
125
- export declare function getDataTypeColor(dataType: string): string;
145
+ export declare function getDataTypeColor(checker: PortCompatibilityChecker, dataType: string): string;
126
146
  /**
127
147
  * Parse typed array notation and get display information
148
+ * @param checker - The instance's port compatibility checker
128
149
  * @param dataType - The data type (e.g., "string[]", "number", "object[]")
129
150
  * @returns Object with display information
130
151
  */
131
- export declare function parseDataTypeDisplay(dataType: string): {
152
+ export declare function parseDataTypeDisplay(checker: PortCompatibilityChecker, dataType: string): {
132
153
  baseType: string;
133
154
  isArray: boolean;
134
155
  displayName: string;
@@ -136,10 +157,11 @@ export declare function parseDataTypeDisplay(dataType: string): {
136
157
  };
137
158
  /**
138
159
  * Get formatted display text for a data type
160
+ * @param checker - The instance's port compatibility checker
139
161
  * @param dataType - The data type
140
162
  * @returns Formatted display text
141
163
  */
142
- export declare function getDataTypeDisplayText(dataType: string): string;
164
+ export declare function getDataTypeDisplayText(checker: PortCompatibilityChecker, dataType: string): string;
143
165
  /**
144
166
  * Check if a data type represents an array
145
167
  * @param dataType - The data type
@@ -191,30 +213,34 @@ export declare function getContrastTextColor(backgroundColor: string): string;
191
213
  export declare function resolveColorToken(token: string): string;
192
214
  /**
193
215
  * Get the appropriate contrast text color for a data type badge
216
+ * @param checker - The instance's port compatibility checker
194
217
  * @param dataType - The data type (e.g., "array", "string", "number")
195
218
  * @returns CSS color value for text that provides good contrast on the data type's background
196
219
  */
197
- export declare function getContrastTextColorForDataType(dataType: string): string;
220
+ export declare function getContrastTextColorForDataType(checker: PortCompatibilityChecker, dataType: string): string;
198
221
  /**
199
222
  * Get the appropriate contrast text color for a category badge
223
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
200
224
  * @param category - The node category
201
225
  * @returns CSS color value for text that provides good contrast on the category's background
202
226
  */
203
- export declare function getContrastTextColorForCategory(category: NodeCategory): string;
227
+ export declare function getContrastTextColorForCategory(categories: CategoriesStore, category: NodeCategory): string;
204
228
  /**
205
229
  * Get a semi-transparent tinted background color for ports
206
230
  * Creates a cohesive look with the icon wrapper styling
231
+ * @param checker - The instance's port compatibility checker
207
232
  * @param dataType - The data type
208
233
  * @param opacity - Opacity percentage (default 25%)
209
234
  * @returns CSS color-mix expression for the tinted background
210
235
  */
211
- export declare function getPortBackgroundColor(dataType: string, opacity?: number): string;
236
+ export declare function getPortBackgroundColor(checker: PortCompatibilityChecker, dataType: string, opacity?: number): string;
212
237
  /**
213
238
  * Get the border color for ports (solid data type color)
239
+ * @param checker - The instance's port compatibility checker
214
240
  * @param dataType - The data type
215
241
  * @returns CSS color value for the port border
216
242
  */
217
- export declare function getPortBorderColor(dataType: string): string;
243
+ export declare function getPortBorderColor(checker: PortCompatibilityChecker, dataType: string): string;
218
244
  /**
219
245
  * Convert RGB components to hex color string
220
246
  * @param r - Red component (0-255)
@@ -3,9 +3,6 @@
3
3
  * Ensures consistent category colors across sidebar and canvas
4
4
  * Uses BEM syntax for CSS classes
5
5
  */
6
- import { getPortCompatibilityChecker } from './connections.js';
7
- import { getCategoryColor as getCategoryColorFromStore } from '../stores/categoriesStore.svelte.js';
8
- import { logger } from './logger.js';
9
6
  /**
10
7
  * Category color mapping to design tokens (CSS variables)
11
8
  * Uses --fd-node-* tokens from tokens.css
@@ -67,51 +64,38 @@ const DEFAULT_DATA_TYPE_COLORS = {
67
64
  * Get the design token for a category color.
68
65
  * Checks the categories store first (which includes API overrides),
69
66
  * then falls back to the static CATEGORY_COLOR_TOKENS map, then to slate.
67
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
68
+ * @param category - The node category
70
69
  */
71
- export function getCategoryColorToken(category) {
72
- return getCategoryColorFromStore(category);
70
+ export function getCategoryColorToken(categories, category) {
71
+ return categories.getColor(category);
73
72
  }
74
73
  /**
75
74
  * Get the reference color token for a data type (configurable version)
75
+ * @param checker - The instance's port compatibility checker (provides data-type config)
76
+ * @param dataType - The data type
76
77
  */
77
- export function getDataTypeColorToken(dataType) {
78
- try {
79
- const checker = getPortCompatibilityChecker();
80
- const config = checker.getDataTypeConfig(dataType);
81
- if (config?.color) {
82
- return config.color;
83
- }
84
- }
85
- catch {
86
- // Fallback to static color mapping if port checker not initialized
78
+ export function getDataTypeColorToken(checker, dataType) {
79
+ const config = checker.getDataTypeConfig(dataType);
80
+ if (config?.color) {
81
+ return config.color;
87
82
  }
88
83
  return DEFAULT_DATA_TYPE_COLORS[dataType.toLowerCase()] || 'var(--fd-node-slate)';
89
84
  }
90
85
  /**
91
86
  * Get data type configuration from port config
87
+ * @param checker - The instance's port compatibility checker
88
+ * @param dataType - The data type
92
89
  */
93
- export function getDataTypeConfig(dataType) {
94
- try {
95
- const checker = getPortCompatibilityChecker();
96
- return checker.getDataTypeConfig(dataType);
97
- }
98
- catch (error) {
99
- logger.warn('Port compatibility checker not initialized:', error);
100
- return undefined;
101
- }
90
+ export function getDataTypeConfig(checker, dataType) {
91
+ return checker.getDataTypeConfig(dataType);
102
92
  }
103
93
  /**
104
94
  * Get all available data types from port configuration
95
+ * @param checker - The instance's port compatibility checker
105
96
  */
106
- export function getAvailableDataTypes() {
107
- try {
108
- const checker = getPortCompatibilityChecker();
109
- return checker.getEnabledDataTypes();
110
- }
111
- catch (error) {
112
- logger.warn('Port compatibility checker not initialized:', error);
113
- return [];
114
- }
97
+ export function getAvailableDataTypes(checker) {
98
+ return checker.getEnabledDataTypes();
115
99
  }
116
100
  /**
117
101
  * Default colors for fallback cases
@@ -124,54 +108,60 @@ export const DEFAULT_COLORS = {
124
108
  };
125
109
  /**
126
110
  * Get category colors
111
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
127
112
  * @param category - The node category
128
113
  * @returns The color configuration for the category
129
114
  */
130
- export function getCategoryColors(category) {
131
- return getCategoryColorFromStore(category);
115
+ export function getCategoryColors(categories, category) {
116
+ return categories.getColor(category);
132
117
  }
133
118
  /**
134
119
  * Get category background color
120
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
135
121
  * @param category - The node category
136
122
  * @returns The background color class
137
123
  */
138
- export function getCategoryBackground(category) {
139
- return getCategoryColors(category);
124
+ export function getCategoryBackground(categories, category) {
125
+ return getCategoryColors(categories, category);
140
126
  }
141
127
  /**
142
128
  * Get category accent color
129
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
143
130
  * @param category - The node category
144
131
  * @returns The accent color class
145
132
  */
146
- export function getCategoryAccent(category) {
147
- return getCategoryColors(category);
133
+ export function getCategoryAccent(categories, category) {
134
+ return getCategoryColors(categories, category);
148
135
  }
149
136
  /**
150
137
  * Get category text color
138
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
151
139
  * @param category - The node category
152
140
  * @returns The text color class
153
141
  */
154
- export function getCategoryText(category) {
155
- return getCategoryColors(category);
142
+ export function getCategoryText(categories, category) {
143
+ return getCategoryColors(categories, category);
156
144
  }
157
145
  /**
158
146
  * Get category border color
147
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
159
148
  * @param category - The node category
160
149
  * @returns The border color class
161
150
  */
162
- export function getCategoryBorder(category) {
163
- return getCategoryColors(category);
151
+ export function getCategoryBorder(categories, category) {
152
+ return getCategoryColors(categories, category);
164
153
  }
165
154
  /**
166
155
  * Get node colors based on category and state
156
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
167
157
  * @param category - The node category
168
158
  * @param isError - Whether the node is in error state
169
159
  * @param isProcessing - Whether the node is processing
170
160
  * @param isSelected - Whether the node is selected
171
161
  * @returns The color configuration object
172
162
  */
173
- export function getNodeColors(category, isError = false, isProcessing = false, isSelected = false) {
174
- const baseColor = getCategoryColors(category);
163
+ export function getNodeColors(categories, category, isError = false, isProcessing = false, isSelected = false) {
164
+ const baseColor = getCategoryColors(categories, category);
175
165
  if (isError) {
176
166
  return {
177
167
  background: 'var(--fd-error-muted)',
@@ -205,67 +195,73 @@ export function getNodeColors(category, isError = false, isProcessing = false, i
205
195
  }
206
196
  /**
207
197
  * Get node background color
198
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
208
199
  * @param category - The node category
209
200
  * @param isError - Whether the node is in error state
210
201
  * @param isProcessing - Whether the node is processing
211
202
  * @param isSelected - Whether the node is selected
212
203
  * @returns The background color
213
204
  */
214
- export function getNodeBackground(category, isError = false, isProcessing = false, isSelected = false) {
215
- return getNodeColors(category, isError, isProcessing, isSelected).background;
205
+ export function getNodeBackground(categories, category, isError = false, isProcessing = false, isSelected = false) {
206
+ return getNodeColors(categories, category, isError, isProcessing, isSelected).background;
216
207
  }
217
208
  /**
218
209
  * Get node accent color
210
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
219
211
  * @param category - The node category
220
212
  * @param isError - Whether the node is in error state
221
213
  * @param isProcessing - Whether the node is processing
222
214
  * @param isSelected - Whether the node is selected
223
215
  * @returns The accent color
224
216
  */
225
- export function getNodeAccent(category, isError = false, isProcessing = false, isSelected = false) {
226
- return getNodeColors(category, isError, isProcessing, isSelected).accent;
217
+ export function getNodeAccent(categories, category, isError = false, isProcessing = false, isSelected = false) {
218
+ return getNodeColors(categories, category, isError, isProcessing, isSelected).accent;
227
219
  }
228
220
  /**
229
221
  * Get node text color
222
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
230
223
  * @param category - The node category
231
224
  * @param isError - Whether the node is in error state
232
225
  * @param isProcessing - Whether the node is processing
233
226
  * @param isSelected - Whether the node is selected
234
227
  * @returns The text color
235
228
  */
236
- export function getNodeText(category, isError = false, isProcessing = false, isSelected = false) {
237
- return getNodeColors(category, isError, isProcessing, isSelected).text;
229
+ export function getNodeText(categories, category, isError = false, isProcessing = false, isSelected = false) {
230
+ return getNodeColors(categories, category, isError, isProcessing, isSelected).text;
238
231
  }
239
232
  /**
240
233
  * Get node border color
234
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
241
235
  * @param category - The node category
242
236
  * @param isError - Whether the node is in error state
243
237
  * @param isProcessing - Whether the node is processing
244
238
  * @param isSelected - Whether the node is selected
245
239
  * @returns The border color
246
240
  */
247
- export function getNodeBorder(category, isError = false, isProcessing = false, isSelected = false) {
248
- return getNodeColors(category, isError, isProcessing, isSelected).border;
241
+ export function getNodeBorder(categories, category, isError = false, isProcessing = false, isSelected = false) {
242
+ return getNodeColors(categories, category, isError, isProcessing, isSelected).border;
249
243
  }
250
244
  /**
251
245
  * Get data type color
246
+ * @param checker - The instance's port compatibility checker
252
247
  * @param dataType - The data type
253
248
  * @returns The color for the data type
254
249
  */
255
- export function getDataTypeColor(dataType) {
256
- return getDataTypeColorToken(dataType);
250
+ export function getDataTypeColor(checker, dataType) {
251
+ return getDataTypeColorToken(checker, dataType);
257
252
  }
258
253
  /**
259
254
  * Parse typed array notation and get display information
255
+ * @param checker - The instance's port compatibility checker
260
256
  * @param dataType - The data type (e.g., "string[]", "number", "object[]")
261
257
  * @returns Object with display information
262
258
  */
263
- export function parseDataTypeDisplay(dataType) {
259
+ export function parseDataTypeDisplay(checker, dataType) {
264
260
  // Check if it's a typed array (ends with [])
265
261
  const isArray = dataType.endsWith('[]');
266
262
  if (isArray) {
267
263
  const elementType = dataType.slice(0, -2); // Remove []
268
- const config = getDataTypeConfig(dataType);
264
+ const config = getDataTypeConfig(checker, dataType);
269
265
  return {
270
266
  baseType: dataType,
271
267
  isArray: true,
@@ -274,7 +270,7 @@ export function parseDataTypeDisplay(dataType) {
274
270
  };
275
271
  }
276
272
  else {
277
- const config = getDataTypeConfig(dataType);
273
+ const config = getDataTypeConfig(checker, dataType);
278
274
  return {
279
275
  baseType: dataType,
280
276
  isArray: false,
@@ -284,11 +280,12 @@ export function parseDataTypeDisplay(dataType) {
284
280
  }
285
281
  /**
286
282
  * Get formatted display text for a data type
283
+ * @param checker - The instance's port compatibility checker
287
284
  * @param dataType - The data type
288
285
  * @returns Formatted display text
289
286
  */
290
- export function getDataTypeDisplayText(dataType) {
291
- const parsed = parseDataTypeDisplay(dataType);
287
+ export function getDataTypeDisplayText(checker, dataType) {
288
+ const parsed = parseDataTypeDisplay(checker, dataType);
292
289
  return parsed.displayName;
293
290
  }
294
291
  /**
@@ -391,42 +388,46 @@ export function resolveColorToken(token) {
391
388
  }
392
389
  /**
393
390
  * Get the appropriate contrast text color for a data type badge
391
+ * @param checker - The instance's port compatibility checker
394
392
  * @param dataType - The data type (e.g., "array", "string", "number")
395
393
  * @returns CSS color value for text that provides good contrast on the data type's background
396
394
  */
397
- export function getContrastTextColorForDataType(dataType) {
398
- const colorToken = getDataTypeColorToken(dataType);
395
+ export function getContrastTextColorForDataType(checker, dataType) {
396
+ const colorToken = getDataTypeColorToken(checker, dataType);
399
397
  const hexColor = resolveColorToken(colorToken);
400
398
  return getContrastTextColor(hexColor);
401
399
  }
402
400
  /**
403
401
  * Get the appropriate contrast text color for a category badge
402
+ * @param categories - The instance's categories store (e.g. `fd.categories`)
404
403
  * @param category - The node category
405
404
  * @returns CSS color value for text that provides good contrast on the category's background
406
405
  */
407
- export function getContrastTextColorForCategory(category) {
408
- const colorToken = getCategoryColorToken(category);
406
+ export function getContrastTextColorForCategory(categories, category) {
407
+ const colorToken = getCategoryColorToken(categories, category);
409
408
  const hexColor = resolveColorToken(colorToken);
410
409
  return getContrastTextColor(hexColor);
411
410
  }
412
411
  /**
413
412
  * Get a semi-transparent tinted background color for ports
414
413
  * Creates a cohesive look with the icon wrapper styling
414
+ * @param checker - The instance's port compatibility checker
415
415
  * @param dataType - The data type
416
416
  * @param opacity - Opacity percentage (default 25%)
417
417
  * @returns CSS color-mix expression for the tinted background
418
418
  */
419
- export function getPortBackgroundColor(dataType, opacity = 25) {
420
- const colorToken = getDataTypeColorToken(dataType);
419
+ export function getPortBackgroundColor(checker, dataType, opacity = 25) {
420
+ const colorToken = getDataTypeColorToken(checker, dataType);
421
421
  return `color-mix(in srgb, ${colorToken} ${opacity}%, transparent)`;
422
422
  }
423
423
  /**
424
424
  * Get the border color for ports (solid data type color)
425
+ * @param checker - The instance's port compatibility checker
425
426
  * @param dataType - The data type
426
427
  * @returns CSS color value for the port border
427
428
  */
428
- export function getPortBorderColor(dataType) {
429
- return getDataTypeColorToken(dataType);
429
+ export function getPortBorderColor(checker, dataType) {
430
+ return getDataTypeColorToken(checker, dataType);
430
431
  }
431
432
  /**
432
433
  * Convert RGB components to hex color string
@@ -32,6 +32,12 @@ export declare class PortCompatibilityChecker {
32
32
  private portConfig;
33
33
  private compatibilityMap;
34
34
  constructor(portConfig: PortConfig);
35
+ /**
36
+ * Replace the port configuration and rebuild the compatibility map in place.
37
+ * Used by mount to apply the backend-fetched port config to an instance's
38
+ * checker without swapping the instance field.
39
+ */
40
+ reinitialize(portConfig: PortConfig): void;
35
41
  /**
36
42
  * Build the compatibility map from configuration rules
37
43
  */
@@ -53,22 +59,10 @@ export declare class PortCompatibilityChecker {
53
59
  */
54
60
  getEnabledDataTypes(): PortDataTypeConfig[];
55
61
  }
56
- /**
57
- * Initialize the global port compatibility checker
58
- */
59
- export declare function initializePortCompatibility(portConfig: PortConfig): void;
60
- /**
61
- * Returns true if the port compatibility checker has been initialized.
62
- */
63
- export declare function isPortCompatibilityInitialized(): boolean;
64
- /**
65
- * Get the global port compatibility checker
66
- */
67
- export declare function getPortCompatibilityChecker(): PortCompatibilityChecker;
68
62
  /**
69
63
  * Get all possible connections from a source node to target nodes
70
64
  */
71
- export declare function getPossibleConnections(sourceNode: WorkflowNode, targetNodes: WorkflowNode[], nodeTypes: NodeMetadata[]): Array<{
65
+ export declare function getPossibleConnections(checker: PortCompatibilityChecker, sourceNode: WorkflowNode, targetNodes: WorkflowNode[], nodeTypes: NodeMetadata[]): Array<{
72
66
  sourceNodeId: string;
73
67
  sourcePortId: string;
74
68
  sourcePort: NodePort;
@@ -80,14 +74,14 @@ export declare function getPossibleConnections(sourceNode: WorkflowNode, targetN
80
74
  /**
81
75
  * Validate if a specific connection is valid
82
76
  */
83
- export declare function validateConnection(sourceNodeId: string, sourcePortId: string, targetNodeId: string, targetPortId: string, nodes: WorkflowNode[], nodeTypes: NodeMetadata[]): {
77
+ export declare function validateConnection(checker: PortCompatibilityChecker, sourceNodeId: string, sourcePortId: string, targetNodeId: string, targetPortId: string, nodes: WorkflowNode[], nodeTypes: NodeMetadata[]): {
84
78
  valid: boolean;
85
79
  error?: string;
86
80
  };
87
81
  /**
88
82
  * Get connection suggestions for a node
89
83
  */
90
- export declare function getConnectionSuggestions(nodeId: string, nodes: WorkflowNode[], nodeTypes: NodeMetadata[]): Array<{
84
+ export declare function getConnectionSuggestions(checker: PortCompatibilityChecker, nodeId: string, nodes: WorkflowNode[], nodeTypes: NodeMetadata[]): Array<{
91
85
  nodeId: string;
92
86
  nodeName: string;
93
87
  portId: string;