@d34dman/flowdrop 0.0.42 → 0.0.44

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 (97) hide show
  1. package/README.md +8 -8
  2. package/dist/api/enhanced-client.d.ts +3 -1
  3. package/dist/api/enhanced-client.js +35 -5
  4. package/dist/components/App.svelte +68 -34
  5. package/dist/components/ConfigForm.svelte +169 -142
  6. package/dist/components/ConfigForm.svelte.d.ts +4 -2
  7. package/dist/components/ConfigPanel.svelte +42 -15
  8. package/dist/components/LogsSidebar.svelte +20 -19
  9. package/dist/components/Navbar.svelte +150 -80
  10. package/dist/components/Navbar.svelte.d.ts +8 -0
  11. package/dist/components/NodeSidebar.svelte +330 -217
  12. package/dist/components/PipelineStatus.svelte +6 -1
  13. package/dist/components/ReadOnlyDetails.svelte +14 -14
  14. package/dist/components/SchemaForm.svelte +49 -30
  15. package/dist/components/SchemaForm.svelte.d.ts +11 -1
  16. package/dist/components/SettingsModal.svelte +279 -0
  17. package/dist/components/SettingsModal.svelte.d.ts +23 -0
  18. package/dist/components/SettingsPanel.svelte +615 -0
  19. package/dist/components/SettingsPanel.svelte.d.ts +21 -0
  20. package/dist/components/ThemeToggle.svelte +186 -0
  21. package/dist/components/ThemeToggle.svelte.d.ts +14 -0
  22. package/dist/components/WorkflowEditor.svelte +110 -36
  23. package/dist/components/form/FormArray.svelte +81 -81
  24. package/dist/components/form/FormAutocomplete.svelte +1014 -0
  25. package/dist/components/form/FormAutocomplete.svelte.d.ts +25 -0
  26. package/dist/components/form/FormCheckboxGroup.svelte +16 -16
  27. package/dist/components/form/FormCodeEditor.svelte +26 -26
  28. package/dist/components/form/FormField.svelte +52 -21
  29. package/dist/components/form/FormFieldLight.svelte +19 -19
  30. package/dist/components/form/FormFieldWrapper.svelte +4 -4
  31. package/dist/components/form/FormMarkdownEditor.svelte +124 -57
  32. package/dist/components/form/FormNumberField.svelte +13 -13
  33. package/dist/components/form/FormRangeField.svelte +16 -16
  34. package/dist/components/form/FormSelect.svelte +15 -15
  35. package/dist/components/form/FormTemplateEditor.svelte +34 -34
  36. package/dist/components/form/FormTextField.svelte +13 -13
  37. package/dist/components/form/FormTextarea.svelte +13 -13
  38. package/dist/components/form/FormToggle.svelte +8 -8
  39. package/dist/components/form/index.d.ts +1 -0
  40. package/dist/components/form/index.js +1 -0
  41. package/dist/components/form/types.d.ts +133 -8
  42. package/dist/components/form/types.js +50 -1
  43. package/dist/components/interrupt/ChoicePrompt.svelte +45 -38
  44. package/dist/components/interrupt/ConfirmationPrompt.svelte +35 -35
  45. package/dist/components/interrupt/FormPrompt.svelte +27 -20
  46. package/dist/components/interrupt/InterruptBubble.svelte +50 -50
  47. package/dist/components/interrupt/TextInputPrompt.svelte +39 -32
  48. package/dist/components/layouts/MainLayout.svelte +233 -34
  49. package/dist/components/layouts/MainLayout.svelte.d.ts +12 -0
  50. package/dist/components/nodes/GatewayNode.svelte +102 -73
  51. package/dist/components/nodes/IdeaNode.svelte +53 -52
  52. package/dist/components/nodes/NotesNode.svelte +120 -88
  53. package/dist/components/nodes/SimpleNode.svelte +67 -47
  54. package/dist/components/nodes/SquareNode.svelte +86 -49
  55. package/dist/components/nodes/TerminalNode.svelte +122 -72
  56. package/dist/components/nodes/ToolNode.svelte +96 -65
  57. package/dist/components/nodes/WorkflowNode.svelte +91 -67
  58. package/dist/components/playground/ChatPanel.svelte +76 -76
  59. package/dist/components/playground/ExecutionLogs.svelte +71 -69
  60. package/dist/components/playground/InputCollector.svelte +59 -59
  61. package/dist/components/playground/MessageBubble.svelte +111 -112
  62. package/dist/components/playground/Playground.svelte +184 -138
  63. package/dist/components/playground/PlaygroundModal.svelte +18 -19
  64. package/dist/components/playground/SessionManager.svelte +68 -67
  65. package/dist/config/defaultPortConfig.js +22 -22
  66. package/dist/core/index.d.ts +2 -0
  67. package/dist/core/index.js +1 -0
  68. package/dist/form/fieldRegistry.d.ts +17 -1
  69. package/dist/form/fieldRegistry.js +18 -2
  70. package/dist/form/index.d.ts +20 -2
  71. package/dist/form/index.js +19 -1
  72. package/dist/helpers/workflowEditorHelper.js +23 -11
  73. package/dist/index.d.ts +5 -0
  74. package/dist/index.js +13 -0
  75. package/dist/services/autoSaveService.d.ts +112 -0
  76. package/dist/services/autoSaveService.js +223 -0
  77. package/dist/services/settingsService.d.ts +92 -0
  78. package/dist/services/settingsService.js +202 -0
  79. package/dist/services/toastService.d.ts +9 -0
  80. package/dist/services/toastService.js +30 -1
  81. package/dist/stores/settingsStore.d.ts +128 -0
  82. package/dist/stores/settingsStore.js +488 -0
  83. package/dist/stores/themeStore.d.ts +68 -0
  84. package/dist/stores/themeStore.js +215 -0
  85. package/dist/styles/base.css +298 -621
  86. package/dist/styles/toast.css +33 -0
  87. package/dist/styles/tokens.css +366 -0
  88. package/dist/types/index.d.ts +78 -0
  89. package/dist/types/index.js +2 -0
  90. package/dist/types/interrupt.d.ts +2 -0
  91. package/dist/types/interrupt.js +8 -2
  92. package/dist/types/playground.d.ts +12 -0
  93. package/dist/types/settings.d.ts +185 -0
  94. package/dist/types/settings.js +101 -0
  95. package/dist/utils/colors.d.ts +100 -7
  96. package/dist/utils/colors.js +228 -67
  97. package/package.json +3 -3
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Settings Types for FlowDrop
3
+ *
4
+ * Provides comprehensive type definitions for all user-configurable settings.
5
+ * Supports theme, editor, UI, behavior, and API settings with hybrid persistence.
6
+ *
7
+ * @module types/settings
8
+ */
9
+ /**
10
+ * Theme preference options
11
+ * - 'light': Force light theme
12
+ * - 'dark': Force dark theme
13
+ * - 'auto': Follow system preference
14
+ */
15
+ export type ThemePreference = "light" | "dark" | "auto";
16
+ /**
17
+ * Resolved theme (actual applied theme, never 'auto')
18
+ */
19
+ export type ResolvedTheme = "light" | "dark";
20
+ /**
21
+ * Theme-related settings
22
+ */
23
+ export interface ThemeSettings {
24
+ /** User's theme preference */
25
+ preference: ThemePreference;
26
+ }
27
+ /**
28
+ * Editor canvas and interaction settings
29
+ */
30
+ export interface EditorSettings {
31
+ /** Show grid lines on the canvas */
32
+ showGrid: boolean;
33
+ /** Snap nodes to grid when dragging */
34
+ snapToGrid: boolean;
35
+ /** Grid cell size in pixels */
36
+ gridSize: number;
37
+ /** Show minimap for navigation */
38
+ showMinimap: boolean;
39
+ /** Default zoom level (1 = 100%) */
40
+ defaultZoom: number;
41
+ /** Automatically fit workflow to view on load */
42
+ fitViewOnLoad: boolean;
43
+ }
44
+ /**
45
+ * UI layout and display settings
46
+ */
47
+ export interface UISettings {
48
+ /** Width of the node sidebar in pixels */
49
+ sidebarWidth: number;
50
+ /** Whether the sidebar is collapsed */
51
+ sidebarCollapsed: boolean;
52
+ /** Enable compact mode for denser UI */
53
+ compactMode: boolean;
54
+ }
55
+ /**
56
+ * Application behavior and automation settings
57
+ */
58
+ export interface BehaviorSettings {
59
+ /** Automatically save changes */
60
+ autoSave: boolean;
61
+ /** Auto-save interval in milliseconds */
62
+ autoSaveInterval: number;
63
+ /** Maximum number of undo history entries */
64
+ undoHistoryLimit: number;
65
+ /** Show confirmation dialog before deleting nodes */
66
+ confirmDelete: boolean;
67
+ }
68
+ /**
69
+ * API connection and request settings
70
+ */
71
+ export interface ApiSettings {
72
+ /** Request timeout in milliseconds */
73
+ timeout: number;
74
+ /** Enable automatic retry on failure */
75
+ retryEnabled: boolean;
76
+ /** Maximum number of retry attempts */
77
+ retryAttempts: number;
78
+ /** Enable response caching */
79
+ cacheEnabled: boolean;
80
+ }
81
+ /**
82
+ * All FlowDrop settings organized by category
83
+ */
84
+ export interface FlowDropSettings {
85
+ /** Theme appearance settings */
86
+ theme: ThemeSettings;
87
+ /** Editor canvas settings */
88
+ editor: EditorSettings;
89
+ /** UI layout settings */
90
+ ui: UISettings;
91
+ /** Application behavior settings */
92
+ behavior: BehaviorSettings;
93
+ /** API connection settings */
94
+ api: ApiSettings;
95
+ }
96
+ /**
97
+ * Settings category names for iteration and tab rendering
98
+ */
99
+ export type SettingsCategory = keyof FlowDropSettings;
100
+ /**
101
+ * All available settings categories
102
+ */
103
+ export declare const SETTINGS_CATEGORIES: SettingsCategory[];
104
+ /**
105
+ * Human-readable labels for settings categories
106
+ */
107
+ export declare const SETTINGS_CATEGORY_LABELS: Record<SettingsCategory, string>;
108
+ /**
109
+ * Icons for settings categories (Iconify icon names)
110
+ */
111
+ export declare const SETTINGS_CATEGORY_ICONS: Record<SettingsCategory, string>;
112
+ /**
113
+ * Default theme settings
114
+ */
115
+ export declare const DEFAULT_THEME_SETTINGS: ThemeSettings;
116
+ /**
117
+ * Default editor settings
118
+ */
119
+ export declare const DEFAULT_EDITOR_SETTINGS: EditorSettings;
120
+ /**
121
+ * Default UI settings
122
+ */
123
+ export declare const DEFAULT_UI_SETTINGS: UISettings;
124
+ /**
125
+ * Default behavior settings
126
+ */
127
+ export declare const DEFAULT_BEHAVIOR_SETTINGS: BehaviorSettings;
128
+ /**
129
+ * Default API settings
130
+ */
131
+ export declare const DEFAULT_API_SETTINGS: ApiSettings;
132
+ /**
133
+ * Complete default settings object
134
+ */
135
+ export declare const DEFAULT_SETTINGS: FlowDropSettings;
136
+ /**
137
+ * Deep partial type for nested settings updates
138
+ */
139
+ export type DeepPartial<T> = {
140
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
141
+ };
142
+ /**
143
+ * Partial settings for incremental updates
144
+ */
145
+ export type PartialSettings = DeepPartial<FlowDropSettings>;
146
+ /**
147
+ * Event payload for settings changes
148
+ */
149
+ export interface SettingsChangeEvent {
150
+ /** The category that changed */
151
+ category: SettingsCategory;
152
+ /** The key within the category that changed */
153
+ key: string;
154
+ /** The previous value */
155
+ previousValue: unknown;
156
+ /** The new value */
157
+ newValue: unknown;
158
+ }
159
+ /**
160
+ * Callback type for settings change listeners
161
+ */
162
+ export type SettingsChangeCallback = (event: SettingsChangeEvent) => void;
163
+ /**
164
+ * localStorage key for persisting settings
165
+ */
166
+ export declare const SETTINGS_STORAGE_KEY = "flowdrop-settings";
167
+ /**
168
+ * API sync status
169
+ */
170
+ export type SyncStatus = "idle" | "syncing" | "synced" | "error";
171
+ /**
172
+ * Settings store state including sync metadata
173
+ */
174
+ export interface SettingsStoreState {
175
+ /** Current settings values */
176
+ settings: FlowDropSettings;
177
+ /** Whether settings have been loaded from storage */
178
+ initialized: boolean;
179
+ /** API sync status */
180
+ syncStatus: SyncStatus;
181
+ /** Last sync timestamp */
182
+ lastSyncedAt: number | null;
183
+ /** Last sync error message */
184
+ syncError: string | null;
185
+ }
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Settings Types for FlowDrop
3
+ *
4
+ * Provides comprehensive type definitions for all user-configurable settings.
5
+ * Supports theme, editor, UI, behavior, and API settings with hybrid persistence.
6
+ *
7
+ * @module types/settings
8
+ */
9
+ /**
10
+ * All available settings categories
11
+ */
12
+ export const SETTINGS_CATEGORIES = [
13
+ "theme",
14
+ "editor",
15
+ "ui",
16
+ "behavior",
17
+ "api"
18
+ ];
19
+ /**
20
+ * Human-readable labels for settings categories
21
+ */
22
+ export const SETTINGS_CATEGORY_LABELS = {
23
+ theme: "Theme",
24
+ editor: "Editor",
25
+ ui: "UI",
26
+ behavior: "Behavior",
27
+ api: "API"
28
+ };
29
+ /**
30
+ * Icons for settings categories (Iconify icon names)
31
+ */
32
+ export const SETTINGS_CATEGORY_ICONS = {
33
+ theme: "mdi:palette",
34
+ editor: "mdi:grid",
35
+ ui: "mdi:view-dashboard",
36
+ behavior: "mdi:cog-play",
37
+ api: "mdi:api"
38
+ };
39
+ // =========================================================================
40
+ // Default Settings
41
+ // =========================================================================
42
+ /**
43
+ * Default theme settings
44
+ */
45
+ export const DEFAULT_THEME_SETTINGS = {
46
+ preference: "auto"
47
+ };
48
+ /**
49
+ * Default editor settings
50
+ */
51
+ export const DEFAULT_EDITOR_SETTINGS = {
52
+ showGrid: true,
53
+ snapToGrid: true,
54
+ gridSize: 20,
55
+ showMinimap: true,
56
+ defaultZoom: 1,
57
+ fitViewOnLoad: true
58
+ };
59
+ /**
60
+ * Default UI settings
61
+ */
62
+ export const DEFAULT_UI_SETTINGS = {
63
+ sidebarWidth: 280,
64
+ sidebarCollapsed: false,
65
+ compactMode: false
66
+ };
67
+ /**
68
+ * Default behavior settings
69
+ */
70
+ export const DEFAULT_BEHAVIOR_SETTINGS = {
71
+ autoSave: false,
72
+ autoSaveInterval: 30000,
73
+ undoHistoryLimit: 50,
74
+ confirmDelete: true
75
+ };
76
+ /**
77
+ * Default API settings
78
+ */
79
+ export const DEFAULT_API_SETTINGS = {
80
+ timeout: 30000,
81
+ retryEnabled: true,
82
+ retryAttempts: 3,
83
+ cacheEnabled: true
84
+ };
85
+ /**
86
+ * Complete default settings object
87
+ */
88
+ export const DEFAULT_SETTINGS = {
89
+ theme: DEFAULT_THEME_SETTINGS,
90
+ editor: DEFAULT_EDITOR_SETTINGS,
91
+ ui: DEFAULT_UI_SETTINGS,
92
+ behavior: DEFAULT_BEHAVIOR_SETTINGS,
93
+ api: DEFAULT_API_SETTINGS
94
+ };
95
+ // =========================================================================
96
+ // Settings Persistence Types
97
+ // =========================================================================
98
+ /**
99
+ * localStorage key for persisting settings
100
+ */
101
+ export const SETTINGS_STORAGE_KEY = "flowdrop-settings";
@@ -5,11 +5,12 @@
5
5
  */
