@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.
- package/dist/api/client.d.ts +5 -1
- package/dist/api/client.js +10 -0
- package/dist/components/App.svelte +2 -0
- package/dist/components/ConfigForm.svelte +1 -0
- package/dist/components/NodeSidebar.svelte +4 -21
- package/dist/components/SettingsPanel.svelte +1 -2
- package/dist/components/ThemeToggle.svelte +1 -1
- package/dist/components/WorkflowEditor.svelte +1 -2
- package/dist/components/form/FormAutocomplete.svelte +3 -12
- package/dist/components/form/FormField.svelte +1 -1
- package/dist/components/form/FormFieldLight.svelte +1 -1
- package/dist/components/nodes/TerminalNode.svelte +45 -9
- package/dist/components/nodes/TerminalNode.svelte.d.ts +2 -1
- package/dist/components/nodes/ToolNode.svelte +17 -11
- package/dist/config/defaultCategories.d.ts +7 -0
- package/dist/config/defaultCategories.js +126 -0
- package/dist/config/endpoints.d.ts +1 -0
- package/dist/config/endpoints.js +1 -0
- package/dist/core/index.d.ts +3 -3
- package/dist/core/index.js +1 -1
- package/dist/editor/index.d.ts +1 -0
- package/dist/editor/index.js +1 -0
- package/dist/services/categoriesApi.d.ts +14 -0
- package/dist/services/categoriesApi.js +41 -0
- package/dist/settings/index.d.ts +2 -1
- package/dist/settings/index.js +2 -1
- package/dist/stores/categoriesStore.d.ts +32 -0
- package/dist/stores/categoriesStore.js +80 -0
- package/dist/stores/settingsStore.d.ts +44 -2
- package/dist/stores/settingsStore.js +37 -15
- package/dist/svelte-app.d.ts +4 -1
- package/dist/svelte-app.js +30 -2
- package/dist/types/index.d.ts +38 -3
- package/dist/utils/colors.d.ts +5 -2
- package/dist/utils/colors.js +7 -3
- package/dist/utils/fetchWithAuth.d.ts +25 -0
- package/dist/utils/fetchWithAuth.js +34 -0
- package/dist/utils/icons.d.ts +7 -3
- package/dist/utils/icons.js +11 -6
- package/package.json +1 -1
- package/dist/stores/themeStore.d.ts +0 -68
- package/dist/stores/themeStore.js +0 -213
|
@@ -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
|
-
}
|