@flowdrop/flowdrop 2.0.0-beta.4 → 2.0.0-beta.6
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 +35 -0
- package/dist/adapters/WorkflowAdapter.js +4 -5
- package/dist/adapters/agentspec/AgentSpecAdapter.js +3 -3
- package/dist/adapters/agentspec/defaultNodeTypes.js +9 -9
- package/dist/commands/executor.js +5 -6
- package/dist/commands/types.js +5 -5
- package/dist/components/App.svelte +5 -14
- package/dist/components/ConfigForm.svelte +6 -505
- package/dist/components/ConfigForm.svelte.d.ts +4 -6
- package/dist/components/ConfigModal.svelte +0 -1
- package/dist/components/NodeSidebar.svelte +4 -4
- package/dist/components/NodeSwapPicker.svelte +2 -2
- package/dist/components/UniversalNode.svelte +5 -4
- package/dist/components/UniversalNode.svelte.d.ts +1 -1
- package/dist/components/console/ConsoleInput.svelte +3 -3
- package/dist/components/form/FormField.svelte +15 -0
- package/dist/components/form/FormFieldLight.svelte +14 -0
- package/dist/components/form/FormPorts.svelte +262 -0
- package/dist/components/form/FormPorts.svelte.d.ts +13 -0
- package/dist/components/nodes/AtomNode.svelte +16 -42
- package/dist/components/nodes/AtomNode.svelte.d.ts +1 -1
- package/dist/components/nodes/GatewayNode.svelte +26 -65
- package/dist/components/nodes/GatewayNode.svelte.d.ts +1 -1
- package/dist/components/nodes/IdeaNode.svelte +10 -8
- package/dist/components/nodes/IdeaNode.svelte.d.ts +8 -4
- package/dist/components/nodes/NotesNode.svelte +6 -4
- package/dist/components/nodes/NotesNode.svelte.d.ts +8 -4
- package/dist/components/nodes/SimpleNode.svelte +31 -55
- package/dist/components/nodes/SimpleNode.svelte.d.ts +4 -4
- package/dist/components/nodes/SquareNode.svelte +31 -55
- package/dist/components/nodes/SquareNode.svelte.d.ts +4 -4
- package/dist/components/nodes/TerminalNode.svelte +34 -38
- package/dist/components/nodes/TerminalNode.svelte.d.ts +4 -4
- package/dist/components/nodes/ToolNode.svelte +10 -8
- package/dist/components/nodes/ToolNode.svelte.d.ts +6 -6
- package/dist/components/nodes/WorkflowNode.svelte +43 -93
- package/dist/components/nodes/WorkflowNode.svelte.d.ts +1 -1
- package/dist/components/playground/PipelineKanbanView.svelte +2 -2
- package/dist/components/playground/PipelineTableView.svelte +2 -2
- package/dist/core/index.d.ts +1 -1
- package/dist/helpers/workflowEditorHelper.js +4 -5
- package/dist/openapi/v1/openapi.yaml +33 -21
- package/dist/registry/nodeComponentRegistry.d.ts +2 -1
- package/dist/schemas/v1/workflow.schema.json +16 -14
- package/dist/services/dynamicSchemaService.d.ts +2 -2
- package/dist/services/dynamicSchemaService.js +8 -8
- package/dist/stores/playgroundStore.svelte.js +1 -1
- package/dist/stores/workflowStore.svelte.d.ts +1 -1
- package/dist/stores/workflowStore.svelte.js +1 -19
- package/dist/types/index.d.ts +51 -27
- package/dist/utils/colors.d.ts +27 -0
- package/dist/utils/colors.js +23 -0
- package/dist/utils/connections.js +6 -6
- package/dist/utils/nodeIds.d.ts +1 -1
- package/dist/utils/nodeIds.js +1 -1
- package/dist/utils/nodeSwap.js +3 -6
- package/dist/utils/portUtils.d.ts +47 -11
- package/dist/utils/portUtils.js +67 -14
- package/package.json +1 -1
|
@@ -21,11 +21,12 @@
|
|
|
21
21
|
let universalNodeEl: HTMLDivElement;
|
|
22
22
|
|
|
23
23
|
let {
|
|
24
|
+
id,
|
|
24
25
|
data,
|
|
25
26
|
selected = false
|
|
26
27
|
}: {
|
|
28
|
+
id: string;
|
|
27
29
|
data: WorkflowNode['data'] & {
|
|
28
|
-
nodeId?: string;
|
|
29
30
|
onConfigOpen?: (node: { id: string; type: string; data: WorkflowNode['data'] }) => void;
|
|
30
31
|
};
|
|
31
32
|
selected?: boolean;
|
|
@@ -81,7 +82,7 @@
|
|
|
81
82
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
82
83
|
event.preventDefault();
|
|
83
84
|
data.onConfigOpen?.({
|
|
84
|
-
id
|
|
85
|
+
id,
|
|
85
86
|
type: resolvedComponentName,
|
|
86
87
|
data
|
|
87
88
|
});
|
|
@@ -165,13 +166,13 @@
|
|
|
165
166
|
{#if nodeComponent}
|
|
166
167
|
<!-- Svelte 5 dynamic component limitation; reactivity maintained via $derived -->
|
|
167
168
|
{@const NodeComponent = nodeComponent}
|
|
168
|
-
<NodeComponent {data} {selected} />
|
|
169
|
+
<NodeComponent {id} {data} {selected} />
|
|
169
170
|
{/if}
|
|
170
171
|
|
|
171
172
|
<!-- Status overlay - only show if there's meaningful status information -->
|
|
172
173
|
{#if shouldShowStatus}
|
|
173
174
|
<NodeStatusOverlay
|
|
174
|
-
nodeId={
|
|
175
|
+
nodeId={id}
|
|
175
176
|
{executionInfo}
|
|
176
177
|
position={getStatusPosition()}
|
|
177
178
|
size={getStatusSize()}
|
|
@@ -341,10 +341,10 @@
|
|
|
341
341
|
if (nodeTypeContext !== null) {
|
|
342
342
|
const prefix = nodeTypeContext.toLowerCase();
|
|
343
343
|
return nodeTypes
|
|
344
|
-
.filter((nt) => nt.
|
|
344
|
+
.filter((nt) => nt.node_type_id.toLowerCase().startsWith(prefix))
|
|
345
345
|
.map((nt) => ({
|
|
346
|
-
value: nt.
|
|
347
|
-
label: nt.
|
|
346
|
+
value: nt.node_type_id,
|
|
347
|
+
label: nt.node_type_id,
|
|
348
348
|
detail: `${nt.name} (${nt.category})`
|
|
349
349
|
}))
|
|
350
350
|
.slice(0, 50);
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
import FormSelect from './FormSelect.svelte';
|
|
38
38
|
import FormCheckboxGroup from './FormCheckboxGroup.svelte';
|
|
39
39
|
import FormArray from './FormArray.svelte';
|
|
40
|
+
import FormPorts from './FormPorts.svelte';
|
|
40
41
|
import FormCodeEditor from './FormCodeEditor.svelte';
|
|
41
42
|
import FormMarkdownEditor from './FormMarkdownEditor.svelte';
|
|
42
43
|
import FormTemplateEditor from './FormTemplateEditor.svelte';
|
|
@@ -140,6 +141,11 @@
|
|
|
140
141
|
return 'template-editor';
|
|
141
142
|
}
|
|
142
143
|
|
|
144
|
+
// Injected port order + exposure widget (the `ports` reserved config prop).
|
|
145
|
+
if (schema.format === 'ports') {
|
|
146
|
+
return 'ports';
|
|
147
|
+
}
|
|
148
|
+
|
|
143
149
|
// Shared basic field resolution (enum/oneOf/primitive types).
|
|
144
150
|
const base = resolveBaseFieldType(schema);
|
|
145
151
|
if (base) {
|
|
@@ -307,6 +313,15 @@
|
|
|
307
313
|
disabled={isReadOnly}
|
|
308
314
|
onChange={(val) => onChange(val)}
|
|
309
315
|
/>
|
|
316
|
+
{:else if fieldType === 'ports'}
|
|
317
|
+
<FormPorts
|
|
318
|
+
id={fieldKey}
|
|
319
|
+
{value}
|
|
320
|
+
ariaDescribedBy={descriptionId}
|
|
321
|
+
disabled={isReadOnly}
|
|
322
|
+
{node}
|
|
323
|
+
onChange={(val) => onChange(val)}
|
|
324
|
+
/>
|
|
310
325
|
{:else if fieldType === 'code-editor'}
|
|
311
326
|
<FormCodeEditor
|
|
312
327
|
id={fieldKey}
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
import FormSelect from './FormSelect.svelte';
|
|
43
43
|
import FormCheckboxGroup from './FormCheckboxGroup.svelte';
|
|
44
44
|
import FormArray from './FormArray.svelte';
|
|
45
|
+
import FormPorts from './FormPorts.svelte';
|
|
45
46
|
import { getInstance } from '../../stores/getInstance.svelte.js';
|
|
46
47
|
import { getResolvedTheme } from '../../stores/settingsStore.svelte.js';
|
|
47
48
|
|
|
@@ -140,6 +141,11 @@
|
|
|
140
141
|
return 'template-editor-fallback';
|
|
141
142
|
}
|
|
142
143
|
|
|
144
|
+
// Injected port order + exposure widget (the `ports` reserved config prop).
|
|
145
|
+
if (schema.format === 'ports') {
|
|
146
|
+
return 'ports';
|
|
147
|
+
}
|
|
148
|
+
|
|
143
149
|
// Object type without specific format would use code editor
|
|
144
150
|
if (schema.type === 'object' && !schema.format) {
|
|
145
151
|
return 'code-editor-fallback';
|
|
@@ -321,6 +327,14 @@
|
|
|
321
327
|
addLabel={`Add ${schema.items.title ?? 'Item'}`}
|
|
322
328
|
onChange={(val) => onChange(val)}
|
|
323
329
|
/>
|
|
330
|
+
{:else if fieldType === 'ports'}
|
|
331
|
+
<FormPorts
|
|
332
|
+
id={fieldKey}
|
|
333
|
+
{value}
|
|
334
|
+
ariaDescribedBy={descriptionId}
|
|
335
|
+
{node}
|
|
336
|
+
onChange={(val) => onChange(val)}
|
|
337
|
+
/>
|
|
324
338
|
{:else if fieldType.endsWith('-fallback')}
|
|
325
339
|
<!-- Fallback for unregistered heavy editors -->
|
|
326
340
|
<div class="form-field-fallback">
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Unified port widget — order + exposure
|
|
3
|
+
|
|
4
|
+
Renders one row per port of the node being configured, each carrying a
|
|
5
|
+
reorder control (up/down) and an expose/hide toggle. Binds to the injected
|
|
6
|
+
`ports` reserved config property (a PortsConfig: a per-direction ordered list
|
|
7
|
+
of {id, exposed?} entries).
|
|
8
|
+
|
|
9
|
+
Order is cosmetic — the engine ignores it. Exposure is semantic in v2: a
|
|
10
|
+
not-exposed port is hidden on the canvas, not wireable, and not
|
|
11
|
+
runtime-overridable.
|
|
12
|
+
|
|
13
|
+
The stored value is materialized as the FULL ordered list on the first edit
|
|
14
|
+
(so order + exposure stay independent inside one positional array), and reset
|
|
15
|
+
to `undefined` when it lands back on the metadata default order with no
|
|
16
|
+
exposure override.
|
|
17
|
+
|
|
18
|
+
@see .claude/plans/exposed-ports.md
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import type {
|
|
23
|
+
DynamicPort,
|
|
24
|
+
NodePort,
|
|
25
|
+
PortConfigEntry,
|
|
26
|
+
PortsConfig,
|
|
27
|
+
WorkflowNode
|
|
28
|
+
} from '../../types/index.js';
|
|
29
|
+
import { dynamicPortToNodePort } from '../../types/index.js';
|
|
30
|
+
import { getInstance } from '../../stores/getInstance.svelte.js';
|
|
31
|
+
import { getPortColorToken, getPortBackgroundColorForPort } from '../../utils/colors.js';
|
|
32
|
+
import { byDefaultOrder, isPortExposed, orderPortsFor } from '../../utils/portUtils.js';
|
|
33
|
+
import FormToggle from './FormToggle.svelte';
|
|
34
|
+
import Icon from '@iconify/svelte';
|
|
35
|
+
|
|
36
|
+
interface Props {
|
|
37
|
+
id: string;
|
|
38
|
+
value: unknown;
|
|
39
|
+
ariaDescribedBy?: string;
|
|
40
|
+
disabled?: boolean;
|
|
41
|
+
onChange: (value: unknown) => void;
|
|
42
|
+
/** The node being configured, source of the port list + metadata defaults. */
|
|
43
|
+
node?: WorkflowNode;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let { id, value, ariaDescribedBy, disabled = false, onChange, node }: Props = $props();
|
|
47
|
+
|
|
48
|
+
const fd = getInstance();
|
|
49
|
+
const checker = fd.portCompatibility;
|
|
50
|
+
|
|
51
|
+
const portsConfig = $derived((value as PortsConfig | undefined) ?? {});
|
|
52
|
+
|
|
53
|
+
// Mirror the canvas: static metadata ports plus user-defined dynamic ports.
|
|
54
|
+
const inputPorts = $derived<NodePort[]>([
|
|
55
|
+
...(node?.data.metadata?.inputs ?? []),
|
|
56
|
+
...((node?.data.config?.dynamicInputs as DynamicPort[]) ?? []).map((p) =>
|
|
57
|
+
dynamicPortToNodePort(p, 'input')
|
|
58
|
+
)
|
|
59
|
+
]);
|
|
60
|
+
const outputPorts = $derived<NodePort[]>([
|
|
61
|
+
...(node?.data.metadata?.outputs ?? []),
|
|
62
|
+
...((node?.data.config?.dynamicOutputs as DynamicPort[]) ?? []).map((p) =>
|
|
63
|
+
dynamicPortToNodePort(p, 'output')
|
|
64
|
+
)
|
|
65
|
+
]);
|
|
66
|
+
|
|
67
|
+
type Direction = 'inputs' | 'outputs';
|
|
68
|
+
|
|
69
|
+
function portsFor(direction: Direction): NodePort[] {
|
|
70
|
+
return direction === 'inputs' ? inputPorts : outputPorts;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** Ports in the order the widget renders them (default order, then override). */
|
|
74
|
+
function orderedPorts(direction: Direction): NodePort[] {
|
|
75
|
+
return orderPortsFor(portsFor(direction), portsConfig[direction]);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Write a direction's desired ordered list (each port carrying its effective
|
|
80
|
+
* exposure) back to the bound value, keeping it minimal: an entry's `exposed`
|
|
81
|
+
* flag is dropped when it equals the port's default, the whole direction is
|
|
82
|
+
* dropped when it carries neither a reorder nor an exposure override, and the
|
|
83
|
+
* value collapses to `undefined` when empty — so an untouched node stores
|
|
84
|
+
* nothing.
|
|
85
|
+
*/
|
|
86
|
+
function commit(
|
|
87
|
+
direction: Direction,
|
|
88
|
+
ordered: NodePort[],
|
|
89
|
+
exposureOf: (port: NodePort) => boolean
|
|
90
|
+
): void {
|
|
91
|
+
const entries: PortConfigEntry[] = ordered.map((port) => {
|
|
92
|
+
const entry: PortConfigEntry = { id: port.id };
|
|
93
|
+
const exposed = exposureOf(port);
|
|
94
|
+
if (exposed !== (port.exposedByDefault ?? true)) entry.exposed = exposed;
|
|
95
|
+
return entry;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const defaultOrder = byDefaultOrder(portsFor(direction)).map((p) => p.id);
|
|
99
|
+
const orderChanged = entries.some((e, i) => e.id !== defaultOrder[i]);
|
|
100
|
+
const hasExposureOverride = entries.some((e) => e.exposed !== undefined);
|
|
101
|
+
|
|
102
|
+
const next: PortsConfig = { ...portsConfig };
|
|
103
|
+
if (orderChanged || hasExposureOverride) next[direction] = entries;
|
|
104
|
+
else delete next[direction];
|
|
105
|
+
|
|
106
|
+
// We carry the untouched direction over verbatim from `portsConfig`, but an
|
|
107
|
+
// earlier edit there may have left an empty array; prune it so an all-default
|
|
108
|
+
// node collapses to `undefined` below rather than persisting `{inputs: []}`.
|
|
109
|
+
const other: Direction = direction === 'inputs' ? 'outputs' : 'inputs';
|
|
110
|
+
if (!next[other] || next[other]?.length === 0) delete next[other];
|
|
111
|
+
onChange(Object.keys(next).length === 0 ? undefined : next);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function setExposed(direction: Direction, portId: string, exposed: boolean): void {
|
|
115
|
+
commit(direction, orderedPorts(direction), (port) =>
|
|
116
|
+
port.id === portId ? exposed : isPortExposed(port, portsConfig[direction])
|
|
117
|
+
);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function move(direction: Direction, index: number, delta: -1 | 1): void {
|
|
121
|
+
const ordered = orderedPorts(direction);
|
|
122
|
+
const target = index + delta;
|
|
123
|
+
if (target < 0 || target >= ordered.length) return;
|
|
124
|
+
[ordered[index], ordered[target]] = [ordered[target], ordered[index]];
|
|
125
|
+
commit(direction, ordered, (port) => isPortExposed(port, portsConfig[direction]));
|
|
126
|
+
}
|
|
127
|
+
</script>
|
|
128
|
+
|
|
129
|
+
<div class="fd-ports" {id} aria-describedby={ariaDescribedBy}>
|
|
130
|
+
{#each [{ key: 'inputs', label: 'Inputs' }, { key: 'outputs', label: 'Outputs' }] as group (group.key)}
|
|
131
|
+
{@const direction = group.key as Direction}
|
|
132
|
+
{@const ordered = orderedPorts(direction)}
|
|
133
|
+
{#if ordered.length > 0}
|
|
134
|
+
<div class="fd-ports__group">
|
|
135
|
+
<span class="fd-ports__group-label">{group.label}</span>
|
|
136
|
+
<ul class="fd-ports__list">
|
|
137
|
+
{#each ordered as port, i (port.id)}
|
|
138
|
+
<li class="fd-ports__item">
|
|
139
|
+
<div class="fd-ports__reorder">
|
|
140
|
+
<button
|
|
141
|
+
type="button"
|
|
142
|
+
disabled={disabled || i === 0}
|
|
143
|
+
onclick={() => move(direction, i, -1)}
|
|
144
|
+
title="Move up"
|
|
145
|
+
aria-label={`Move ${port.name} up`}
|
|
146
|
+
>
|
|
147
|
+
<Icon icon="heroicons:chevron-up" />
|
|
148
|
+
</button>
|
|
149
|
+
<button
|
|
150
|
+
type="button"
|
|
151
|
+
disabled={disabled || i === ordered.length - 1}
|
|
152
|
+
onclick={() => move(direction, i, 1)}
|
|
153
|
+
title="Move down"
|
|
154
|
+
aria-label={`Move ${port.name} down`}
|
|
155
|
+
>
|
|
156
|
+
<Icon icon="heroicons:chevron-down" />
|
|
157
|
+
</button>
|
|
158
|
+
</div>
|
|
159
|
+
<span class="fd-ports__name">{port.name}</span>
|
|
160
|
+
<span
|
|
161
|
+
class="fd-ports__badge"
|
|
162
|
+
style="background-color:{getPortBackgroundColorForPort(
|
|
163
|
+
checker,
|
|
164
|
+
port,
|
|
165
|
+
15
|
|
166
|
+
)};color:{getPortColorToken(
|
|
167
|
+
checker,
|
|
168
|
+
port
|
|
169
|
+
)};border:1px solid {getPortBackgroundColorForPort(checker, port, 30)}"
|
|
170
|
+
>
|
|
171
|
+
{port.dataType}
|
|
172
|
+
</span>
|
|
173
|
+
<FormToggle
|
|
174
|
+
id={`${id}-${direction}-${port.id}`}
|
|
175
|
+
value={isPortExposed(port, portsConfig[direction])}
|
|
176
|
+
onLabel="Exposed"
|
|
177
|
+
offLabel="Hidden"
|
|
178
|
+
{disabled}
|
|
179
|
+
onChange={(exposed) => setExposed(direction, port.id, exposed)}
|
|
180
|
+
/>
|
|
181
|
+
</li>
|
|
182
|
+
{/each}
|
|
183
|
+
</ul>
|
|
184
|
+
</div>
|
|
185
|
+
{/if}
|
|
186
|
+
{/each}
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<style>
|
|
190
|
+
.fd-ports {
|
|
191
|
+
display: flex;
|
|
192
|
+
flex-direction: column;
|
|
193
|
+
gap: var(--fd-space-3, 0.75rem);
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.fd-ports__group {
|
|
197
|
+
display: flex;
|
|
198
|
+
flex-direction: column;
|
|
199
|
+
gap: var(--fd-space-1, 0.25rem);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.fd-ports__group-label {
|
|
203
|
+
font-size: var(--fd-text-xs);
|
|
204
|
+
font-weight: 600;
|
|
205
|
+
color: var(--fd-text-muted);
|
|
206
|
+
text-transform: uppercase;
|
|
207
|
+
letter-spacing: 0.04em;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.fd-ports__list {
|
|
211
|
+
list-style: none;
|
|
212
|
+
margin: 0;
|
|
213
|
+
padding: 0;
|
|
214
|
+
display: flex;
|
|
215
|
+
flex-direction: column;
|
|
216
|
+
gap: var(--fd-space-1, 0.25rem);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.fd-ports__item {
|
|
220
|
+
display: flex;
|
|
221
|
+
align-items: center;
|
|
222
|
+
gap: var(--fd-space-2, 0.5rem);
|
|
223
|
+
padding: var(--fd-space-1, 0.25rem) var(--fd-space-2, 0.5rem);
|
|
224
|
+
border-radius: var(--fd-radius-md, 6px);
|
|
225
|
+
border: 1px solid var(--fd-border-muted);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.fd-ports__reorder {
|
|
229
|
+
display: flex;
|
|
230
|
+
flex-direction: column;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.fd-ports__reorder button {
|
|
234
|
+
display: flex;
|
|
235
|
+
align-items: center;
|
|
236
|
+
justify-content: center;
|
|
237
|
+
padding: 0;
|
|
238
|
+
border: none;
|
|
239
|
+
background: none;
|
|
240
|
+
color: var(--fd-text-muted);
|
|
241
|
+
cursor: pointer;
|
|
242
|
+
line-height: 1;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.fd-ports__reorder button:disabled {
|
|
246
|
+
opacity: 0.3;
|
|
247
|
+
cursor: default;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
.fd-ports__name {
|
|
251
|
+
flex: 1;
|
|
252
|
+
font-size: var(--fd-text-xs);
|
|
253
|
+
font-weight: 500;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
.fd-ports__badge {
|
|
257
|
+
font-size: var(--fd-text-2xs, 0.625rem);
|
|
258
|
+
padding: 0 var(--fd-space-1, 0.25rem);
|
|
259
|
+
border-radius: var(--fd-radius-sm, 4px);
|
|
260
|
+
white-space: nowrap;
|
|
261
|
+
}
|
|
262
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { WorkflowNode } from '../../types/index.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
id: string;
|
|
4
|
+
value: unknown;
|
|
5
|
+
ariaDescribedBy?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
onChange: (value: unknown) => void;
|
|
8
|
+
/** The node being configured, source of the port list + metadata defaults. */
|
|
9
|
+
node?: WorkflowNode;
|
|
10
|
+
}
|
|
11
|
+
declare const FormPorts: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type FormPorts = ReturnType<typeof FormPorts>;
|
|
13
|
+
export default FormPorts;
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
NodeExtensions,
|
|
18
18
|
NodePort,
|
|
19
19
|
AtomUIConfig,
|
|
20
|
+
PortsConfig,
|
|
20
21
|
WorkflowNode as WorkflowNodeType
|
|
21
22
|
} from '../../types/index.js';
|
|
22
|
-
import {
|
|
23
|
+
import { getPortColorToken } from '../../utils/colors.js';
|
|
23
24
|
import { getInstance } from '../../stores/getInstance.svelte.js';
|
|
24
|
-
import {
|
|
25
|
+
import { orderPortsFor, isPortVisible } from '../../utils/portUtils.js';
|
|
25
26
|
import { ProximityConnectHelper } from '../../helpers/proximityConnect.js';
|
|
26
27
|
|
|
27
28
|
interface AtomNodeData {
|
|
28
29
|
label: string;
|
|
29
30
|
config: ConfigValues;
|
|
30
31
|
metadata: NodeMetadata;
|
|
31
|
-
nodeId?: string;
|
|
32
32
|
extensions?: NodeExtensions;
|
|
33
33
|
onConfigOpen?: (node: {
|
|
34
34
|
id: string;
|
|
@@ -38,35 +38,26 @@
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
interface Props {
|
|
41
|
+
id: string;
|
|
41
42
|
data: AtomNodeData;
|
|
42
43
|
selected?: boolean;
|
|
43
44
|
isProcessing?: boolean;
|
|
44
45
|
isError?: boolean;
|
|
45
46
|
}
|
|
46
47
|
|
|
47
|
-
let { data, selected, isProcessing, isError }: Props = $props();
|
|
48
|
+
let { id, data, selected, isProcessing, isError }: Props = $props();
|
|
48
49
|
|
|
49
50
|
const fd = getInstance();
|
|
50
51
|
const checker = fd.portCompatibility;
|
|
51
52
|
|
|
52
|
-
const nodeId = $derived(
|
|
53
|
+
const nodeId = $derived(id);
|
|
53
54
|
const nodeType = $derived(data.metadata?.type ?? 'atom');
|
|
54
55
|
|
|
55
56
|
// Instance extensions override node-type defaults.
|
|
56
57
|
const atomCfg = $derived<AtomUIConfig>(
|
|
57
58
|
data.extensions?.ui?.atom ?? data.metadata?.extensions?.ui?.atom ?? {}
|
|
58
59
|
);
|
|
59
|
-
const
|
|
60
|
-
data.extensions?.ui?.hideUnconnectedHandles ??
|
|
61
|
-
data.metadata?.extensions?.ui?.hideUnconnectedHandles ??
|
|
62
|
-
false
|
|
63
|
-
);
|
|
64
|
-
const hiddenPorts = $derived(
|
|
65
|
-
data.extensions?.ui?.hiddenPorts ?? data.metadata?.extensions?.ui?.hiddenPorts ?? {}
|
|
66
|
-
);
|
|
67
|
-
const portOrder = $derived(
|
|
68
|
-
data.extensions?.ui?.portOrder ?? data.metadata?.extensions?.ui?.portOrder ?? {}
|
|
69
|
-
);
|
|
60
|
+
const portsConfig = $derived((data.config?.ports as PortsConfig | undefined) ?? {});
|
|
70
61
|
|
|
71
62
|
// Optional, server-driven accent. When unset the inline custom property is
|
|
72
63
|
// omitted, so CSS falls back to the neutral border — uncolored atoms are
|
|
@@ -90,32 +81,15 @@
|
|
|
90
81
|
const nodeLike = $derived<Pick<WorkflowNodeType, 'type' | 'data'>>({ type: nodeType, data });
|
|
91
82
|
|
|
92
83
|
const inPorts = $derived(
|
|
93
|
-
|
|
94
|
-
(p: NodePort) =>
|
|
95
|
-
isPortVisible(
|
|
96
|
-
p,
|
|
97
|
-
'input',
|
|
98
|
-
hiddenPorts,
|
|
99
|
-
hideUnconnectedHandles,
|
|
100
|
-
fd.workflow.connectedHandles,
|
|
101
|
-
nodeId
|
|
102
|
-
)
|
|
84
|
+
orderPortsFor(ProximityConnectHelper.getAllPorts(nodeLike, 'input'), portsConfig.inputs).filter(
|
|
85
|
+
(p: NodePort) => isPortVisible(p, 'input', portsConfig)
|
|
103
86
|
)
|
|
104
87
|
);
|
|
105
88
|
const outPorts = $derived(
|
|
106
|
-
|
|
89
|
+
orderPortsFor(
|
|
107
90
|
ProximityConnectHelper.getAllPorts(nodeLike, 'output'),
|
|
108
|
-
|
|
109
|
-
).filter((p: NodePort) =>
|
|
110
|
-
isPortVisible(
|
|
111
|
-
p,
|
|
112
|
-
'output',
|
|
113
|
-
hiddenPorts,
|
|
114
|
-
hideUnconnectedHandles,
|
|
115
|
-
fd.workflow.connectedHandles,
|
|
116
|
-
nodeId
|
|
117
|
-
)
|
|
118
|
-
)
|
|
91
|
+
portsConfig.outputs
|
|
92
|
+
).filter((p: NodePort) => isPortVisible(p, 'output', portsConfig))
|
|
119
93
|
);
|
|
120
94
|
|
|
121
95
|
/** Friendly label for a value, using the field's oneOf titles when present. */
|
|
@@ -157,9 +131,9 @@
|
|
|
157
131
|
type="target"
|
|
158
132
|
position={Position.Left}
|
|
159
133
|
id={`${nodeId}-input-${port.id}`}
|
|
160
|
-
style="--fd-handle-fill: var(--fd-port-skin-color, {
|
|
134
|
+
style="--fd-handle-fill: var(--fd-port-skin-color, {getPortColorToken(
|
|
161
135
|
checker,
|
|
162
|
-
port
|
|
136
|
+
port
|
|
163
137
|
)}); top: {portTopPct(index, inPorts.length)}%;"
|
|
164
138
|
/>
|
|
165
139
|
{/each}
|
|
@@ -192,9 +166,9 @@
|
|
|
192
166
|
type="source"
|
|
193
167
|
position={Position.Right}
|
|
194
168
|
id={`${nodeId}-output-${port.id}`}
|
|
195
|
-
style="--fd-handle-fill: var(--fd-port-skin-color, {
|
|
169
|
+
style="--fd-handle-fill: var(--fd-port-skin-color, {getPortColorToken(
|
|
196
170
|
checker,
|
|
197
|
-
port
|
|
171
|
+
port
|
|
198
172
|
)}); top: {portTopPct(index, outPorts.length)}%;"
|
|
199
173
|
/>
|
|
200
174
|
{/each}
|
|
@@ -3,7 +3,6 @@ interface AtomNodeData {
|
|
|
3
3
|
label: string;
|
|
4
4
|
config: ConfigValues;
|
|
5
5
|
metadata: NodeMetadata;
|
|
6
|
-
nodeId?: string;
|
|
7
6
|
extensions?: NodeExtensions;
|
|
8
7
|
onConfigOpen?: (node: {
|
|
9
8
|
id: string;
|
|
@@ -16,6 +15,7 @@ interface AtomNodeData {
|
|
|
16
15
|
}) => void;
|
|
17
16
|
}
|
|
18
17
|
interface Props {
|
|
18
|
+
id: string;
|
|
19
19
|
data: AtomNodeData;
|
|
20
20
|
selected?: boolean;
|
|
21
21
|
isProcessing?: boolean;
|