@d34dman/flowdrop 0.0.16 → 0.0.18

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 (37) hide show
  1. package/README.md +106 -0
  2. package/dist/api/enhanced-client.d.ts +3 -3
  3. package/dist/api/enhanced-client.js +57 -57
  4. package/dist/components/FlowDropZone.svelte +4 -5
  5. package/dist/components/FlowDropZone.svelte.d.ts +1 -1
  6. package/dist/components/TerminalNode.svelte +565 -0
  7. package/dist/components/TerminalNode.svelte.d.ts +24 -0
  8. package/dist/components/UniversalNode.svelte +94 -34
  9. package/dist/components/WorkflowEditor.svelte +63 -3
  10. package/dist/config/runtimeConfig.d.ts +2 -2
  11. package/dist/config/runtimeConfig.js +7 -7
  12. package/dist/helpers/workflowEditorHelper.d.ts +44 -4
  13. package/dist/helpers/workflowEditorHelper.js +161 -30
  14. package/dist/index.d.ts +16 -13
  15. package/dist/index.js +19 -8
  16. package/dist/registry/builtinNodes.d.ts +77 -0
  17. package/dist/registry/builtinNodes.js +194 -0
  18. package/dist/registry/index.d.ts +7 -0
  19. package/dist/registry/index.js +10 -0
  20. package/dist/registry/nodeComponentRegistry.d.ts +307 -0
  21. package/dist/registry/nodeComponentRegistry.js +315 -0
  22. package/dist/registry/plugin.d.ts +215 -0
  23. package/dist/registry/plugin.js +249 -0
  24. package/dist/services/draftStorage.d.ts +1 -1
  25. package/dist/services/draftStorage.js +5 -5
  26. package/dist/stores/workflowStore.d.ts +2 -2
  27. package/dist/stores/workflowStore.js +16 -16
  28. package/dist/styles/base.css +15 -0
  29. package/dist/svelte-app.d.ts +6 -6
  30. package/dist/svelte-app.js +25 -25
  31. package/dist/types/auth.d.ts +2 -2
  32. package/dist/types/auth.js +7 -7
  33. package/dist/types/events.d.ts +2 -2
  34. package/dist/types/index.d.ts +38 -3
  35. package/dist/utils/nodeTypes.d.ts +76 -21
  36. package/dist/utils/nodeTypes.js +182 -32
  37. package/package.json +2 -2
