@d34dman/flowdrop 0.0.52 → 0.0.54

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 (40) hide show
  1. package/dist/components/App.svelte +9 -6
  2. package/dist/components/ConfigForm.svelte +1 -0
  3. package/dist/components/NodeSidebar.svelte +0 -2
  4. package/dist/components/PortCoordinateTracker.svelte +58 -0
  5. package/dist/components/PortCoordinateTracker.svelte.d.ts +12 -0
  6. package/dist/components/SettingsPanel.svelte +1 -2
  7. package/dist/components/ThemeToggle.svelte +1 -1
  8. package/dist/components/WorkflowEditor.svelte +44 -11
  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/SimpleNode.svelte +0 -6
  13. package/dist/components/nodes/SquareNode.svelte +0 -4
  14. package/dist/components/nodes/TerminalNode.svelte +45 -9
  15. package/dist/components/nodes/TerminalNode.svelte.d.ts +2 -1
  16. package/dist/components/nodes/ToolNode.svelte +17 -11
  17. package/dist/components/nodes/WorkflowNode.svelte +0 -10
  18. package/dist/core/index.d.ts +2 -2
  19. package/dist/core/index.js +1 -1
  20. package/dist/editor/index.d.ts +1 -0
  21. package/dist/editor/index.js +2 -0
  22. package/dist/helpers/proximityConnect.d.ts +19 -3
  23. package/dist/helpers/proximityConnect.js +109 -7
  24. package/dist/playground/index.d.ts +1 -1
  25. package/dist/playground/index.js +1 -1
  26. package/dist/services/portConfigApi.js +0 -11
  27. package/dist/settings/index.d.ts +2 -1
  28. package/dist/settings/index.js +2 -1
  29. package/dist/stores/interruptStore.d.ts +8 -30
  30. package/dist/stores/interruptStore.js +7 -76
  31. package/dist/stores/portCoordinateStore.d.ts +60 -0
  32. package/dist/stores/portCoordinateStore.js +186 -0
  33. package/dist/stores/settingsStore.d.ts +44 -2
  34. package/dist/stores/settingsStore.js +37 -15
  35. package/dist/types/index.d.ts +22 -0
  36. package/dist/utils/fetchWithAuth.d.ts +25 -0
  37. package/dist/utils/fetchWithAuth.js +34 -0
  38. package/package.json +1 -1
  39. package/dist/stores/themeStore.d.ts +0 -68
  40. package/dist/stores/themeStore.js +0 -213
@@ -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
  // =========================================================================
@@ -108,6 +108,26 @@ export interface NodePort {
108
108
  */
109
109
  schema?: OutputSchema | InputSchema;
110
110
  }
111
+ /**
112
+ * Absolute position of a port handle in canvas space.
113
+ * Used by proximity connect and other features that need port positions.
114
+ */
115
+ export interface PortCoordinate {
116
+ /** Absolute X position in canvas space */
117
+ x: number;
118
+ /** Absolute Y position in canvas space */
119
+ y: number;
120
+ /** Handle ID in format: ${nodeId}-${direction}-${portId} */
121
+ handleId: string;
122
+ /** The node this port belongs to */
123
+ nodeId: string;
124
+ /** Port direction */
125
+ direction: 'input' | 'output';
126
+ /** Port data type for compatibility checks */
127
+ dataType: string;
128
+ }
129
+ /** Map of handle IDs to their absolute canvas coordinates */
130
+ export type PortCoordinateMap = Map<string, PortCoordinate>;
111
131
  /**
112
132
  * Dynamic port configuration for user-defined inputs/outputs
113
133
  * These are defined in the node's config and allow users to create
@@ -511,6 +531,8 @@ export interface NodeMetadata {
511
531
  color?: string;
512
532
  /** Badge label displayed in the node header (e.g., "TOOL", "API", "LLM"). Overridable per-instance via config.instanceBadge. */
513
533
  badge?: string;
534
+ /** Port dataType to expose on tool nodes. Defaults to 'tool'. Set to another type (e.g., 'trigger') to show that port instead. */
535
+ portDataType?: string;
514
536
  inputs: NodePort[];
515
537
  outputs: NodePort[];
516
538
  configSchema?: ConfigSchema;
