@flowdrop/flowdrop 2.0.0-beta.5 → 2.0.0-beta.7

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +39 -2
  2. package/dist/commands/executor.js +46 -20
  3. package/dist/components/App.svelte +1 -10
  4. package/dist/components/ConfigForm.svelte +98 -529
  5. package/dist/components/ConfigForm.svelte.d.ts +4 -6
  6. package/dist/components/ConfigModal.svelte +0 -1
  7. package/dist/components/form/FormField.svelte +15 -0
  8. package/dist/components/form/FormFieldLight.svelte +14 -0
  9. package/dist/components/form/FormFieldset.svelte +44 -10
  10. package/dist/components/form/FormPorts.svelte +262 -0
  11. package/dist/components/form/FormPorts.svelte.d.ts +13 -0
  12. package/dist/components/form/FormRangeField.svelte +43 -3
  13. package/dist/components/nodes/AtomNode.svelte +13 -39
  14. package/dist/components/nodes/GatewayNode.svelte +20 -56
  15. package/dist/components/nodes/SimpleNode.svelte +23 -49
  16. package/dist/components/nodes/SquareNode.svelte +23 -49
  17. package/dist/components/nodes/TerminalNode.svelte +25 -31
  18. package/dist/components/nodes/WorkflowNode.svelte +37 -84
  19. package/dist/core/index.d.ts +1 -1
  20. package/dist/openapi/v1/openapi.yaml +33 -21
  21. package/dist/schemas/v1/workflow.schema.json +16 -14
  22. package/dist/services/dynamicSchemaService.d.ts +29 -2
  23. package/dist/services/dynamicSchemaService.js +54 -25
  24. package/dist/stores/workflowStore.svelte.d.ts +1 -1
  25. package/dist/stores/workflowStore.svelte.js +7 -2
  26. package/dist/types/index.d.ts +74 -20
  27. package/dist/types/uischema.d.ts +5 -0
  28. package/dist/utils/colors.d.ts +27 -0
  29. package/dist/utils/colors.js +23 -0
  30. package/dist/utils/portUtils.d.ts +47 -11
  31. package/dist/utils/portUtils.js +67 -14
  32. package/dist/utils/schemaMerge.d.ts +25 -0
  33. package/dist/utils/schemaMerge.js +61 -0
  34. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import type { ConfigSchema, WorkflowNode, WorkflowEdge, NodeUIExtensions, AuthProvider } from '../types/index.js';
1
+ import type { ConfigSchema, WorkflowNode, WorkflowEdge, AuthProvider } from '../types/index.js';
2
2
  import type { UISchemaElement } from '../types/uischema.js';
3
3
  interface Props {
4
4
  /** Optional workflow node (if provided, schema and values are derived from it) */
@@ -14,8 +14,6 @@ interface Props {
14
14
  uiSchema?: UISchemaElement;
15
15
  /** Direct config values (used when node is not provided) */
16
16
  values?: Record<string, unknown>;
17
- /** Whether to show UI extension settings section */
18
- showUIExtensions?: boolean;
19
17
  /** Optional workflow ID for context in external links */
20
18
  workflowId?: string;
21
19
  /** Whether to also save the workflow when saving config */
@@ -33,9 +31,9 @@ interface Props {
33
31
  /** Auth provider for API requests (used for template variable API mode) */
34
32
  authProvider?: AuthProvider;
35
33
  /** Callback when any field value changes (fired on blur for immediate sync) */
36
- onChange?: (config: Record<string, unknown>, uiExtensions?: NodeUIExtensions) => void;
37
- /** Callback when form is saved (includes both config and extensions if enabled) */
38
- onSave?: (config: Record<string, unknown>, uiExtensions?: NodeUIExtensions) => void;
34
+ onChange?: (config: Record<string, unknown>) => void;
35
+ /** Callback when form is saved */
36
+ onSave?: (config: Record<string, unknown>) => void;
39
37
  /** Callback when form is cancelled */
40
38
  onCancel?: () => void;
41
39
  }
@@ -77,7 +77,6 @@
77
77
  <ConfigForm
78
78
  schema={props.configSchema}
79
79
  values={localConfigValues}
80
- showUIExtensions={false}
81
80
  onSave={(config) => {
82
81
  onSave?.(config);
83
82
  }}
@@ -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">
@@ -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
- <div class="form-fieldset__label">
38
- <Icon icon="heroicons:chevron-right" class="form-fieldset__chevron" />
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
- </div>
41
- {#if group.description}
42
- <span class="form-fieldset__badge">{group.description}</span>
43
- {/if}
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-xs);
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-top: var(--fd-space-xs);
143
+ padding: var(--fd-space-xl);
110
144
  }
111
145
 
112
146
  .form-fieldset__fields {
@@ -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;
@@ -37,7 +37,7 @@
37
37
  value = 0,
38
38
  min = 0,
39
39
  max = 100,
40
- step = 1,
40
+ step,
41
41
  required = false,
42
42
  disabled = false,
43
43
  ariaDescribedBy,
@@ -56,6 +56,40 @@
56
56
  return isNaN(parsed) ? min : parsed;
57
57
  });
