@flowdrop/flowdrop 2.5.0 → 2.7.0

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 (68) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/dist/chat/commandClassifier.d.ts +19 -1
  3. package/dist/chat/commandClassifier.js +33 -1
  4. package/dist/chat/index.d.ts +1 -1
  5. package/dist/chat/index.js +1 -1
  6. package/dist/commands/executor.js +270 -37
  7. package/dist/commands/index.d.ts +1 -1
  8. package/dist/commands/parser.js +20 -0
  9. package/dist/commands/types.d.ts +77 -12
  10. package/dist/components/App.svelte +8 -0
  11. package/dist/components/BindablePortListbox.svelte +426 -0
  12. package/dist/components/BindablePortListbox.svelte.d.ts +23 -0
  13. package/dist/components/WorkflowInterfaceEditor.svelte +142 -36
  14. package/dist/components/WorkflowInterfaceEditor.svelte.d.ts +8 -0
  15. package/dist/components/WorkflowInterfaceEntryCard.svelte +537 -294
  16. package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +6 -3
  17. package/dist/components/WorkflowInterfaceEntryComposer.svelte +331 -0
  18. package/dist/components/WorkflowInterfaceEntryComposer.svelte.d.ts +19 -0
  19. package/dist/components/console/CommandConsole.svelte +8 -0
  20. package/dist/components/console/formatters.d.ts +9 -1
  21. package/dist/components/console/formatters.js +54 -0
  22. package/dist/core/index.d.ts +1 -1
  23. package/dist/messages/context.d.ts +6 -0
  24. package/dist/messages/context.js +8 -0
  25. package/dist/messages/defaults.d.ts +78 -2
  26. package/dist/messages/defaults.js +50 -3
  27. package/dist/messages/index.d.ts +1 -1
  28. package/dist/messages/index.js +1 -1
  29. package/dist/services/globalSave.d.ts +7 -1
  30. package/dist/services/globalSave.js +17 -3
  31. package/dist/stores/instanceContainer.svelte.d.ts +26 -0
  32. package/dist/stores/instanceContainer.svelte.js +24 -0
  33. package/dist/stores/workflowStore.svelte.d.ts +10 -0
  34. package/dist/stores/workflowStore.svelte.js +15 -0
  35. package/dist/stories/WebMCPFakeAgent.svelte +229 -0
  36. package/dist/stories/WebMCPFakeAgent.svelte.d.ts +10 -0
  37. package/dist/styles/base.css +4 -2
  38. package/dist/styles/tokens.css +6 -0
  39. package/dist/svelte-app.d.ts +24 -2
  40. package/dist/svelte-app.js +65 -3
  41. package/dist/types/index.d.ts +49 -0
  42. package/dist/utils/focus.d.ts +18 -0
  43. package/dist/utils/focus.js +24 -0
  44. package/dist/utils/whenWorkflowLoaded.svelte.d.ts +17 -0
  45. package/dist/utils/whenWorkflowLoaded.svelte.js +42 -0
  46. package/dist/utils/workflowInterface.d.ts +47 -3
  47. package/dist/utils/workflowInterface.js +84 -9
  48. package/dist/webmcp/WebMCP.stories.svelte +101 -0
  49. package/dist/webmcp/WebMCP.stories.svelte.d.ts +18 -0
  50. package/dist/webmcp/WebMCPConfirm.svelte +216 -0
  51. package/dist/webmcp/WebMCPConfirm.svelte.d.ts +21 -0
  52. package/dist/webmcp/bridge.d.ts +63 -0
  53. package/dist/webmcp/bridge.js +106 -0
  54. package/dist/webmcp/descriptors.d.ts +59 -0
  55. package/dist/webmcp/descriptors.js +504 -0
  56. package/dist/webmcp/fake.d.ts +23 -0
  57. package/dist/webmcp/fake.js +42 -0
  58. package/dist/webmcp/gate.d.ts +76 -0
  59. package/dist/webmcp/gate.js +188 -0
  60. package/dist/webmcp/index.d.ts +36 -0
  61. package/dist/webmcp/index.js +32 -0
  62. package/dist/webmcp/register.d.ts +33 -0
  63. package/dist/webmcp/register.js +504 -0
  64. package/dist/webmcp/types.d.ts +268 -0
  65. package/dist/webmcp/types.js +23 -0
  66. package/dist/webmcp/validate.d.ts +32 -0
  67. package/dist/webmcp/validate.js +118 -0
  68. package/package.json +6 -1