@@ -48,22 +48,22 @@ export class StaticAuthProvider {
48
48
  constructor(config) {
49
49
  this.headers = {};
50
50
  switch (config.type) {
51
- case "bearer":
51
+ case 'bearer':
52
52
  if (config.token) {
53
- this.headers["Authorization"] = `Bearer ${config.token}`;
53
+ this.headers['Authorization'] = `Bearer ${config.token}`;
54
54
  }
55
55
  break;
56
- case "api_key":
56
+ case 'api_key':
57
57
  if (config.apiKey) {
58
- this.headers["X-API-Key"] = config.apiKey;
58
+ this.headers['X-API-Key'] = config.apiKey;
59
59
  }
60
60
  break;
61
- case "custom":
61
+ case 'custom':
62
62
  if (config.headers) {
63
63
  this.headers = { ...config.headers };
64
64
  }
65
65
  break;
66
- case "none":
66
+ case 'none':
67
67
  default:
68
68
  // No headers needed
69
69
  break;
@@ -237,7 +237,7 @@ export class NoAuthProvider {
237
237
  * @returns AuthProvider instance
238
238
  */
239
239
  export function createAuthProviderFromLegacyConfig(authConfig) {
240
- if (!authConfig || authConfig.type === "none") {
240
+ if (!authConfig || authConfig.type === 'none') {
241
241
  return new NoAuthProvider();
242
242
  }
243
243
  return new StaticAuthProvider(authConfig);
@@ -6,13 +6,13 @@
6
6
  *
7
7
  * @module types/events
8
8
  */
9
- import type { Workflow } from "./index.js";
9
+ import type { Workflow } from './index.js';
10
10
  /**
11
11
  * Types of workflow changes
12
12
  *
13
13
  * Used to identify what kind of change triggered the onWorkflowChange event.
14
14
  */
15
- export type WorkflowChangeType = "node_add" | "node_remove" | "node_move" | "node_config" | "edge_add" | "edge_remove" | "metadata" | "name" | "description";
15
+ export type WorkflowChangeType = 'node_add' | 'node_remove' | 'node_move' | 'node_config' | 'edge_add' | 'edge_remove' | 'metadata' | 'name' | 'description';
16
16
  /**
17
17
  * High-level event handlers for enterprise integration
18
18
  *
@@ -71,9 +71,27 @@ export interface NodePort {
71
71
  defaultValue?: unknown;
72
72
  }
73
73
  /**
74
- * Node types for explicit component rendering
75
- */
76
- export type NodeType = 'note' | 'simple' | 'square' | 'tool' | 'gateway' | 'default';
74
+ * Built-in node types for explicit component rendering.
75
+ * These are the node types that ship with FlowDrop.
76
+ */
77
+ export type BuiltinNodeType = 'note' | 'simple' | 'square' | 'tool' | 'gateway' | 'terminal' | 'default';
78
+ /**
79
+ * Node type for component rendering.
80
+ * Includes built-in types and allows custom registered types.
81
+ *
82
+ * Built-in types: note, simple, square, tool, gateway, terminal, default
83
+ * Custom types: Any string registered via nodeComponentRegistry
84
+ *
85
+ * @example
86
+ * ```typescript
87
+ * // Built-in type
88
+ * const type: NodeType = "simple";
89
+ *
90
+ * // Custom registered type
91
+ * const customType: NodeType = "mylib:fancy";
92
+ * ```
93
+ */
94
+ export type NodeType = BuiltinNodeType | (string & Record<never, never>);
77
95
  /**
78
96
  * Node configuration metadata
79
97
  */
@@ -85,6 +103,7 @@ export interface NodeMetadata {
85
103
  * Array of supported node types that this node can be rendered as.
86
104
  * If not specified, defaults to the single 'type' field or 'default'.
87
105
  * This allows nodes to support multiple rendering modes (e.g., both 'simple' and 'default').
106
+ * Can include both built-in types and custom registered types.
88
107
  */
89
108
  supportedTypes?: NodeType[];
90
109
  description: string;
@@ -252,6 +271,14 @@ export interface WorkflowNode extends Node {
252
271
  executionInfo?: NodeExecutionInfo;
253
272
  };
254
273
  }
274
+ /**
275
+ * Edge category types based on source port data type
276
+ * Used for visual styling of edges on the canvas
277
+ * - trigger: For control flow connections (dataType: "trigger")
278
+ * - tool: Dashed amber line for tool connections (dataType: "tool")
279
+ * - data: Normal gray line for all other data connections
280
+ */
281
+ export type EdgeCategory = 'trigger' | 'tool' | 'data';
255
282
  /**
256
283
  * Extended edge type for workflows
257
284
  */
@@ -267,6 +294,14 @@ export interface WorkflowEdge extends Edge {
267
294
  data?: {
268
295
  label?: string;
269
296
  condition?: string;
297
+ /** Edge metadata for API and persistence */
298
+ metadata?: {
299
+ /** Edge type for styling ("tool" or "data") */
300
+ edgeType?: EdgeCategory;
301
+ /** Data type of the source output port (e.g., "tool", "string", "number") */
302
+ sourcePortDataType?: string;
303
+ };
304
+ /** @deprecated Use metadata.edgeType instead - kept for backward compatibility */
270
305
  isToolConnection?: boolean;
271
306
  targetNodeType?: string;
272
307
  targetCategory?: string;
@@ -1,57 +1,112 @@
1
1
  /**
2
2
  * Node type utilities for FlowDrop
3
- * Handles dynamic node type resolution based on NodeMetadata
3
+ * Handles dynamic node type resolution based on NodeMetadata.
4
+ *
5
+ * This module provides utilities for:
6
+ * - Resolving which node type to use based on metadata and config
7
+ * - Getting available node types for a given metadata
8
+ * - Creating config schema properties for node type selection
9
+ *
10
+ * Works with both built-in types and custom registered types.
4
11
  */
5
12
  import type { NodeType, NodeMetadata } from '../types/index.js';
6
13
  /**
7
- * Gets the SvelteFlow component name for a given NodeType
14
+ * Gets the SvelteFlow component name for a given NodeType.
15
+ * Supports both built-in types and registered custom types.
16
+ *
17
+ * @param nodeType - The node type identifier
18
+ * @returns The component name to use
8
19
  */
9
- export declare function getComponentNameForNodeType(nodeType: NodeType): string;
20
+ export declare function getComponentNameForNodeType(nodeType: NodeType | string): string;
10
21
  /**
11
- * Gets the available node types for a given NodeMetadata
22
+ * Gets the available node types for a given NodeMetadata.
12
23
  * Priority: supportedTypes > type > "default"
24
+ *
25
+ * @param metadata - The node metadata
26
+ * @returns Array of available node type identifiers
13
27
  */
14
- export declare function getAvailableNodeTypes(metadata: NodeMetadata): NodeType[];
28
+ export declare function getAvailableNodeTypes(metadata: NodeMetadata): (NodeType | string)[];
15
29
  /**
16
- * Gets the primary (default) node type for a given NodeMetadata
17
- * This is used when no specific type is configured by the user
30
+ * Gets the primary (default) node type for a given NodeMetadata.
31
+ * This is used when no specific type is configured by the user.
32
+ *
33
+ * @param metadata - The node metadata
34
+ * @returns The primary node type
18
35
  */
19
- export declare function getPrimaryNodeType(metadata: NodeMetadata): NodeType;
36
+ export declare function getPrimaryNodeType(metadata: NodeMetadata): NodeType | string;
20
37
  /**
21
- * Determines the appropriate node type based on configuration and metadata
38
+ * Determines the appropriate node type based on configuration and metadata.
39
+ *
22
40
  * Priority:
23
41
  * 1. configNodeType (if valid for this metadata)
24
42
  * 2. metadata.type (if valid)
25
43
  * 3. First supportedType
26
44
  * 4. "default"
45
+ *
46
+ * @param metadata - The node metadata
47
+ * @param configNodeType - Optional type from user config
48
+ * @returns The resolved node type
27
49
  */
28
- export declare function resolveNodeType(metadata: NodeMetadata, configNodeType?: string): NodeType;
50
+ export declare function resolveNodeType(metadata: NodeMetadata, configNodeType?: string): NodeType | string;
29
51
  /**
30
- * Gets the SvelteFlow component name for resolved node type
31
- * This replaces the old mapNodeType function
52
+ * Gets the SvelteFlow component name for resolved node type.
53
+ * This is the main function used by UniversalNode to determine which component to render.
54
+ *
55
+ * @param metadata - The node metadata
56
+ * @param configNodeType - Optional type from user config
57
+ * @returns The component name to use
32
58
  */
33
59
  export declare function resolveComponentName(metadata: NodeMetadata, configNodeType?: string): string;
34
60
  /**
35
- * Validates if a node type is supported by the given metadata
61
+ * Validates if a node type is supported by the given metadata.
62
+ *
63
+ * @param metadata - The node metadata
64
+ * @param nodeType - The type to check
65
+ * @returns true if the type is supported
36
66
  */
37
- export declare function isNodeTypeSupported(metadata: NodeMetadata, nodeType: NodeType): boolean;
67
+ export declare function isNodeTypeSupported(metadata: NodeMetadata, nodeType: NodeType | string): boolean;
38
68
  /**
39
- * Gets enum options for node type configuration
40
- * Used in config schemas to show available options
69
+ * Gets enum options for node type configuration.
70
+ * Used in config schemas to show available options.
71
+ *
72
+ * This function combines:
73
+ * - Types specified in metadata.supportedTypes
74
+ * - Registered custom types (optionally filtered)
75
+ *
76
+ * @param metadata - The node metadata
77
+ * @param includeCustomTypes - Whether to include registered custom types
78
+ * @returns Object with enum values and display names
41
79
  */
42
- export declare function getNodeTypeEnumOptions(metadata: NodeMetadata): {
80
+ export declare function getNodeTypeEnumOptions(metadata: NodeMetadata, includeCustomTypes?: boolean): {
43
81
  enum: string[];
44
82
  enumNames: string[];
45
83
  };
46
84
  /**
47
- * Creates a nodeType config property that respects supportedTypes
48
- * This replaces hardcoded enum values in config schemas
85
+ * Creates a nodeType config property that respects supportedTypes.
86
+ * This replaces hardcoded enum values in config schemas.
87
+ *
88
+ * @param metadata - The node metadata
89
+ * @param defaultType - Optional default type override
90
+ * @returns Config schema property object
49
91
  */
50
- export declare function createNodeTypeConfigProperty(metadata: NodeMetadata, defaultType?: NodeType): {
92
+ export declare function createNodeTypeConfigProperty(metadata: NodeMetadata, defaultType?: NodeType | string): {
51
93
  type: "string";
52
94
  title: string;
53
95
  description: string;
54
- default: NodeType;
96
+ default: string;
55
97
  enum: string[];
56
98
  enumNames: string[];
57
99
  };
100
+ /**
101
+ * Check if a type string represents a valid registered or built-in type.
102
+ *
103
+ * @param type - The type to check
104
+ * @returns true if the type is valid
105
+ */
106
+ export declare function isValidNodeType(type: string): boolean;
107
+ /**
108
+ * Get all available node types (built-in + registered).
109
+ *
110
+ * @returns Array of all valid node type identifiers
111
+ */
112
+ export declare function getAllNodeTypes(): string[];
@@ -1,9 +1,19 @@
1
1
  /**
2
2
  * Node type utilities for FlowDrop
3
- * Handles dynamic node type resolution based on NodeMetadata
3
+ * Handles dynamic node type resolution based on NodeMetadata.
4
+ *
5
+ * This module provides utilities for:
6
+ * - Resolving which node type to use based on metadata and config
7
+ * - Getting available node types for a given metadata
8
+ * - Creating config schema properties for node type selection
9
+ *
10
+ * Works with both built-in types and custom registered types.
4
11
  */
12
+ import { nodeComponentRegistry } from '../registry/nodeComponentRegistry.js';
13
+ import { resolveBuiltinAlias, isBuiltinType } from '../registry/builtinNodes.js';
5
14
  /**
6
- * Maps NodeType to SvelteFlow component names
15
+ * Maps built-in NodeType to SvelteFlow component names.
16
+ * This is kept for backwards compatibility.
7
17
  */
8
18
  const NODE_TYPE_TO_COMPONENT_MAP = {
9
19
  note: 'note',
@@ -11,17 +21,48 @@ const NODE_TYPE_TO_COMPONENT_MAP = {
11
21
  square: 'square',
12
22
  tool: 'tool',
13
23
  gateway: 'gateway',
24
+ terminal: 'terminal',
14
25
  default: 'workflowNode'
15
26
  };
16
27
  /**
17
- * Gets the SvelteFlow component name for a given NodeType
28
+ * Display names for built-in node types.
29
+ */
30
+ const TYPE_DISPLAY_NAMES = {
31
+ note: 'Note (sticky note style)',
32
+ simple: 'Simple (compact layout)',
33
+ square: 'Square (geometric layout)',
34
+ tool: 'Tool (specialized for agent tools)',
35
+ gateway: 'Gateway (branching control flow)',
36
+ terminal: 'Terminal (start/end/exit)',
37
+ default: 'Default (standard workflow node)'
38
+ };
39
+ /**
40
+ * Gets the SvelteFlow component name for a given NodeType.
41
+ * Supports both built-in types and registered custom types.
42
+ *
43
+ * @param nodeType - The node type identifier
44
+ * @returns The component name to use
18
45
  */
19
46
  export function getComponentNameForNodeType(nodeType) {
20
- return NODE_TYPE_TO_COMPONENT_MAP[nodeType] || 'workflowNode';
47
+ // Resolve aliases first (e.g., "default" -> "workflowNode")
48
+ const resolvedType = resolveBuiltinAlias(nodeType);
49
+ // Check if it's registered in the registry
50
+ if (nodeComponentRegistry.has(resolvedType)) {
51
+ return resolvedType;
52
+ }
53
+ // Fall back to built-in mapping
54
+ if (nodeType in NODE_TYPE_TO_COMPONENT_MAP) {
55
+ return NODE_TYPE_TO_COMPONENT_MAP[nodeType];
56
+ }
57
+ // Unknown type - return as-is (might be a custom type)
58
+ return resolvedType;
21
59
  }
22
60
  /**
23
- * Gets the available node types for a given NodeMetadata
61
+ * Gets the available node types for a given NodeMetadata.
24
62
  * Priority: supportedTypes > type > "default"
63
+ *
64
+ * @param metadata - The node metadata
65
+ * @returns Array of available node type identifiers
25
66
  */
26
67
  export function getAvailableNodeTypes(metadata) {
27
68
  if (metadata.supportedTypes && metadata.supportedTypes.length > 0) {
@@ -33,71 +74,139 @@ export function getAvailableNodeTypes(metadata) {
33
74
  return ['default'];
34
75
  }
35
76
  /**
36
- * Gets the primary (default) node type for a given NodeMetadata
37
- * This is used when no specific type is configured by the user
77
+ * Gets the primary (default) node type for a given NodeMetadata.
78
+ * This is used when no specific type is configured by the user.
79
+ *
80
+ * @param metadata - The node metadata
81
+ * @returns The primary node type
38
82
  */
39
83
  export function getPrimaryNodeType(metadata) {
40
84
  const availableTypes = getAvailableNodeTypes(metadata);
41
85
  return availableTypes[0];
42
86
  }
43
87
  /**
44
- * Determines the appropriate node type based on configuration and metadata
88
+ * Determines the appropriate node type based on configuration and metadata.
89
+ *
45
90
  * Priority:
46
91
  * 1. configNodeType (if valid for this metadata)
47
92
  * 2. metadata.type (if valid)
48
93
  * 3. First supportedType
49
94
  * 4. "default"
95
+ *
96
+ * @param metadata - The node metadata
97
+ * @param configNodeType - Optional type from user config
98
+ * @returns The resolved node type
50
99
  */
51
100
  export function resolveNodeType(metadata, configNodeType) {
52
101
  const availableTypes = getAvailableNodeTypes(metadata);
53
102
  // Check if configNodeType is valid for this metadata
54
- if (configNodeType && availableTypes.includes(configNodeType)) {
55
- return configNodeType;
103
+ if (configNodeType) {
104
+ // Resolve alias for comparison
105
+ const resolvedConfig = resolveBuiltinAlias(configNodeType);
106
+ // Check if it's in available types
107
+ if (availableTypes.includes(configNodeType) ||
108
+ availableTypes.includes(resolvedConfig)) {
109
+ return configNodeType;
110
+ }
111
+ // Check if it's a registered custom type
112
+ if (nodeComponentRegistry.has(configNodeType) || nodeComponentRegistry.has(resolvedConfig)) {
113
+ return configNodeType;
114
+ }
56
115
  }
57
116
  // Fall back to primary type
58
117
  return getPrimaryNodeType(metadata);
59
118
  }
60
119
  /**
61
- * Gets the SvelteFlow component name for resolved node type
62
- * This replaces the old mapNodeType function
120
+ * Gets the SvelteFlow component name for resolved node type.
121
+ * This is the main function used by UniversalNode to determine which component to render.
122
+ *
123
+ * @param metadata - The node metadata
124
+ * @param configNodeType - Optional type from user config
125
+ * @returns The component name to use
63
126
  */
64
127
  export function resolveComponentName(metadata, configNodeType) {
65
128
  const nodeType = resolveNodeType(metadata, configNodeType);
66
129
  return getComponentNameForNodeType(nodeType);
67
130
  }
68
131
  /**
69
- * Validates if a node type is supported by the given metadata
132
+ * Validates if a node type is supported by the given metadata.
133
+ *
134
+ * @param metadata - The node metadata
135
+ * @param nodeType - The type to check
136
+ * @returns true if the type is supported
70
137
  */
71
138
  export function isNodeTypeSupported(metadata, nodeType) {
72
139
  const availableTypes = getAvailableNodeTypes(metadata);
73
- return availableTypes.includes(nodeType);
140
+ // Check direct match
141
+ if (availableTypes.includes(nodeType)) {
142
+ return true;
143
+ }
144
+ // Check alias match
145
+ const resolvedType = resolveBuiltinAlias(nodeType);
146
+ if (availableTypes.includes(resolvedType)) {
147
+ return true;
148
+ }
149
+ // Check if it's a registered custom type that's in the available list
150
+ if (nodeComponentRegistry.has(nodeType)) {
151
+ return availableTypes.some((t) => t === nodeType || resolveBuiltinAlias(t) === nodeType);
152
+ }
153
+ return false;
74
154
  }
75
155
  /**
76
- * Gets enum options for node type configuration
77
- * Used in config schemas to show available options
156
+ * Gets enum options for node type configuration.
157
+ * Used in config schemas to show available options.
158
+ *
159
+ * This function combines:
160
+ * - Types specified in metadata.supportedTypes
161
+ * - Registered custom types (optionally filtered)
162
+ *
163
+ * @param metadata - The node metadata
164
+ * @param includeCustomTypes - Whether to include registered custom types
165
+ * @returns Object with enum values and display names
78
166
  */
79
- export function getNodeTypeEnumOptions(metadata) {
167
+ export function getNodeTypeEnumOptions(metadata, includeCustomTypes = false) {
80
168
  const availableTypes = getAvailableNodeTypes(metadata);
81
- const typeDisplayNames = {
82
- note: 'Note (sticky note style)',
83
- simple: 'Simple (compact layout)',
84
- square: 'Square (geometric layout)',
85
- tool: 'Tool (specialized for agent tools)',
86
- gateway: 'Gateway (branching control flow)',
87
- default: 'Default (standard workflow node)'
88
- };
89
- return {
90
- enum: availableTypes,
91
- enumNames: availableTypes.map((type) => typeDisplayNames[type] || type)
92
- };
169
+ // Build enum values and names
170
+ const enumValues = [];
171
+ const enumNames = [];
172
+ for (const type of availableTypes) {
173
+ enumValues.push(type);
174
+ // Get display name from registry or fallback to built-in names
175
+ const registration = nodeComponentRegistry.get(type);
176
+ if (registration) {
177
+ enumNames.push(registration.displayName);
178
+ }
179
+ else if (type in TYPE_DISPLAY_NAMES) {
180
+ enumNames.push(TYPE_DISPLAY_NAMES[type]);
181
+ }
182
+ else {
183
+ // Format unknown type nicely
184
+ enumNames.push(formatTypeName(type));
185
+ }
186
+ }
187
+ // Optionally include all registered custom types
188
+ if (includeCustomTypes) {
189
+ const registrations = nodeComponentRegistry.filter({
190
+ predicate: (reg) => !isBuiltinType(reg.type) && !enumValues.includes(reg.type)
191
+ });
192
+ for (const reg of registrations) {
193
+ enumValues.push(reg.type);
194
+ enumNames.push(reg.displayName);
195
+ }
196
+ }
197
+ return { enum: enumValues, enumNames };
93
198
  }
94
199
  /**
95
- * Creates a nodeType config property that respects supportedTypes
96
- * This replaces hardcoded enum values in config schemas
200
+ * Creates a nodeType config property that respects supportedTypes.
201
+ * This replaces hardcoded enum values in config schemas.
202
+ *
203
+ * @param metadata - The node metadata
204
+ * @param defaultType - Optional default type override
205
+ * @returns Config schema property object
97
206
  */
98
207
  export function createNodeTypeConfigProperty(metadata, defaultType) {
99
208
  const { enum: enumValues, enumNames } = getNodeTypeEnumOptions(metadata);
100
- const primaryType = defaultType || getPrimaryNodeType(metadata);
209
+ const primaryType = defaultType ?? getPrimaryNodeType(metadata);
101
210
  return {
102
211
  type: 'string',
103
212
  title: 'Node Type',
@@ -107,3 +216,44 @@ export function createNodeTypeConfigProperty(metadata, defaultType) {
107
216
  enumNames
108
217
  };
109
218
  }
219
+ /**
220
+ * Check if a type string represents a valid registered or built-in type.
221
+ *
222
+ * @param type - The type to check
223
+ * @returns true if the type is valid
224
+ */
225
+ export function isValidNodeType(type) {
226
+ return isBuiltinType(type) || nodeComponentRegistry.has(type);
227
+ }
228
+ /**
229
+ * Get all available node types (built-in + registered).
230
+ *
231
+ * @returns Array of all valid node type identifiers
232
+ */
233
+ export function getAllNodeTypes() {
234
+ return nodeComponentRegistry.getTypes();
235
+ }
236
+ /**
237
+ * Format a type name for display when no display name is registered.
238
+ *
239
+ * @param type - The raw type string
240
+ * @returns Formatted display name
241
+ */
242
+ function formatTypeName(type) {
243
+ // Handle namespaced types (e.g., "mylib:fancy" -> "Mylib: Fancy")
244
+ if (type.includes(':')) {
245
+ const [namespace, name] = type.split(':');
246
+ return `${capitalize(namespace)}: ${capitalize(name)}`;
247
+ }
248
+ // Capitalize and add spaces for camelCase
249
+ return capitalize(type.replace(/([A-Z])/g, ' $1').trim());
250
+ }
251
+ /**
252
+ * Capitalize the first letter of a string.
253
+ *
254
+ * @param str - The string to capitalize
255
+ * @returns Capitalized string
256
+ */
257
+ function capitalize(str) {
258
+ return str.charAt(0).toUpperCase() + str.slice(1);
259
+ }
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.16",
5
+ "version": "0.0.18",
6
6
  "scripts": {
7
7
  "dev": "vite dev",
8
8
  "build": "vite build && npm run prepack",
@@ -136,4 +136,4 @@
136
136
  "svelte-5-french-toast": "^2.0.6",
137
137
  "uuid": "^11.1.0"
138
138
  }
139
- }
139
+ }