@d34dman/flowdrop 0.0.51 → 0.0.53

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 (42) hide show
  1. package/dist/api/client.d.ts +5 -1
  2. package/dist/api/client.js +10 -0
  3. package/dist/components/App.svelte +2 -0
  4. package/dist/components/ConfigForm.svelte +1 -0
  5. package/dist/components/NodeSidebar.svelte +4 -21
  6. package/dist/components/SettingsPanel.svelte +1 -2
  7. package/dist/components/ThemeToggle.svelte +1 -1
  8. package/dist/components/WorkflowEditor.svelte +1 -2
  9. package/dist/components/form/FormAutocomplete.svelte +3 -12
  10. package/dist/components/form/FormField.svelte +1 -1
  11. package/dist/components/form/FormFieldLight.svelte +1 -1
  12. package/dist/components/nodes/TerminalNode.svelte +45 -9
  13. package/dist/components/nodes/TerminalNode.svelte.d.ts +2 -1
  14. package/dist/components/nodes/ToolNode.svelte +17 -11
  15. package/dist/config/defaultCategories.d.ts +7 -0
  16. package/dist/config/defaultCategories.js +126 -0
  17. package/dist/config/endpoints.d.ts +1 -0
  18. package/dist/config/endpoints.js +1 -0
  19. package/dist/core/index.d.ts +3 -3
  20. package/dist/core/index.js +1 -1
  21. package/dist/editor/index.d.ts +1 -0
  22. package/dist/editor/index.js +1 -0
  23. package/dist/services/categoriesApi.d.ts +14 -0
  24. package/dist/services/categoriesApi.js +41 -0
  25. package/dist/settings/index.d.ts +2 -1
  26. package/dist/settings/index.js +2 -1
  27. package/dist/stores/categoriesStore.d.ts +32 -0
  28. package/dist/stores/categoriesStore.js +80 -0
  29. package/dist/stores/settingsStore.d.ts +44 -2
  30. package/dist/stores/settingsStore.js +37 -15
  31. package/dist/svelte-app.d.ts +4 -1
  32. package/dist/svelte-app.js +30 -2
  33. package/dist/types/index.d.ts +38 -3
  34. package/dist/utils/colors.d.ts +5 -2
  35. package/dist/utils/colors.js +7 -3
  36. package/dist/utils/fetchWithAuth.d.ts +25 -0
  37. package/dist/utils/fetchWithAuth.js +34 -0
  38. package/dist/utils/icons.d.ts +7 -3
  39. package/dist/utils/icons.js +11 -6
  40. package/package.json +1 -1
  41. package/dist/stores/themeStore.d.ts +0 -68
  42. package/dist/stores/themeStore.js +0 -213
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Categories Store for FlowDrop
3
+ *
4
+ * Manages category definitions with merged defaults and API-provided overrides.
5
+ * Exposes lookup helpers for icon, color, and label resolution.
6
+ */
7
+ import type { CategoryDefinition, NodeCategory } from '../types/index.js';
8
+ /**
9
+ * Readable store of all category definitions, sorted by weight.
10
+ */
11
+ export declare const categories: import("svelte/store").Readable<CategoryDefinition[]>;
12
+ /**
13
+ * Initialize categories with API data, merging with defaults.
14
+ * API categories override defaults by name; custom categories are appended.
15
+ */
16
+ export declare function initializeCategories(apiCategories: CategoryDefinition[]): void;
17
+ /**
18
+ * Get the display label for a category.
19
+ */
20
+ export declare function getCategoryLabel(category: NodeCategory): string;
21
+ /**
22
+ * Get the icon for a category.
23
+ */
24
+ export declare function getCategoryIcon(category: NodeCategory): string;
25
+ /**
26
+ * Get the color token for a category.
27
+ */
28
+ export declare function getCategoryColor(category: NodeCategory): string;
29
+ /**
30
+ * Get the full category definition, or undefined if not found.
31
+ */
32
+ export declare function getCategoryDefinition(category: NodeCategory): CategoryDefinition | undefined;
@@ -0,0 +1,80 @@
1
+ /**
2
+ * Categories Store for FlowDrop
3
+ *
4
+ * Manages category definitions with merged defaults and API-provided overrides.
5
+ * Exposes lookup helpers for icon, color, and label resolution.
6
+ */
7
+ import { writable, derived, get } from 'svelte/store';
8
+ import { DEFAULT_CATEGORIES } from '../config/defaultCategories.js';
9
+ /**
10
+ * Internal writable store holding the category definitions.
11
+ * Initialized with defaults, updated when API data is fetched.
12
+ */
13
+ const categoriesInternal = writable(DEFAULT_CATEGORIES);
14
+ /**
15
+ * Derived lookup map: category name → CategoryDefinition
16
+ */
17
+ const categoryMap = derived(categoriesInternal, ($categories) => {
18
+ const map = new Map();
19
+ for (const cat of $categories) {
20
+ map.set(cat.name, cat);
21
+ }
22
+ return map;
23
+ });
24
+ /**
25
+ * Readable store of all category definitions, sorted by weight.
26
+ */
27
+ export const categories = derived(categoriesInternal, ($categories) => [...$categories].sort((a, b) => (a.weight ?? 999) - (b.weight ?? 999)));
28
+ /**
29
+ * Initialize categories with API data, merging with defaults.
30
+ * API categories override defaults by name; custom categories are appended.
31
+ */
32
+ export function initializeCategories(apiCategories) {
33
+ const defaultMap = new Map();
34
+ for (const cat of DEFAULT_CATEGORIES) {
35
+ defaultMap.set(cat.name, cat);
36
+ }
37
+ // API categories override defaults by name
38
+ for (const cat of apiCategories) {
39
+ defaultMap.set(cat.name, {
40
+ ...defaultMap.get(cat.name),
41
+ ...cat
42
+ });
43
+ }
44
+ categoriesInternal.set(Array.from(defaultMap.values()));
45
+ }
46
+ /**
47
+ * Get the display label for a category.
48
+ */
49
+ export function getCategoryLabel(category) {
50
+ const map = get(categoryMap);
51
+ const def = map.get(category);
52
+ if (def?.label)
53
+ return def.label;
54
+ // Auto-generate: capitalize each word
55
+ return category
56
+ .split(/[\s_-]+/)
57
+ .map((word) => word.charAt(0).toUpperCase() + word.slice(1))
58
+ .join(' ');
59
+ }
60
+ /**
61
+ * Get the icon for a category.
62
+ */
63
+ export function getCategoryIcon(category) {
64
+ const map = get(categoryMap);
65
+ return map.get(category)?.icon ?? 'mdi:folder';
66
+ }
67
+ /**
68
+ * Get the color token for a category.
69
+ */
70
+ export function getCategoryColor(category) {
71
+ const map = get(categoryMap);
72
+ return map.get(category)?.color ?? 'var(--fd-node-slate)';
73
+ }
74
+ /**
75
+ * Get the full category definition, or undefined if not found.
76
+ */
77
+ export function getCategoryDefinition(category) {
78
+ const map = get(categoryMap);
79
+ return map.get(category);
80
+ }
@@ -5,11 +5,12 @@
5
5
  * - Hybrid persistence (localStorage primary, optional API sync)