@@ -36,7 +36,8 @@ export interface SetConfigCommand {
36
36
  export interface GetConfigCommand {
37
37
  type: 'get_config';
38
38
  nodeId: string;
39
- key: string;
39
+ /** One key; omit to read every value together with the node's config schema. */
40
+ key?: string;
40
41
  }
41
42
  export interface ConnectCommand {
42
43
  type: 'connect';
@@ -65,6 +66,16 @@ export interface ListEdgesCommand {
65
66
  export interface ListTypesCommand {
66
67
  type: 'list_types';
67
68
  }
69
+ /** Describe one node type — ports, config schema, defaults — before adding it. */
70
+ export interface DescribeTypeCommand {
71
+ type: 'describe_type';
72
+ nodeTypeId: string;
73
+ }
74
+ /** Find node types by a case-insensitive substring of id, name, description or tags. */
75
+ export interface SearchTypesCommand {
76
+ type: 'search_types';
77
+ query: string;
78
+ }
68
79
  export interface InfoCommand {
69
80
  type: 'info';
70
81
  nodeId: string;
@@ -136,7 +147,7 @@ export interface CanvasResetViewCommand {
136
147
  type: 'canvas_reset_view';
137
148
  }
138
149
  /** Discriminated union of all commands */
139
- export type Command = AddNodeCommand | DeleteNodeCommand | RenameNodeCommand | SetConfigCommand | GetConfigCommand | ConnectCommand | DisconnectPortsCommand | DisconnectNodeCommand | ListNodesCommand | ListEdgesCommand | ListTypesCommand | InfoCommand | UndoCommand | RedoCommand | ConfigOpenCommand | SelectNodeCommand | HelpCommand | ClearCommand | SwapNodeCommand | MoveNodeCommand | AutoLayoutCommand | BeautifyLayoutCommand | CanvasFitViewCommand | CanvasZoomInCommand | CanvasZoomOutCommand | CanvasZoomToCommand | CanvasPanToCommand | CanvasResetViewCommand;
150
+ export type Command = AddNodeCommand | DeleteNodeCommand | RenameNodeCommand | SetConfigCommand | GetConfigCommand | ConnectCommand | DisconnectPortsCommand | DisconnectNodeCommand | ListNodesCommand | ListEdgesCommand | ListTypesCommand | DescribeTypeCommand | SearchTypesCommand | InfoCommand | UndoCommand | RedoCommand | ConfigOpenCommand | SelectNodeCommand | HelpCommand | ClearCommand | SwapNodeCommand | MoveNodeCommand | AutoLayoutCommand | BeautifyLayoutCommand | CanvasFitViewCommand | CanvasZoomInCommand | CanvasZoomOutCommand | CanvasZoomToCommand | CanvasPanToCommand | CanvasResetViewCommand;
140
151
  export type ParseResult = {
141
152
  ok: true;
142
153
  command: Command;
@@ -145,7 +156,9 @@ export type ParseResult = {
145
156
  error: string;
146
157
  input: string;
147
158
  };
148
- export type CommandErrorCode = 'NODE_NOT_FOUND' | 'NODE_TYPE_NOT_FOUND' | 'PORT_NOT_FOUND' | 'EDGE_NOT_FOUND' | 'INVALID_CONNECTION' | 'CYCLE_DETECTED' | 'NO_WORKFLOW' | 'PARSE_ERROR' | 'UNKNOWN_COMMAND' | 'CONFIG_KEY_NOT_FOUND' | 'CONFIG_VALIDATION_ERROR' | 'UNDO_UNAVAILABLE' | 'REDO_UNAVAILABLE';
159
+ export type CommandErrorCode = 'NODE_NOT_FOUND' | 'NODE_TYPE_NOT_FOUND' | 'PORT_NOT_FOUND' | 'EDGE_NOT_FOUND' | 'INVALID_CONNECTION' | 'CYCLE_DETECTED' | 'NO_WORKFLOW' | 'PARSE_ERROR' | 'UNKNOWN_COMMAND' | 'CONFIG_KEY_NOT_FOUND'
160
+ /** search_types with a blank query — use list_types for the whole catalog. */
161
+ | 'EMPTY_QUERY' | 'CONFIG_VALIDATION_ERROR' | 'UNDO_UNAVAILABLE' | 'REDO_UNAVAILABLE';
149
162
  /** Result data for add_node — nodeId is DSL-format short ID (e.g. "llm_node.1") */
150
163
  export interface AddNodeResultData {
151
164
  nodeId: string;
@@ -174,13 +187,54 @@ export interface ListEdgesResultData {
174
187
  targetPort: string;
175
188
  }>;
176
189
  }
190
+ /** One row of list_types / search_types — `typeId` is the short id add_node accepts. */
191
+ export interface TypeSummary {
192
+ typeId: string;
193
+ name: string;
194
+ category: string;
195
+ description?: string;
196
+ tags?: string[];
197
+ }
177
198
  /** Result data for list_types — type IDs are short names usable with add command */
178
199
  export interface ListTypesResultData {
179
- types: Array<{
180
- typeId: string;
181
- name: string;
182
- category: string;
183
- }>;
200
+ types: TypeSummary[];
201
+ }
202
+ /** Result data for search_types — the matching rows, in catalog order */
203
+ export interface SearchTypesResultData {
204
+ query: string;
205
+ types: TypeSummary[];
206
+ }
207
+ /** One config key as described by describe_type / get_config */
208
+ export interface ConfigKeyDescription {
209
+ key: string;
210
+ /** JSON Schema type — a literal, or a list when the schema declares several. */
211
+ type?: string | string[];
212
+ title?: string;
213
+ description?: string;
214
+ enum?: unknown[];
215
+ default?: unknown;
216
+ required?: boolean;
217
+ }
218
+ /** One port as described by describe_type */
219
+ export interface PortDescription {
220
+ portId: string;
221
+ name: string;
222
+ dataType: string;
223
+ required?: boolean;
224
+ description?: string;
225
+ }
226
+ /**
227
+ * Result data for describe_type — everything an agent needs to know about a
228
+ * node type before adding one. `confirmation`, `can` and `agent` are passed
229
+ * through from the host's payload untouched when present.
230
+ */
231
+ export interface DescribeTypeResultData extends TypeSummary {
232
+ inputs: PortDescription[];
233
+ outputs: PortDescription[];
234
+ config: ConfigKeyDescription[];
235
+ confirmation?: NodeMetadata['confirmation'];
236
+ can?: NodeMetadata['can'];
237
+ agent?: NodeMetadata['agent'];
184
238
  }
185
239
  /** Result data for info command — all IDs are DSL-format short IDs */
186
240
  export interface InfoResultData {
@@ -210,12 +264,21 @@ export interface InfoResultData {
210
264
  localPort: string;
211
265
  }>;
212
266
  }
213
- /** Result data for get_config command */
214
- export interface GetConfigResultData {
267
+ /** get_config with a key: that key's value and its schema entry, if declared. */
268
+ export interface GetConfigKeyResultData {
215
269
  nodeId: string;
216
270
  key: string;
217
271
  value: unknown;
272
+ schema?: ConfigKeyDescription;
273
+ }
274
+ /** get_config without a key: every current value and the whole config schema. */
275
+ export interface GetConfigAllResultData {
276
+ nodeId: string;
277
+ values: Record<string, unknown>;
278
+ schema: ConfigKeyDescription[];
218
279
  }
280
+ /** Result data for get_config — narrow on `'key' in data`. */
281
+ export type GetConfigResultData = GetConfigKeyResultData | GetConfigAllResultData;
219
282
  /** Result data for help command */
220
283
  export interface HelpResultData {
221
284
  commands: Array<{
@@ -231,11 +294,13 @@ export interface SetConfigResultData {
231
294
  value: unknown;
232
295
  /** Validation warnings (non-blocking unless strict mode) */
233
296
  warnings?: Array<{
234
- type: 'enum' | 'type_mismatch';
297
+ type: 'enum' | 'type_mismatch' | 'unknown_key';
235
298
  message: string;
236
299
  allowedValues?: unknown[];
237
300
  expectedType?: string;
238
301
  actualType?: string;
302
+ /** For `unknown_key`: the keys the node's config schema does declare. */
303
+ knownKeys?: string[];
239
304
  }>;
240
305
  }
241
306
  /** Result data for swap_node command */
@@ -252,7 +317,7 @@ export interface SwapNodeResultData {
252
317
  configReset: string[];
253
318
  }
254
319
  /** Result data types union for typed access */
255
- export type CommandResultData = AddNodeResultData | ListNodesResultData | ListEdgesResultData | ListTypesResultData | InfoResultData | GetConfigResultData | SetConfigResultData | HelpResultData | SwapNodeResultData;
320
+ export type CommandResultData = AddNodeResultData | ListNodesResultData | ListEdgesResultData | ListTypesResultData | SearchTypesResultData | DescribeTypeResultData | InfoResultData | GetConfigResultData | SetConfigResultData | HelpResultData | SwapNodeResultData;
256
321
  /** Successful command result */
257
322
  export interface CommandResultOk {
258
323
  ok: true;
@@ -348,6 +348,13 @@
348
348
 
349
349
  let nodes = $state<NodeMetadata[]>([]);
350
350
  let nodeTypesLoading = $state<boolean>(true);
351
+
352
+ // The instance carries the list this editor knows, so code outside the
353
+ // component tree (the WebMCP adapter's list_types / add_node) reads what the
354
+ // editor fetched instead of fetching again.
355
+ $effect(() => {
356
+ fd.nodeTypes.set(nodes);
357
+ });
351
358
  // Remove workflow prop - use global store directly
352
359
  // let workflow = $derived($workflowStore || initialWorkflow);
353
360
  let error = $state<string | null>(null);
@@ -1254,6 +1261,7 @@
1254
1261
  <WorkflowInterfaceEditor
1255
1262
  workflow={fd.workflow.current}
1256
1263
  dataTypes={fd.portCompatibility.getEnabledDataTypes()}
1264
+ checker={fd.portCompatibility}
1257
1265
  onChange={(next) => fd.workflow.batchUpdate({ interface: next })}
1258
1266
  />
1259
1267
  {/if}
@@ -0,0 +1,426 @@
1
+ <!--
2
+ BindablePortListbox — the one place a workflow interface entry picks a port.
3
+
4
+ A searchable, grouped listbox over `rankBindablePorts()`: ports nothing is
5
+ using yet first, then the connected or already-published ones. Each row
6
+ wears the same two chips a port row wears on the canvas — the shape symbol
7
+ in the lane's colour and the outlined lane-name chip — so a candidate is
8
+ recognisable as the port it points at, and the fixed-width symbol keeps the
9
+ rows aligned whatever the type name's length.
10
+
11
+ Shared by the "Add input / Add output" composer (highlight, then a separate
12
+ Add button confirms) and by an existing entry's "Bound port" control (a
13
+ click confirms, like a select). The two differ only in `confirmOnClick`;
14
+ keyboard handling — arrows, Home/End, Enter to confirm, Escape to cancel —
15
+ lives on the listbox as a roving `aria-activedescendant`, so the options
16
+ themselves carry no key handlers.
17
+
18
+ Owns only the search query and the highlight. What a confirmed pick means
19
+ belongs to the caller.
20
+ -->
21
+
22
+ <script lang="ts">
23
+ import Icon from '@iconify/svelte';
24
+ import Input from './Input.svelte';
25
+ import PortShapeSymbol from './ports/PortShapeSymbol.svelte';
26
+ import PortLaneChip from './ports/PortLaneChip.svelte';
27
+ import { m } from '../messages/index.js';
28
+ import type { PortCompatibilityChecker } from '../utils/connections.js';
29
+ import { focusOnMount } from '../utils/focus.js';
30
+ import {
31
+ bindablePortKey,
32
+ isFreeBindablePort,
33
+ type RankedBindablePort
34
+ } from '../utils/workflowInterface.js';
35
+
36
+ interface Props {
37
+ direction: 'inputs' | 'outputs';
38
+ /** From `rankBindablePorts` — already ordered free-first. */
39
+ candidates: RankedBindablePort[];
40
+ /** The instance's checker — source of each row's shape symbol and lane colour. */
41
+ checker: PortCompatibilityChecker;
42
+ /** Unique per listbox on the page; option ids are derived from it. */
43
+ idPrefix: string;
44
+ /** The port the caller is already bound to, marked as such in the list. */
45
+ currentKey?: string;
46
+ /** A single click confirms (select-like) instead of only highlighting. */
47
+ confirmOnClick?: boolean;
48
+ /** Take keyboard focus when rendered — the list is a modal moment. */
49
+ autofocus?: boolean;
50
+ onHighlight?: (candidate: RankedBindablePort | undefined) => void;
51
+ onConfirm: (candidate: RankedBindablePort) => void;
52
+ onCancel?: () => void;
53
+ }
54
+
55
+ const {
56
+ direction,
57
+ candidates,
58
+ checker,
59
+ idPrefix,
60
+ currentKey,
61
+ confirmOnClick = false,
62
+ autofocus = false,
63
+ onHighlight,
64
+ onConfirm,
65
+ onCancel
66
+ }: Props = $props();
67
+
68
+ const isInput = $derived(direction === 'inputs');
69
+
70
+ let query = $state('');
71
+ let highlightedKey = $state<string | null>(null);
72
+
73
+ const filtered = $derived.by(() => {
74
+ const q = query.trim().toLowerCase();
75
+ if (!q) return candidates;
76
+ return candidates.filter((candidate) =>
77
+ [
78
+ candidate.nodeLabel,
79
+ candidate.port.name,
80
+ candidate.port.id,
81
+ candidate.port.dataType,
82
+ candidate.port.description ?? ''
83
+ ].some((text) => text.toLowerCase().includes(q))
84
+ );
85
+ });
86
+
87
+ const free = $derived(filtered.filter(isFreeBindablePort));
88
+ const taken = $derived(filtered.filter((candidate) => !isFreeBindablePort(candidate)));
89
+
90
+ const highlighted = $derived(
91
+ highlightedKey === null
92
+ ? undefined
93
+ : candidates.find((candidate) => bindablePortKey(candidate) === highlightedKey)
94
+ );
95
+
96
+ function highlight(candidate: RankedBindablePort | undefined): void {
97
+ highlightedKey = candidate ? bindablePortKey(candidate) : null;
98
+ onHighlight?.(candidate);
99
+ }
100
+
101
+ /**
102
+ * A DOM id for an option. Node and port ids can hold any character, so each
103
+ * one outside `[A-Za-z0-9-]` — the underscore included — is written as `_`
104
+ * plus its hex code point. Reversible, so `a.b` and `a_b` cannot collide.
105
+ */
106
+ function optionId(candidate: RankedBindablePort): string {
107
+ const raw = `${candidate.nodeId}-${candidate.port.id}`;
108
+ const safe = raw.replace(/[^A-Za-z0-9-]/g, (c) => `_${c.codePointAt(0)!.toString(16)}`);
109
+ return `${idPrefix}-${safe}`;
110
+ }
111
+
112
+ function pick(candidate: RankedBindablePort): void {
113
+ highlight(candidate);
114
+ if (confirmOnClick) onConfirm(candidate);
115
+ }
116
+
117
+ function handleKeydown(event: KeyboardEvent): void {
118
+ if (event.key === 'Escape') {
119
+ event.preventDefault();
120
+ onCancel?.();
121
+ return;
122
+ }
123
+ if (filtered.length === 0) return;
124
+ const index = highlighted
125
+ ? filtered.findIndex((c) => bindablePortKey(c) === bindablePortKey(highlighted))
126
+ : -1;
127
+ if (event.key === 'ArrowDown') {
128
+ event.preventDefault();
129
+ highlight(filtered[Math.min(index + 1, filtered.length - 1)]);
130
+ } else if (event.key === 'ArrowUp') {
131
+ event.preventDefault();
132
+ highlight(filtered[Math.max(index - 1, 0)]);
133
+ } else if (event.key === 'Home') {
134
+ event.preventDefault();
135
+ highlight(filtered[0]);
136
+ } else if (event.key === 'End') {
137
+ event.preventDefault();
138
+ highlight(filtered[filtered.length - 1]);
139
+ } else if (event.key === 'Enter') {
140
+ event.preventDefault();
141
+ if (highlighted) onConfirm(highlighted);
142
+ }
143
+ }
144
+ </script>
145
+
146
+ <div class="wf-portlist">
147
+ {#if candidates.length > 0}
148
+ <Input
149
+ size="sm"
150
+ type="search"
151
+ value={query}
152
+ placeholder={m().workflowInterface.composerSearchPlaceholder}
153
+ aria-label={m().workflowInterface.composerSearchLabel}
154
+ oninput={(e) => (query = e.currentTarget.value)}
155
+ >
156
+ {#snippet leading()}
157
+ <Icon icon="heroicons:magnifying-glass" />
158
+ {/snippet}
159
+ </Input>
160
+ {/if}
161
+
162
+ <div
163
+ class="wf-portlist__list"
164
+ role="listbox"
165
+ tabindex="0"
166
+ {@attach focusOnMount(autofocus)}
167
+ aria-label={isInput
168
+ ? m().workflowInterface.composerListLabelInput
169
+ : m().workflowInterface.composerListLabelOutput}
170
+ aria-activedescendant={highlighted ? optionId(highlighted) : undefined}
171
+ onkeydown={handleKeydown}
172
+ >
173
+ {#if candidates.length === 0}
174
+ <p class="wf-portlist__empty">{m().workflowInterface.composerNoPorts}</p>
175
+ {:else if filtered.length === 0}
176
+ <p class="wf-portlist__empty">{m().workflowInterface.composerNoMatches}</p>
177
+ {:else}
178
+ {#snippet option(candidate: RankedBindablePort)}
179
+ {@const key = bindablePortKey(candidate)}
180
+ {@const isHighlighted = highlighted !== undefined && bindablePortKey(highlighted) === key}
181
+ {@const isCurrent = currentKey !== undefined && currentKey === key}
182
+ <!-- Keyboard handling lives on the listbox (roving aria-activedescendant),
183
+ so the option itself needs no key handler. -->
184
+ <!-- svelte-ignore a11y_click_events_have_key_events -->
185
+ <div
186
+ id={optionId(candidate)}
187
+ class="wf-portlist__option"
188
+ class:wf-portlist__option--highlighted={isHighlighted}
189
+ class:wf-portlist__option--current={isCurrent}
190
+ class:wf-portlist__option--taken={!isFreeBindablePort(candidate)}
191
+ role="option"
192
+ tabindex="-1"
193
+ aria-selected={isHighlighted}
194
+ onclick={() => pick(candidate)}
195
+ ondblclick={() => onConfirm(candidate)}
196
+ >
197
+ <PortShapeSymbol {checker} port={candidate.port} />
198
+ <span class="wf-portlist__option-body">
199
+ <span class="wf-portlist__option-path">
200
+ <span class="wf-portlist__option-node">{candidate.nodeLabel}</span>
201
+ <Icon icon="heroicons:chevron-right" />
202
+ <span class="wf-portlist__option-port">{candidate.port.name}</span>
203
+ <PortLaneChip {checker} port={candidate.port} />
204
+ </span>
205
+ {#if candidate.port.description}
206
+ <span class="wf-portlist__option-desc">{candidate.port.description}</span>
207
+ {/if}
208
+ {#if isCurrent || candidate.connected || candidate.publishedAs !== undefined || candidate.port.required}
209
+ <span class="wf-portlist__option-flags">
210
+ {#if isCurrent}
211
+ <span class="flowdrop-badge flowdrop-badge--sm flowdrop-badge--primary">
212
+ {m().workflowInterface.bindingCurrent}
213
+ </span>
214
+ {/if}
215
+ {#if candidate.connected}
216
+ <span class="flowdrop-badge flowdrop-badge--sm flowdrop-badge--warning">
217
+ {m().workflowInterface.composerConnected}
218
+ </span>
219
+ {/if}
220
+ {#if candidate.publishedAs !== undefined}
221
+ <span class="flowdrop-badge flowdrop-badge--sm flowdrop-badge--secondary">
222
+ {m().workflowInterface.composerPublishedAs({ id: candidate.publishedAs })}
223
+ </span>
224
+ {/if}
225
+ {#if candidate.port.required}
226
+ <span class="flowdrop-badge flowdrop-badge--sm flowdrop-badge--outline">
227
+ {m().workflowInterface.composerRequired}
228
+ </span>
229
+ {/if}
230
+ </span>
231
+ {/if}
232
+ </span>
233
+ <span class="wf-portlist__option-check" aria-hidden="true">
234
+ <Icon icon="heroicons:check" />
235
+ </span>
236
+ </div>
237
+ {/snippet}
238
+
239
+ {#if free.length > 0}
240
+ <div class="wf-portlist__group" role="presentation">
241
+ <span class="wf-portlist__group-title">{m().workflowInterface.composerGroupFree}</span>
242
+ {#each free as candidate (bindablePortKey(candidate))}
243
+ {@render option(candidate)}
244
+ {/each}
245
+ </div>
246
+ {/if}
247
+ {#if taken.length > 0}
248
+ <div class="wf-portlist__group" role="presentation">
249
+ <span class="wf-portlist__group-title">{m().workflowInterface.composerGroupTaken}</span>
250
+ {#each taken as candidate (bindablePortKey(candidate))}
251
+ {@render option(candidate)}
252
+ {/each}
253
+ </div>
254
+ {/if}
255
+ {/if}
256
+ </div>
257
+ </div>
258
+
259
+ <style>
260
+ .wf-portlist {
261
+ display: flex;
262
+ flex-direction: column;
263
+ gap: var(--fd-space-xs);
264
+ }
265
+
266
+ .wf-portlist__list {
267
+ display: flex;
268
+ flex-direction: column;
269
+ gap: var(--fd-space-xs);
270
+ max-height: 18rem;
271
+ overflow-y: auto;
272
+ padding: var(--fd-space-2xs);
273
+ border: 1px solid var(--fd-border);
274
+ border-radius: var(--fd-radius-md);
275
+ background-color: var(--fd-card);
276
+ scrollbar-width: thin;
277
+ scrollbar-color: var(--fd-scrollbar-thumb) var(--fd-scrollbar-track);
278
+ }
279
+
280
+ .wf-portlist__list:focus-visible {
281
+ outline: none;
282
+ border-color: var(--fd-primary);
283
+ box-shadow: 0 0 0 var(--fd-ring-width) var(--fd-primary-muted);
284
+ }
285
+
286
+ .wf-portlist__empty {
287
+ margin: 0;
288
+ padding: var(--fd-space-md) var(--fd-space-sm);
289
+ font-size: var(--fd-text-xs);
290
+ line-height: 1.5;
291
+ text-align: center;
292
+ color: var(--fd-muted-foreground);
293
+ }
294
+
295
+ .wf-portlist__group {
296
+ display: flex;
297
+ flex-direction: column;
298
+ gap: 0.125rem;
299
+ }
300
+
301
+ .wf-portlist__group-title {
302
+ padding: var(--fd-space-2xs) var(--fd-space-xs);
303
+ font-size: var(--fd-text-2xs);
304
+ font-weight: 600;
305
+ letter-spacing: 0.05em;
306
+ text-transform: uppercase;
307
+ color: var(--fd-muted-foreground);
308
+ }
309
+
310
+ .wf-portlist__option {
311
+ display: flex;
312
+ align-items: flex-start;
313
+ gap: var(--fd-space-xs);
314
+ padding: var(--fd-space-xs);
315
+ border: 1px solid transparent;
316
+ border-radius: var(--fd-radius-md);
317
+ cursor: pointer;
318
+ transition:
319
+ background-color var(--fd-transition-fast),
320
+ border-color var(--fd-transition-fast);
321
+ }
322
+
323
+ .wf-portlist__option:hover {
324
+ background-color: var(--fd-muted);
325
+ }
326
+
327
+ .wf-portlist__option--highlighted,
328
+ .wf-portlist__option--highlighted:hover {
329
+ border-color: var(--fd-primary);
330
+ background-color: var(--fd-primary-muted);
331
+ }
332
+
333
+ .wf-portlist__option--taken .wf-portlist__option-node,
334
+ .wf-portlist__option--taken .wf-portlist__option-port {
335
+ color: var(--fd-muted-foreground);
336
+ }
337
+
338
+ .wf-portlist__option--taken :global(.flowdrop-port-symbol),
339
+ .wf-portlist__option--taken :global(.flowdrop-badge--outline) {
340
+ opacity: 0.7;
341
+ }
342
+
343
+ /* The entry's own port is "taken" by itself; do not grey it out. */
344
+ .wf-portlist__option--current .wf-portlist__option-node,
345
+ .wf-portlist__option--current .wf-portlist__option-port {
346
+ color: var(--fd-foreground);
347
+ }
348
+
349
+ .wf-portlist__option--current :global(.flowdrop-port-symbol),
350
+ .wf-portlist__option--current :global(.flowdrop-badge--outline) {
351
+ opacity: 1;
352
+ }
353
+
354
+ /* The lane chip is quiet on purpose; keep it from stretching a wrapped path. */
355
+ .wf-portlist__option-path :global(.flowdrop-badge--outline) {
356
+ flex: none;
357
+ }
358
+
359
+ .wf-portlist__option-body {
360
+ display: flex;
361
+ flex-direction: column;
362
+ gap: 0.125rem;
363
+ flex: 1;
364
+ min-width: 0;
365
+ }
366
+
367
+ .wf-portlist__option-path {
368
+ display: inline-flex;
369
+ align-items: center;
370
+ flex-wrap: wrap;
371
+ gap: 0.125rem;
372
+ font-size: var(--fd-text-xs);
373
+ line-height: 1.4;
374
+ }
375
+
376
+ .wf-portlist__option-path :global(svg) {
377
+ flex-shrink: 0;
378
+ color: var(--fd-muted-foreground);
379
+ }
380
+
381
+ .wf-portlist__option-node {
382
+ color: var(--fd-muted-foreground);
383
+ }
384
+
385
+ .wf-portlist__option-port {
386
+ font-weight: 600;
387
+ color: var(--fd-foreground);
388
+ }
389
+
390
+ .wf-portlist__option-desc {
391
+ font-size: var(--fd-text-2xs);
392
+ line-height: 1.45;
393
+ color: var(--fd-muted-foreground);
394
+ display: -webkit-box;
395
+ -webkit-line-clamp: 2;
396
+ line-clamp: 2;
397
+ -webkit-box-orient: vertical;
398
+ overflow: hidden;
399
+ }
400
+
401
+ .wf-portlist__option-flags {
402
+ display: flex;
403
+ flex-wrap: wrap;
404
+ gap: var(--fd-space-2xs);
405
+ margin-top: 0.125rem;
406
+ }
407
+
408
+ .wf-portlist__option-flags :global(.flowdrop-badge) {
409
+ font-size: var(--fd-text-2xs);
410
+ line-height: 1.2;
411
+ }
412
+
413
+ .wf-portlist__option-check {
414
+ flex-shrink: 0;
415
+ display: inline-flex;
416
+ width: 1rem;
417
+ margin-top: 0.125rem;
418
+ color: var(--fd-primary);
419
+ opacity: 0;
420
+ transition: opacity var(--fd-transition-fast);
421
+ }
422
+
423
+ .wf-portlist__option--highlighted .wf-portlist__option-check {
424
+ opacity: 1;
425
+ }
426
+ </style>
@@ -0,0 +1,23 @@
1
+ import type { PortCompatibilityChecker } from '../utils/connections.js';
2
+ import { type RankedBindablePort } from '../utils/workflowInterface.js';
3
+ interface Props {
4
+ direction: 'inputs' | 'outputs';
5
+ /** From `rankBindablePorts` — already ordered free-first. */
6
+ candidates: RankedBindablePort[];
7
+ /** The instance's checker — source of each row's shape symbol and lane colour. */
8
+ checker: PortCompatibilityChecker;
9
+ /** Unique per listbox on the page; option ids are derived from it. */
10
+ idPrefix: string;
11
+ /** The port the caller is already bound to, marked as such in the list. */
12
+ currentKey?: string;
13
+ /** A single click confirms (select-like) instead of only highlighting. */
14
+ confirmOnClick?: boolean;
15
+ /** Take keyboard focus when rendered — the list is a modal moment. */
16
+ autofocus?: boolean;
17
+ onHighlight?: (candidate: RankedBindablePort | undefined) => void;
18
+ onConfirm: (candidate: RankedBindablePort) => void;
19
+ onCancel?: () => void;
20
+ }
21
+ declare const BindablePortListbox: import("svelte").Component<Props, {}, "">;
22
+ type BindablePortListbox = ReturnType<typeof BindablePortListbox>;
23
+ export default BindablePortListbox;