@flowdrop/flowdrop 2.0.0-beta.7 → 2.0.0-beta.9
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/CHANGELOG.md +18 -0
- package/dist/components/App.svelte +467 -182
- package/dist/components/App.svelte.d.ts +14 -1
- package/dist/components/ConfigPanel.svelte +230 -12
- package/dist/components/ConfigPanel.svelte.d.ts +6 -0
- package/dist/components/SettingsPanel.svelte +22 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte +153 -0
- package/dist/components/surfaces/SurfaceOverlay.svelte.d.ts +14 -0
- package/dist/components/surfaces/TabbedSurface.svelte +133 -0
- package/dist/components/surfaces/TabbedSurface.svelte.d.ts +27 -0
- package/dist/stores/settingsStore.svelte.d.ts +13 -0
- package/dist/stores/settingsStore.svelte.js +32 -0
- package/dist/svelte-app.d.ts +12 -1
- package/dist/svelte-app.js +3 -1
- package/dist/types/settings.d.ts +16 -0
- package/dist/types/settings.js +3 -1
- package/dist/utils/portal.d.ts +18 -0
- package/dist/utils/portal.js +34 -0
- package/package.json +1 -1
|
@@ -64,6 +64,19 @@ export declare function getSystemThemeState(): ResolvedTheme;
|
|
|
64
64
|
* @returns Cleanup function that removes the listener
|
|
65
65
|
*/
|
|
66
66
|
export declare function initThemeListener(): () => void;
|
|
67
|
+
/**
|
|
68
|
+
* Seed UI settings from host-provided defaults (e.g. mount props) without
|
|
69
|
+
* overriding a returning user's persisted choices.
|
|
70
|
+
*
|
|
71
|
+
* For each provided key, the value is applied only when that key is **absent**
|
|
72
|
+
* from the persisted snapshot — so a mount prop sets the initial behavior but a
|
|
73
|
+
* value the user has actually changed always wins. Seeded values are not
|
|
74
|
+
* written to storage (storage stays user-driven), matching the precedence used
|
|
75
|
+
* by {@link initializeSettings}: library default < host default < user snapshot.
|
|
76
|
+
*
|
|
77
|
+
* @param partial - UI defaults to seed
|
|
78
|
+
*/
|
|
79
|
+
export declare function seedUiDefaults(partial: Partial<UISettings>): void;
|
|
67
80
|
/**
|
|
68
81
|
* Update settings with partial values
|
|
69
82
|
*
|
|
@@ -268,6 +268,38 @@ function notifyChange(category, key, previousValue, newValue) {
|
|
|
268
268
|
function getCategoryAsRecord(settings, category) {
|
|
269
269
|
return Object.fromEntries(Object.entries(settings[category]));
|
|
270
270
|
}
|
|
271
|
+
/**
|
|
272
|
+
* Seed UI settings from host-provided defaults (e.g. mount props) without
|
|
273
|
+
* overriding a returning user's persisted choices.
|
|
274
|
+
*
|
|
275
|
+
* For each provided key, the value is applied only when that key is **absent**
|
|
276
|
+
* from the persisted snapshot — so a mount prop sets the initial behavior but a
|
|
277
|
+
* value the user has actually changed always wins. Seeded values are not
|
|
278
|
+
* written to storage (storage stays user-driven), matching the precedence used
|
|
279
|
+
* by {@link initializeSettings}: library default < host default < user snapshot.
|
|
280
|
+
*
|
|
281
|
+
* @param partial - UI defaults to seed
|
|
282
|
+
*/
|
|
283
|
+
export function seedUiDefaults(partial) {
|
|
284
|
+
const persistedUi = loadRawFromStorage()?.ui ?? {};
|
|
285
|
+
const seeded = {};
|
|
286
|
+
for (const key of Object.keys(partial)) {
|
|
287
|
+
if (partial[key] === undefined)
|
|
288
|
+
continue;
|
|
289
|
+
if (key in persistedUi)
|
|
290
|
+
continue;
|
|
291
|
+
seeded[key] = partial[key];
|
|
292
|
+
}
|
|
293
|
+
if (Object.keys(seeded).length === 0)
|
|
294
|
+
return;
|
|
295
|
+
storeState = {
|
|
296
|
+
...storeState,
|
|
297
|
+
settings: {
|
|
298
|
+
...storeState.settings,
|
|
299
|
+
ui: { ...storeState.settings.ui, ...seeded }
|
|
300
|
+
}
|
|
301
|
+
};
|
|
302
|
+
}
|
|
271
303
|
/**
|
|
272
304
|
* Update settings with partial values
|
|
273
305
|
*
|
package/dist/svelte-app.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ import type { FlowDropTheme, FlowDropThemeName } from './types/theme.js';
|
|
|
14
14
|
import type { WorkflowFormatAdapter } from './registry/workflowFormatRegistry.js';
|
|
15
15
|
import { type FlowDropInstance } from './stores/instanceContainer.svelte.js';
|
|
16
16
|
import { type DraftStorageOption } from './services/draftStorage.js';
|
|
17
|
-
import type { PartialSettings, SettingsCategory } from './types/settings.js';
|
|
17
|
+
import type { PartialSettings, SettingsCategory, SurfacePlacement } from './types/settings.js';
|
|
18
18
|
import type { NavbarAction } from './types/navbar.js';
|
|
19
19
|
export type { NavbarAction };
|
|
20
20
|
/**
|
|
@@ -39,6 +39,17 @@ export interface FlowDropMountOptions {
|
|
|
39
39
|
showNavbar?: boolean;
|
|
40
40
|
/** Disable the node sidebar */
|
|
41
41
|
disableSidebar?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Default host for the config panel: `sidebar` (default), `modal`, or
|
|
44
|
+
* `below`. Seeds the user setting on first load; a later user change wins.
|
|
45
|
+
*/
|
|
46
|
+
configPlacement?: SurfacePlacement;
|
|
47
|
+
/**
|
|
48
|
+
* Default host for the console / AI Assistant group: `below` (default),
|
|
49
|
+
* `sidebar`, or `modal`. Seeds the user setting on first load; a later user
|
|
50
|
+
* change wins.
|
|
51
|
+
*/
|
|
52
|
+
consolePlacement?: SurfacePlacement;
|
|
42
53
|
/**
|
|
43
54
|
* Editor interaction mode. Replaces the former `readOnly` + `lockWorkflow`
|
|
44
55
|
* mount options (2.0). `'edit'` (default) allows editing; `'readonly'` and
|
package/dist/svelte-app.js
CHANGED
|
@@ -132,7 +132,7 @@ async function configureInstance(fd, options) {
|
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
134
|
export async function mountFlowDropApp(container, options = {}) {
|
|
135
|
-
const { workflow, nodes, endpointConfig, portConfig, categories, height = '100vh', width = '100%', showNavbar = false, disableSidebar, mode, pipelineId, navbarTitle, navbarActions, showSettings, showStatus, authProvider, eventHandlers, features: userFeatures, settings: initialSettings, draftStorageKey: customDraftKey, draftStorage, formatAdapters, theme, settingsCategories, showSettingsSyncButton, showSettingsResetButton, instanceId } = options;
|
|
135
|
+
const { workflow, nodes, endpointConfig, portConfig, categories, height = '100vh', width = '100%', showNavbar = false, disableSidebar, configPlacement, consolePlacement, mode, pipelineId, navbarTitle, navbarActions, showSettings, showStatus, authProvider, eventHandlers, features: userFeatures, settings: initialSettings, draftStorageKey: customDraftKey, draftStorage, formatAdapters, theme, settingsCategories, showSettingsSyncButton, showSettingsResetButton, instanceId } = options;
|
|
136
136
|
// Per-instance state container — this is what allows multiple FlowDrop
|
|
137
137
|
// editors to coexist on one page without sharing workflow/history state.
|
|
138
138
|
const { fd, isDefault } = acquireInstance(instanceId);
|
|
@@ -181,6 +181,8 @@ export async function mountFlowDropApp(container, options = {}) {
|
|
|
181
181
|
width,
|
|
182
182
|
showNavbar,
|
|
183
183
|
disableSidebar,
|
|
184
|
+
configPlacement,
|
|
185
|
+
consolePlacement,
|
|
184
186
|
mode,
|
|
185
187
|
pipelineId,
|
|
186
188
|
navbarTitle,
|
package/dist/types/settings.d.ts
CHANGED
|
@@ -45,6 +45,18 @@ export interface EditorSettings {
|
|
|
45
45
|
/** Distance threshold in pixels for proximity connect */
|
|
46
46
|
proximityConnectDistance: number;
|
|
47
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* Where an auxiliary surface (config panel, console/chat) is hosted.
|
|
50
|
+
*
|
|
51
|
+
* - `sidebar` — the right rail.
|
|
52
|
+
* - `modal` — a centered overlay floating above the canvas.
|
|
53
|
+
* - `below` — the bottom panel.
|
|
54
|
+
*
|
|
55
|
+
* Surfaces routed to the same host coexist as tabs. Modelled as one enum per
|
|
56
|
+
* surface (rather than a boolean per host) so invalid combinations — two hosts
|
|
57
|
+
* at once, or none — are unrepresentable.
|
|
58
|
+
*/
|
|
59
|
+
export type SurfacePlacement = 'sidebar' | 'modal' | 'below';
|
|
48
60
|
/**
|
|
49
61
|
* UI layout and display settings
|
|
50
62
|
*/
|
|
@@ -63,6 +75,10 @@ export interface UISettings {
|
|
|
63
75
|
consoleHeight: number;
|
|
64
76
|
/** Active tab in the bottom panel */
|
|
65
77
|
bottomPanelTab: 'console' | 'chat';
|
|
78
|
+
/** Where the node/workflow configuration panel is hosted. Default `sidebar`. */
|
|
79
|
+
configPlacement: SurfacePlacement;
|
|
80
|
+
/** Where the console / AI Assistant group is hosted. Default `below`. */
|
|
81
|
+
consolePlacement: SurfacePlacement;
|
|
66
82
|
}
|
|
67
83
|
/**
|
|
68
84
|
* Application behavior and automation settings
|
package/dist/types/settings.js
CHANGED
|
@@ -62,7 +62,9 @@ export const DEFAULT_UI_SETTINGS = {
|
|
|
62
62
|
theme: 'default',
|
|
63
63
|
consoleOpen: false,
|
|
64
64
|
consoleHeight: 300,
|
|
65
|
-
bottomPanelTab: 'console'
|
|
65
|
+
bottomPanelTab: 'console',
|
|
66
|
+
configPlacement: 'sidebar',
|
|
67
|
+
consolePlacement: 'below'
|
|
66
68
|
};
|
|
67
69
|
/**
|
|
68
70
|
* Default behavior settings
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte action that relocates an element to `document.body` (or another
|
|
3
|
+
* target) for its lifetime, then removes it on destroy.
|
|
4
|
+
*
|
|
5
|
+
* Modals and overlays use `position: fixed` expecting the viewport as their
|
|
6
|
+
* containing block. When any ancestor establishes a containing block — via
|
|
7
|
+
* `transform`, `filter`, `backdrop-filter`, `will-change`, `contain`, etc. —
|
|
8
|
+
* `fixed` resolves against that ancestor instead, causing clipping and
|
|
9
|
+
* mis-centering. Portalling the node to `document.body` sidesteps this by
|
|
10
|
+
* escaping those ancestors entirely.
|
|
11
|
+
*
|
|
12
|
+
* Usage: `<div use:portal>…</div>` or `<div use:portal={targetElement}>…</div>`.
|
|
13
|
+
* No-op during SSR (no `document`).
|
|
14
|
+
*/
|
|
15
|
+
export declare function portal(node: HTMLElement, target?: HTMLElement | undefined): {
|
|
16
|
+
update(nextTarget: HTMLElement | undefined): void;
|
|
17
|
+
destroy(): void;
|
|
18
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Svelte action that relocates an element to `document.body` (or another
|
|
3
|
+
* target) for its lifetime, then removes it on destroy.
|
|
4
|
+
*
|
|
5
|
+
* Modals and overlays use `position: fixed` expecting the viewport as their
|
|
6
|
+
* containing block. When any ancestor establishes a containing block — via
|
|
7
|
+
* `transform`, `filter`, `backdrop-filter`, `will-change`, `contain`, etc. —
|
|
8
|
+
* `fixed` resolves against that ancestor instead, causing clipping and
|
|
9
|
+
* mis-centering. Portalling the node to `document.body` sidesteps this by
|
|
10
|
+
* escaping those ancestors entirely.
|
|
11
|
+
*
|
|
12
|
+
* Usage: `<div use:portal>…</div>` or `<div use:portal={targetElement}>…</div>`.
|
|
13
|
+
* No-op during SSR (no `document`).
|
|
14
|
+
*/
|
|
15
|
+
export function portal(node, target = undefined) {
|
|
16
|
+
let host = null;
|
|
17
|
+
function mount(to) {
|
|
18
|
+
if (typeof document === 'undefined')
|
|
19
|
+
return;
|
|
20
|
+
host = to ?? document.body;
|
|
21
|
+
host.appendChild(node);
|
|
22
|
+
}
|
|
23
|
+
mount(target);
|
|
24
|
+
return {
|
|
25
|
+
update(nextTarget) {
|
|
26
|
+
mount(nextTarget);
|
|
27
|
+
},
|
|
28
|
+
destroy() {
|
|
29
|
+
if (node.parentNode) {
|
|
30
|
+
node.parentNode.removeChild(node);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "2.0.0-beta.
|
|
6
|
+
"version": "2.0.0-beta.9",
|
|
7
7
|
"author": "Shibin Das (D34dMan)",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/flowdrop-io/flowdrop/issues"
|