@d34dman/flowdrop 0.0.22 → 0.0.24

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 (44) hide show
  1. package/dist/components/App.svelte +26 -25
  2. package/dist/components/ConfigForm.svelte +141 -520
  3. package/dist/components/ConfigForm.svelte.d.ts +5 -3
  4. package/dist/components/form/FormArray.svelte +1049 -0
  5. package/dist/components/form/FormArray.svelte.d.ts +22 -0
  6. package/dist/components/form/FormCheckboxGroup.svelte +152 -0
  7. package/dist/components/form/FormCheckboxGroup.svelte.d.ts +15 -0
  8. package/dist/components/form/FormField.svelte +297 -0
  9. package/dist/components/form/FormField.svelte.d.ts +18 -0
  10. package/dist/components/form/FormFieldWrapper.svelte +133 -0
  11. package/dist/components/form/FormFieldWrapper.svelte.d.ts +18 -0
  12. package/dist/components/form/FormNumberField.svelte +109 -0
  13. package/dist/components/form/FormNumberField.svelte.d.ts +23 -0
  14. package/dist/components/form/FormRangeField.svelte +252 -0
  15. package/dist/components/form/FormRangeField.svelte.d.ts +21 -0
  16. package/dist/components/form/FormSelect.svelte +126 -0
  17. package/dist/components/form/FormSelect.svelte.d.ts +18 -0
  18. package/dist/components/form/FormTextField.svelte +88 -0
  19. package/dist/components/form/FormTextField.svelte.d.ts +17 -0
  20. package/dist/components/form/FormTextarea.svelte +94 -0
  21. package/dist/components/form/FormTextarea.svelte.d.ts +19 -0
  22. package/dist/components/form/FormToggle.svelte +123 -0
  23. package/dist/components/form/FormToggle.svelte.d.ts +17 -0
  24. package/dist/components/form/index.d.ts +42 -0
  25. package/dist/components/form/index.js +46 -0
  26. package/dist/components/form/types.d.ts +224 -0
  27. package/dist/components/form/types.js +29 -0
  28. package/dist/components/nodes/GatewayNode.svelte +76 -16
  29. package/dist/components/nodes/SimpleNode.svelte +41 -5
  30. package/dist/components/nodes/SimpleNode.svelte.d.ts +2 -1
  31. package/dist/components/nodes/SquareNode.svelte +41 -5
  32. package/dist/components/nodes/SquareNode.svelte.d.ts +2 -1
  33. package/dist/components/nodes/WorkflowNode.svelte +88 -5
  34. package/dist/index.d.ts +2 -3
  35. package/dist/index.js +1 -3
  36. package/dist/stores/workflowStore.d.ts +15 -0
  37. package/dist/stores/workflowStore.js +28 -0
  38. package/dist/types/index.d.ts +176 -1
  39. package/dist/types/index.js +16 -0
  40. package/package.json +3 -3
  41. package/dist/config/demo.d.ts +0 -58
  42. package/dist/config/demo.js +0 -142
  43. package/dist/data/samples.d.ts +0 -51
  44. package/dist/data/samples.js +0 -3245
@@ -70,6 +70,61 @@ export interface NodePort {
70
70
  description?: string;
71
71
  defaultValue?: unknown;
72
72
  }