@@ -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
+ }
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.52",
5
+ "version": "0.0.54",
6
6
  "scripts": {
7
7
  "dev": "vite dev",
8
8
  "build": "vite build && npm run prepack",
@@ -1,68 +0,0 @@
1
- /**
2
- * Theme Store for FlowDrop
3
- *
4
- * @deprecated This module is deprecated. Use `settingsStore` instead.
5
- *
6
- * The theme functionality has been moved to the unified settings system.
7
- * Import from settingsStore for new code:
8
- *
9
- * ```typescript
10
- * import { theme, resolvedTheme, setTheme, toggleTheme, cycleTheme } from "./settingsStore.js";
11
- * ```
12
- *
13
- * This module re-exports from settingsStore for backward compatibility.
14
- *
15
- * Provides reactive theme state management with:
16
- * - Three theme modes: 'light', 'dark', 'auto' (follows system preference)
17
- * - localStorage persistence
18
- * - System preference detection via matchMedia
19
- * - Automatic data-theme attribute application
20
- *
21
- * @module stores/themeStore
22
- */
23
- /** Theme preference options */
24
- export type ThemePreference = 'light' | 'dark' | 'auto';
25
- /** Resolved theme (actual applied theme, never 'auto') */
26
- export type ResolvedTheme = 'light' | 'dark';
27
- /**
28
- * User's theme preference store
29
- * Can be 'light', 'dark', or 'auto'
30
- */
31
- export declare const theme: import("svelte/store").Writable<ThemePreference>;
32
- /**
33
- * Resolved theme store
34
- * Always returns the actual theme being applied ('light' or 'dark')
35
- * When theme is 'auto', this reflects the system preference
36
- */
37
- export declare const resolvedTheme: import("svelte/store").Readable<ResolvedTheme>;
38
- /**
39
- * Set the theme preference
40
- *
41
- * @param newTheme - The new theme preference ('light', 'dark', or 'auto')
42
- */
43
- export declare function setTheme(newTheme: ThemePreference): void;
44
- /**
45
- * Toggle between light and dark themes
46
- * If currently 'auto', switches to the opposite of system preference
47
- */
48
- export declare function toggleTheme(): void;
49
- /**
50
- * Cycle through theme options: light -> dark -> auto -> light
51
- */
52
- export declare function cycleTheme(): void;
53
- /**
54
- * Initialize the theme system
55
- * Should be called once on app startup
56
- *
57
- * This function:
58
- * 1. Applies the current resolved theme to the document
59
- * 2. Sets up reactivity to apply theme changes
60
- */
61
- export declare function initializeTheme(): void;
62
- /**
63
- * Check if theme system is initialized
64
- * Useful for SSR scenarios
65
- *
66
- * @returns true if running in browser and theme is applied
67
- */
68
- export declare function isThemeInitialized(): boolean;
@@ -1,213 +0,0 @@
1
- /**
2
- * Theme Store for FlowDrop
3
- *
4
- * @deprecated This module is deprecated. Use `settingsStore` instead.
5
- *
6
- * The theme functionality has been moved to the unified settings system.
7
- * Import from settingsStore for new code:
8
- *
9
- * ```typescript
10
- * import { theme, resolvedTheme, setTheme, toggleTheme, cycleTheme } from "./settingsStore.js";
11
- * ```
12
- *
13
- * This module re-exports from settingsStore for backward compatibility.
14
- *
15
- * Provides reactive theme state management with:
16
- * - Three theme modes: 'light', 'dark', 'auto' (follows system preference)
17
- * - localStorage persistence
18
- * - System preference detection via matchMedia
19
- * - Automatic data-theme attribute application
20
- *
21
- * @module stores/themeStore
22
- */
23
- import { writable, derived, get } from 'svelte/store';
24
- /** localStorage key for persisting theme preference */
25
- const STORAGE_KEY = 'flowdrop-theme';
26
- /** Default theme preference when none is stored */
27
- const DEFAULT_THEME = 'auto';
28
- // =========================================================================
29
- // System Preference Detection
30
- // =========================================================================
31
- /**
32
- * Get the system's color scheme preference
33
- *
34
- * @returns 'dark' if system prefers dark mode, 'light' otherwise
35
- */
36
- function getSystemTheme() {
37
- if (typeof window === 'undefined') {
38
- return 'light';
39
- }
40
- return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
41
- }
42
- /**
43
- * Store for system theme preference
44
- * Updates when system preference changes
45
- */
46
- const systemTheme = writable(typeof window !== 'undefined' ? getSystemTheme() : 'light');
47
- // Listen for system theme changes
48
- if (typeof window !== 'undefined') {
49
- const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
50
- /**
51
- * Handler for system theme preference changes
52
- */
53
- const handleSystemThemeChange = (event) => {
54
- systemTheme.set(event.matches ? 'dark' : 'light');
55
- };
56
- // Modern browsers use addEventListener
57
- if (mediaQuery.addEventListener) {
58
- mediaQuery.addEventListener('change', handleSystemThemeChange);
59
- }
60
- else {
61
- // Fallback for older browsers
62
- mediaQuery.addListener(handleSystemThemeChange);
63
- }
64
- }
65
- // =========================================================================
66
- // Theme Preference Store
67
- // =========================================================================
68
- /**
69
- * Load saved theme preference from localStorage
70
- *
71
- * @returns Saved theme preference or default
72
- */
73
- function loadSavedTheme() {
74
- if (typeof window === 'undefined') {
75
- return DEFAULT_THEME;
76
- }
77
- try {
78
- const saved = localStorage.getItem(STORAGE_KEY);
79
- if (saved === 'light' || saved === 'dark' || saved === 'auto') {
80
- return saved;
81
- }
82
- }
83
- catch {
84
- // localStorage may be unavailable (e.g., private browsing)
85
- console.warn('Failed to load theme from localStorage');
86
- }
87
- return DEFAULT_THEME;
88
- }
89
- /**
90
- * Save theme preference to localStorage
91
- *
92
- * @param theme - Theme preference to save
93
- */
94
- function saveTheme(theme) {
95
- if (typeof window === 'undefined') {
96
- return;
97
- }
98
- try {
99
- localStorage.setItem(STORAGE_KEY, theme);
100
- }
101
- catch {
102
- // localStorage may be unavailable
103
- console.warn('Failed to save theme to localStorage');
104
- }
105
- }
106
- /**
107
- * User's theme preference store
108
- * Can be 'light', 'dark', or 'auto'
109
- */
110
- export const theme = writable(loadSavedTheme());
111
- // =========================================================================
112
- // Resolved Theme Store
113
- // =========================================================================
114
- /**
115
- * Resolved theme store
116
- * Always returns the actual theme being applied ('light' or 'dark')
117
- * When theme is 'auto', this reflects the system preference
118
- */
119
- export const resolvedTheme = derived([theme, systemTheme], ([$theme, $systemTheme]) => {
120
- if ($theme === 'auto') {
121
- return $systemTheme;
122
- }
123
- return $theme;
124
- });
125
- // =========================================================================
126
- // Theme Actions
127
- // =========================================================================
128
- /**
129
- * Apply theme to the document
130
- * Sets the data-theme attribute on the document element
131
- *
132
- * @param resolved - The resolved theme to apply
133
- */
134
- function applyTheme(resolved) {
135
- if (typeof document === 'undefined') {
136
- return;
137
- }
138
- document.documentElement.setAttribute('data-theme', resolved);
139
- }
140
- /**
141
- * Set the theme preference
142
- *
143
- * @param newTheme - The new theme preference ('light', 'dark', or 'auto')
144
- */
145
- export function setTheme(newTheme) {
146
- theme.set(newTheme);
147
- saveTheme(newTheme);
148
- }
149
- /**
150
- * Toggle between light and dark themes
151
- * If currently 'auto', switches to the opposite of system preference
152
- */
153
- export function toggleTheme() {
154
- const currentTheme = get(theme);
155
- const currentResolved = get(resolvedTheme);
156
- if (currentTheme === 'auto') {
157
- // Switch to opposite of system preference
158
- setTheme(currentResolved === 'dark' ? 'light' : 'dark');
159
- }
160
- else {
161
- // Toggle between light and dark
162
- setTheme(currentTheme === 'dark' ? 'light' : 'dark');
163
- }
164
- }
165
- /**
166
- * Cycle through theme options: light -> dark -> auto -> light
167
- */
168
- export function cycleTheme() {
169
- const currentTheme = get(theme);
170
- switch (currentTheme) {
171
- case 'light':
172
- setTheme('dark');
173
- break;
174
- case 'dark':
175
- setTheme('auto');
176
- break;
177
- case 'auto':
178
- setTheme('light');
179
- break;
180
- }
181
- }
182
- // =========================================================================
183
- // Initialization
184
- // =========================================================================
185
- /**
186
- * Initialize the theme system
187
- * Should be called once on app startup
188
- *
189
- * This function:
190
- * 1. Applies the current resolved theme to the document
191
- * 2. Sets up reactivity to apply theme changes
192
- */
193
- export function initializeTheme() {
194
- // Apply initial theme
195
- const resolved = get(resolvedTheme);
196
- applyTheme(resolved);
197
- // Subscribe to resolved theme changes and apply them
198
- resolvedTheme.subscribe((resolved) => {
199
- applyTheme(resolved);
200
- });
201
- }
202
- /**
203
- * Check if theme system is initialized
204
- * Useful for SSR scenarios
205
- *
206
- * @returns true if running in browser and theme is applied
207
- */
208
- export function isThemeInitialized() {
209
- if (typeof document === 'undefined') {
210
- return false;
211
- }
212
- return document.documentElement.hasAttribute('data-theme');
213
- }