@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
|
@@ -3,14 +3,16 @@
|
|
|
3
3
|
Visual representation of gateway/branch nodes with branching flow indicators
|
|
4
4
|
Shows active branches and execution paths
|
|
5
5
|
Styled with BEM syntax following WorkflowNode pattern
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
-
|
|
6
|
+
|
|
7
|
+
Port rendering:
|
|
8
|
+
- Input-port exposure (data.config.ports, falling back to each port's
|
|
9
|
+
exposedByDefault) decides which input ports render, in effective order.
|
|
10
|
+
Branches are authored output paths and always render.
|
|
9
11
|
-->
|
|
10
12
|
|
|
11
13
|
<script lang="ts">
|
|
12
14
|
import { Position, Handle } from '@xyflow/svelte';
|
|
13
|
-
import type { WorkflowNode,
|
|
15
|
+
import type { WorkflowNode, Branch, PortsConfig } from '../../types/index.js';
|
|
14
16
|
import Icon from '@iconify/svelte';
|
|
15
17
|
import NodeConfigButton from './NodeConfigButton.svelte';
|
|
16
18
|
import { getNodeIcon } from '../../utils/icons.js';
|
|
@@ -20,11 +22,12 @@
|
|
|
20
22
|
getPortBackgroundColor
|
|
21
23
|
} from '../../utils/colors.js';
|
|
22
24
|
import { getInstance } from '../../stores/getInstance.svelte.js';
|
|
25
|
+
import { orderPortsFor, isPortVisible } from '../../utils/portUtils.js';
|
|
23
26
|
import { m } from '../../messages/index.js';
|
|
24
27
|
|
|
25
28
|
interface Props {
|
|
29
|
+
id: string;
|
|
26
30
|
data: WorkflowNode['data'] & {
|
|
27
|
-
nodeId?: string;
|
|
28
31
|
onConfigOpen?: (node: { id: string; type: string; data: WorkflowNode['data'] }) => void;
|
|
29
32
|
};
|
|
30
33
|
selected?: boolean;
|
|
@@ -56,60 +59,21 @@
|
|
|
56
59
|
);
|
|
57
60
|
|
|
58
61
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
|
|
62
|
-
const hideUnconnectedHandles = $derived(
|
|
63
|
-
props.data.extensions?.ui?.hideUnconnectedHandles ??
|
|
64
|
-
props.data.metadata?.extensions?.ui?.hideUnconnectedHandles ??
|
|
65
|
-
false
|
|
66
|
-
);
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Check if a port should be visible based on connection state and settings
|
|
70
|
-
* @param port - The port to check
|
|
71
|
-
* @param type - Whether this is an 'input' or 'output' port
|
|
72
|
-
* @returns true if the port should be visible
|
|
62
|
+
* Per-instance port order + exposure, in config. Order overrides the metadata
|
|
63
|
+
* default; exposure is semantic (a not-exposed port is hidden, not wireable,
|
|
64
|
+
* not runtime-overridable).
|
|
73
65
|
*/
|
|
74
|
-
|
|
75
|
-
// Always show if hideUnconnectedHandles is disabled
|
|
76
|
-
if (!hideUnconnectedHandles) {
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
// Always show required ports
|
|
81
|
-
if (port.required) {
|
|
82
|
-
return true;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// Check if port is connected
|
|
86
|
-
const handleId = `${props.data.nodeId}-${type}-${port.id}`;
|
|
87
|
-
return fd.workflow.connectedHandles.has(handleId);
|
|
88
|
-
}
|
|
66
|
+
const portsConfig = $derived((props.data.config?.ports as PortsConfig | undefined) ?? {});
|
|
89
67
|
|
|
90
68
|
/**
|
|
91
|
-
* Derived list of
|
|
69
|
+
* Derived list of exposed input ports, in effective order.
|
|
92
70
|
*/
|
|
93
71
|
const visibleInputPorts = $derived(
|
|
94
|
-
props.data.metadata.inputs.filter((port) =>
|
|
72
|
+
orderPortsFor(props.data.metadata.inputs, portsConfig.inputs).filter((port) =>
|
|
73
|
+
isPortVisible(port, 'input', portsConfig)
|
|
74
|
+
)
|
|
95
75
|
);
|
|
96
76
|
|
|
97
|
-
/**
|
|
98
|
-
* Check if a branch output should be visible based on connection state
|
|
99
|
-
* @param branchName - The branch name to check
|
|
100
|
-
* @returns true if the branch should be visible
|
|
101
|
-
*/
|
|
102
|
-
function isBranchVisible(branchName: string): boolean {
|
|
103
|
-
// Always show if hideUnconnectedHandles is disabled
|
|
104
|
-
if (!hideUnconnectedHandles) {
|
|
105
|
-
return true;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
// Check if branch output is connected
|
|
109
|
-
const handleId = `${props.data.nodeId}-output-${branchName}`;
|
|
110
|
-
return fd.workflow.connectedHandles.has(handleId);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
77
|
// Gateway-specific data - branches are calculated at runtime from config
|
|
114
78
|
let branches = $derived((props.data.config?.branches as Branch[]) || []);
|
|
115
79
|
let activeBranches = $derived(
|
|
@@ -117,9 +81,9 @@
|
|
|
117
81
|
);
|
|
118
82
|
|
|
119
83
|
/**
|
|
120
|
-
*
|
|
84
|
+
* Branches are authored output paths, so they always render.
|
|
121
85
|
*/
|
|
122
|
-
const visibleBranches = $derived(branches
|
|
86
|
+
const visibleBranches = $derived(branches);
|
|
123
87
|
|
|
124
88
|
/**
|
|
125
89
|
* Handle double-click to open config
|
|
@@ -127,7 +91,7 @@
|
|
|
127
91
|
function handleNodeDoubleClick(): void {
|
|
128
92
|
if (props.data.onConfigOpen) {
|
|
129
93
|
props.data.onConfigOpen({
|
|
130
|
-
id: props.
|
|
94
|
+
id: props.id,
|
|
131
95
|
type: 'gateway',
|
|
132
96
|
data: props.data
|
|
133
97
|
});
|
|
@@ -151,7 +115,7 @@
|
|
|
151
115
|
class:flowdrop-workflow-node--selected={props.selected}
|
|
152
116
|
ondblclick={handleNodeDoubleClick}
|
|
153
117
|
aria-label={graph.gatewayNode({ title: displayTitle })}
|
|
154
|
-
aria-describedby="node-description-{props.
|
|
118
|
+
aria-describedby="node-description-{props.id}"
|
|
155
119
|
>
|
|
156
120
|
<!-- Node Header: expands in multiples of 10 (title row 40px + gap 10px + description 20px per line) -->
|
|
157
121
|
<div class="flowdrop-workflow-node__header">
|
|
@@ -173,15 +137,12 @@
|
|
|
173
137
|
</h3>
|
|
174
138
|
</div>
|
|
175
139
|
<!-- Node Description - line-height 20px so header grows in steps of 10 -->
|
|
176
|
-
<p
|
|
177
|
-
class="flowdrop-workflow-node__header-desc"
|
|
178
|
-
id="node-description-{props.data.nodeId || 'unknown'}"
|
|
179
|
-
>
|
|
140
|
+
<p class="flowdrop-workflow-node__header-desc" id="node-description-{props.id}">
|
|
180
141
|
{displayDescription}
|
|
181
142
|
</p>
|
|
182
143
|
</div>
|
|
183
144
|
|
|
184
|
-
<!-- Input Ports Container (
|
|
145
|
+
<!-- Input Ports Container (exposed input ports) -->
|
|
185
146
|
{#if visibleInputPorts.length > 0}
|
|
186
147
|
<div class="flowdrop-workflow-node__ports">
|
|
187
148
|
<div class="flowdrop-workflow-node__ports-list">
|
|
@@ -191,7 +152,7 @@
|
|
|
191
152
|
<Handle
|
|
192
153
|
type="target"
|
|
193
154
|
position={Position.Left}
|
|
194
|
-
id={`${props.
|
|
155
|
+
id={`${props.id}-input-${port.id}`}
|
|
195
156
|
class="flowdrop-workflow-node__handle"
|
|
196
157
|
style="top: var(--fd-node-port-row-height); transform: translateY(-50%); --fd-handle-fill: {getDataTypeColorToken(
|
|
197
158
|
checker,
|
|
@@ -235,7 +196,7 @@
|
|
|
235
196
|
</div>
|
|
236
197
|
{/if}
|
|
237
198
|
|
|
238
|
-
<!-- Branches Section (Output Ports)
|
|
199
|
+
<!-- Branches Section (Output Ports) -->
|
|
239
200
|
{#if visibleBranches.length > 0}
|
|
240
201
|
<div class="flowdrop-workflow-node__ports">
|
|
241
202
|
<div class="flowdrop-workflow-node__ports-list">
|
|
@@ -280,7 +241,7 @@
|
|
|
280
241
|
<Handle
|
|
281
242
|
type="source"
|
|
282
243
|
position={Position.Right}
|
|
283
|
-
id={`${props.
|
|
244
|
+
id={`${props.id}-output-${branch.name}`}
|
|
284
245
|
class={`flowdrop-workflow-node__handle ${isActive ? 'flowdrop-workflow-node__handle--active' : ''}`}
|
|
285
246
|
style="top: var(--fd-node-port-row-height); transform: translateY(-50%); --fd-handle-fill: {isActive
|
|
286
247
|
? getDataTypeColorToken(checker, 'trigger')
|
|
@@ -303,7 +264,7 @@
|
|
|
303
264
|
</div>
|
|
304
265
|
</div>
|
|
305
266
|
{/if}
|
|
306
|
-
<!-- Note: When
|
|
267
|
+
<!-- Note: When there are no branches, we don't show anything -->
|
|
307
268
|
|
|
308
269
|
<!-- Config button -->
|
|
309
270
|
<NodeConfigButton onclick={handleNodeDoubleClick} title="Configure node" />
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
* IdeaNode component props
|
|
20
20
|
* Displays a card-style node for conceptual flow diagrams
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
interface Props {
|
|
23
|
+
id: string;
|
|
23
24
|
data: {
|
|
24
25
|
label: string;
|
|
25
26
|
config: ConfigValues;
|
|
26
27
|
metadata: NodeMetadata;
|
|
27
|
-
nodeId?: string;
|
|
28
28
|
onConfigOpen?: (node: {
|
|
29
29
|
id: string;
|
|
30
30
|
type: string;
|
|
@@ -34,7 +34,9 @@
|
|
|
34
34
|
selected?: boolean;
|
|
35
35
|
isProcessing?: boolean;
|
|
36
36
|
isError?: boolean;
|
|
37
|
-
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
let props: Props = $props();
|
|
38
40
|
|
|
39
41
|
const checker = getInstance().portCompatibility;
|
|
40
42
|
|
|
@@ -101,7 +103,7 @@
|
|
|
101
103
|
function openConfigSidebar(): void {
|
|
102
104
|
if (props.data.onConfigOpen) {
|
|
103
105
|
const nodeForConfig = {
|
|
104
|
-
id: props.
|
|
106
|
+
id: props.id,
|
|
105
107
|
type: 'idea',
|
|
106
108
|
data: props.data
|
|
107
109
|
};
|
|
@@ -139,7 +141,7 @@
|
|
|
139
141
|
checker,
|
|
140
142
|
IDEA_DATA_TYPE
|
|
141
143
|
)}; --fd-handle-border-color: var(--fd-handle-border); top: 40px; transform: translateY(-50%); z-index: 30;"
|
|
142
|
-
id={`${props.
|
|
144
|
+
id={`${props.id}-input-left`}
|
|
143
145
|
/>
|
|
144
146
|
{/if}
|
|
145
147
|
|
|
@@ -152,7 +154,7 @@
|
|
|
152
154
|
checker,
|
|
153
155
|
IDEA_DATA_TYPE
|
|
154
156
|
)}; --fd-handle-border-color: var(--fd-handle-border); left: 140px; transform: translateX(-50%); z-index: 30;"
|
|
155
|
-
id={`${props.
|
|
157
|
+
id={`${props.id}-input-top`}
|
|
156
158
|
/>
|
|
157
159
|
{/if}
|
|
158
160
|
|
|
@@ -203,7 +205,7 @@
|
|
|
203
205
|
checker,
|
|
204
206
|
IDEA_DATA_TYPE
|
|
205
207
|
)}; --fd-handle-border-color: var(--fd-handle-border); top: 40px; transform: translateY(-50%); z-index: 30;"
|
|
206
|
-
id={`${props.
|
|
208
|
+
id={`${props.id}-output-right`}
|
|
207
209
|
/>
|
|
208
210
|
{/if}
|
|
209
211
|
|
|
@@ -216,7 +218,7 @@
|
|
|
216
218
|
checker,
|
|
217
219
|
IDEA_DATA_TYPE
|
|
218
220
|
)}; --fd-handle-border-color: var(--fd-handle-border); left: 140px; transform: translateX(-50%); z-index: 30;"
|
|
219
|
-
id={`${props.
|
|
221
|
+
id={`${props.id}-output-bottom`}
|
|
220
222
|
/>
|
|
221
223
|
{/if}
|
|
222
224
|
</div>
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { ConfigValues, NodeMetadata } from '../../types/index.js';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* IdeaNode component props
|
|
4
|
+
* Displays a card-style node for conceptual flow diagrams
|
|
5
|
+
*/
|
|
6
|
+
interface Props {
|
|
7
|
+
id: string;
|
|
3
8
|
data: {
|
|
4
9
|
label: string;
|
|
5
10
|
config: ConfigValues;
|
|
6
11
|
metadata: NodeMetadata;
|
|
7
|
-
nodeId?: string;
|
|
8
12
|
onConfigOpen?: (node: {
|
|
9
13
|
id: string;
|
|
10
14
|
type: string;
|
|
@@ -18,7 +22,7 @@ type $$ComponentProps = {
|
|
|
18
22
|
selected?: boolean;
|
|
19
23
|
isProcessing?: boolean;
|
|
20
24
|
isError?: boolean;
|
|
21
|
-
}
|
|
22
|
-
declare const IdeaNode: import("svelte").Component
|
|
25
|
+
}
|
|
26
|
+
declare const IdeaNode: import("svelte").Component<Props, {}, "">;
|
|
23
27
|
type IdeaNode = ReturnType<typeof IdeaNode>;
|
|
24
28
|
export default IdeaNode;
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
* NotesNode component props
|
|
10
10
|
* Displays a styled note with markdown content
|
|
11
11
|
*/
|
|
12
|
-
|
|
12
|
+
interface Props {
|
|
13
|
+
id: string;
|
|
13
14
|
data: {
|
|
14
15
|
label: string;
|
|
15
16
|
config: ConfigValues;
|
|
16
17
|
metadata: NodeMetadata;
|
|
17
|
-
nodeId?: string;
|
|
18
18
|
onConfigOpen?: (node: {
|
|
19
19
|
id: string;
|
|
20
20
|
type: string;
|
|
@@ -24,7 +24,9 @@
|
|
|
24
24
|
selected?: boolean;
|
|
25
25
|
isProcessing?: boolean;
|
|
26
26
|
isError?: boolean;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let props: Props = $props();
|
|
28
30
|
|
|
29
31
|
// Hoist the notes branch — read for placeholder, every type name, processing,
|
|
30
32
|
// error, and configure tooltip.
|
|
@@ -75,7 +77,7 @@
|
|
|
75
77
|
function openConfigSidebar(): void {
|
|
76
78
|
if (props.data.onConfigOpen) {
|
|
77
79
|
const nodeForConfig = {
|
|
78
|
-
id: props.
|
|
80
|
+
id: props.id,
|
|
79
81
|
type: 'note',
|
|
80
82
|
data: props.data
|
|
81
83
|
};
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import type { ConfigValues, NodeMetadata } from '../../types/index.js';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* NotesNode component props
|
|
4
|
+
* Displays a styled note with markdown content
|
|
5
|
+
*/
|
|
6
|
+
interface Props {
|
|
7
|
+
id: string;
|
|
3
8
|
data: {
|
|
4
9
|
label: string;
|
|
5
10
|
config: ConfigValues;
|
|
6
11
|
metadata: NodeMetadata;
|
|
7
|
-
nodeId?: string;
|
|
8
12
|
onConfigOpen?: (node: {
|
|
9
13
|
id: string;
|
|
10
14
|
type: string;
|
|
@@ -18,7 +22,7 @@ type $$ComponentProps = {
|
|
|
18
22
|
selected?: boolean;
|
|
19
23
|
isProcessing?: boolean;
|
|
20
24
|
isError?: boolean;
|
|
21
|
-
}
|
|
22
|
-
declare const NotesNode: import("svelte").Component
|
|
25
|
+
}
|
|
26
|
+
declare const NotesNode: import("svelte").Component<Props, {}, "">;
|
|
23
27
|
type NotesNode = ReturnType<typeof NotesNode>;
|
|
24
28
|
export default NotesNode;
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
A simple node with optional input and output ports
|
|
4
4
|
Styled with BEM syntax
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
-
|
|
6
|
+
Port rendering:
|
|
7
|
+
- Exposure (data.config.ports, falling back to each port's exposedByDefault)
|
|
8
|
+
decides which ports render — a not-exposed port is hidden.
|
|
9
|
+
- Order: data.config.ports order overrides the metadata default (displayOrder);
|
|
10
|
+
unlisted ports follow in default order.
|
|
10
11
|
-->
|
|
11
12
|
|
|
12
13
|
<script lang="ts">
|
|
@@ -16,22 +17,23 @@
|
|
|
16
17
|
NodeMetadata,
|
|
17
18
|
NodeExtensions,
|
|
18
19
|
NodePort,
|
|
19
|
-
DynamicPort
|
|
20
|
+
DynamicPort,
|
|
21
|
+
PortsConfig
|
|
20
22
|
} from '../../types/index.js';
|
|
21
23
|
import { dynamicPortToNodePort } from '../../types/index.js';
|
|
22
24
|
import Icon from '@iconify/svelte';
|
|
23
|
-
import {
|
|
25
|
+
import { getPortColorToken, getCategoryColorToken } from '../../utils/colors.js';
|
|
24
26
|
import { getInstance } from '../../stores/getInstance.svelte.js';
|
|
25
|
-
import {
|
|
27
|
+
import { orderPortsFor, getPortTop, isPortVisible } from '../../utils/portUtils.js';
|
|
26
28
|
import NodeConfigButton from './NodeConfigButton.svelte';
|
|
27
29
|
import AlertCircleIcon from '../icons/AlertCircleIcon.svelte';
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
interface Props {
|
|
32
|
+
id: string;
|
|
30
33
|
data: {
|
|
31
34
|
label: string;
|
|
32
35
|
config: ConfigValues;
|
|
33
36
|
metadata: NodeMetadata;
|
|
34
|
-
nodeId?: string;
|
|
35
37
|
extensions?: NodeExtensions;
|
|
36
38
|
onConfigOpen?: (node: {
|
|
37
39
|
id: string;
|
|
@@ -42,27 +44,19 @@
|
|
|
42
44
|
selected?: boolean;
|
|
43
45
|
isProcessing?: boolean;
|
|
44
46
|
isError?: boolean;
|
|
45
|
-
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
let props: Props = $props();
|
|
46
50
|
|
|
47
51
|
const fd = getInstance();
|
|
48
52
|
const checker = fd.portCompatibility;
|
|
49
53
|
|
|
50
54
|
/**
|
|
51
|
-
*
|
|
55
|
+
* Per-instance port order + exposure, in config. Order overrides the metadata
|
|
56
|
+
* default; exposure is semantic (a not-exposed port is hidden, not wireable,
|
|
57
|
+
* not runtime-overridable).
|
|
52
58
|
*/
|
|
53
|
-
const
|
|
54
|
-
props.data.extensions?.ui?.hideUnconnectedHandles ??
|
|
55
|
-
props.data.metadata?.extensions?.ui?.hideUnconnectedHandles ??
|
|
56
|
-
false
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const hiddenPorts = $derived(
|
|
60
|
-
props.data.extensions?.ui?.hiddenPorts ?? props.data.metadata?.extensions?.ui?.hiddenPorts ?? {}
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const portOrder = $derived(
|
|
64
|
-
props.data.extensions?.ui?.portOrder ?? props.data.metadata?.extensions?.ui?.portOrder ?? {}
|
|
65
|
-
);
|
|
59
|
+
const portsConfig = $derived((props.data.config?.ports as PortsConfig | undefined) ?? {});
|
|
66
60
|
|
|
67
61
|
// Prioritize metadata icon over config icon for simple nodes (metadata is the node definition)
|
|
68
62
|
let nodeIcon = $derived(
|
|
@@ -93,7 +87,7 @@
|
|
|
93
87
|
if (props.data.onConfigOpen) {
|
|
94
88
|
// Create a WorkflowNodeType-like object for the global ConfigSidebar
|
|
95
89
|
const nodeForConfig = {
|
|
96
|
-
id: props.
|
|
90
|
+
id: props.id,
|
|
97
91
|
type: 'simple',
|
|
98
92
|
data: props.data
|
|
99
93
|
};
|
|
@@ -122,38 +116,20 @@
|
|
|
122
116
|
* All visible input ports in user-defined order.
|
|
123
117
|
*/
|
|
124
118
|
const visibleInputPorts = $derived(
|
|
125
|
-
|
|
119
|
+
orderPortsFor(
|
|
126
120
|
[...(props.data.metadata?.inputs ?? []), ...dynamicInputs],
|
|
127
|
-
|
|
128
|
-
).filter((p: NodePort) =>
|
|
129
|
-
isPortVisible(
|
|
130
|
-
p,
|
|
131
|
-
'input',
|
|
132
|
-
hiddenPorts,
|
|
133
|
-
hideUnconnectedHandles,
|
|
134
|
-
fd.workflow.connectedHandles,
|
|
135
|
-
props.data.nodeId
|
|
136
|
-
)
|
|
137
|
-
)
|
|
121
|
+
portsConfig.inputs
|
|
122
|
+
).filter((p: NodePort) => isPortVisible(p, 'input', portsConfig))
|
|
138
123
|
);
|
|
139
124
|
|
|
140
125
|
/**
|
|
141
126
|
* All visible output ports in user-defined order.
|
|
142
127
|
*/
|
|
143
128
|
const visibleOutputPorts = $derived(
|
|
144
|
-
|
|
129
|
+
orderPortsFor(
|
|
145
130
|
[...(props.data.metadata?.outputs ?? []), ...dynamicOutputs],
|
|
146
|
-
|
|
147
|
-
).filter((p: NodePort) =>
|
|
148
|
-
isPortVisible(
|
|
149
|
-
p,
|
|
150
|
-
'output',
|
|
151
|
-
hiddenPorts,
|
|
152
|
-
hideUnconnectedHandles,
|
|
153
|
-
fd.workflow.connectedHandles,
|
|
154
|
-
props.data.nodeId
|
|
155
|
-
)
|
|
156
|
-
)
|
|
131
|
+
portsConfig.outputs
|
|
132
|
+
).filter((p: NodePort) => isPortVisible(p, 'output', portsConfig))
|
|
157
133
|
);
|
|
158
134
|
|
|
159
135
|
/**
|
|
@@ -172,14 +148,14 @@
|
|
|
172
148
|
<Handle
|
|
173
149
|
type="target"
|
|
174
150
|
position={Position.Left}
|
|
175
|
-
style="--fd-handle-fill: var(--fd-port-skin-color, {
|
|
151
|
+
style="--fd-handle-fill: var(--fd-port-skin-color, {getPortColorToken(
|
|
176
152
|
checker,
|
|
177
|
-
port
|
|
153
|
+
port
|
|
178
154
|
)}); --fd-handle-border-color: var(--fd-handle-border); top: {getPortTop(
|
|
179
155
|
index,
|
|
180
156
|
visibleInputPorts.length
|
|
181
157
|
)}px; transform: translateY(-50%); z-index: 30;"
|
|
182
|
-
id={`${props.
|
|
158
|
+
id={`${props.id}-input-${port.id}`}
|
|
183
159
|
/>
|
|
184
160
|
{/each}
|
|
185
161
|
|
|
@@ -244,14 +220,14 @@
|
|
|
244
220
|
<Handle
|
|
245
221
|
type="source"
|
|
246
222
|
position={Position.Right}
|
|
247
|
-
style="--fd-handle-fill: var(--fd-port-skin-color, {
|
|
223
|
+
style="--fd-handle-fill: var(--fd-port-skin-color, {getPortColorToken(
|
|
248
224
|
checker,
|
|
249
|
-
port
|
|
225
|
+
port
|
|
250
226
|
)}); --fd-handle-border-color: var(--fd-handle-border); top: {getPortTop(
|
|
251
227
|
index,
|
|
252
228
|
visibleOutputPorts.length
|
|
253
229
|
)}px; transform: translateY(-50%); z-index: 30;"
|
|
254
|
-
id={`${props.
|
|
230
|
+
id={`${props.id}-output-${port.id}`}
|
|
255
231
|
/>
|
|
256
232
|
{/each}
|
|
257
233
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ConfigValues, NodeMetadata, NodeExtensions } from '../../types/index.js';
|
|
2
|
-
|
|
2
|
+
interface Props {
|
|
3
|
+
id: string;
|
|
3
4
|
data: {
|
|
4
5
|
label: string;
|
|
5
6
|
config: ConfigValues;
|
|
6
7
|
metadata: NodeMetadata;
|
|
7
|
-
nodeId?: string;
|
|
8
8
|
extensions?: NodeExtensions;
|
|
9
9
|
onConfigOpen?: (node: {
|
|
10
10
|
id: string;
|
|
@@ -19,7 +19,7 @@ type $$ComponentProps = {
|
|
|
19
19
|
selected?: boolean;
|
|
20
20
|
isProcessing?: boolean;
|
|
21
21
|
isError?: boolean;
|
|
22
|
-
}
|
|
23
|
-
declare const SimpleNode: import("svelte").Component
|
|
22
|
+
}
|
|
23
|
+
declare const SimpleNode: import("svelte").Component<Props, {}, "">;
|
|
24
24
|
type SimpleNode = ReturnType<typeof SimpleNode>;
|
|
25
25
|
export default SimpleNode;
|