58
58
 
59
+ /** Count the decimal places of a finite number (e.g. 0.7 -> 1, 3 -> 0). */
60
+ function decimalPlaces(n: number): number {
61
+ if (!Number.isFinite(n)) return 0;
62
+ const text = String(n);
63
+ const dot = text.indexOf('.');
64
+ return dot === -1 ? 0 : text.length - dot - 1;
65
+ }
66
+
67
+ /**
68
+ * Resolve the step the native input should use.
69
+ *
70
+ * The backend often omits `step`, and a default of 1 makes the browser snap a
71
+ * fractional value (0.7) to the nearest integer (1) — the thumb jumps to that
72
+ * snapped position while our fill/label still show the raw value, so they
73
+ * disagree on load. When no step is given, infer one from the precision of the
74
+ * initial value/min/max so a value like 0.7 yields a step of 0.1.
75
+ *
76
+ * Granularity is a property of the field, not the live value, so it is captured
77
+ * ONCE. Recomputing from the live value would coarsen the step back to 1 the
78
+ * instant the user drags onto a whole number (e.g. 1.0), stranding the slider
79
+ * on integer increments.
80
+ */
81
+ const initialNumeric = typeof value === 'number' ? value : Number(value);
82
+ const inferredStep = ((): number => {
83
+ const places = Math.max(
84
+ decimalPlaces(Number.isNaN(initialNumeric) ? min : initialNumeric),
85
+ decimalPlaces(min),
86
+ decimalPlaces(max)
87
+ );
88
+ return places > 0 ? Math.pow(10, -places) : 1;
89
+ })();
90
+
91
+ const effectiveStep = $derived(typeof step === 'number' && step > 0 ? step : inferredStep);
92
+
59
93
  /**
60
94
  * Compute the percentage position for the filled track
61
95
  * Used to show visual progress of the slider
@@ -79,14 +113,20 @@
79
113
 
80
114
  <div class="form-range-container">
81
115
  <div class="form-range-slider">
116
+ <!--
117
+ Order matters: min/max/step must be applied BEFORE value. A range input
118
+ defaults to step=1, so setting value=0.7 first snaps it to 1, and the later
119
+ step=0.1 does not re-validate the already-snapped value. Setting the bounds
120
+ and step first lets the value land truthfully.
121
+ -->
82
122
  <input
83
123
  {id}
84
124
  type="range"
85
125
  class="form-range-field"
86
- value={numericValue}
87
126
  {min}
88
127
  {max}
89
- {step}
128
+ step={effectiveStep}
129
+ value={numericValue}
90
130
  {disabled}
91
131
  {required}
92
132
  aria-describedby={ariaDescribedBy}
@@ -17,11 +17,12 @@
17
17
  NodeExtensions,
18
18
  NodePort,
19
19
  AtomUIConfig,
20
+ PortsConfig,
20
21
  WorkflowNode as WorkflowNodeType
21
22
  } from '../../types/index.js';
22
- import { getDataTypeColor } from '../../utils/colors.js';
23
+ import { getPortColorToken } from '../../utils/colors.js';
23
24
  import { getInstance } from '../../stores/getInstance.svelte.js';
24
- import { applyPortOrder, isPortVisible } from '../../utils/portUtils.js';
25
+ import { orderPortsFor, isPortVisible } from '../../utils/portUtils.js';
25
26
  import { ProximityConnectHelper } from '../../helpers/proximityConnect.js';
26
27
 
27
28
  interface AtomNodeData {
@@ -56,17 +57,7 @@
56
57
  const atomCfg = $derived<AtomUIConfig>(
57
58
  data.extensions?.ui?.atom ?? data.metadata?.extensions?.ui?.atom ?? {}
58
59
  );
59
- const hideUnconnectedHandles = $derived(
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
- applyPortOrder(ProximityConnectHelper.getAllPorts(nodeLike, 'input'), portOrder.inputs).filter(
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
- applyPortOrder(
89
+ orderPortsFor(
107
90
  ProximityConnectHelper.getAllPorts(nodeLike, 'output'),
108
- portOrder.outputs
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, {getDataTypeColor(
134
+ style="--fd-handle-fill: var(--fd-port-skin-color, {getPortColorToken(
161
135
  checker,
162
- port.dataType
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, {getDataTypeColor(
169
+ style="--fd-handle-fill: var(--fd-port-skin-color, {getPortColorToken(
196
170
  checker,
197
- port.dataType
171
+ port
198
172
  )}); top: {portTopPct(index, outPorts.length)}%;"
199
173
  />
200
174
  {/each}