6
6
  * - Category-specific derived stores for performance
7
7
  * - Deep merge support for partial updates
8
- * - Theme system compatibility (backward compatible with themeStore)
8
+ * - Integrated theme system with system preference detection
9
9
  *
10
10
  * @module stores/settingsStore
11
11
  */
12
- import type { FlowDropSettings, ThemeSettings, EditorSettings, UISettings, BehaviorSettings, ApiSettings, PartialSettings, SyncStatus, SettingsChangeCallback, SettingsCategory } from '../types/settings.js';
12
+ import type { FlowDropSettings, ThemeSettings, EditorSettings, UISettings, BehaviorSettings, ApiSettings, PartialSettings, SyncStatus, ResolvedTheme, ThemePreference, SettingsChangeCallback, SettingsCategory } from '../types/settings.js';
13
+ export type { ThemePreference, ResolvedTheme } from '../types/settings.js';
13
14
  /**
14
15
  * Main settings store (read-only access to current settings)
15
16
  */
@@ -42,6 +43,16 @@ export declare const behaviorSettings: import("svelte/store").Readable<BehaviorS
42
43
  * API settings store
43
44
  */
44
45
  export declare const apiSettings: import("svelte/store").Readable<ApiSettings>;
46
+ /**
47
+ * Theme preference store
48
+ * Derived from themeSettings for convenient access
49
+ */
50
+ export declare const theme: import("svelte/store").Readable<ThemePreference>;
51
+ /**
52
+ * Resolved theme - the actual theme applied ('light' or 'dark')
53
+ * When preference is 'auto', resolves based on system preference
54
+ */
55
+ export declare const resolvedTheme: import("svelte/store").Readable<ResolvedTheme>;
45
56
  /**
46
57
  * Update settings with partial values
47
58
  *
@@ -58,6 +69,37 @@ export declare function resetSettings(categories?: SettingsCategory[]): void;
58
69
  * Get current settings synchronously
59
70
  */
