@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
@@ -20,12 +20,21 @@
20
20
 
21
21
  <script lang="ts">
22
22
  import Icon from '@iconify/svelte';
23
+ import Button from './Button.svelte';
24
+ import IconButton from './IconButton.svelte';
25
+ import Input from './Input.svelte';
26
+ import Select from './Select.svelte';
27
+ import BindablePortListbox from './BindablePortListbox.svelte';
28
+ import PortShapeSymbol from './ports/PortShapeSymbol.svelte';
29
+ import PortLaneChip from './ports/PortLaneChip.svelte';
23
30
  import { m } from '../messages/index.js';
24
31
  import type { PortDataTypeConfig, WorkflowInterfaceEntry } from '../types/index.js';
32
+ import type { PortCompatibilityChecker } from '../utils/connections.js';
25
33
  import {
34
+ bindablePortKey,
26
35
  describeInterfaceEntryStatus,
27
36
  pullEntryFieldsFromPort,
28
- type BindablePort,
37
+ type RankedBindablePort,
29
38
  type InterfaceIssue,
30
39
  type ResolvedInterfaceEntry
31
40
  } from '../utils/workflowInterface.js';
@@ -34,10 +43,12 @@
34
43
  entry: WorkflowInterfaceEntry;
35
44
  direction: 'inputs' | 'outputs';
36
45
  status: ResolvedInterfaceEntry | undefined;
37
- /** Candidate ports for this direction, for the binding picker. */
38
- candidates: BindablePort[];
46
+ /** Candidate ports for this direction, ranked, for the binding picker. */
47
+ candidates: RankedBindablePort[];
39
48
  /** The authoring vocabulary offered by the dataType picker. */
40
49
  dataTypes: PortDataTypeConfig[];
50
+ /** The instance's checker — shape symbol and lane colour of the bound port. */
51
+ checker: PortCompatibilityChecker;
41
52
  /** The issues this card explains in its footer. */
42
53
  footerIssues: InterfaceIssue[];
43
54
  /** Input side only: the bound port already receives another edge. */
@@ -57,6 +68,7 @@
57
68
  status,
58
69
  candidates,
59
70
  dataTypes,
71
+ checker,
60
72
  footerIssues,
61
73
  alreadyConnected = false,
62
74
  conflictingSource,
@@ -68,19 +80,11 @@
68
80
  }: Props = $props();
69
81
 
70
82
  /**
71
- * Whether the secondary fields are disclosed.
72
- *
73
- * Seeded once, from whether this entry wants attention, and owned by the
74
- * author from then on. It must NOT track `status`: that is live data, and a
75
- * disclosure driven by data is the bug this component was split out to kill.
76
- * Rendering `open` as a reactive attribute meant every edit in the card came
77
- * back as a new `workflow`, re-ran the attribute and slammed the fields shut,
78
- * pulling the focused input out from under the author mid-word — focus fell
79
- * to `<body>` and the keystrokes after it were silently dropped. Deriving it
80
- * from `status` instead of seeding from it reintroduces exactly that, most
81
- * sharply when the author fixes a type mismatch with the select inside and it
82
- * shuts on them mid-fix.
83
+ * Whether the secondary fields are disclosed: seeded once from whether the
84
+ * entry wants attention, then the author's. Deriving it from `status` would
85
+ * shut the fields on every edit and drop the focused input's keystrokes.
83
86
  */
87
+ // The seed is meant to be read once.
84
88
  // svelte-ignore state_referenced_locally
85
89
  let fieldsOpen = $state(status?.status === 'type-mismatch');
86
90
 
@@ -102,33 +106,44 @@
102
106
  return options;
103
107
  }
104
108
 
105
- function bindingKey(nodeId: string, portId: string): string {
106
- return `${nodeId}::${portId}`;
107
- }
109
+ /** Whether the binding picker is unfolded under the "Bound port" control. */
110
+ let pickerOpen = $state(false);
108
111
 
109
- /** The entry's current single binding, as a picker value (`''` = unbound). */
110
- const currentBinding = $derived(
111
- entry.bindings[0] ? bindingKey(entry.bindings[0].nodeId, entry.bindings[0].portId) : ''
112
- );
112
+ /** The entry's current single binding, as a picker key (`undefined` = unbound). */
113
+ const currentKey = $derived(entry.bindings[0] ? bindablePortKey(entry.bindings[0]) : undefined);
114
+
115
+ /** The bound port, when the single binding resolves. */
116
+ const boundTarget = $derived(status?.targets[0]);
113
117
 
114
118
  /** The bound port's own dataType, when the single binding resolves. */
115
- const boundPortType = $derived(status?.targets[0]?.port.dataType);
119
+ const boundPortType = $derived(boundTarget?.port.dataType);
116
120
 
