@flowdrop/flowdrop 2.0.0-beta.6 → 2.0.0-beta.8
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 +25 -0
- package/dist/commands/executor.js +46 -20
- package/dist/components/App.svelte +467 -182
- package/dist/components/App.svelte.d.ts +14 -1
- package/dist/components/ConfigForm.svelte +93 -25
- package/dist/components/ConfigPanel.svelte +223 -12
- package/dist/components/ConfigPanel.svelte.d.ts +6 -0
- package/dist/components/SettingsPanel.svelte +22 -0
- package/dist/components/form/FormFieldset.svelte +44 -10
- package/dist/components/form/FormRangeField.svelte +43 -3
- package/dist/components/surfaces/SurfaceOverlay.svelte +146 -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/services/dynamicSchemaService.d.ts +29 -2
- package/dist/services/dynamicSchemaService.js +54 -25
- package/dist/stores/settingsStore.svelte.d.ts +13 -0
- package/dist/stores/settingsStore.svelte.js +32 -0
- package/dist/stores/workflowStore.svelte.js +6 -1
- package/dist/svelte-app.d.ts +12 -1
- package/dist/svelte-app.js +3 -1
- package/dist/types/index.d.ts +29 -0
- package/dist/types/settings.d.ts +16 -0
- package/dist/types/settings.js +3 -1
- package/dist/types/uischema.d.ts +5 -0
- package/dist/utils/portal.d.ts +18 -0
- package/dist/utils/portal.js +34 -0
- package/dist/utils/schemaMerge.d.ts +25 -0
- package/dist/utils/schemaMerge.js +61 -0
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ import type { AuthProvider } from '../types/auth.js';
|
|
|
6
6
|
import type { FlowDropEventHandlers, FlowDropFeatures } from '../types/events.js';
|
|
7
7
|
import type { FlowDropTheme, FlowDropThemeName } from '../types/theme.js';
|
|
8
8
|
import type { FlowDropInstance } from '../stores/instanceContainer.svelte.js';
|
|
9
|
-
import type { SettingsCategory } from '../types/settings.js';
|
|
9
|
+
import type { SettingsCategory, SurfacePlacement } from '../types/settings.js';
|
|
10
10
|
import type { MessagesOverride } from '../messages/index.js';
|
|
11
11
|
/**
|
|
12
12
|
* Configuration props for runtime customization
|
|
@@ -24,6 +24,19 @@ interface Props {
|
|
|
24
24
|
showNavbar?: boolean;
|
|
25
25
|
/** Disable the node sidebar */
|
|
26
26
|
disableSidebar?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Default host for the node/workflow configuration panel: `sidebar` (right
|
|
29
|
+
* rail), `modal` (centered overlay), or `below` (bottom panel). Seeds the
|
|
30
|
+
* user setting on first load — a value the user later changes wins.
|
|
31
|
+
* @default 'sidebar'
|
|
32
|
+
*/
|
|
33
|
+
configPlacement?: SurfacePlacement;
|
|
34
|
+
/**
|
|
35
|
+
* Default host for the console / AI Assistant group. Seeds the user setting
|
|
36
|
+
* on first load — a value the user later changes wins.
|
|
37
|
+
* @default 'below'
|
|
38
|
+
*/
|
|
39
|
+
consolePlacement?: SurfacePlacement;
|
|
27
40
|
/**
|
|
28
41
|
* Editor interaction mode. Replaces the former `readOnly` + `lockWorkflow`
|
|
29
42
|
* boolean pair (2.0 breaking change).
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
getEffectiveConfigEditOptions,
|
|
38
38
|
fetchDynamicSchema,
|
|
39
39
|
resolveExternalEditUrl,
|
|
40
|
+
resolveDynamicSchemaKey,
|
|
40
41
|
invalidateSchemaCache,
|
|
41
42
|
type DynamicSchemaResult
|
|
42
43
|
} from '../services/dynamicSchemaService.js';
|
|
@@ -45,6 +46,7 @@
|
|
|
45
46
|
import { getAvailableVariables } from '../services/variableService.js';
|
|
46
47
|
import { logger } from '../utils/logger.js';
|
|
47
48
|
import { mergeWithDefaults, cascadeClearAutocompleteDependents } from '../utils/formMerge.js';
|
|
49
|
+
import { applyFetchedSchema } from '../utils/schemaMerge.js';
|
|
48
50
|
|
|
49
51
|
interface Props {
|
|
50
52
|
/** Optional workflow node (if provided, schema and values are derived from it) */
|
|
@@ -120,6 +122,9 @@
|
|
|
120
122
|
let dynamicSchemaLoading = $state(false);
|
|
121
123
|
let dynamicSchemaError = $state<string | null>(null);
|
|
122
124
|
let fetchedDynamicSchema = $state<ConfigSchema | null>(null);
|
|
125
|
+
// A uiSchema the endpoint returned alongside the schema (server-hydrated
|
|
126
|
+
// forms). Held next to fetchedDynamicSchema and cleared in lockstep with it.
|
|
127
|
+
let fetchedDynamicUiSchema = $state<UISchemaElement | null>(null);
|
|
123
128
|
|
|
124
129
|
/**
|
|
125
130
|
* Get the admin edit configuration for the node
|
|
@@ -154,38 +159,73 @@
|
|
|
154
159
|
* Priority: fetchedDynamicSchema > direct schema prop > node metadata configSchema
|
|
155
160
|
*/
|
|
156
161
|
const configSchema = $derived.by<ConfigSchema | undefined>(() => {
|
|
157
|
-
|
|
162
|
+
const staticSchema = schema ?? (node?.data.metadata?.configSchema as ConfigSchema | undefined);
|
|
163
|
+
// A fetched dynamic schema is layered onto the static one per the endpoint's
|
|
164
|
+
// mergeStrategy/target (default 'replace' → fetched wins wholesale). With no
|
|
165
|
+
// static schema, the fetched schema is the form.
|
|
158
166
|
if (fetchedDynamicSchema) {
|
|
159
|
-
|
|
167
|
+
const endpoint = configEditOptions?.dynamicSchema;
|
|
168
|
+
return endpoint
|
|
169
|
+
? applyFetchedSchema(staticSchema, fetchedDynamicSchema, endpoint)
|
|
170
|
+
: fetchedDynamicSchema;
|
|
160
171
|
}
|
|
161
|
-
|
|
162
|
-
return schema ?? (node?.data.metadata?.configSchema as ConfigSchema | undefined);
|
|
172
|
+
return staticSchema;
|
|
163
173
|
});
|
|
164
174
|
|
|
165
175
|
/**
|
|
166
|
-
* Get the UI schema
|
|
167
|
-
* Priority: direct uiSchema prop > node metadata
|
|
176
|
+
* Get the UI schema for the active configSchema.
|
|
177
|
+
* Priority: direct uiSchema prop > fetched dynamic uiSchema > node metadata.
|
|
178
|
+
*
|
|
179
|
+
* When the dynamic fetch returned a uiSchema, it wins over the node's static
|
|
180
|
+
* metadata uiSchema: the static one references only the static schema's
|
|
181
|
+
* properties, so it can't lay out a server-provided (hydrated) schema — its
|
|
182
|
+
* controls would point at fields that aren't rendered while the fetched
|
|
183
|
+
* fields would have no controls at all. The endpoint is expected to return a
|
|
184
|
+
* uiSchema describing the schema it served.
|
|
168
185
|
*/
|
|
169
186
|
const configUISchema = $derived.by<UISchemaElement | undefined>(() => {
|
|
170
|
-
|
|
187
|
+
if (uiSchema) return uiSchema;
|
|
188
|
+
if (fetchedDynamicSchema && fetchedDynamicUiSchema) return fetchedDynamicUiSchema;
|
|
189
|
+
return node?.data.metadata?.uiSchema as UISchemaElement | undefined;
|
|
171
190
|
});
|
|
172
191
|
|
|
173
192
|
/**
|
|
174
|
-
*
|
|
175
|
-
*
|
|
193
|
+
* Whether this node sources its schema dynamically: dynamic schema is
|
|
194
|
+
* configured and used, and it actually contributes to the form — either there
|
|
195
|
+
* is no static schema to fall back on, it is explicitly preferred, or it is
|
|
196
|
+
* configured to merge/target (in which case it layers onto the static schema
|
|
197
|
+
* rather than replacing it, so we fetch even when a static schema exists).
|
|
176
198
|
*/
|
|
177
|
-
const
|
|
178
|
-
if (!node) return false;
|
|
199
|
+
const wantsDynamicSchema = $derived.by(() => {
|
|
200
|
+
if (!node || !useDynamicSchema) return false;
|
|
201
|
+
const endpoint = configEditOptions?.dynamicSchema;
|
|
202
|
+
const layersOntoStatic = endpoint?.mergeStrategy === 'merge' || endpoint?.target != null;
|
|
179
203
|
const staticSchema = schema ?? node.data.metadata?.configSchema;
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
204
|
+
return !staticSchema || configEditOptions?.preferDynamicSchema === true || layersOntoStatic;
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Resolved fetch key for the dynamic schema endpoint. Read from the committed
|
|
209
|
+
* `node.data.config` (not the in-flight `edits`/`configValues`), so it moves
|
|
210
|
+
* at the commit boundary: a field edit reaches it only once `handleFormBlur`
|
|
211
|
+
* fires `onChange` and the parent writes the value back onto the node. It
|
|
212
|
+
* therefore recomputes when a committed config value the endpoint's
|
|
213
|
+
* parameterMapping references changes (e.g. a trigger node's event_type),
|
|
214
|
+
* driving the auto-refetch effect below. Relies on `node` being a deep
|
|
215
|
+
* reactive proxy whose `.data.config` is mutated in place; a replaced node or
|
|
216
|
+
* a plain snapshot would not re-run this derived.
|
|
217
|
+
*/
|
|
218
|
+
const dynamicSchemaKey = $derived.by<string | null>(() => {
|
|
219
|
+
if (!node || !configEditOptions?.dynamicSchema || !wantsDynamicSchema) return null;
|
|
220
|
+
return resolveDynamicSchemaKey(configEditOptions.dynamicSchema, node, workflowId);
|
|
187
221
|
});
|
|
188
222
|
|
|
223
|
+
/**
|
|
224
|
+
* Key of the schema currently loaded or in flight. Guards the effect from
|
|
225
|
+
* re-fetching a schema whose inputs have not changed.
|
|
226
|
+
*/
|
|
227
|
+
let loadedSchemaKey = $state<string | null>(null);
|
|
228
|
+
|
|
189
229
|
/**
|
|
190
230
|
* Get the current configuration from node or direct prop
|
|
191
231
|
*/
|
|
@@ -241,6 +281,7 @@
|
|
|
241
281
|
|
|
242
282
|
if (result.success && result.schema) {
|
|
243
283
|
fetchedDynamicSchema = result.schema;
|
|
284
|
+
fetchedDynamicUiSchema = result.uiSchema ?? null;
|
|
244
285
|
} else {
|
|
245
286
|
dynamicSchemaError =
|
|
246
287
|
result.error ?? configEditOptions.errorMessage ?? 'Failed to load configuration schema';
|
|
@@ -262,8 +303,9 @@
|
|
|
262
303
|
if (!node || !configEditOptions?.dynamicSchema) return;
|
|
263
304
|
|
|
264
305
|
// Invalidate the cache first
|
|
265
|
-
invalidateSchemaCache(node, configEditOptions.dynamicSchema);
|
|
306
|
+
invalidateSchemaCache(node, configEditOptions.dynamicSchema, workflowId);
|
|
266
307
|
fetchedDynamicSchema = null;
|
|
308
|
+
fetchedDynamicUiSchema = null;
|
|
267
309
|
|
|
268
310
|
// Reload the schema
|
|
269
311
|
await loadDynamicSchema();
|
|
@@ -294,12 +336,31 @@
|
|
|
294
336
|
}
|
|
295
337
|
|
|
296
338
|
/**
|
|
297
|
-
*
|
|
339
|
+
* Load — and reload — the dynamic schema when its resolved key changes.
|
|
340
|
+
*
|
|
341
|
+
* Covers both the initial fetch (loadedSchemaKey starts null) and refetching
|
|
342
|
+
* after a config value the endpoint depends on changes (e.g. picking a
|
|
343
|
+
* different trigger event_type). A load already in flight is left to finish;
|
|
344
|
+
* the effect re-runs when it settles and picks up any newer key then.
|
|
345
|
+
*
|
|
346
|
+
* The `dynamicSchemaLoading` read is load-bearing in both directions: it
|
|
347
|
+
* guards against re-entering while a fetch is in flight, AND — because it is
|
|
348
|
+
* a tracked read — flipping back to false on settle is what re-runs this
|
|
349
|
+
* effect to pick up a newer key. Don't hoist or drop it; the settle-and-
|
|
350
|
+
* refetch depends on it.
|
|
351
|
+
*
|
|
352
|
+
* loadedSchemaKey is set BEFORE the fetch (not after success) on purpose: a
|
|
353
|
+
* failed load consumes the key so a persistent error can't loop the effect
|
|
354
|
+
* into a refetch storm. Recovery from an error is manual, via
|
|
355
|
+
* refreshDynamicSchema().
|
|
298
356
|
*/
|
|
299
357
|
$effect(() => {
|
|
300
|
-
|
|
301
|
-
|
|
358
|
+
const key = dynamicSchemaKey;
|
|
359
|
+
if (key === null || key === loadedSchemaKey || dynamicSchemaLoading) {
|
|
360
|
+
return;
|
|
302
361
|
}
|
|
362
|
+
loadedSchemaKey = key;
|
|
363
|
+
loadDynamicSchema();
|
|
303
364
|
});
|
|
304
365
|
|
|
305
366
|
/**
|
|
@@ -336,7 +397,11 @@
|
|
|
336
397
|
*/
|
|
337
398
|
function handleFormBlur(): void {
|
|
338
399
|
if (onChange) {
|
|
339
|
-
|
|
400
|
+
// Spread `initialConfig` first so config keys the active schema doesn't
|
|
401
|
+
// own (e.g. after a dynamic schema narrows the field set) pass through
|
|
402
|
+
// untouched instead of being silently dropped; `configValues` then wins
|
|
403
|
+
// for every field the schema actually renders.
|
|
404
|
+
onChange({ ...initialConfig, ...configValues });
|
|
340
405
|
// Discharge the edits buffer at the commit boundary. Subsequent prop
|
|
341
406
|
// changes (parent absorbing the commit, undo/redo, collaboration) then
|
|
342
407
|
// flow through `initialConfig` cleanly instead of being shadowed by a
|
|
@@ -350,9 +415,12 @@
|
|
|
350
415
|
* Collects config values and optionally saves the workflow.
|
|
351
416
|
*/
|
|
352
417
|
async function handleSave(): Promise<void> {
|
|
353
|
-
// Collect all form values including hidden fields
|
|
418
|
+
// Collect all form values including hidden fields. Start from
|
|
419
|
+
// `initialConfig` so keys the active schema doesn't own survive the save
|
|
420
|
+
// (see handleFormBlur); `configValues` and the DOM scrape below then take
|
|
421
|
+
// precedence for every field the schema renders.
|
|
354
422
|
const form = document.querySelector('.config-form');
|
|
355
|
-
const updatedConfig: Record<string, unknown> = { ...configValues };
|
|
423
|
+
const updatedConfig: Record<string, unknown> = { ...initialConfig, ...configValues };
|
|
356
424
|
|
|
357
425
|
if (form) {
|
|
358
426
|
const inputs = form.querySelectorAll('input, select, textarea');
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
import ReadOnlyDetails from './ReadOnlyDetails.svelte';
|
|
13
13
|
import { getUiSettings } from '../stores/settingsStore.svelte.js';
|
|
14
14
|
import { m } from '../messages/index.js';
|
|
15
|
+
import { portal } from '../utils/portal.js';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* A single detail item with label and value
|
|
@@ -41,6 +42,12 @@
|
|
|
41
42
|
onClose: () => void;
|
|
42
43
|
/** Optional callback to initiate node swap — when provided, shows swap button */
|
|
43
44
|
onSwap?: () => void;
|
|
45
|
+
/**
|
|
46
|
+
* Whether to show the "pop out" control that opens the panel content in a
|
|
47
|
+
* wide centered modal — useful when the narrow sidebar cramps fields such
|
|
48
|
+
* as prompts. Defaults to true.
|
|
49
|
+
*/
|
|
50
|
+
expandable?: boolean;
|
|
44
51
|
/** Slot content for the configuration form */
|
|
45
52
|
children?: Snippet;
|
|
46
53
|
}
|
|
@@ -53,15 +60,65 @@
|
|
|
53
60
|
configTitle = 'Configuration',
|
|
54
61
|
onClose,
|
|
55
62
|
onSwap,
|
|
63
|
+
expandable = true,
|
|
56
64
|
children
|
|
57
65
|
}: Props = $props();
|
|
58
66
|
|
|
67
|
+
/** Whether the panel content is currently popped out into the modal. */
|
|
68
|
+
let expanded = $state(false);
|
|
69
|
+
|
|
70
|
+
// Unique per component instance so two FlowDrop editors on one page don't
|
|
71
|
+
// render colliding DOM ids (a11y).
|
|
72
|
+
const uid = $props.id();
|
|
73
|
+
const titleId = `${uid}-config-panel-title`;
|
|
74
|
+
|
|
59
75
|
/**
|
|
60
76
|
* Check if details section should be shown
|
|
61
77
|
*/
|
|
62
78
|
const hasDetails = $derived(id !== undefined || details.length > 0 || description !== undefined);
|
|
79
|
+
|
|
80
|
+
/** Dock the popped-out content back into the sidebar (Esc / backdrop click). */
|
|
81
|
+
function dock() {
|
|
82
|
+
expanded = false;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function handleModalKeydown(event: KeyboardEvent) {
|
|
86
|
+
if (event.key === 'Escape') {
|
|
87
|
+
event.stopPropagation();
|
|
88
|
+
dock();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function handleBackdropClick(event: MouseEvent) {
|
|
93
|
+
if (event.target === event.currentTarget) {
|
|
94
|
+
dock();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
63
97
|
</script>
|
|
64
98
|
|
|
99
|
+
<!--
|
|
100
|
+
The details + configuration content is rendered as a snippet so it can live
|
|
101
|
+
in exactly one place at a time — the sidebar rail while docked, or the modal
|
|
102
|
+
while popped out — without duplicating the form (a Snippet can only be
|
|
103
|
+
rendered once).
|
|
104
|
+
-->
|
|
105
|
+
{#snippet panelContent()}
|
|
106
|
+
{#if hasDetails && id}
|
|
107
|
+
<div class="config-panel__details">
|
|
108
|
+
<ReadOnlyDetails {id} {description} {details} />
|
|
109
|
+
</div>
|
|
110
|
+
{/if}
|
|
111
|
+
|
|
112
|
+
<div class="config-panel__content">
|
|
113
|
+
{#if children}
|
|
114
|
+
<div class="config-panel__section">
|
|
115
|
+
<h3 class="config-panel__section-title">{configTitle}</h3>
|
|
116
|
+
{@render children()}
|
|
117
|
+
</div>
|
|
118
|
+
{/if}
|
|
119
|
+
</div>
|
|
120
|
+
{/snippet}
|
|
121
|
+
|
|
65
122
|
<div class="config-panel" class:config-panel--compact={getUiSettings().compactMode}>
|
|
66
123
|
<!-- Header -->
|
|
67
124
|
<div class="config-panel__header">
|
|
@@ -77,6 +134,16 @@
|
|
|
77
134
|
<Icon icon="heroicons:arrows-right-left" />
|
|
78
135
|
</button>
|
|
79
136
|
{/if}
|
|
137
|
+
{#if expandable && !expanded}
|
|
138
|
+
<button
|
|
139
|
+
class="config-panel__action-btn"
|
|
140
|
+
onclick={() => (expanded = true)}
|
|
141
|
+
aria-label="Pop out configuration"
|
|
142
|
+
title="Pop out to a larger window"
|
|
143
|
+
>
|
|
144
|
+
<Icon icon="heroicons:arrows-pointing-out" />
|
|
145
|
+
</button>
|
|
146
|
+
{/if}
|
|
80
147
|
<button
|
|
81
148
|
class="config-panel__close"
|
|
82
149
|
onclick={onClose}
|
|
@@ -87,23 +154,61 @@
|
|
|
87
154
|
</div>
|
|
88
155
|
</div>
|
|
89
156
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<div class="config-
|
|
93
|
-
<
|
|
157
|
+
{#if expanded}
|
|
158
|
+
<!-- Content is popped out into the modal; show a lightweight placeholder. -->
|
|
159
|
+
<div class="config-panel__popped">
|
|
160
|
+
<Icon icon="heroicons:window" class="config-panel__popped-icon" />
|
|
161
|
+
<p class="config-panel__popped-text">Configuration is open in a larger window.</p>
|
|
162
|
+
<button class="config-panel__popped-btn" onclick={dock}> Dock back to sidebar </button>
|
|
94
163
|
</div>
|
|
164
|
+
{:else}
|
|
165
|
+
{@render panelContent()}
|
|
95
166
|
{/if}
|
|
167
|
+
</div>
|
|
96
168
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
169
|
+
{#if expanded}
|
|
170
|
+
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
171
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
172
|
+
<div
|
|
173
|
+
class="config-panel-modal__backdrop"
|
|
174
|
+
use:portal
|
|
175
|
+
onclick={handleBackdropClick}
|
|
176
|
+
onkeydown={handleModalKeydown}
|
|
177
|
+
>
|
|
178
|
+
<div
|
|
179
|
+
class="config-panel-modal"
|
|
180
|
+
role="dialog"
|
|
181
|
+
aria-modal="true"
|
|
182
|
+
aria-labelledby={titleId}
|
|
183
|
+
tabindex="-1"
|
|
184
|
+
>
|
|
185
|
+
<div class="config-panel-modal__header">
|
|
186
|
+
<h2 id={titleId} class="config-panel-modal__title">{title}</h2>
|
|
187
|
+
<div class="config-panel__actions">
|
|
188
|
+
<button
|
|
189
|
+
class="config-panel__action-btn"
|
|
190
|
+
onclick={dock}
|
|
191
|
+
aria-label="Dock configuration back to sidebar"
|
|
192
|
+
title="Dock back to sidebar"
|
|
193
|
+
>
|
|
194
|
+
<Icon icon="heroicons:arrows-pointing-in" />
|
|
195
|
+
</button>
|
|
196
|
+
<button
|
|
197
|
+
class="config-panel__close"
|
|
198
|
+
onclick={onClose}
|
|
199
|
+
aria-label={m().layout.closeConfigPanel}
|
|
200
|
+
>
|
|
201
|
+
×
|
|
202
|
+
</button>
|
|
203
|
+
</div>
|
|
103
204
|
</div>
|
|
104
|
-
|
|
205
|
+
|
|
206
|
+
<div class="config-panel-modal__body">
|
|
207
|
+
{@render panelContent()}
|
|
208
|
+
</div>
|
|
209
|
+
</div>
|
|
105
210
|
</div>
|
|
106
|
-
|
|
211
|
+
{/if}
|
|
107
212
|
|
|
108
213
|
<style>
|
|
109
214
|
.config-panel {
|
|
@@ -236,4 +341,110 @@
|
|
|
236
341
|
.config-panel--compact .config-panel__section {
|
|
237
342
|
gap: 0.5rem;
|
|
238
343
|
}
|
|
344
|
+
|
|
345
|
+
/* Popped-out placeholder (shown in the rail while the modal is open) */
|
|
346
|
+
.config-panel__popped {
|
|
347
|
+
flex: 1;
|
|
348
|
+
display: flex;
|
|
349
|
+
flex-direction: column;
|
|
350
|
+
align-items: center;
|
|
351
|
+
justify-content: center;
|
|
352
|
+
gap: 0.75rem;
|
|
353
|
+
padding: 2rem 1rem;
|
|
354
|
+
text-align: center;
|
|
355
|
+
color: var(--fd-muted-foreground);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.config-panel__popped :global(.config-panel__popped-icon) {
|
|
359
|
+
width: 2rem;
|
|
360
|
+
height: 2rem;
|
|
361
|
+
opacity: 0.6;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
.config-panel__popped-text {
|
|
365
|
+
margin: 0;
|
|
366
|
+
font-size: var(--fd-text-sm);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.config-panel__popped-btn {
|
|
370
|
+
border: 1px solid var(--fd-border);
|
|
371
|
+
background-color: var(--fd-card);
|
|
372
|
+
color: var(--fd-foreground);
|
|
373
|
+
padding: 0.375rem 0.75rem;
|
|
374
|
+
border-radius: var(--fd-radius-sm);
|
|
375
|
+
font-size: var(--fd-text-sm);
|
|
376
|
+
cursor: pointer;
|
|
377
|
+
transition:
|
|
378
|
+
color var(--fd-transition-fast),
|
|
379
|
+
background-color var(--fd-transition-fast),
|
|
380
|
+
border-color var(--fd-transition-fast);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.config-panel__popped-btn:hover {
|
|
384
|
+
color: var(--fd-primary);
|
|
385
|
+
border-color: var(--fd-primary);
|
|
386
|
+
background-color: var(--fd-subtle);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/* Pop-out modal */
|
|
390
|
+
.config-panel-modal__backdrop {
|
|
391
|
+
position: fixed;
|
|
392
|
+
inset: 0;
|
|
393
|
+
background-color: var(--fd-backdrop, rgba(0, 0, 0, 0.5));
|
|
394
|
+
display: flex;
|
|
395
|
+
align-items: center;
|
|
396
|
+
justify-content: center;
|
|
397
|
+
z-index: 1000;
|
|
398
|
+
padding: 1rem;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.config-panel-modal {
|
|
402
|
+
display: flex;
|
|
403
|
+
flex-direction: column;
|
|
404
|
+
width: 100%;
|
|
405
|
+
max-width: 48rem;
|
|
406
|
+
max-height: 90vh;
|
|
407
|
+
background-color: var(--fd-panel-bg, var(--fd-card));
|
|
408
|
+
border: 1px solid var(--fd-border);
|
|
409
|
+
border-radius: var(--fd-radius-lg, 0.75rem);
|
|
410
|
+
box-shadow: var(--fd-shadow-lg, 0 20px 25px -5px rgba(0, 0, 0, 0.25));
|
|
411
|
+
overflow: hidden;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.config-panel-modal__header {
|
|
415
|
+
display: flex;
|
|
416
|
+
justify-content: space-between;
|
|
417
|
+
align-items: center;
|
|
418
|
+
padding: 0.875rem 1rem;
|
|
419
|
+
border-bottom: 1px solid var(--fd-border);
|
|
420
|
+
background-color: var(--fd-card);
|
|
421
|
+
flex-shrink: 0;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.config-panel-modal__title {
|
|
425
|
+
margin: 0;
|
|
426
|
+
font-size: 1rem;
|
|
427
|
+
font-weight: 600;
|
|
428
|
+
color: var(--fd-foreground);
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.config-panel-modal__body {
|
|
432
|
+
flex: 1;
|
|
433
|
+
min-height: 0;
|
|
434
|
+
overflow-y: auto;
|
|
435
|
+
display: flex;
|
|
436
|
+
flex-direction: column;
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
/* Inside the modal the content area should breathe on a wider canvas. */
|
|
440
|
+
.config-panel-modal__body .config-panel__content {
|
|
441
|
+
padding: 1.25rem 1.5rem;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
@media (max-width: 640px) {
|
|
445
|
+
.config-panel-modal {
|
|
446
|
+
max-width: 100%;
|
|
447
|
+
max-height: 95vh;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
239
450
|
</style>
|
|
@@ -26,6 +26,12 @@ interface Props {
|
|
|
26
26
|
onClose: () => void;
|
|
27
27
|
/** Optional callback to initiate node swap — when provided, shows swap button */
|
|
28
28
|
onSwap?: () => void;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to show the "pop out" control that opens the panel content in a
|
|
31
|
+
* wide centered modal — useful when the narrow sidebar cramps fields such
|
|
32
|
+
* as prompts. Defaults to true.
|
|
33
|
+
*/
|
|
34
|
+
expandable?: boolean;
|
|
29
35
|
/** Slot content for the configuration form */
|
|
30
36
|
children?: Snippet;
|
|
31
37
|
}
|
|
@@ -202,6 +202,28 @@
|
|
|
202
202
|
{ const: 'drafter', title: 'Drafter' }
|
|
203
203
|
],
|
|
204
204
|
default: 'default'
|
|
205
|
+
},
|
|
206
|
+
configPlacement: {
|
|
207
|
+
type: 'string',
|
|
208
|
+
title: 'Config Panel Location',
|
|
209
|
+
description: 'Where the node/workflow configuration panel opens',
|
|
210
|
+
oneOf: [
|
|
211
|
+
{ const: 'sidebar', title: 'Right sidebar' },
|
|
212
|
+
{ const: 'modal', title: 'Modal window' },
|
|
213
|
+
{ const: 'below', title: 'Bottom panel' }
|
|
214
|
+
],
|
|
215
|
+
default: 'sidebar'
|
|
216
|
+
},
|
|
217
|
+
consolePlacement: {
|
|
218
|
+
type: 'string',
|
|
219
|
+
title: 'Console / AI Assistant Location',
|
|
220
|
+
description: 'Where the console and AI Assistant open',
|
|
221
|
+
oneOf: [
|
|
222
|
+
{ const: 'sidebar', title: 'Right sidebar' },
|
|
223
|
+
{ const: 'modal', title: 'Modal window' },
|
|
224
|
+
{ const: 'below', title: 'Bottom panel' }
|
|
225
|
+
],
|
|
226
|
+
default: 'below'
|
|
205
227
|
}
|
|
206
228
|
}
|
|
207
229
|
},
|
|
@@ -29,18 +29,22 @@
|
|
|
29
29
|
|
|
30
30
|
const isCollapsible = $derived(group.collapsible !== false);
|
|
31
31
|
const isDefaultOpen = $derived(group.defaultOpen !== false);
|
|
32
|
+
const headerIcon = $derived(group.icon ?? 'heroicons:adjustments-horizontal');
|
|
32
33
|
</script>
|
|
33
34
|
|
|
34
35
|
{#if isCollapsible}
|
|
35
36
|
<details class="flowdrop-details form-fieldset" open={isDefaultOpen}>
|
|
36
37
|
<summary class="flowdrop-details__summary form-fieldset__summary">
|
|
37
|
-
<
|
|
38
|
-
<Icon icon=
|
|
38
|
+
<span class="form-fieldset__label">
|
|
39
|
+
<Icon icon={headerIcon} class="form-fieldset__icon" />
|
|
39
40
|
<span class="form-fieldset__title">{group.label}</span>
|
|
40
|
-
</
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
</span>
|
|
42
|
+
<span class="form-fieldset__meta">
|
|
43
|
+
{#if group.description}
|
|
44
|
+
<span class="form-fieldset__badge">{group.description}</span>
|
|
45
|
+
{/if}
|
|
46
|
+
<Icon icon="heroicons:chevron-right" class="form-fieldset__chevron" />
|
|
47
|
+
</span>
|
|
44
48
|
</summary>
|
|
45
49
|
<div class="flowdrop-details__content form-fieldset__content">
|
|
46
50
|
<div class="form-fieldset__fields">
|
|
@@ -62,18 +66,48 @@
|
|
|
62
66
|
|
|
63
67
|
<style>
|
|
64
68
|
/* ============================================
|
|
65
|
-
COLLAPSIBLE FIELDSET
|
|
66
|
-
Extends .flowdrop-details from base.css
|
|
69
|
+
COLLAPSIBLE FIELDSET — filled header bar
|
|
70
|
+
Extends .flowdrop-details from base.css, overriding the summary
|
|
71
|
+
into a distinct header bar (subtle fill + bottom divider when open)
|
|
72
|
+
over a card body. Scoped to .form-fieldset so other .flowdrop-details
|
|
73
|
+
consumers (e.g. NodeSidebar) are unaffected.
|
|
67
74
|
============================================ */
|
|
68
75
|
|
|
69
76
|
.form-fieldset__summary {
|
|
70
|
-
gap: var(--fd-space-
|
|
77
|
+
gap: var(--fd-space-sm);
|
|
78
|
+
padding: var(--fd-space-md) var(--fd-space-xl);
|
|
79
|
+
background: var(--fd-subtle);
|
|
80
|
+
border-radius: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.form-fieldset__summary:hover {
|
|
84
|
+
background-color: var(--fd-muted);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/* Divider between header bar and body — only while expanded */
|
|
88
|
+
details.form-fieldset[open] > .form-fieldset__summary {
|
|
89
|
+
border-bottom: 1px solid var(--fd-border-muted);
|
|
71
90
|
}
|
|
72
91
|
|
|
73
92
|
.form-fieldset__label {
|
|
74
93
|
display: flex;
|
|
75
94
|
align-items: center;
|
|
76
95
|
gap: var(--fd-space-xs);
|
|
96
|
+
min-width: 0;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.form-fieldset__meta {
|
|
100
|
+
display: flex;
|
|
101
|
+
align-items: center;
|
|
102
|
+
gap: var(--fd-space-sm);
|
|
103
|
+
flex-shrink: 0;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.form-fieldset :global(.form-fieldset__icon) {
|
|
107
|
+
width: 1rem;
|
|
108
|
+
height: 1rem;
|
|
109
|
+
color: var(--fd-muted-foreground);
|
|
110
|
+
flex-shrink: 0;
|
|
77
111
|
}
|
|
78
112
|
|
|
79
113
|
.form-fieldset__title {
|
|
@@ -106,7 +140,7 @@
|
|
|
106
140
|
}
|
|
107
141
|
|
|
108
142
|
.form-fieldset__content {
|
|
109
|
-
padding
|
|
143
|
+
padding: var(--fd-space-xl);
|
|
110
144
|
}
|
|
111
145
|
|
|
112
146
|
.form-fieldset__fields {
|