60
71
  export declare function getSettings(): FlowDropSettings;
72
+ /**
73
+ * Set the theme preference
74
+ *
75
+ * @param newTheme - The new theme preference ('light', 'dark', or 'auto')
76
+ */
77
+ export declare function setTheme(newTheme: ThemePreference): void;
78
+ /**
79
+ * Toggle between light and dark themes
80
+ * If currently 'auto', switches to the opposite of system preference
81
+ */
82
+ export declare function toggleTheme(): void;
83
+ /**
84
+ * Cycle through theme options: light -> dark -> auto -> light
85
+ */
86
+ export declare function cycleTheme(): void;
87
+ /**
88
+ * Initialize the theme system
89
+ * Should be called once on app startup
90
+ *
91
+ * This function:
92
+ * 1. Applies the current resolved theme to the document
93
+ * 2. Sets up reactivity to apply theme changes
94
+ */
95
+ export declare function initializeTheme(): void;
96
+ /**
97
+ * Check if theme system is initialized
98
+ * Useful for SSR scenarios
99
+ *
100
+ * @returns true if running in browser and theme is applied
101
+ */
102
+ export declare function isThemeInitialized(): boolean;
61
103
  /**
62
104
  * Set the settings service for API operations
63
105
  *
@@ -5,7 +5,7 @@
5
5
  * - Hybrid persistence (localStorage primary, optional API sync)
6
6
  * - Category-specific derived stores for performance
7
7
  * - Deep merge support for partial updates
8
- * - Theme system compatibility (backward compatible with themeStore)
8
+ * - Integrated theme system with system preference detection
9
9
  *
10
10
  * @module stores/settingsStore
11
11
  */
