@d34dman/flowdrop 0.0.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 (46) hide show
  1. package/README.md +293 -0
  2. package/dist/adapters/WorkflowAdapter.d.ts +166 -0
  3. package/dist/adapters/WorkflowAdapter.js +337 -0
  4. package/dist/api/client.d.ts +79 -0
  5. package/dist/api/client.js +208 -0
  6. package/dist/app.css +0 -0
  7. package/dist/clients/ApiClient.d.ts +203 -0
  8. package/dist/clients/ApiClient.js +212 -0
  9. package/dist/components/App.svelte +237 -0
  10. package/dist/components/App.svelte.d.ts +3 -0
  11. package/dist/components/CanvasBanner.svelte +51 -0
  12. package/dist/components/CanvasBanner.svelte.d.ts +22 -0
  13. package/dist/components/LoadingSpinner.svelte +36 -0
  14. package/dist/components/LoadingSpinner.svelte.d.ts +8 -0
  15. package/dist/components/Node.svelte +38 -0
  16. package/dist/components/Node.svelte.d.ts +4 -0
  17. package/dist/components/NodeSidebar.svelte +500 -0
  18. package/dist/components/NodeSidebar.svelte.d.ts +9 -0
  19. package/dist/components/WorkflowEditor.svelte +542 -0
  20. package/dist/components/WorkflowEditor.svelte.d.ts +10 -0
  21. package/dist/components/WorkflowNode.svelte +558 -0
  22. package/dist/components/WorkflowNode.svelte.d.ts +11 -0
  23. package/dist/data/samples.d.ts +17 -0
  24. package/dist/data/samples.js +1193 -0
  25. package/dist/examples/adapter-usage.d.ts +66 -0
  26. package/dist/examples/adapter-usage.js +138 -0
  27. package/dist/examples/api-client-usage.d.ts +31 -0
  28. package/dist/examples/api-client-usage.js +241 -0
  29. package/dist/index.d.ts +19 -0
  30. package/dist/index.js +27 -0
  31. package/dist/services/api.d.ts +110 -0
  32. package/dist/services/api.js +149 -0
  33. package/dist/services/workflowStorage.d.ts +37 -0
  34. package/dist/services/workflowStorage.js +116 -0
  35. package/dist/styles/base.css +858 -0
  36. package/dist/svelte-app.d.ts +17 -0
  37. package/dist/svelte-app.js +30 -0
  38. package/dist/types/index.d.ts +179 -0
  39. package/dist/types/index.js +4 -0
  40. package/dist/utils/colors.d.ts +121 -0
  41. package/dist/utils/colors.js +240 -0
  42. package/dist/utils/connections.d.ts +47 -0
  43. package/dist/utils/connections.js +240 -0
  44. package/dist/utils/icons.d.ts +102 -0
  45. package/dist/utils/icons.js +149 -0
  46. package/package.json +99 -0
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Svelte App Wrapper for Drupal Integration
3
+ * This provides a way to mount Svelte components in Drupal
4
+ */
5
+ import type { Workflow, NodeMetadata } from './types/index.js';
6
+ /**
7
+ * Mount the WorkflowEditor component in a Drupal container
8
+ */
9
+ export declare function mountWorkflowEditor(container: HTMLElement, options?: {
10
+ workflow?: Workflow;
11
+ nodes?: NodeMetadata[];
12
+ apiBaseUrl?: string;
13
+ }): any;
14
+ /**
15
+ * Unmount a Svelte app
16
+ */
17
+ export declare function unmountWorkflowEditor(app: any): void;
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Svelte App Wrapper for Drupal Integration
3
+ * This provides a way to mount Svelte components in Drupal
4
+ */
5
+ import { mount } from 'svelte';
6
+ import WorkflowEditor from './components/WorkflowEditor.svelte';
7
+ /**
8
+ * Mount the WorkflowEditor component in a Drupal container
9
+ */
10
+ export function mountWorkflowEditor(container, options = {}) {
11
+ const { workflow, nodes = [], apiBaseUrl } = options;
12
+ // Create the Svelte component
13
+ const app = mount(WorkflowEditor, {
14
+ target: container,
15
+ props: {
16
+ workflow,
17
+ nodes,
18
+ apiBaseUrl
19
+ }
20
+ });
21
+ return app;
22
+ }
23
+ /**
24
+ * Unmount a Svelte app
25
+ */
26
+ export function unmountWorkflowEditor(app) {
27
+ if (app && typeof app.destroy === 'function') {
28
+ app.destroy();
29
+ }
30
+ }
@@ -0,0 +1,179 @@
1
+ /**
2
+ * Core types for the Workflow Library
3
+ */
4
+ import type { Node, Edge, XYPosition } from "@xyflow/svelte";
5
+ import { ConnectionLineType } from "@xyflow/svelte";
6
+ /**
7
+ * Node category types for organizing nodes in the sidebar
8
+ * Based on Langflow's actual categories
9
+ */
10
+ export type NodeCategory = "inputs" | "outputs" | "prompts" | "models" | "processing" | "logic" | "data" | "helpers" | "tools" | "vector stores" | "embeddings" | "memories" | "agents" | "bundles";
11
+ /**
12
+ * Node input/output types
13
+ */
14
+ export type NodeDataType = "string" | "text" | "number" | "integer" | "float" | "boolean" | "array" | "list" | "object" | "json" | "file" | "document" | "image" | "picture" | "audio" | "sound" | "video" | "movie" | "url" | "email" | "date" | "datetime" | "time";
15
+ /**
16
+ * Node port configuration
17
+ */
18
+ export interface NodePort {
19
+ id: string;
20
+ name: string;
21
+ type: "input" | "output";
22
+ dataType: NodeDataType;
23
+ required?: boolean;
24
+ description?: string;
25
+ defaultValue?: unknown;
26
+ }
27
+ /**
28
+ * Node configuration metadata
29
+ */
30
+ export interface NodeMetadata {
31
+ id: string;
32
+ name: string;
33
+ description: string;
34
+ category: NodeCategory;
35
+ version: string;
36
+ icon?: string;
37
+ color?: string;
38
+ inputs: NodePort[];
39
+ outputs: NodePort[];
40
+ configSchema?: Record<string, unknown>;
41
+ tags?: string[];
42
+ }
43
+ /**
44
+ * Node configuration data
45
+ */
46
+ export interface NodeConfig {
47
+ [key: string]: unknown;
48
+ }
49
+ /**
50
+ * Extended node type for workflows
51
+ */
52
+ export interface WorkflowNode extends Node {
53
+ id: string;
54
+ type: string;
55
+ position: XYPosition;
56
+ deletable?: boolean;
57
+ data: {
58
+ label: string;
59
+ config: NodeConfig;
60
+ metadata: NodeMetadata;
61
+ isProcessing?: boolean;
62
+ error?: string;
63
+ nodeId?: string;
64
+ };
65
+ }
66
+ /**
67
+ * Extended edge type for workflows
68
+ */
69
+ export interface WorkflowEdge extends Edge {
70
+ id: string;
71
+ source: string;
72
+ target: string;
73
+ sourceHandle?: string;
74
+ targetHandle?: string;
75
+ type?: ConnectionLineType;
76
+ selectable?: boolean;
77
+ deletable?: boolean;
78
+ data?: {
79
+ label?: string;
80
+ condition?: string;
81
+ };
82
+ }
83
+ /**
84
+ * Complete workflow definition
85
+ */
86
+ export interface Workflow {
87
+ id: string;
88
+ name: string;
89
+ description?: string;
90
+ nodes: WorkflowNode[];
91
+ edges: WorkflowEdge[];
92
+ metadata?: {
93
+ version: string;
94
+ createdAt: string;
95
+ updatedAt: string;
96
+ author?: string;
97
+ tags?: string[];
98
+ };
99
+ }
100
+ /**
101
+ * API response types
102
+ */
103
+ export interface ApiResponse<T> {
104
+ success: boolean;
105
+ data?: T;
106
+ error?: string;
107
+ message?: string;
108
+ }
109
+ export interface NodesResponse extends ApiResponse<NodeMetadata[]> {
110
+ }
111
+ export interface WorkflowResponse extends ApiResponse<Workflow> {
112
+ }
113
+ export interface WorkflowsResponse extends ApiResponse<Workflow[]> {
114
+ }
115
+ /**
116
+ * Workflow execution status
117
+ */
118
+ export type ExecutionStatus = "idle" | "running" | "completed" | "failed" | "cancelled";
119
+ /**
120
+ * Workflow execution result
121
+ */
122
+ export interface ExecutionResult {
123
+ id: string;
124
+ workflowId: string;
125
+ status: ExecutionStatus;
126
+ startTime: string;
127
+ endTime?: string;
128
+ results?: Record<string, unknown>;
129
+ error?: string;
130
+ logs?: string[];
131
+ }
132
+ /**
133
+ * Library configuration
134
+ */
135
+ export interface FlowDropConfig {
136
+ apiBaseUrl: string;
137
+ theme?: "light" | "dark" | "auto";
138
+ enableDebug?: boolean;
139
+ autoSave?: boolean;
140
+ autoSaveInterval?: number;
141
+ maxUndoSteps?: number;
142
+ nodeSpacing?: number;
143
+ gridSize?: number;
144
+ }
145
+ /**
146
+ * Event types for the workflow editor
147
+ */
148
+ export interface WorkflowEvents {
149
+ nodeAdded: {
150
+ node: WorkflowNode;
151
+ };
152
+ nodeRemoved: {
153
+ nodeId: string;
154
+ };
155
+ nodeUpdated: {
156
+ node: WorkflowNode;
157
+ };
158
+ edgeAdded: {
159
+ edge: WorkflowEdge;
160
+ };
161
+ edgeRemoved: {
162
+ edgeId: string;
163
+ };
164
+ workflowSaved: {
165
+ workflow: Workflow;
166
+ };
167
+ workflowLoaded: {
168
+ workflow: Workflow;
169
+ };
170
+ executionStarted: {
171
+ workflowId: string;
172
+ };
173
+ executionCompleted: {
174
+ result: ExecutionResult;
175
+ };
176
+ executionFailed: {
177
+ error: string;
178
+ };
179
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Core types for the Workflow Library
3
+ */
4
+ import { ConnectionLineType } from "@xyflow/svelte";
@@ -0,0 +1,121 @@
1
+ /**
2
+ * Centralized color management for FlowDrop
3
+ * Ensures consistent category colors across sidebar and canvas
4
+ * Uses BEM syntax for CSS classes
5
+ */
6
+ import type { NodeCategory } from "../types/index.js";
7
+ /**
8
+ * Color configuration type for consistent color objects
9
+ */
10
+ export interface ColorConfig {
11
+ background: string;
12
+ accent: string;
13
+ text: string;
14
+ border: string;
15
+ }
16
+ /**
17
+ * Category color mapping to reference tokens (CSS variables)
18
+ */
19
+ export declare const CATEGORY_COLOR_TOKENS: Record<NodeCategory, string>;
20
+ /**
21
+ * Data type color mapping to reference tokens (CSS variables)
22
+ */
23
+ export declare const DATA_TYPE_COLOR_TOKENS: Record<string, string>;
24
+ /**
25
+ * Get the reference color token for a category
26
+ */
27
+ export declare function getCategoryColorToken(category: NodeCategory): string;
28
+ /**
29
+ * Get the reference color token for a data type
30
+ */
31
+ export declare function getDataTypeColorToken(dataType: string): string;
32
+ /**
33
+ * Default colors for fallback cases
34
+ */
35
+ export declare const DEFAULT_COLORS: ColorConfig;
36
+ /**
37
+ * Get category colors
38
+ * @param category - The node category
39
+ * @returns The color configuration for the category
40
+ */
41
+ export declare function getCategoryColors(category: NodeCategory): ColorConfig;
42
+ /**
43
+ * Get category background color
44
+ * @param category - The node category
45
+ * @returns The background color class
46
+ */
47
+ export declare function getCategoryBackground(category: NodeCategory): string;
48
+ /**
49
+ * Get category accent color (for icons, highlights)
50
+ * @param category - The node category
51
+ * @returns The accent color class
52
+ */
53
+ export declare function getCategoryAccent(category: NodeCategory): string;
54
+ /**
55
+ * Get category text color
56
+ * @param category - The node category
57
+ * @returns The text color class
58
+ */
59
+ export declare function getCategoryText(category: NodeCategory): string;
60
+ /**
61
+ * Get category border color
62
+ * @param category - The node category
63
+ * @returns The border color class
64
+ */
65
+ export declare function getCategoryBorder(category: NodeCategory): string;
66
+ /**
67
+ * Get node colors based on category and status
68
+ * @param category - The node category
69
+ * @param isError - Whether the node has an error
70
+ * @param isProcessing - Whether the node is processing
71
+ * @param isSelected - Whether the node is selected
72
+ * @returns The color configuration for the node
73
+ */
74
+ export declare function getNodeColors(category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): ColorConfig;
75
+ /**
76
+ * Get node background color
77
+ * @param category - The node category
78
+ * @param isError - Whether the node has an error
79
+ * @param isProcessing - Whether the node is processing
80
+ * @param isSelected - Whether the node is selected
81
+ * @returns The background color class
82
+ */
83
+ export declare function getNodeBackground(category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
84
+ /**
85
+ * Get node accent color
86
+ * @param category - The node category
87
+ * @param isError - Whether the node has an error
88
+ * @param isProcessing - Whether the node is processing
89
+ * @param isSelected - Whether the node is selected
90
+ * @returns The accent color class
91
+ */
92
+ export declare function getNodeAccent(category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
93
+ /**
94
+ * Get node text color
95
+ * @param category - The node category
96
+ * @param isError - Whether the node has an error
97
+ * @param isProcessing - Whether the node is processing
98
+ * @param isSelected - Whether the node is selected
99
+ * @returns The text color class
100
+ */
101
+ export declare function getNodeText(category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
102
+ /**
103
+ * Get node border color
104
+ * @param category - The node category
105
+ * @param isError - Whether the node has an error
106
+ * @param isProcessing - Whether the node is processing
107
+ * @param isSelected - Whether the node is selected
108
+ * @returns The border color class
109
+ */
110
+ export declare function getNodeBorder(category: NodeCategory, isError?: boolean, isProcessing?: boolean, isSelected?: boolean): string;
111
+ /**
112
+ * Data type color mapping for ports (used in WorkflowNode, etc.)
113
+ * These use BEM color classes for consistency
114
+ */
115
+ export declare const dataTypeColors: Record<string, string>;
116
+ /**
117
+ * Get data type color class
118
+ * @param dataType - The data type string
119
+ * @returns The color class for the data type
120
+ */
121
+ export declare function getDataTypeColor(dataType: string): string;
@@ -0,0 +1,240 @@
1
+ /**
2
+ * Centralized color management for FlowDrop
3
+ * Ensures consistent category colors across sidebar and canvas
4
+ * Uses BEM syntax for CSS classes
5
+ */
6
+ /**
7
+ * Category color mapping to reference tokens (CSS variables)
8
+ */
9
+ export const CATEGORY_COLOR_TOKENS = {
10
+ "inputs": "var(--color-ref-emerald-500)",
11
+ "outputs": "var(--color-ref-blue-600)",
12
+ "prompts": "var(--color-ref-amber-500)",
13
+ "models": "var(--color-ref-indigo-500)",
14
+ "processing": "var(--color-ref-teal-500)",
15
+ "logic": "var(--color-ref-purple-600)",
16
+ "data": "var(--color-ref-orange-500)",
17
+ "helpers": "var(--color-ref-slate-500)",
18
+ "tools": "var(--color-ref-amber-500)",
19
+ "vector stores": "var(--color-ref-emerald-500)",
20
+ "embeddings": "var(--color-ref-indigo-500)",
21
+ "memories": "var(--color-ref-blue-600)",
22
+ "agents": "var(--color-ref-teal-500)",
23
+ "bundles": "var(--color-ref-slate-500)"
24
+ };
25
+ /**
26
+ * Data type color mapping to reference tokens (CSS variables)
27
+ */
28
+ export const DATA_TYPE_COLOR_TOKENS = {
29
+ string: "var(--color-ref-emerald-500)",
30
+ text: "var(--color-ref-emerald-500)",
31
+ number: "var(--color-ref-blue-600)",
32
+ integer: "var(--color-ref-blue-600)",
33
+ float: "var(--color-ref-blue-600)",
34
+ boolean: "var(--color-ref-purple-600)",
35
+ array: "var(--color-ref-amber-500)",
36
+ list: "var(--color-ref-amber-500)",
37
+ object: "var(--color-ref-orange-500)",
38
+ json: "var(--color-ref-orange-500)",
39
+ file: "var(--color-ref-red-500)",
40
+ document: "var(--color-ref-red-500)",
41
+ image: "var(--color-ref-pink-500)",
42
+ picture: "var(--color-ref-pink-500)",
43
+ audio: "var(--color-ref-indigo-500)",
44
+ sound: "var(--color-ref-indigo-500)",
45
+ video: "var(--color-ref-teal-500)",
46
+ movie: "var(--color-ref-teal-500)",
47
+ url: "var(--color-ref-cyan-500)",
48
+ email: "var(--color-ref-cyan-500)",
49
+ date: "var(--color-ref-lime-500)",
50
+ datetime: "var(--color-ref-lime-500)",
51
+ time: "var(--color-ref-lime-500)"
52
+ };
53
+ /**
54
+ * Get the reference color token for a category
55
+ */
56
+ export function getCategoryColorToken(category) {
57
+ return CATEGORY_COLOR_TOKENS[category] || "var(--color-ref-slate-500)";
58
+ }
59
+ /**
60
+ * Get the reference color token for a data type
61
+ */
62
+ export function getDataTypeColorToken(dataType) {
63
+ return DATA_TYPE_COLOR_TOKENS[dataType.toLowerCase()] || "var(--color-ref-slate-500)";
64
+ }
65
+ /**
66
+ * Default colors for fallback cases
67
+ */
68
+ export const DEFAULT_COLORS = {
69
+ background: "flowdrop-color--base-light",
70
+ accent: "flowdrop-color--neutral",
71
+ text: "flowdrop-color--base-text",
72
+ border: "flowdrop-color--base-border"
73
+ };
74
+ /**
75
+ * Get category colors
76
+ * @param category - The node category
77
+ * @returns The color configuration for the category
78
+ */
79
+ export function getCategoryColors(category) {
80
+ const colorToken = CATEGORY_COLOR_TOKENS[category];
81
+ if (colorToken) {
82
+ // Convert color token to BEM color class
83
+ const colorName = colorToken.replace("var(--color-ref-", "").replace(")", "");
84
+ return {
85
+ background: `flowdrop-color--${colorName.split("-")[0]}-light`,
86
+ accent: `flowdrop-color--${colorName.split("-")[0]}`,
87
+ text: `flowdrop-color--${colorName.split("-")[0]}-text`,
88
+ border: `flowdrop-color--${colorName.split("-")[0]}-border`
89
+ };
90
+ }
91
+ return DEFAULT_COLORS;
92
+ }
93
+ /**
94
+ * Get category background color
95
+ * @param category - The node category
96
+ * @returns The background color class
97
+ */
98
+ export function getCategoryBackground(category) {
99
+ return getCategoryColors(category).background;
100
+ }
101
+ /**
102
+ * Get category accent color (for icons, highlights)
103
+ * @param category - The node category
104
+ * @returns The accent color class
105
+ */
106
+ export function getCategoryAccent(category) {
107
+ return getCategoryColors(category).accent;
108
+ }
109
+ /**
110
+ * Get category text color
111
+ * @param category - The node category
112
+ * @returns The text color class
113
+ */
114
+ export function getCategoryText(category) {
115
+ return getCategoryColors(category).text;
116
+ }
117
+ /**
118
+ * Get category border color
119
+ * @param category - The node category
120
+ * @returns The border color class
121
+ */
122
+ export function getCategoryBorder(category) {
123
+ return getCategoryColors(category).border;
124
+ }
125
+ /**
126
+ * Get node colors based on category and status
127
+ * @param category - The node category
128
+ * @param isError - Whether the node has an error
129
+ * @param isProcessing - Whether the node is processing
130
+ * @param isSelected - Whether the node is selected
131
+ * @returns The color configuration for the node
132
+ */
133
+ export function getNodeColors(category, isError = false, isProcessing = false, isSelected = false) {
134
+ if (isError) {
135
+ return {
136
+ background: "flowdrop-color--error-light",
137
+ accent: "flowdrop-color--error",
138
+ text: "flowdrop-color--error-text",
139
+ border: "flowdrop-color--error-border"
140
+ };
141
+ }
142
+ if (isProcessing) {
143
+ return {
144
+ background: "flowdrop-color--warning-light",
145
+ accent: "flowdrop-color--warning",
146
+ text: "flowdrop-color--warning-text",
147
+ border: "flowdrop-color--warning-border"
148
+ };
149
+ }
150
+ if (isSelected) {
151
+ return {
152
+ background: "flowdrop-color--primary-light",
153
+ accent: "flowdrop-color--primary",
154
+ text: "flowdrop-color--primary-text",
155
+ border: "flowdrop-color--primary-border"
156
+ };
157
+ }
158
+ return getCategoryColors(category);
159
+ }
160
+ /**
161
+ * Get node background color
162
+ * @param category - The node category
163
+ * @param isError - Whether the node has an error
164
+ * @param isProcessing - Whether the node is processing
165
+ * @param isSelected - Whether the node is selected
166
+ * @returns The background color class
167
+ */
168
+ export function getNodeBackground(category, isError = false, isProcessing = false, isSelected = false) {
169
+ return getNodeColors(category, isError, isProcessing, isSelected).background;
170
+ }
171
+ /**
172
+ * Get node accent color
173
+ * @param category - The node category
174
+ * @param isError - Whether the node has an error
175
+ * @param isProcessing - Whether the node is processing
176
+ * @param isSelected - Whether the node is selected
177
+ * @returns The accent color class
178
+ */
179
+ export function getNodeAccent(category, isError = false, isProcessing = false, isSelected = false) {
180
+ return getNodeColors(category, isError, isProcessing, isSelected).accent;
181
+ }
182
+ /**
183
+ * Get node text color
184
+ * @param category - The node category
185
+ * @param isError - Whether the node has an error
186
+ * @param isProcessing - Whether the node is processing
187
+ * @param isSelected - Whether the node is selected
188
+ * @returns The text color class
189
+ */
190
+ export function getNodeText(category, isError = false, isProcessing = false, isSelected = false) {
191
+ return getNodeColors(category, isError, isProcessing, isSelected).text;
192
+ }
193
+ /**
194
+ * Get node border color
195
+ * @param category - The node category
196
+ * @param isError - Whether the node has an error
197
+ * @param isProcessing - Whether the node is processing
198
+ * @param isSelected - Whether the node is selected
199
+ * @returns The border color class
200
+ */
201
+ export function getNodeBorder(category, isError = false, isProcessing = false, isSelected = false) {
202
+ return getNodeColors(category, isError, isProcessing, isSelected).border;
203
+ }
204
+ /**
205
+ * Data type color mapping for ports (used in WorkflowNode, etc.)
206
+ * These use BEM color classes for consistency
207
+ */
208
+ export const dataTypeColors = {
209
+ string: "flowdrop-color--emerald",
210
+ text: "flowdrop-color--emerald",
211
+ number: "flowdrop-color--blue",
212
+ integer: "flowdrop-color--blue",
213
+ float: "flowdrop-color--blue",
214
+ boolean: "flowdrop-color--purple",
215
+ array: "flowdrop-color--amber",
216
+ list: "flowdrop-color--amber",
217
+ object: "flowdrop-color--orange",
218
+ json: "flowdrop-color--orange",
219
+ file: "flowdrop-color--red",
220
+ document: "flowdrop-color--red",
221
+ image: "flowdrop-color--pink",
222
+ picture: "flowdrop-color--pink",
223
+ audio: "flowdrop-color--indigo",
224
+ sound: "flowdrop-color--indigo",
225
+ video: "flowdrop-color--teal",
226
+ movie: "flowdrop-color--teal",
227
+ url: "flowdrop-color--cyan",
228
+ email: "flowdrop-color--cyan",
229
+ date: "flowdrop-color--lime",
230
+ datetime: "flowdrop-color--lime",
231
+ time: "flowdrop-color--lime"
232
+ };
233
+ /**
234
+ * Get data type color class
235
+ * @param dataType - The data type string
236
+ * @returns The color class for the data type
237
+ */
238
+ export function getDataTypeColor(dataType) {
239
+ return dataTypeColors[dataType.toLowerCase()] || "flowdrop-color--slate";
240
+ }
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Connection validation utilities for FlowDrop
3
+ */
4
+ import type { NodeMetadata, NodePort, NodeDataType, WorkflowNode, WorkflowEdge } from "../types/index.js";
5
+ /**
6
+ * Check if two data types are compatible for connection
7
+ */
8
+ export declare function areDataTypesCompatible(outputType: NodeDataType, inputType: NodeDataType): boolean;
9
+ /**
10
+ * Get all possible connections from a source node to target nodes
11
+ */
12
+ export declare function getPossibleConnections(sourceNode: WorkflowNode, targetNodes: WorkflowNode[], nodeTypes: NodeMetadata[]): Array<{
13
+ sourceNodeId: string;
14
+ sourcePortId: string;
15
+ sourcePort: NodePort;
16
+ targetNodeId: string;
17
+ targetPortId: string;
18
+ targetPort: NodePort;
19
+ compatible: boolean;
20
+ }>;
21
+ /**
22
+ * Validate if a specific connection is valid
23
+ */
24
+ export declare function validateConnection(sourceNodeId: string, sourcePortId: string, targetNodeId: string, targetPortId: string, nodes: WorkflowNode[], nodeTypes: NodeMetadata[]): {
25
+ valid: boolean;
26
+ error?: string;
27
+ };
28
+ /**
29
+ * Get connection suggestions for a node
30
+ */
31
+ export declare function getConnectionSuggestions(nodeId: string, nodes: WorkflowNode[], nodeTypes: NodeMetadata[]): Array<{
32
+ nodeId: string;
33
+ nodeName: string;
34
+ portId: string;
35
+ portName: string;
36
+ portType: "input" | "output";
37
+ dataType: NodeDataType;
38
+ compatible: boolean;
39
+ }>;
40
+ /**
41
+ * Check if a workflow has any cycles (prevent infinite loops)
42
+ */
43
+ export declare function hasCycles(nodes: WorkflowNode[], edges: WorkflowEdge[]): boolean;
44
+ /**
45
+ * Get the execution order for a workflow (topological sort)
46
+ */
47
+ export declare function getExecutionOrder(nodes: WorkflowNode[], edges: WorkflowEdge[]): string[];