73
+ /**
74
+ * Dynamic port configuration for user-defined inputs/outputs
75
+ * These are defined in the node's config and allow users to create
76
+ * custom input/output handles at runtime similar to gateway branches
77
+ */
78
+ export interface DynamicPort {
79
+ /** Unique identifier for the port (used for handle IDs and connections) */
80
+ name: string;
81
+ /** Display label shown in the UI */
82
+ label: string;
83
+ /** Description of what this port accepts/provides */
84
+ description?: string;
85
+ /** Data type for the port (affects color and connection validation) */
86
+ dataType: NodeDataType;
87
+ /** Whether this port is required for execution */
88
+ required?: boolean;
89
+ }
90
+ /**
91
+ * Branch configuration for gateway nodes
92
+ *
93
+ * Branches define conditional output paths in gateway/switch nodes.
94
+ * Each branch creates an output handle that can be connected to downstream nodes.
95
+ * Branches are stored in `config.branches` array and support dynamic addition/removal
96
+ * through the node configuration panel.
97
+ *
98
+ * @example
99
+ * ```typescript
100
+ * const branches: Branch[] = [
101
+ * { name: "high", label: "High Priority", condition: "priority > 8" },
102
+ * { name: "medium", label: "Medium Priority", condition: "priority >= 4" },
103
+ * { name: "default", label: "Default", isDefault: true }
104
+ * ];
105
+ * ```
106
+ */
107
+ export interface Branch {
108
+ /** Unique identifier for the branch (used as handle ID and for connections) */
109
+ name: string;
110
+ /** Display label shown in the UI (optional, defaults to name) */
111
+ label?: string;
112
+ /** Description of when this branch is activated */
113
+ description?: string;
114
+ /** Optional value associated with the branch (e.g., for Switch matching) */
115
+ value?: string;
116
+ /** Optional condition expression for this branch */
117
+ condition?: string;
118
+ /** Whether this is the default/fallback branch */
119
+ isDefault?: boolean;
120
+ }
121
+ /**
122
+ * Convert a DynamicPort to a NodePort
123
+ * @param port - The dynamic port configuration
124
+ * @param portType - Whether this is an input or output port
125
+ * @returns A NodePort compatible with the rendering system
126
+ */
127
+ export declare function dynamicPortToNodePort(port: DynamicPort, portType: 'input' | 'output'): NodePort;
73
128
  /**
74
129
  * Built-in node types for explicit component rendering.
75
130
  * These are the node types that ship with FlowDrop.
@@ -92,6 +147,48 @@ export type BuiltinNodeType = 'note' | 'simple' | 'square' | 'tool' | 'gateway'
92
147
  * ```
93
148
  */
94
149
  export type NodeType = BuiltinNodeType | (string & Record<never, never>);
150
+ /**
151
+ * UI-related extension settings for nodes
152
+ * Used to control visual behavior in the workflow editor
153
+ */
154
+ export interface NodeUIExtensions {
155
+ /** Show/hide unconnected handles (ports) to reduce visual noise */
156
+ hideUnconnectedHandles?: boolean;
157
+ /** Custom styles or theme overrides */
158
+ style?: Record<string, unknown>;
159
+ /** Any other UI-specific settings */
160
+ [key: string]: unknown;
161
+ }
162
+ /**
163
+ * Custom extension properties for 3rd party integrations
164
+ * Allows storing additional configuration and UI state data
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * const extensions: NodeExtensions = {
169
+ * ui: {
170
+ * hideUnconnectedHandles: true,
171
+ * style: { opacity: 0.8 }
172
+ * },
173
+ * "myapp:analytics": {
174
+ * trackUsage: true,
175
+ * customField: "value"
176
+ * }
177
+ * };
178
+ * ```
179
+ */
180
+ export interface NodeExtensions {
181
+ /**
182
+ * UI-related settings for the node
183
+ * Used to control visual behavior in the workflow editor
184
+ */
185
+ ui?: NodeUIExtensions;
186
+ /**
187
+ * Namespaced extension data from 3rd party integrations
188
+ * Use your package/organization name as the key (e.g., "myapp", "acme:analyzer")
189
+ */
190
+ [namespace: string]: unknown;
191
+ }
95
192
  /**
96
193
  * Node configuration metadata
97
194
  */
@@ -114,7 +211,14 @@ export interface NodeMetadata {
114
211
  inputs: NodePort[];
115
212
  outputs: NodePort[];
116
213
  configSchema?: ConfigSchema;
214
+ /** Default configuration values for this node type */
215
+ config?: Record<string, unknown>;
117
216
  tags?: string[];
217
+ /**
218
+ * Custom extension properties for 3rd party integrations
219
+ * Allows storing additional configuration and UI state data at the node type level
220
+ */
221
+ extensions?: NodeExtensions;
118
222
  }