6
6
  import type { NodeCategory, PortDataTypeConfig } from '../types/index.js';
7
7
  /**
8
- * Category color mapping to reference tokens (CSS variables)
8
+ * Category color mapping to design tokens (CSS variables)
9
+ * Uses --fd-node-* tokens from tokens.css
9
10
  */
10
11
  export declare const CATEGORY_COLOR_TOKENS: Record<NodeCategory, string>;
11
12
  /**
12
- * Get the reference color token for a category
13
+ * Get the design token for a category color
13
14
  */
14
15
  export declare function getCategoryColorToken(category: NodeCategory): string;
15
16
  /**
@@ -158,6 +159,59 @@ export declare function hexToRgb(hex: string): {
158
159
  g: number;
159
160
  b: number;
160
161
  } | null;
162
+ /**
163
+ * Calculate the relative luminance of a color
164
+ * Based on WCAG 2.1 guidelines for contrast calculations
165
+ * @param r - Red component (0-255)
166
+ * @param g - Green component (0-255)
167
+ * @param b - Blue component (0-255)
168
+ * @returns Relative luminance value (0-1)
169
+ */
170
+ export declare function getRelativeLuminance(r: number, g: number, b: number): number;
171
+ /**
172
+ * Determine if a background color is considered "light" (needs dark text)
173
+ * @param hex - Hex color string
174
+ * @returns True if the color is light and needs dark text for contrast
175
+ */
176
+ export declare function isLightColor(hex: string): boolean;
177
+ /**
178
+ * Get the appropriate contrast text color (black or white) for a background
179
+ * @param backgroundColor - Hex color string of the background
180
+ * @returns CSS color value for text that provides good contrast
181
+ */
182
+ export declare function getContrastTextColor(backgroundColor: string): string;
183
+ /**
184
+ * Resolve a CSS variable token to its hex value
185
+ * @param token - CSS variable token (e.g., "var(--fd-node-amber)")
186
+ * @returns Hex color value or the original value if not a known token
187
+ */
188
+ export declare function resolveColorToken(token: string): string;
189
+ /**
190
+ * Get the appropriate contrast text color for a data type badge
191
+ * @param dataType - The data type (e.g., "array", "string", "number")
192
+ * @returns CSS color value for text that provides good contrast on the data type's background
193
+ */
194
+ export declare function getContrastTextColorForDataType(dataType: string): string;
195
+ /**
196
+ * Get the appropriate contrast text color for a category badge
197
+ * @param category - The node category
198
+ * @returns CSS color value for text that provides good contrast on the category's background
199
+ */
200
+ export declare function getContrastTextColorForCategory(category: NodeCategory): string;
201
+ /**
202
+ * Get a semi-transparent tinted background color for ports
203
+ * Creates a cohesive look with the icon wrapper styling
204
+ * @param dataType - The data type
205
+ * @param opacity - Opacity percentage (default 25%)
206
+ * @returns CSS color-mix expression for the tinted background
207
+ */
208
+ export declare function getPortBackgroundColor(dataType: string, opacity?: number): string;
209
+ /**
210
+ * Get the border color for ports (solid data type color)
211
+ * @param dataType - The data type
212
+ * @returns CSS color value for the port border
213
+ */
214
+ export declare function getPortBorderColor(dataType: string): string;
161
215
  /**
162
216
  * Convert RGB components to hex color string
163
217
  * @param r - Red component (0-255)
@@ -168,25 +222,64 @@ export declare function hexToRgb(hex: string): {
168
222
  export declare function rgbToHex(r: number, g: number, b: number): string;
169
223
  /**
170
224
  * Generate a light tint of a color (similar to Tailwind's -50 shade)
171
- * Creates a very light background-friendly version of the color
225
+ * Creates a very light background-friendly version of the color for light mode
172
226
  * @param hex - Base hex color string
173
227
  * @returns Light tint hex color string
174
228
  */