117
- function handleBindingChange(value: string): void {
118
- if (!value) {
119
- onPatch({ bindings: [] });
120
- return;
121
- }
122
- const [nodeId, portId] = value.split('::');
123
- const patch: Partial<WorkflowInterfaceEntry> = { bindings: [{ nodeId, portId }] };
121
+ /**
122
+ * The picker's candidates, with this entry's own port counted as free: it
123
+ * is "published" — by the very entry choosing — and greying it out as taken
124
+ * would tell the author their current choice is unavailable.
125
+ */
126
+ const ownCandidates = $derived(
127
+ candidates.map((candidate) =>
128
+ candidate.publishedAs === entry.id ? { ...candidate, publishedAs: undefined } : candidate
129
+ )
130
+ );
131
+
132
+ function bindTo(candidate: RankedBindablePort): void {
133
+ const patch: Partial<WorkflowInterfaceEntry> = {
134
+ bindings: [{ nodeId: candidate.nodeId, portId: candidate.port.id }]
135
+ };
124
136
  // Convenience default: prefill an empty dataType from the picked port's own
125
137
  // type. The field stays freely editable afterward — this only saves the
126
138
  // common case of typing out what the port already declares.
127
- if (!entry.dataType) {
128
- const match = candidates.find((b) => b.nodeId === nodeId && b.port.id === portId);
129
- if (match) patch.dataType = match.port.dataType;
130
- }
139
+ if (!entry.dataType) patch.dataType = candidate.port.dataType;
131
140
  onPatch(patch);
141
+ pickerOpen = false;
142
+ }
143
+
144
+ function unbind(): void {
145
+ onPatch({ bindings: [] });
146
+ pickerOpen = false;
132
147
  }
133
148
 
134
149
  /**
@@ -172,70 +187,121 @@
172
187
  status.status !== 'ok' &&
173
188
  status.status !== 'unbound'}
174
189
  >
175
- {#if status}
176
- <span
177
- class="wf-interface__dot wf-interface__dot--{status.status}"
178
- title={describeInterfaceEntryStatus(status)}
179
- ></span>
180
- {/if}
181
- <div class="wf-interface__reorder">
182
- <button
183
- type="button"
184
- disabled={isFirst}
185
- onclick={() => onMove(-1)}
186
- aria-label={m().workflowInterface.moveUp({ id: entry.id })}
187
- >
188
- <Icon icon="heroicons:chevron-up" />
189
- </button>
190
- <button
191
- type="button"
192
- disabled={isLast}
193
- onclick={() => onMove(1)}
194
- aria-label={m().workflowInterface.moveDown({ id: entry.id })}
195
- >
196
- <Icon icon="heroicons:chevron-down" />
197
- </button>
190
+ <div class="wf-interface__entry-side">
191
+ <div class="wf-interface__reorder">
192
+ <button
193
+ type="button"
194
+ disabled={isFirst}
195
+ onclick={() => onMove(-1)}
196
+ aria-label={m().workflowInterface.moveUp({ id: entry.id })}
197
+ >
198
+ <Icon icon="heroicons:chevron-up" />
199
+ </button>
200
+ <button
201
+ type="button"
202
+ disabled={isLast}
203
+ onclick={() => onMove(1)}
204
+ aria-label={m().workflowInterface.moveDown({ id: entry.id })}
205
+ >
206
+ <Icon icon="heroicons:chevron-down" />
207
+ </button>
208
+ </div>
198
209
  </div>
199
210
 
200
211
  <div class="wf-interface__fields">
201
- <div class="wf-interface__row">
212
+ <div class="wf-interface__row wf-interface__row--identity">
202
213
  <label class="wf-interface__field wf-interface__field--id">
203
214
  <span class="wf-interface__label">{m().workflowInterface.idLabel}</span>
204
- <input
215
+ <Input
216
+ size="sm"
205
217
  type="text"
206
218
  value={entry.id}
207
219
  onchange={(e) => onPatch({ id: e.currentTarget.value })}
208
220
  />
209
221
  </label>
210
- <label class="wf-interface__field wf-interface__field--wide">
211
- <span class="wf-interface__label">{m().workflowInterface.bindingLabel}</span>
212
- <select value={currentBinding} onchange={(e) => handleBindingChange(e.currentTarget.value)}>
213
- <option value="">{m().workflowInterface.bindingUnbound}</option>
214
- {#each candidates as candidate (bindingKey(candidate.nodeId, candidate.port.id))}
215
- <option value={bindingKey(candidate.nodeId, candidate.port.id)}>
216
- {candidate.nodeLabel} — {candidate.port.name} ({candidate.port.dataType})
217
- </option>
218
- {/each}
219
- </select>
222
+ <div class="wf-interface__field wf-interface__field--binding">
223
+ <span class="wf-interface__label" id="wf-binding-label-{direction}-{entry.id}">
224
+ {m().workflowInterface.bindingLabel}
225
+ </span>
226
+ <!-- The bound port, said back the way the canvas says it — shape symbol,
227
+ node › port, lane chip — and the way in to change it. Looks like a
228
+ select, opens the shared port listbox instead. -->
229
+ <button
230
+ type="button"
231
+ class="wf-interface__binding"
232
+ class:wf-interface__binding--open={pickerOpen}
233
+ class:wf-interface__binding--invalid={isInput && alreadyConnected}
234
+ class:wf-interface__binding--empty={!entry.bindings[0]}
235
+ aria-haspopup="listbox"
236
+ aria-expanded={pickerOpen}
237
+ aria-labelledby="wf-binding-label-{direction}-{entry.id}"
238
+ title={m().workflowInterface.bindingChange}
239
+ onclick={() => (pickerOpen = !pickerOpen)}
240
+ >
241
+ {#if boundTarget}
242
+ <PortShapeSymbol {checker} port={boundTarget.port} />
243
+ <span class="wf-interface__binding-path">
244
+ <span class="wf-interface__binding-node">
245
+ {boundTarget.node.data?.label ?? boundTarget.node.id}
246
+ </span>
247
+ <Icon icon="heroicons:chevron-right" />
248
+ <span class="wf-interface__binding-port">{boundTarget.port.name}</span>
249
+ <PortLaneChip {checker} port={boundTarget.port} />
250
+ </span>
251
+ {:else if entry.bindings[0]}
252
+ <span class="wf-interface__binding-path wf-interface__binding-path--dangling">
253
+ {m().workflowInterface.bindingDangling({
254
+ nodeId: entry.bindings[0].nodeId,
255
+ portId: entry.bindings[0].portId
256
+ })}
257
+ </span>
258
+ {:else}
259
+ <span class="wf-interface__binding-placeholder">
260
+ {m().workflowInterface.bindingUnbound}
261
+ </span>
262
+ {/if}
263
+ <Icon icon="heroicons:chevron-up-down" class="wf-interface__binding-caret" />
264
+ </button>
220
265
  {#if isInput && alreadyConnected}
221
266
  <span class="wf-interface__inline wf-interface__inline--error">
222
267
  {m().workflowInterface.alreadyConnectedInline({ source: conflictingSource ?? '' })}
223
268
  </span>
224
269
  {/if}
225
- </label>
226
- {#if status?.targets[0]}
227
- <button
228
- type="button"
229
- class="wf-interface__pull"
230
- title={m().workflowInterface.pullFromPortTitle}
231
- onclick={() => onPatch(pullEntryFieldsFromPort(status.targets[0].port))}
232
- >
233
- <Icon icon="heroicons:arrow-down-tray" />
234
- {m().workflowInterface.pullFromPort}
235
- </button>
236
- {/if}
270
+ </div>
237
271
  </div>
238
272
 
273
+ {#if pickerOpen}
274
+ <div
275
+ class="wf-interface__picker"
276
+ role="group"
277
+ aria-label={m().workflowInterface.bindingChoose}
278
+ >
279
+ <BindablePortListbox
280
+ {direction}
281
+ candidates={ownCandidates}
282
+ {checker}
283
+ idPrefix="wf-binding-option-{direction}-{entry.id}"
284
+ {currentKey}
285
+ confirmOnClick
286
+ autofocus
287
+ onConfirm={bindTo}
288
+ onCancel={() => (pickerOpen = false)}
289
+ />
290
+ <div class="wf-interface__picker-actions">
291
+ {#if entry.bindings[0]}
292
+ <Button variant="ghost" size="sm" onclick={unbind}>
293
+ <Icon icon="heroicons:link-slash" />
294
+ {m().workflowInterface.bindingUnbind}
295
+ </Button>
296
+ {/if}
297
+ <span class="wf-interface__picker-spacer"></span>
298
+ <Button variant="ghost" size="sm" onclick={() => (pickerOpen = false)}>
299
+ {m().workflowInterface.composerCancel}
300
+ </Button>
301
+ </div>
302
+ </div>
303
+ {/if}
304
+
239
305
  <!-- Two-way, and it settles: the setter writes what the DOM already
240
306
  reports, and assigning `open` a value it already holds fires no
241
307
  further `toggle`. Without that the pair would be an unbounded
@@ -243,110 +309,144 @@
243
309
  update-depth guard could not catch, since each turn is a fresh
244
310
  event task. -->
245
311
  <details class="wf-interface__more" bind:open={fieldsOpen}>
246
- <summary>{m().workflowInterface.moreOptions}</summary>
247
- <div class="wf-interface__row">
248
- <label class="wf-interface__field">
249
- <span class="wf-interface__label">{m().workflowInterface.nameLabel}</span>
250
- <input
251
- type="text"
252
- value={entry.name ?? ''}
253
- placeholder={m().workflowInterface.namePlaceholder}
254
- onchange={(e) => onPatch({ name: e.currentTarget.value || undefined })}
255
- />
256
- </label>
257
- <label class="wf-interface__field">
258
- <span class="wf-interface__label">{m().workflowInterface.dataTypeLabel}</span>
259
- <select
260
- value={entry.dataType}
261
- onchange={(e) => onPatch({ dataType: e.currentTarget.value })}
262
- >
263
- {#if !entry.dataType}
264
- <option value="" disabled selected>
265
- {m().workflowInterface.dataTypePlaceholder}
266
- </option>
267
- {/if}
268
- {#each dataTypeOptions(entry.dataType) as option (option.id)}
269
- <option value={option.id}>{option.name}</option>
270
- {/each}
271
- </select>
272
- {#if status?.status === 'type-mismatch' && boundPortType}
273
- <span class="wf-interface__inline wf-interface__inline--warning">
274
- {m().workflowInterface.typeMismatchInline({ portType: boundPortType ?? '' })}
275
- <button
276
- type="button"
277
- class="wf-interface__quickfix"
278
- onclick={() => onPatch({ dataType: boundPortType ?? entry.dataType })}
279
- >
280
- {m().workflowInterface.useMatchPortType}
281
- </button>
282
- </span>
283
- {/if}
284
- </label>
285
- {#if isInput}
286
- <label class="wf-interface__field wf-interface__field--checkbox">
287
- <input
288
- type="checkbox"
289
- checked={entry.required ?? false}
290
- onchange={(e) => onPatch({ required: e.currentTarget.checked || undefined })}
312
+ <summary>
313
+ <Icon icon="heroicons:chevron-right" />
314
+ {m().workflowInterface.moreOptions}
315
+ </summary>
316
+ <div class="wf-interface__more-body">
317
+ {#if boundTarget}
318
+ <div class="wf-interface__pull-row">
319
+ <Button
320
+ variant="ghost"
321
+ size="sm"
322
+ class="wf-interface__pull"
323
+ title={m().workflowInterface.pullFromPortTitle}
324
+ onclick={() => onPatch(pullEntryFieldsFromPort(boundTarget.port))}
325
+ >
326
+ <Icon icon="heroicons:arrow-down-tray" />
327
+ {m().workflowInterface.pullFromPort}
328
+ </Button>
329
+ </div>
330
+ {/if}
331
+ <div class="wf-interface__row">
332
+ <label class="wf-interface__field">
333
+ <span class="wf-interface__label">{m().workflowInterface.nameLabel}</span>
334
+ <Input
335
+ size="sm"
336
+ type="text"
337
+ value={entry.name ?? ''}
338
+ placeholder={m().workflowInterface.namePlaceholder}
339
+ onchange={(e) => onPatch({ name: e.currentTarget.value || undefined })}
291
340
  />
292
- <span class="wf-interface__label">{m().workflowInterface.requiredLabel}</span>
293
341
  </label>
294
- {/if}
295
- </div>
342
+ <label class="wf-interface__field">
343
+ <span class="wf-interface__label">{m().workflowInterface.dataTypeLabel}</span>
344
+ <Select
345
+ size="sm"
346
+ invalid={status?.status === 'type-mismatch'}
347
+ value={entry.dataType}
348
+ onchange={(e) => onPatch({ dataType: e.currentTarget.value })}
349
+ >
350
+ {#if !entry.dataType}
351
+ <option value="" disabled selected>
352
+ {m().workflowInterface.dataTypePlaceholder}
353
+ </option>
354
+ {/if}
355
+ {#each dataTypeOptions(entry.dataType) as option (option.id)}
356
+ <option value={option.id}>{option.name}</option>
357
+ {/each}
358
+ </Select>
359
+ {#if status?.status === 'type-mismatch' && boundPortType}
360
+ <span class="wf-interface__inline wf-interface__inline--warning">
361
+ {m().workflowInterface.typeMismatchInline({ portType: boundPortType ?? '' })}
362
+ <button
363
+ type="button"
364
+ class="wf-interface__quickfix"
365
+ onclick={() => onPatch({ dataType: boundPortType ?? entry.dataType })}
366
+ >
367
+ {m().workflowInterface.useMatchPortType}
368
+ </button>
369
+ </span>
370
+ {/if}
371
+ </label>
372
+ </div>
296
373
 
297
- <div class="wf-interface__row">
298
- <label class="wf-interface__field wf-interface__field--wide">
299
- <span class="wf-interface__label">{m().workflowInterface.descriptionLabel}</span>
300
- <input
301
- type="text"
302
- value={entry.description ?? ''}
303
- onchange={(e) => onPatch({ description: e.currentTarget.value || undefined })}
304
- />
305
- </label>
306
- <label class="wf-interface__field">
307
- <span class="wf-interface__label">{m().workflowInterface.defaultValueLabel}</span>
308
- <input
309
- type="text"
310
- value={formatDefaultValue(entry.defaultValue)}
311
- onchange={(e) => onPatch({ defaultValue: parseDefaultValue(e.currentTarget.value) })}
312
- />
313
- </label>
314
- </div>
374
+ <div class="wf-interface__row">
375
+ <label class="wf-interface__field wf-interface__field--wide">
376
+ <span class="wf-interface__label">{m().workflowInterface.descriptionLabel}</span>
377
+ <Input
378
+ size="sm"
379
+ type="text"
380
+ value={entry.description ?? ''}
381
+ onchange={(e) => onPatch({ description: e.currentTarget.value || undefined })}
382
+ />
383
+ </label>
384
+ </div>
315
385
 
316
- {#if isInput}
317
- <div class="wf-interface__examples">
318
- <span class="wf-interface__label">
319
- {m().workflowInterface.examplesLabel}
320
- </span>
321
- {#each entry.examples ?? [] as example, exampleIndex (exampleIndex)}
322
- <div class="wf-interface__example-row">
386
+ <div class="wf-interface__row">
387
+ <label class="wf-interface__field">
388
+ <span class="wf-interface__label">{m().workflowInterface.defaultValueLabel}</span>
389
+ <Input
390
+ size="sm"
391
+ type="text"
392
+ value={formatDefaultValue(entry.defaultValue)}
393
+ onchange={(e) => onPatch({ defaultValue: parseDefaultValue(e.currentTarget.value) })}
394
+ />
395
+ </label>
396
+ {#if isInput}
397
+ <label class="wf-interface__field wf-interface__field--checkbox">
323
398
  <input
324
- type="text"
325
- value={formatDefaultValue(example)}
326
- onchange={(e) => patchExample(exampleIndex, e.currentTarget.value)}
399
+ type="checkbox"
400
+ checked={entry.required ?? false}
401
+ onchange={(e) => onPatch({ required: e.currentTarget.checked || undefined })}
327
402
  />
328
- <button
329
- type="button"
330
- class="wf-interface__example-remove"
331
- onclick={() => removeExample(exampleIndex)}
332
- aria-label={m().workflowInterface.removeExample}
333
- >
334
- <Icon icon="heroicons:x-mark" />
335
- </button>
336
- </div>
337
- {/each}
338
- <button type="button" class="wf-interface__example-add" onclick={addExample}>
339
- <Icon icon="heroicons:plus" />
340
- {m().workflowInterface.addExample}
341
- </button>
403
+ <span class="wf-interface__label">{m().workflowInterface.requiredLabel}</span>
404
+ </label>
405
+ {/if}
342
406
  </div>
343
- {/if}
407
+
408
+ {#if isInput}
409
+ <div class="wf-interface__examples">
410
+ <span class="wf-interface__label">
411
+ {m().workflowInterface.examplesLabel}
412
+ </span>
413
+ {#each entry.examples ?? [] as example, exampleIndex (exampleIndex)}
414
+ <div class="wf-interface__example-row">
415
+ <Input
416
+ size="sm"
417
+ type="text"
418
+ value={formatDefaultValue(example)}
419
+ onchange={(e) => patchExample(exampleIndex, e.currentTarget.value)}
420
+ />
421
+ <IconButton
422
+ size="sm"
423
+ class="wf-interface__example-remove"
424
+ onclick={() => removeExample(exampleIndex)}
425
+ ariaLabel={m().workflowInterface.removeExample}
426
+ >
427
+ <Icon icon="heroicons:x-mark" />
428
+ </IconButton>
429
+ </div>
430
+ {/each}
431
+ <Button
432
+ variant="ghost"
433
+ size="sm"
434
+ class="wf-interface__example-add"
435
+ onclick={addExample}
436
+ >
437
+ <Icon icon="heroicons:plus" />
438
+ {m().workflowInterface.addExample}
439
+ </Button>
440
+ </div>
441
+ {/if}
442
+ </div>
344
443
  </details>
345
444
 
346
- <!-- Every resolveInterface status renders in words somewhere in this card —
347
- the obligation that makes this surface canonical. `ok` lives on the
348
- header dot; type-mismatch and already-connected render inline next to
349
- their own field; the rest are explained here. -->
445
+ <!-- Every non-ok resolveInterface status renders in words somewhere in this
446
+ card — the obligation that makes this surface canonical. `ok` says
447
+ nothing: neutral is the good state, and the card's error border already
448
+ marks the bad ones. Type-mismatch and already-connected render inline
449
+ next to their own field; the rest are explained here. -->
350
450
  {#if status && FOOTER_STATUSES.has(status.status)}
351
451
  <p class="wf-interface__status wf-interface__status--{status.status}">
352
452
  {describeInterfaceEntryStatus(status)}
@@ -366,45 +466,87 @@
366
466
  {/if}
367
467
  </div>
368
468
 
369
- <button
370
- type="button"
469
+ <IconButton
470
+ size="sm"
371
471
  class="wf-interface__remove"
372
472
  onclick={onRemove}
373
- aria-label={m().workflowInterface.removeEntry({ id: entry.id })}
473
+ ariaLabel={m().workflowInterface.removeEntry({ id: entry.id })}
374
474
  >
375
475
  <Icon icon="heroicons:trash" />
376
- </button>
476
+ </IconButton>
377
477
  </li>
378
478
 
379
479
  <style>
480
+ /*
481
+ One interface entry, styled as a card in the same family as the settings
482
+ form beside it: the shared `.flowdrop-input` controls (via Input/Select),
483
+ the shared `.flowdrop-btn` buttons (via Button/IconButton), the settings
484
+ form's label weight and size, and the panel's card surface. Nothing here
485
+ declares a colour that isn't a design token.
486
+ */
380
487
  .wf-interface__entry {
381
488
  display: flex;
382
489
  align-items: flex-start;
383
- gap: var(--fd-space-xs);
384
- padding: var(--fd-space-xs);
385
- border: 1px solid var(--fd-border-muted);
386
- border-radius: var(--fd-radius-md);
490
+ gap: var(--fd-space-sm);
491
+ padding: var(--fd-space-sm) var(--fd-space-sm) var(--fd-space-sm) var(--fd-space-xs);
492
+ background-color: var(--fd-card);
493
+ border: 1px solid var(--fd-border);
494
+ border-radius: var(--fd-radius-lg);
495
+ box-shadow: var(--fd-shadow-sm);
496
+ transition:
497
+ border-color var(--fd-transition-fast),
498
+ box-shadow var(--fd-transition-fast);
499
+ }
500
+
501
+ .wf-interface__entry:hover {
502
+ border-color: var(--fd-border-strong);
503
+ }
504
+
505
+ .wf-interface__entry:focus-within {
506
+ border-color: var(--fd-primary);
507
+ box-shadow: 0 0 0 var(--fd-ring-width) var(--fd-primary-muted);
387
508
  }
388
509
 
389
510
  .wf-interface__entry--error {
390
- border-color: color-mix(in srgb, var(--fd-error) 40%, var(--fd-border-muted));
511
+ border-color: color-mix(in srgb, var(--fd-error) 45%, var(--fd-border));
391
512
  }
392
513
 
393
- .wf-interface__reorder {
514
+ /* The card's spine: health dot on top, reorder chevrons below. */
515
+ .wf-interface__entry-side {
394
516
  display: flex;
395
517
  flex-direction: column;
518
+ align-items: center;
519
+ gap: var(--fd-space-2xs);
396
520
  flex-shrink: 0;
521
+ padding-top: 0.375rem;
522
+ }
523
+
524
+ .wf-interface__reorder {
525
+ display: flex;
526
+ flex-direction: column;
397
527
  }
398
528
 
399
529
  .wf-interface__reorder button {
400
530
  display: flex;
401
531
  align-items: center;
402
532
  justify-content: center;
533
+ width: 1.25rem;
534
+ height: 1rem;
403
535
  padding: 0;
404
536
  border: none;
537
+ border-radius: var(--fd-radius-sm);
405
538
  background: none;
406
539
  color: var(--fd-muted-foreground);
540
+ font-size: 0.875rem;
407
541
  cursor: pointer;
542
+ transition:
543
+ color var(--fd-transition-fast),
544
+ background-color var(--fd-transition-fast);
545
+ }
546
+
547
+ .wf-interface__reorder button:hover:not(:disabled) {
548
+ color: var(--fd-foreground);
549
+ background-color: var(--fd-subtle);
408
550
  }
409
551
 
410
552
  .wf-interface__reorder button:disabled {
@@ -417,25 +559,29 @@
417
559
  min-width: 0;
418
560
  display: flex;
419
561
  flex-direction: column;
420
- gap: var(--fd-space-xs);
562
+ gap: var(--fd-space-sm);
421
563
  }
422
564
 
423
565
  .wf-interface__row {
424
566
  display: flex;
425
567
  flex-wrap: wrap;
426
- gap: var(--fd-space-xs);
568
+ gap: var(--fd-space-sm);
427
569
  }
428
570
 
429
571
  .wf-interface__field {
430
572
  display: flex;
431
573
  flex-direction: column;
432
- gap: 0.125rem;
433
- flex: 1;
434
- min-width: 6rem;
574
+ gap: var(--fd-space-2xs);
575
+ flex: 1 1 8rem;
576
+ min-width: 0;
435
577
  }
436
578
 
437
579
  .wf-interface__field--id {
438
- flex: 0 0 8rem;
580
+ flex: 1 1 7rem;
581
+ }
582
+
583
+ .wf-interface__field--binding {
584
+ flex: 2 1 12rem;
439
585
  }
440
586
 
441
587
  .wf-interface__field--wide {
@@ -445,62 +591,148 @@
445
591
  .wf-interface__field--checkbox {
446
592
  flex-direction: row;
447
593
  align-items: center;
448
- gap: 0.375rem;
594
+ gap: var(--fd-space-xs);
449
595
  flex: 0 0 auto;
596
+ align-self: flex-end;
597
+ min-height: 2rem;
598
+ }
599
+
600
+ .wf-interface__field--checkbox input[type='checkbox'] {
601
+ width: 1rem;
602
+ height: 1rem;
603
+ margin: 0;
604
+ accent-color: var(--fd-primary);
605
+ cursor: pointer;
450
606
  }
451
607
 
608
+ /* Same voice as FormFieldWrapper's `.form-field__label`. */
452
609
  .wf-interface__label {
453
- font-size: var(--fd-text-xs);
454
- color: var(--fd-muted-foreground);
610
+ font-size: 0.8125rem;
611
+ font-weight: 600;
612
+ line-height: 1.4;
613
+ letter-spacing: -0.01em;
614
+ color: var(--fd-foreground);
455
615
  }
456
616
 
457
- .wf-interface__field input[type='text'],
458
- .wf-interface__field select {
459
- padding: 0.25rem 0.375rem;
617
+ .wf-interface__field--checkbox .wf-interface__label {
618
+ font-weight: 500;
619
+ }
620
+
621
+ /* The bound port, said back the way the canvas says it, in a select's clothes. */
622
+ .wf-interface__binding {
623
+ display: flex;
624
+ align-items: center;
625
+ gap: var(--fd-space-xs);
626
+ width: 100%;
627
+ min-height: 2rem;
628
+ padding: var(--fd-space-2xs) var(--fd-space-xs);
460
629
  border: 1px solid var(--fd-border);
461
- border-radius: var(--fd-radius-sm);
462
- background-color: var(--fd-background);
630
+ border-radius: var(--fd-control-radius);
631
+ background-color: var(--fd-card);
463
632
  color: var(--fd-foreground);
633
+ font: inherit;
464
634
  font-size: var(--fd-text-xs);
635
+ text-align: left;
636
+ cursor: pointer;
637
+ transition:
638
+ border-color var(--fd-transition-fast),
639
+ box-shadow var(--fd-transition-fast);
640
+ }
641
+
642
+ .wf-interface__binding:hover {
643
+ border-color: var(--fd-border-strong);
644
+ }
645
+
646
+ .wf-interface__binding:focus-visible,
647
+ .wf-interface__binding--open {
648
+ outline: none;
649
+ border-color: var(--fd-primary);
650
+ box-shadow: 0 0 0 var(--fd-ring-width) var(--fd-primary-muted);
651
+ }
652
+
653
+ .wf-interface__binding--invalid {
654
+ border-color: var(--fd-error);
655
+ }
656
+
657
+ .wf-interface__binding-path {
658
+ display: inline-flex;
659
+ align-items: center;
660
+ flex-wrap: wrap;
661
+ gap: 0.125rem;
662
+ flex: 1;
663
+ min-width: 0;
664
+ line-height: 1.4;
465
665
  }
466
666
 
467
- /* Selects size to their longest option instead of truncating it. */
468
- .wf-interface__field select {
469
- min-width: 8rem;
470
- width: max-content;
471
- max-width: 100%;
667
+ .wf-interface__binding-path :global(svg) {
668
+ flex-shrink: 0;
669
+ color: var(--fd-muted-foreground);
472
670
  }
473
671
 
474
- /* Entry health at a glance; the title tooltip carries the words. */
475
- .wf-interface__dot {
672
+ .wf-interface__binding-path :global(.flowdrop-badge--outline) {
673
+ flex: none;
674
+ }
675
+
676
+ .wf-interface__binding-node {
677
+ color: var(--fd-muted-foreground);
678
+ }
679
+
680
+ .wf-interface__binding-port {
681
+ font-weight: 600;
682
+ }
683
+
684
+ .wf-interface__binding-path--dangling {
685
+ color: var(--fd-error);
686
+ font-family: var(--fd-font-mono);
687
+ }
688
+
689
+ .wf-interface__binding-placeholder {
690
+ flex: 1;
691
+ color: var(--fd-muted-foreground);
692
+ }
693
+
694
+ .wf-interface__binding :global(.wf-interface__binding-caret) {
476
695
  flex-shrink: 0;
477
- width: 0.5rem;
478
- height: 0.5rem;
479
- margin-top: 0.5rem;
480
- border-radius: 50%;
481
- background-color: var(--fd-muted-foreground);
696
+ margin-left: auto;
697
+ color: var(--fd-muted-foreground);
698
+ }
699
+
700
+ /* The unfolded picker: the shared listbox plus its own unbind/cancel row. */
701
+ .wf-interface__picker {
702
+ display: flex;
703
+ flex-direction: column;
704
+ gap: var(--fd-space-xs);
705
+ padding: var(--fd-space-xs);
706
+ border: 1px solid color-mix(in srgb, var(--fd-primary) 45%, var(--fd-border));
707
+ border-radius: var(--fd-radius-md);
708
+ background-color: color-mix(in srgb, var(--fd-primary) 3%, var(--fd-card));
709
+ }
710
+
711
+ .wf-interface__picker-actions {
712
+ display: flex;
713
+ align-items: center;
714
+ gap: var(--fd-space-xs);
482
715
  }
483
716
 
484
- .wf-interface__dot--ok {
485
- background-color: var(--fd-success);
717
+ .wf-interface__picker-spacer {
718
+ flex: 1;
486
719
  }
487
720
 
488
- .wf-interface__dot--type-mismatch,
489
- .wf-interface__dot--unbound {
490
- background-color: var(--fd-warning);
721
+ .wf-interface__pull-row {
722
+ display: flex;
491
723
  }
492
724
 
493
- .wf-interface__dot--dangling,
494
- .wf-interface__dot--hidden,
495
- .wf-interface__dot--over-bound {
496
- background-color: var(--fd-error);
725
+ .wf-interface__pull-row :global(.wf-interface__pull) {
726
+ padding-inline: var(--fd-space-xs);
727
+ color: var(--fd-primary);
497
728
  }
498
729
 
499
730
  /* Field-anchored feedback: one short line under the field it belongs to. */
500
731
  .wf-interface__inline {
501
732
  display: inline-flex;
733
+ flex-wrap: wrap;
502
734
  align-items: baseline;
503
- gap: 0.375rem;
735
+ gap: var(--fd-space-xs);
504
736
  font-size: var(--fd-text-xs);
505
737
  line-height: 1.4;
506
738
  }
@@ -514,17 +746,20 @@
514
746
  }
515
747
 
516
748
  .wf-interface__quickfix {
517
- padding: 0 0.25rem;
518
- border: 1px solid var(--fd-border);
519
- border-radius: var(--fd-radius-sm);
520
- background-color: var(--fd-background);
521
- color: var(--fd-foreground);
522
- font-size: var(--fd-text-xs);
749
+ padding: 0 var(--fd-space-xs);
750
+ border: 1px solid currentColor;
751
+ border-radius: var(--fd-radius-full);
752
+ background-color: transparent;
753
+ color: inherit;
754
+ font-size: var(--fd-text-2xs);
755
+ font-weight: 600;
756
+ line-height: 1.4;
523
757
  cursor: pointer;
758
+ transition: background-color var(--fd-transition-fast);
524
759
  }
525
760
 
526
761
  .wf-interface__quickfix:hover {
527
- background-color: var(--fd-muted);
762
+ background-color: color-mix(in srgb, currentColor 12%, transparent);
528
763
  }
529
764
 
530
765
  /* The secondary fields live behind a disclosure so a card's resting state
@@ -534,109 +769,109 @@
534
769
  }
535
770
 
536
771
  .wf-interface__more > summary {
772
+ display: inline-flex;
773
+ align-items: center;
774
+ gap: 0.125rem;
775
+ list-style: none;
776
+ padding: 0.125rem var(--fd-space-xs) 0.125rem 0.125rem;
777
+ border-radius: var(--fd-radius-sm);
537
778
  color: var(--fd-muted-foreground);
779
+ font-weight: 500;
538
780
  cursor: pointer;
539
781
  user-select: none;
782
+ transition:
783
+ color var(--fd-transition-fast),
784
+ background-color var(--fd-transition-fast);
540
785
  }
541
786
 
542
- .wf-interface__more[open] > summary {
543
- margin-bottom: var(--fd-space-xs);
787
+ .wf-interface__more > summary::-webkit-details-marker {
788
+ display: none;
544
789
  }
545
790
 
546
- .wf-interface__more > :global(.wf-interface__row + .wf-interface__row),
547
- .wf-interface__more .wf-interface__examples {
548
- margin-top: var(--fd-space-xs);
791
+ .wf-interface__more > summary:hover {
792
+ color: var(--fd-foreground);
793
+ background-color: var(--fd-subtle);
549
794
  }
550
795
 
551
- .wf-interface__pull {
552
- display: inline-flex;
553
- align-items: center;
554
- gap: 0.25rem;
555
- align-self: flex-end;
556
- padding: 0.25rem 0.375rem;
557
- border: 1px solid var(--fd-border);
558
- border-radius: var(--fd-radius-sm);
559
- background-color: var(--fd-background);
560
- color: var(--fd-foreground);
561
- font-size: var(--fd-text-xs);
562
- white-space: nowrap;
563
- cursor: pointer;
796
+ .wf-interface__more > summary :global(svg) {
797
+ transition: transform var(--fd-transition-fast);
564
798
  }
565
799
 
566
- .wf-interface__pull:hover {
567
- background-color: var(--fd-muted);
800
+ .wf-interface__more[open] > summary :global(svg) {
801
+ transform: rotate(90deg);
802
+ }
803
+
804
+ .wf-interface__more-body {
805
+ display: flex;
806
+ flex-direction: column;
807
+ gap: var(--fd-space-sm);
808
+ margin-top: var(--fd-space-sm);
809
+ padding-top: var(--fd-space-sm);
810
+ border-top: 1px dashed var(--fd-border-muted);
568
811
  }
569
812
 
570
813
  .wf-interface__examples {
571
814
  display: flex;
572
815
  flex-direction: column;
573
- gap: 0.25rem;
816
+ gap: var(--fd-space-xs);
574
817
  }
575
818
 
576
819
  .wf-interface__example-row {
577
820
  display: flex;
578
821
  align-items: center;
579
- gap: 0.25rem;
822
+ gap: var(--fd-space-xs);
580
823
  }
581
824
 
582
- .wf-interface__example-row input {
825
+ .wf-interface__example-row :global(.flowdrop-input) {
583
826
  flex: 1;
584
- padding: 0.25rem 0.375rem;
585
- border: 1px solid var(--fd-border);
586
- border-radius: var(--fd-radius-sm);
587
- background-color: var(--fd-background);
588
- color: var(--fd-foreground);
589
- font-size: var(--fd-text-xs);
590
827
  }
591
828
 
592
- .wf-interface__example-remove {
593
- display: inline-flex;
594
- padding: 0.125rem;
595
- border: none;
596
- background: none;
597
- color: var(--fd-muted-foreground);
598
- cursor: pointer;
829
+ .wf-interface__example-row :global(.wf-interface__example-remove) {
830
+ width: 1.75rem;
831
+ height: 1.75rem;
832
+ flex-shrink: 0;
599
833
  }
600
834
 
601
- .wf-interface__example-remove:hover {
835
+ .wf-interface__example-row :global(.wf-interface__example-remove:hover) {
602
836
  color: var(--fd-error);
603
837
  }
604
838
 
605
- .wf-interface__example-add {
606
- display: inline-flex;
607
- align-items: center;
608
- gap: 0.25rem;
839
+ .wf-interface__examples :global(.wf-interface__example-add) {
609
840
  align-self: flex-start;
610
- padding: 0.125rem 0.25rem;
611
- border: none;
612
- background: none;
841
+ min-height: 1.75rem;
842
+ padding-inline: var(--fd-space-xs);
613
843
  color: var(--fd-muted-foreground);
614
- font-size: var(--fd-text-xs);
615
- cursor: pointer;
616
844
  }
617
845
 
618
- .wf-interface__example-add:hover {
846
+ .wf-interface__examples :global(.wf-interface__example-add:hover) {
619
847
  color: var(--fd-foreground);
620
848
  }
621
849
 
850
+ /* Status callouts: a tinted strip with a coloured edge, not bare coloured text. */
622
851
  .wf-interface__status {
623
852
  margin: 0;
853
+ padding: var(--fd-space-2xs) var(--fd-space-xs);
854
+ border-left: 3px solid var(--fd-muted-foreground);
855
+ border-radius: 0 var(--fd-radius-sm) var(--fd-radius-sm) 0;
856
+ background-color: var(--fd-muted);
624
857
  font-size: var(--fd-text-xs);
625
858
  line-height: 1.5;
626
- color: var(--fd-muted-foreground);
859
+ color: var(--fd-foreground);
627
860
  }
628
861
 
629
862
  .wf-interface__status--error,
630
863
  .wf-interface__status--dangling,
631
864
  .wf-interface__status--hidden,
632
865
  .wf-interface__status--over-bound {
633
- color: var(--fd-error);
866
+ border-left-color: var(--fd-error);
867
+ background-color: var(--fd-error-muted);
634
868
  }
635
869
 
636
870
  .wf-interface__status--warning,
637
871
  .wf-interface__status--unbound,
638
872
  .wf-interface__status--type-mismatch {
639
- color: var(--fd-warning);
873
+ border-left-color: var(--fd-warning);
874
+ background-color: var(--fd-warning-muted);
640
875
  }
641
876
 
642
877
  .wf-interface__meta {
@@ -644,29 +879,37 @@
644
879
  color: var(--fd-muted-foreground);
645
880
  }
646
881
 
882
+ .wf-interface__meta > summary {
883
+ cursor: pointer;
884
+ user-select: none;
885
+ }
886
+
887
+ .wf-interface__meta > summary:hover {
888
+ color: var(--fd-foreground);
889
+ }
890
+
647
891
  .wf-interface__meta pre {
648
- margin: 0.25rem 0 0;
649
- padding: 0.375rem;
650
- background: var(--fd-muted);
892
+ margin: var(--fd-space-xs) 0 0;
893
+ padding: var(--fd-space-xs);
894
+ border: 1px solid var(--fd-border-muted);
651
895
  border-radius: var(--fd-radius-sm);
896
+ background-color: var(--fd-muted);
897
+ color: var(--fd-foreground);
898
+ font-family: var(--fd-font-mono);
899
+ font-size: var(--fd-text-2xs);
900
+ line-height: 1.5;
652
901
  overflow-x: auto;
653
902
  }
654
903
 
655
- .wf-interface__remove {
904
+ .wf-interface__entry :global(.wf-interface__remove) {
656
905
  flex-shrink: 0;
657
- display: flex;
658
- align-items: center;
659
- justify-content: center;
660
- padding: 0.25rem;
661
- border: none;
662
- background: none;
663
- color: var(--fd-muted-foreground);
664
- cursor: pointer;
665
- border-radius: var(--fd-radius-sm);
906
+ width: 1.75rem;
907
+ height: 1.75rem;
908
+ margin-top: 0.125rem;
666
909
  }
667
910
 
668
- .wf-interface__remove:hover {
911
+ .wf-interface__entry :global(.wf-interface__remove:hover) {
669
912
  color: var(--fd-error);
670
- background-color: color-mix(in srgb, var(--fd-error) 10%, transparent);
913
+ background-color: var(--fd-error-muted);
671
914
  }
672
915
  </style>