119
223
  /**
120
224
  * Common base interface for all schema properties
@@ -243,13 +347,59 @@ export type SchemaProperty<T extends SchemaType> = T extends 'config' ? ConfigPr
243
347
  export type SchemaTypeMap<T extends SchemaType> = T extends 'config' ? ConfigSchema : T extends 'input' ? InputSchema : T extends 'output' ? OutputSchema : never;
244
348
  /**
245
349
  * Node configuration values
246
- * Key-value pairs of user-entered configuration values
350
+ *
351
+ * Key-value pairs of user-entered configuration values based on the node's configSchema.
352
+ * This is where all node-specific settings are stored, including:
353
+ *
354
+ * **Standard Properties:**
355
+ * - Any property defined in the node's `configSchema` (e.g., model, temperature, apiKey)
356
+ *
357
+ * **Special Properties (Dynamic Ports):**
358
+ * - `dynamicInputs`: Array of DynamicPort for user-defined input handles
359
+ * - `dynamicOutputs`: Array of DynamicPort for user-defined output handles
360
+ * - `branches`: Array of Branch for gateway node conditional output paths
361
+ *
362
+ * The backend uses this object to:
363
+ * - Store and retrieve node configuration
364
+ * - Pass configuration values to node processors during execution
365
+ * - Persist node state across sessions
366
+ *
367
+ * @example
368
+ * ```typescript
369
+ * const config: ConfigValues = {
370
+ * // Standard configuration from configSchema
371
+ * model: "gpt-4o-mini",
372
+ * temperature: 0.7,
373
+ * maxTokens: 1000,
374
+ *
375
+ * // Dynamic input ports
376
+ * dynamicInputs: [
377
+ * { name: "extra_data", label: "Extra Data", dataType: "json" }
378
+ * ],
379
+ *
380
+ * // Gateway branches
381
+ * branches: [
382
+ * { name: "success", label: "Success", condition: "status === 200" },
383
+ * { name: "error", label: "Error", isDefault: true }
384
+ * ]
385
+ * };
386
+ * ```
247
387
  */
248
388
  export interface ConfigValues {
389
+ /** Dynamic input ports for user-defined input handles */
390
+ dynamicInputs?: DynamicPort[];
391
+ /** Dynamic output ports for user-defined output handles */
392
+ dynamicOutputs?: DynamicPort[];
393
+ /** Branches for gateway node conditional output paths */
394
+ branches?: Branch[];
395
+ /** Any other configuration properties defined in configSchema */
249
396
  [key: string]: unknown;
250
397
  }
251
398
  /**
252
399
  * Extended node type for workflows
400
+ *
401
+ * Represents a node instance in a workflow, containing position, display data,
402
+ * configuration values, and metadata from the node type definition.
253
403
  */