@@ -157,7 +157,7 @@ export const behaviorSettings = derived(settingsStore, ($settings) => $settings.
157
157
  */
158
158
  export const apiSettings = derived(settingsStore, ($settings) => $settings.api);
159
159
  // =========================================================================
160
- // Theme Compatibility (for themeStore migration)
160
+ // Theme System
161
161
  // =========================================================================
162
162
  /**
163
163
  * System theme preference store
@@ -188,13 +188,15 @@ if (typeof window !== 'undefined') {
188
188
  }
189
189
  }
190
190
  /**
191
- * Theme preference (internal - exported via core/themeStore)
191
+ * Theme preference store
192
+ * Derived from themeSettings for convenient access
192
193
  */
193
- const theme = derived(themeSettings, ($theme) => $theme.preference);
194
+ export const theme = derived(themeSettings, ($theme) => $theme.preference);
194
195
  /**
195
- * Resolved theme (internal - exported via core/themeStore)
196
+ * Resolved theme - the actual theme applied ('light' or 'dark')
197
+ * When preference is 'auto', resolves based on system preference
196
198
  */
197
- const resolvedTheme = derived([themeSettings, systemTheme], ([$themeSettings, $systemTheme]) => {
199
+ export const resolvedTheme = derived([themeSettings, systemTheme], ([$themeSettings, $systemTheme]) => {
198
200
  if ($themeSettings.preference === 'auto') {
199
201
  return $systemTheme;
200
202
  }
@@ -288,18 +290,21 @@ export function getSettings() {
288
290
  return get(settingsStore);
289
291
  }
290
292
  // =========================================================================
291
- // Theme-Specific Functions (backward compatible with themeStore)
293
+ // Theme Actions
292
294
  // =========================================================================
293
295
  /**
294
- * Set the theme preference (internal - exported via core/themeStore)
296
+ * Set the theme preference
297
+ *
298
+ * @param newTheme - The new theme preference ('light', 'dark', or 'auto')
295
299
  */
296
- function setTheme(newTheme) {
300
+ export function setTheme(newTheme) {
297
301
  updateSettings({ theme: { preference: newTheme } });
298
302
  }
299
303
  /**
300
- * Toggle between light and dark themes (internal - exported via core/themeStore)
304
+ * Toggle between light and dark themes
305
+ * If currently 'auto', switches to the opposite of system preference
301
306
  */
302
- function toggleTheme() {
307
+ export function toggleTheme() {
303
308
  const currentTheme = get(theme);
304
309
  const currentResolved = get(resolvedTheme);
305
310
  if (currentTheme === 'auto') {
@@ -310,9 +315,9 @@ function toggleTheme() {
310
315
  }
311
316
  }
312
317
  /**
313
- * Cycle through theme options (internal - exported via core/themeStore)
318
+ * Cycle through theme options: light -> dark -> auto -> light
314
319
  */
315
- function cycleTheme() {
320
+ export function cycleTheme() {
316
321
  const currentTheme = get(theme);
317
322
  switch (currentTheme) {
318
323
  case 'light':
@@ -338,9 +343,14 @@ function applyTheme(resolved) {
338
343
  document.documentElement.setAttribute('data-theme', resolved);
339
344
  }
340
345
  /**
341
- * Initialize the theme system (internal - exported via core/themeStore)
346
+ * Initialize the theme system
347
+ * Should be called once on app startup
348
+ *
349
+ * This function:
350
+ * 1. Applies the current resolved theme to the document
351
+ * 2. Sets up reactivity to apply theme changes
342
352
  */
343
- function initializeTheme() {
353
+ export function initializeTheme() {
344
354
  const resolved = get(resolvedTheme);
345
355
  applyTheme(resolved);
346
356
  // Subscribe to resolved theme changes and apply them
@@ -348,6 +358,18 @@ function initializeTheme() {
348
358
  applyTheme(theme);
349
359
  });
350
360
  }
361
+ /**
362
+ * Check if theme system is initialized
363
+ * Useful for SSR scenarios
364
+ *
365
+ * @returns true if running in browser and theme is applied
366
+ */
367
+ export function isThemeInitialized() {
368
+ if (typeof document === 'undefined') {
369
+ return false;
370
+ }
371
+ return document.documentElement.hasAttribute('data-theme');
372
+ }
351
373
  // =========================================================================
352
374
  // API Sync Functions
353
375
  // =========================================================================
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * @module svelte-app
8
8
  */
9
- import type { Workflow, NodeMetadata, PortConfig } from './types/index.js';
9
+ import type { Workflow, NodeMetadata, PortConfig, CategoryDefinition } from './types/index.js';
10
10
  import type { EndpointConfig } from './config/endpoints.js';
11
11
  import type { AuthProvider } from './types/auth.js';
12
12
  import type { FlowDropEventHandlers, FlowDropFeatures } from './types/events.js';
@@ -39,6 +39,8 @@ export interface FlowDropMountOptions {
39
39
  endpointConfig?: EndpointConfig;
40
40
  /** Port configuration for connections */
41
41
  portConfig?: PortConfig;
42
+ /** Category definitions for node categories */
43
+ categories?: CategoryDefinition[];
42
44
  /** Editor height */
43
45
  height?: string | number;
44
46
  /** Editor width */
@@ -140,6 +142,7 @@ export declare function mountWorkflowEditor(container: HTMLElement, options?: {
140
142
  nodes?: NodeMetadata[];
141
143
  endpointConfig?: EndpointConfig;
142
144
  portConfig?: PortConfig;
145
+ categories?: CategoryDefinition[];
143
146
  }): Promise<MountedFlowDropApp>;
144
147
  /**
145
148
  * Unmount a FlowDrop app
@@ -12,6 +12,8 @@ import App from './components/App.svelte';
12
12
  import { initializePortCompatibility } from './utils/connections.js';
13
13
  import { DEFAULT_PORT_CONFIG } from './config/defaultPortConfig.js';
14
14
  import { fetchPortConfig } from './services/portConfigApi.js';
15
+ import { fetchCategories } from './services/categoriesApi.js';
16
+ import { initializeCategories } from './stores/categoriesStore.js';
15
17
  import { isDirty, markAsSaved, getWorkflow as getWorkflowFromStore, setOnDirtyStateChange, setOnWorkflowChange } from './stores/workflowStore.js';
16
18
  import { DraftAutoSaveManager, getDraftStorageKey } from './services/draftStorage.js';
17
19
  import { mergeFeatures } from './types/events.js';
@@ -41,7 +43,7 @@ import { initializeSettings } from './stores/settingsStore.js';
41
43
  * ```
42
44
  */
43
45
  export async function mountFlowDropApp(container, options = {}) {
44
- const { workflow, nodes, endpointConfig, portConfig, height = '100vh', width = '100%', showNavbar = false, disableSidebar, lockWorkflow, readOnly, nodeStatuses, pipelineId, navbarTitle, navbarActions, showSettings, authProvider, eventHandlers, features: userFeatures, settings: initialSettings, draftStorageKey: customDraftKey } = options;
46
+ const { workflow, nodes, endpointConfig, portConfig, categories, height = '100vh', width = '100%', showNavbar = false, disableSidebar, lockWorkflow, readOnly, nodeStatuses, pipelineId, navbarTitle, navbarActions, showSettings, authProvider, eventHandlers, features: userFeatures, settings: initialSettings, draftStorageKey: customDraftKey } = options;
45
47
  // Merge features with defaults
46
48
  const features = mergeFeatures(userFeatures);
47
49
  // Apply initial settings overrides and initialize theme
@@ -83,6 +85,19 @@ export async function mountFlowDropApp(container, options = {}) {
83
85
  finalPortConfig = DEFAULT_PORT_CONFIG;
84
86
  }
85
87
  initializePortCompatibility(finalPortConfig);
88
+ // Initialize categories
89
+ if (categories) {
90
+ initializeCategories(categories);
91
+ }
92
+ else if (config) {
93
+ try {
94
+ const fetchedCategories = await fetchCategories(config);
95
+ initializeCategories(fetchedCategories);
96
+ }
97
+ catch (error) {
98
+ console.warn('Failed to fetch categories from API, using defaults:', error);
99
+ }
100
+ }
86
101
  // Set up event handler callbacks in the store
87
102
  if (eventHandlers?.onDirtyStateChange) {
88
103
  setOnDirtyStateChange(eventHandlers.onDirtyStateChange);
@@ -194,7 +209,7 @@ export async function mountFlowDropApp(container, options = {}) {
194
209
  * @returns Promise resolving to a MountedFlowDropApp instance
195
210
  */
196
211
  export async function mountWorkflowEditor(container, options = {}) {
197
- const { nodes = [], endpointConfig, portConfig } = options;
212
+ const { nodes = [], endpointConfig, portConfig, categories } = options;
198
213
  // Create endpoint configuration
199
214
  let config;
200
215
  if (endpointConfig) {
@@ -230,6 +245,19 @@ export async function mountWorkflowEditor(container, options = {}) {
230
245
  finalPortConfig = DEFAULT_PORT_CONFIG;
231
246
  }
232
247
  initializePortCompatibility(finalPortConfig);
248
+ // Initialize categories
249
+ if (categories) {
250
+ initializeCategories(categories);
251
+ }
252
+ else if (config) {
253
+ try {
254
+ const fetchedCategories = await fetchCategories(config);
255
+ initializeCategories(fetchedCategories);
256
+ }
257
+ catch (error) {
258
+ console.warn('Failed to fetch categories from API, using defaults:', error);
259
+ }
260
+ }
233
261
  // Create the Svelte component
234
262
  const svelteApp = mount(WorkflowEditor, {
235
263
  target: container,
@@ -5,10 +5,43 @@ import type { Node, Edge, XYPosition } from '@xyflow/svelte';
5
5
  import { ConnectionLineType } from '@xyflow/svelte';
6
6
  import type { EndpointConfig } from '../config/endpoints.js';
7
7
  /**
8
- * Node category types for organizing nodes in the sidebar
9
- * Based on actual API response categories
8
+ * Built-in node categories that ship with FlowDrop.
9
+ * These categories have predefined icons, colors, and display names.
10
10
  */
11
- export type NodeCategory = 'triggers' | 'inputs' | 'outputs' | 'prompts' | 'models' | 'processing' | 'logic' | 'data' | 'tools' | 'helpers' | 'vector stores' | 'embeddings' | 'memories' | 'agents' | 'ai' | 'interrupts' | 'bundles';
11
+ export type BuiltinNodeCategory = 'triggers' | 'inputs' | 'outputs' | 'prompts' | 'models' | 'processing' | 'logic' | 'data' | 'tools' | 'helpers' | 'vector stores' | 'embeddings' | 'memories' | 'agents' | 'ai' | 'interrupts' | 'bundles';
12
+ /**
13
+ * Node category for organizing nodes in the sidebar.
14
+ * Includes all built-in categories plus any custom string.
15
+ * Custom categories can be defined via the `/categories` API endpoint.
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * // Built-in category
20
+ * const cat: NodeCategory = 'triggers';
21
+ *
22
+ * // Custom category
23
+ * const custom: NodeCategory = 'my-custom-category';
24
+ * ```
25
+ */
26
+ export type NodeCategory = BuiltinNodeCategory | (string & Record<never, never>);
27
+ /**
28
+ * Category definition with metadata for display and organization.
29
+ * Fetched from the `/categories` API endpoint or provided as defaults.
30
+ */
31
+ export interface CategoryDefinition {
32
+ /** Machine name / unique identifier */
33
+ name: string;
34
+ /** Display label shown in UI */
35
+ label: string;
36
+ /** Icon identifier (e.g. 'mdi:brain') */
37
+ icon?: string;
38
+ /** Color token or CSS value (e.g. 'var(--fd-node-purple)') */
39
+ color?: string;
40
+ /** Category description */
41
+ description?: string;
42
+ /** Sort weight for ordering (lower = earlier) */
43
+ weight?: number;
44
+ }
12
45
  /**
13
46
  * Port data type configuration
14
47
  */
@@ -478,6 +511,8 @@ export interface NodeMetadata {
478
511
  color?: string;
479
512
  /** Badge label displayed in the node header (e.g., "TOOL", "API", "LLM"). Overridable per-instance via config.instanceBadge. */
480
513
  badge?: string;
514
+ /** Port dataType to expose on tool nodes. Defaults to 'tool'. Set to another type (e.g., 'trigger') to show that port instead. */
515
+ portDataType?: string;
481
516
  inputs: NodePort[];
482
517
  outputs: NodePort[];
483
518
  configSchema?: ConfigSchema;
@@ -7,10 +7,13 @@ import type { NodeCategory, PortDataTypeConfig } from '../types/index.js';
7
7
  /**
8
8
  * Category color mapping to design tokens (CSS variables)
9
9
  * Uses --fd-node-* tokens from tokens.css
10
+ * These serve as static defaults; the categories store provides dynamic overrides.
10
11
  */
11
- export declare const CATEGORY_COLOR_TOKENS: Record<NodeCategory, string>;
12
+ export declare const CATEGORY_COLOR_TOKENS: Record<string, string>;
12
13
  /**
13
- * Get the design token for a category color
14
+ * Get the design token for a category color.
15
+ * Checks the categories store first (which includes API overrides),
16
+ * then falls back to the static CATEGORY_COLOR_TOKENS map, then to slate.
14
17
  */
15
18
  export declare function getCategoryColorToken(category: NodeCategory): string;
16
19
  /**
@@ -4,9 +4,11 @@
4
4
  * Uses BEM syntax for CSS classes
5
5
  */
6
6
  import { getPortCompatibilityChecker } from './connections.js';
7
+ import { getCategoryColor as getCategoryColorFromStore } from '../stores/categoriesStore.js';
7
8
  /**
8
9
  * Category color mapping to design tokens (CSS variables)
9
10
  * Uses --fd-node-* tokens from tokens.css
11
+ * These serve as static defaults; the categories store provides dynamic overrides.
10
12
  */
11
13
  export const CATEGORY_COLOR_TOKENS = {
12
14
  triggers: 'var(--fd-node-cyan)',
@@ -61,10 +63,12 @@ const DEFAULT_DATA_TYPE_COLORS = {
61
63
  branch: 'var(--fd-node-purple)'
62
64
  };
63
65
  /**
64
- * Get the design token for a category color
66
+ * Get the design token for a category color.
67
+ * Checks the categories store first (which includes API overrides),
68
+ * then falls back to the static CATEGORY_COLOR_TOKENS map, then to slate.
65
69
  */
66
70
  export function getCategoryColorToken(category) {
67
- return CATEGORY_COLOR_TOKENS[category] || 'var(--fd-node-slate)';
71
+ return getCategoryColorFromStore(category);
68
72
  }
69
73
  /**
70
74
  * Get the reference color token for a data type (configurable version)
@@ -124,7 +128,7 @@ export const DEFAULT_COLORS = {
124
128
  * @returns The color configuration for the category
125
129
  */
126
130
  export function getCategoryColors(category) {
127
- return CATEGORY_COLOR_TOKENS[category] || 'var(--fd-node-slate)';
131
+ return getCategoryColorFromStore(category);
128
132
  }
129
133
  /**
130
134
  * Get category background color
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Fetch authentication utilities
3
+ *
4
+ * Shared logic for building HTTP headers with authentication.
5
+ * Used by components that make authenticated API requests (e.g., FormAutocomplete).
6
+ *
7
+ * @module utils/fetchWithAuth
8
+ */
9
+ import type { AuthProvider } from '../types/auth.js';
10
+ /**
11
+ * Build fetch headers with optional authentication
12
+ *
13
+ * Constructs standard JSON request headers and merges in authentication
14
+ * headers from the provided AuthProvider, if available.
15
+ *
16
+ * @param authProvider - Optional auth provider to get headers from
17
+ * @returns Promise resolving to a complete headers object
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * const headers = await buildFetchHeaders(authProvider);
22
+ * const response = await fetch(url, { headers });
23
+ * ```
24
+ */
25
+ export declare function buildFetchHeaders(authProvider?: AuthProvider): Promise<Record<string, string>>;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Fetch authentication utilities
3
+ *
4
+ * Shared logic for building HTTP headers with authentication.
5
+ * Used by components that make authenticated API requests (e.g., FormAutocomplete).
6
+ *
7
+ * @module utils/fetchWithAuth
8
+ */
9
+ /**
10
+ * Build fetch headers with optional authentication
11
+ *
12
+ * Constructs standard JSON request headers and merges in authentication
13
+ * headers from the provided AuthProvider, if available.
14
+ *
15
+ * @param authProvider - Optional auth provider to get headers from
16
+ * @returns Promise resolving to a complete headers object
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * const headers = await buildFetchHeaders(authProvider);
21
+ * const response = await fetch(url, { headers });
22
+ * ```
23
+ */
24
+ export async function buildFetchHeaders(authProvider) {
25
+ const headers = {
26
+ Accept: 'application/json',
27
+ 'Content-Type': 'application/json'
28
+ };
29
+ if (authProvider) {
30
+ const authHeaders = await authProvider.getAuthHeaders();
31
+ Object.assign(headers, authHeaders);
32
+ }
33
+ return headers;
34
+ }
@@ -65,9 +65,11 @@ export declare const DEFAULT_ICONS: {
65
65
  readonly BUNDLE: "mdi:package-variant";
66
66
  };
67
67
  /**
68
- * Category-specific icons matching Langflow's visual style
68
+ * Category-specific icons for built-in categories.
69
+ * Custom categories fall back to DEFAULT_ICONS.CATEGORY.
70
+ * These serve as static defaults; the categories store provides dynamic overrides.
69
71
  */
70
- export declare const CATEGORY_ICONS: Record<NodeCategory, string>;
72
+ export declare const CATEGORY_ICONS: Record<string, string>;
71
73
  /**
72
74
  * Get the appropriate icon for a node
73
75
  * @param nodeIcon - The node's specific icon
@@ -76,7 +78,9 @@ export declare const CATEGORY_ICONS: Record<NodeCategory, string>;
76
78
  */
77
79
  export declare function getNodeIcon(nodeIcon?: string, category?: NodeCategory): string;
78
80
  /**
79
- * Get the appropriate icon for a category
81
+ * Get the appropriate icon for a category.
82
+ * Checks the categories store first (which includes API overrides),
83
+ * then falls back to the static CATEGORY_ICONS map, then to the default.
80
84
  * @param category - The category
81
85
  * @returns The icon to use
82
86
  */
@@ -2,6 +2,7 @@
2
2
  * Centralized icon management for FlowDrop
3
3
  * Ensures consistent icon usage across all components
4
4
  */
5
+ import { getCategoryIcon as getCategoryIconFromStore } from '../stores/categoriesStore.js';
5
6
  /**
6
7
  * Default icons for different contexts
7
8
  */
@@ -77,7 +78,9 @@ export const DEFAULT_ICONS = {
77
78
  BUNDLE: 'mdi:package-variant'
78
79
  };
79
80
  /**
80
- * Category-specific icons matching Langflow's visual style
81
+ * Category-specific icons for built-in categories.
82
+ * Custom categories fall back to DEFAULT_ICONS.CATEGORY.
83
+ * These serve as static defaults; the categories store provides dynamic overrides.
81
84
  */
82
85
  export const CATEGORY_ICONS = {
83
86
  triggers: 'mdi:lightning-bolt',
@@ -109,20 +112,22 @@ export function getNodeIcon(nodeIcon, category) {
109
112
  if (nodeIcon) {
110
113
  return nodeIcon;
111
114
  }
112
- // If category is provided, use category icon
113
- if (category && CATEGORY_ICONS[category]) {
114
- return CATEGORY_ICONS[category];
115
+ // If category is provided, use category icon from store (which includes API overrides)
116
+ if (category) {
117
+ return getCategoryIconFromStore(category);
115
118
  }
116
119
  // Fallback to default node icon
117
120
  return DEFAULT_ICONS.NODE;
118
121
  }
119
122
  /**
120
- * Get the appropriate icon for a category
123
+ * Get the appropriate icon for a category.
124
+ * Checks the categories store first (which includes API overrides),
125
+ * then falls back to the static CATEGORY_ICONS map, then to the default.
121
126
  * @param category - The category
122
127
  * @returns The icon to use
123
128
  */
124
129
  export function getCategoryIcon(category) {
125
- return CATEGORY_ICONS[category] || DEFAULT_ICONS.CATEGORY;
130
+ return getCategoryIconFromStore(category);
126
131
  }
127
132
  /**
128
133
  * Get a default icon by key
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.51",
5
+ "version": "0.0.53",
6
6
  "scripts": {
7
7
  "dev": "vite dev",
8
8
  "build": "vite build && npm run prepack",