175
229
  export declare function getLightTint(hex: string): string;
230
+ /**
231
+ * Generate a dark tint of a color for dark mode backgrounds
232
+ * Creates a subtle, muted version of the color that works well on dark backgrounds
233
+ * @param hex - Base hex color string
234
+ * @param opacity - Optional opacity for the color overlay (default 0.15)
235
+ * @returns Dark tint hex color string
236
+ */
237
+ export declare function getDarkTint(hex: string, opacity?: number): string;
176
238
  /**
177
239
  * Generate a border tint of a color (similar to Tailwind's -300 shade)
178
- * Creates a medium-light version suitable for borders
240
+ * Creates a medium-light version suitable for borders in light mode
179
241
  * @param hex - Base hex color string
180
242
  * @returns Border tint hex color string
181
243
  */
182
244
  export declare function getBorderTint(hex: string): string;
245
+ /**
246
+ * Generate a dark border tint of a color for dark mode
247
+ * Creates a medium-dark version suitable for borders in dark mode
248
+ * @param hex - Base hex color string
249
+ * @returns Dark border tint hex color string
250
+ */
251
+ export declare function getDarkBorderTint(hex: string): string;
252
+ /**
253
+ * Color variants interface for theming components
254
+ */
255
+ export interface ColorVariants {
256
+ /** Base color value */
257
+ base: string;
258
+ /** Light tint for light mode backgrounds */
259
+ light: string;
260
+ /** Border tint for light mode borders */
261
+ border: string;
262
+ /** Dark tint for dark mode backgrounds */
263
+ darkLight: string;
264
+ /** Dark border tint for dark mode borders */
265
+ darkBorder: string;
266
+ }
183
267
  /**
184
268
  * Generate color variants for theming a component
269
+ * Returns variants for both light and dark modes
185
270
  * @param baseColor - Base hex color string
186
- * @returns Object with base, light, and border color variants
271
+ * @returns Object with base, light, border, darkLight, and darkBorder color variants
187
272
  */
188
- export declare function getColorVariants(baseColor: string): {
273
+ export declare function getColorVariants(baseColor: string): ColorVariants;
274
+ /**
275
+ * Get theme-aware color variants
276
+ * Returns the appropriate light or dark variants based on the theme
277
+ * @param baseColor - Base hex color string
278
+ * @param isDarkMode - Whether dark mode is active
279
+ * @returns Object with base, background, and border colors appropriate for the theme
280
+ */
281
+ export declare function getThemeAwareColorVariants(baseColor: string, isDarkMode: boolean): {
189
282
  base: string;
190
- light: string;
283
+ background: string;
191
284
  border: string;
192
285
  };