254
404
  export interface WorkflowNode extends Node {
255
405
  id: string;
@@ -257,14 +407,39 @@ export interface WorkflowNode extends Node {
257
407
  position: XYPosition;
258
408
  deletable?: boolean;
259
409
  data: {
410
+ /** Display label for the node instance */
260
411
  label: string;
412
+ /**
413
+ * Node configuration values
414
+ *
415
+ * Contains all user-configured settings for this node instance based on the
416
+ * node type's configSchema. This includes standard properties defined in the
417
+ * schema as well as special dynamic port configurations.
418
+ *
419
+ * The backend uses this object to:
420
+ * - Store and retrieve node configuration
421
+ * - Pass configuration values to node processors during execution
422
+ * - Persist node state across sessions
423
+ *
424
+ * @see ConfigValues for detailed documentation of available properties
425
+ */
261
426
  config: ConfigValues;
427
+ /** Node type metadata (inputs, outputs, configSchema, etc.) */
262
428
  metadata: NodeMetadata;
429
+ /** Whether the node is currently processing/executing */
263
430
  isProcessing?: boolean;
431
+ /** Error message if the node execution failed */
264
432
  error?: string;
433
+ /** Alternative node identifier */
265
434
  nodeId?: string;
266
435
  /** Node execution tracking information */
267
436
  executionInfo?: NodeExecutionInfo;
437
+ /**
438
+ * Per-instance extension properties for 3rd party integrations
439
+ * Overrides or extends the node type extensions defined in metadata.extensions
440
+ * Use for instance-specific UI states or custom data
441
+ */
442
+ extensions?: NodeExtensions;
268
443
  };
269
444
  }
270
445
  /**
@@ -2,3 +2,19 @@
2
2
  * Core types for the Workflow Library
3
3
  */
4
4
  import { ConnectionLineType } from '@xyflow/svelte';
5
+ /**
6
+ * Convert a DynamicPort to a NodePort
7
+ * @param port - The dynamic port configuration
8
+ * @param portType - Whether this is an input or output port
9
+ * @returns A NodePort compatible with the rendering system
10
+ */
11
+ export function dynamicPortToNodePort(port, portType) {
12
+ return {
13
+ id: port.name,
14
+ name: port.label,
15
+ type: portType,
16
+ dataType: port.dataType,
17
+ required: port.required ?? false,
18
+ description: port.description
19
+ };
20
+ }
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@d34dman/flowdrop",
3
3
  "license": "MIT",
4
4
  "private": false,
5
- "version": "0.0.22",
5
+ "version": "0.0.24",
6
6
  "scripts": {
7
7
  "dev": "vite dev",
8
8
  "build": "vite build && npm run prepack",
@@ -125,7 +125,8 @@
125
125
  "vite": "^6.2.6",
126
126
  "vite-plugin-devtools-json": "^0.2.1",
127
127
  "vitest": "^3.2.3",
128
- "vitest-browser-svelte": "^0.1.0"
128
+ "vitest-browser-svelte": "^0.1.0",
129
+ "@types/uuid": "^10.0.0"
129
130
  },
130
131
  "overrides": {
131
132
  "@sveltejs/kit": {
@@ -136,7 +137,6 @@
136
137
  "svelte"
137
138
  ],
138
139
  "dependencies": {
139
- "@types/uuid": "^10.0.0",
140
140
  "@xyflow/svelte": "~1.2",
141
141
  "marked": "^16.1.1",
142
142
  "svelte-5-french-toast": "^2.0.6",
@@ -1,58 +0,0 @@
1
- /**
2
- * Demo configuration for FlowDrop UI
3
- * Controls which nodes and workflows are shown in demo mode
4
- */
5
- import type { DemoConfig } from '../data/samples.js';
6
- /**
7
- * Default demo configuration
8
- * Change this to enable/disable demo mode and control what's shown
9
- */
10
- export declare const defaultDemoConfig: DemoConfig;
11
- /**
12
- * Demo mode presets for different scenarios
13
- */
14
- export declare const demoPresets: Record<string, DemoConfig>;
15
- /**
16
- * Get the current demo configuration
17
- * You can modify this function to read from localStorage, URL params, etc.
18
- */
19
- export declare function getCurrentDemoConfig(): DemoConfig;
20
- /**
21
- * Set demo configuration (for future use with UI controls)
22
- */
23
- export declare function setDemoConfig(config: DemoConfig): void;
24
- /**
25
- * Load demo configuration from localStorage
26
- */
27
- export declare function loadDemoConfig(): DemoConfig;
28
- /**
29
- * Demo workflow configuration
30
- */
31
- export declare const demoWorkflowConfig: {
32
- defaultWorkflow: string;
33
- autoLoadDemo: boolean;
34
- sampleWorkflowName: string;
35
- sampleWorkflowDescription: string;
36
- };
37
- /**
38
- * Demo instructions for non-technical users
39
- */
40
- export declare const demoInstructions: {
41
- title: string;
42
- description: string;
43
- steps: ({
44
- step: number;
45
- title: string;
46
- description: string;
47
- example: string;
48
- note?: undefined;
49
- } | {
50
- step: number;
51
- title: string;
52
- description: string;
53
- note: string;
54
- example?: undefined;
55
- })[];
56
- benefits: string[];
57
- useCases: string[];
58
- };
@@ -1,142 +0,0 @@
1
- /**
2
- * Demo configuration for FlowDrop UI
3
- * Controls which nodes and workflows are shown in demo mode
4
- */
5
- /**
6
- * Default demo configuration
7
- * Change this to enable/disable demo mode and control what's shown
8
- */
9
- export const defaultDemoConfig = {
10
- enabled: true, // Set to true to enable demo mode
11
- mode: 'content-management' // Show only whitelisted content management nodes
12
- };
13
- /**
14
- * Demo mode presets for different scenarios
15
- */
16
- export const demoPresets = {
17
- // Content management demo mode - show only whitelisted nodes
18
- 'content-management': {
19
- enabled: true,
20
- mode: 'content-management'
21
- },
22
- // Show all nodes (disable demo filtering)
23
- 'all-nodes': {
24
- enabled: false,
25
- mode: 'all'
26
- }
27
- };
28
- /**
29
- * Get the current demo configuration
30
- * You can modify this function to read from localStorage, URL params, etc.
31
- */
32
- export function getCurrentDemoConfig() {
33
- // For now, return the default config
34
- // In the future, this could check localStorage or URL parameters
35
- return defaultDemoConfig;
36
- }
37
- /**
38
- * Set demo configuration (for future use with UI controls)
39
- */
40
- export function setDemoConfig(config) {
41
- // Store in localStorage for persistence
42
- if (typeof localStorage !== 'undefined') {
43
- localStorage.setItem('flowdrop-demo-config', JSON.stringify(config));
44
- }
45
- }
46
- /**
47
- * Load demo configuration from localStorage
48
- */
49
- export function loadDemoConfig() {
50
- if (typeof localStorage !== 'undefined') {
51
- const stored = localStorage.getItem('flowdrop-demo-config');
52
- if (stored) {
53
- try {
54
- return JSON.parse(stored);
55
- }
56
- catch {
57
- // Fall back to default if parsing fails
58
- return defaultDemoConfig;
59
- }
60
- }
61
- }
62
- return defaultDemoConfig;
63
- }
64
- /**
65
- * Demo workflow configuration
66
- */
67
- export const demoWorkflowConfig = {
68
- // Which workflow to show by default in demo mode
69
- defaultWorkflow: 'sample', // Use sample workflow for now
70
- // Whether to auto-load a workflow on startup
71
- autoLoadDemo: false,
72
- // Sample workflow is used in demo mode
73
- sampleWorkflowName: 'Simple Chat Workflow',
74
- sampleWorkflowDescription: 'A basic workflow demonstrating direct text input to AI model response'
75
- };
76
- /**
77
- * Demo instructions for non-technical users
78
- */
79
- export const demoInstructions = {
80
- title: 'Multi-Agent Workflow Demo',
81
- description: 'This demo shows how FlowDrop uses multiple AI agents working together to process and manage data workflows.',
82
- steps: [
83
- {
84
- step: 1,
85
- title: 'User Input',
86
- description: 'Start by providing input data or instructions to the main agent.',
87
- example: 'Analyze and process the provided dataset'
88
- },
89
- {
90
- step: 2,
91
- title: 'Main Agent Orchestration',
92
- description: 'The main conversational agent understands your request and coordinates with specialized sub-agents.',
93
- note: 'Acts as the intelligent orchestrator of the entire workflow'
94
- },
95
- {
96
- step: 3,
97
- title: 'Data Analysis Agent',
98
- description: 'Specialized agent analyzes data using search and processing tools to find and examine relevant information.',
99
- note: 'Uses connected data sources and search tools for intelligent data discovery'
100
- },
101
- {
102
- step: 4,
103
- title: 'Data Processing Agent',
104
- description: 'Specialized agent processes and transforms data using available tools and formatters.',
105
- note: 'Has access to multiple tools and makes tracked transformations'
106
- },
107
- {
108
- step: 5,
109
- title: 'Tool Integration',
110
- description: 'Sub-agents use specialized tools for data processing, formatting, and transformation.',
111
- note: "Tools are connected via special 'tool' interface ports"
112
- },
113
- {
114
- step: 6,
115
- title: 'Agent Collaboration',
116
- description: 'Sub-agents report back to the main agent with their findings and completed work.',
117
- note: 'Multi-agent coordination ensures comprehensive task completion'
118
- },
119
- {
120
- step: 7,
121
- title: 'Orchestrated Response',
122
- description: 'Main agent compiles results from all sub-agents and provides a comprehensive response.',
123
- note: 'Includes summaries, results, and next steps for review'
124
- }
125
- ],
126
- benefits: [
127
- 'Multi-agent collaboration for complex tasks',
128
- 'Specialized agents for specific data processing functions',
129
- 'Intelligent task orchestration and coordination',
130
- 'Tool-based architecture for extensibility',
131
- 'Human oversight through review process',
132
- 'Scalable agent-to-agent communication patterns'
133
- ],
134
- useCases: [
135
- 'Multi-agent data analysis and processing',
136
- 'Coordinated data transformation workflows',
137
- 'Agent-orchestrated data quality checks',
138
- 'Collaborative data processing pipelines',
139
- 'Tool-assisted bulk data operations',
140
- 'Intelligent workflow automation'
141
- ]
142
- };
@@ -1,51 +0,0 @@
1
- /**
2
- * Sample data for FlowDrop development and testing
3
- * Includes sample nodes and workflows for demonstration and testing purposes
4
- */
5
- import type { NodeMetadata, Workflow } from '../types/index.js';
6
- import { CATEGORY_ICONS } from '../utils/icons.js';
7
- /**
8
- * Sample node data for development and testing
9
- * These represent the available node types in the workflow editor
10
- */
11
- export declare const sampleNodes: NodeMetadata[];
12
- export { CATEGORY_ICONS as categoryIcons };
13
- /**
14
- * Demo mode configuration
15
- */
16
- export interface DemoConfig {
17
- enabled: boolean;
18
- mode: 'content-management' | 'all';
19
- }
20
- /**
21
- * Filter nodes based on demo configuration
22
- * @param nodes - All available nodes
23
- * @param config - Demo configuration
24
- * @returns Filtered array of nodes
25
- */
26
- export declare function filterNodesForDemo(nodes: NodeMetadata[], config: DemoConfig): NodeMetadata[];
27
- /**
28
- * Get the list of allowed demo node IDs
29
- */
30
- export declare function getDemoAllowedNodeIds(): string[];
31
- /**
32
- * Check if a node is allowed in demo mode
33
- */
34
- export declare function isNodeAllowedInDemo(nodeId: string): boolean;
35
- /**
36
- * Get demo-specific nodes only
37
- */
38
- export declare function getDemoNodes(): NodeMetadata[];
39
- /**
40
- * Get nodes by category with demo filtering
41
- */
42
- export declare function getNodesByCategory(category: string, demoConfig?: DemoConfig): NodeMetadata[];
43
- /**
44
- * Search nodes with demo filtering
45
- */
46
- export declare function searchNodes(query: string, demoConfig?: DemoConfig): NodeMetadata[];
47
- /**
48
- * Sample workflow for development
49
- * Updated to use the new node types
50
- */
51
- export declare const sampleWorkflow: Workflow;