@flowdrop/flowdrop 2.2.0 → 2.2.1
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.
|
@@ -0,0 +1,672 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
WorkflowInterfaceEntryCard Component
|
|
3
|
+
|
|
4
|
+
One row of `WorkflowInterfaceEditor` — a single `WorkflowInterface` entry:
|
|
5
|
+
identity, its binding, the secondary fields behind a disclosure, the examples
|
|
6
|
+
list on the input side, and the in-words explanation of the entry's
|
|
7
|
+
`resolveInterface` status.
|
|
8
|
+
|
|
9
|
+
A component rather than a chunk of the parent's `{#each}` because the
|
|
10
|
+
disclosure is per-row state. Nested in the parent it needed a keyed map and
|
|
11
|
+
hand-written bookkeeping to add, drop and reorder alongside the entries; here
|
|
12
|
+
Svelte gives each row its own instance, its own `fieldsOpen`, and disposal for
|
|
13
|
+
free. The parent keys the `{#each}` by a minted row id, so an instance travels
|
|
14
|
+
with its entry across reorders instead of staying in the slot.
|
|
15
|
+
|
|
16
|
+
Owns no entry data. Reads `entry` as a prop and reports every change through
|
|
17
|
+
`onPatch`, which the parent commits to the workflow — so this stays as
|
|
18
|
+
stateless about the workflow as the parent is.
|
|
19
|
+
-->
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import Icon from '@iconify/svelte';
|
|
23
|
+
import { m } from '../messages/index.js';
|
|
24
|
+
import type { PortDataTypeConfig, WorkflowInterfaceEntry } from '../types/index.js';
|
|
25
|
+
import {
|
|
26
|
+
describeInterfaceEntryStatus,
|
|
27
|
+
pullEntryFieldsFromPort,
|
|
28
|
+
type BindablePort,
|
|
29
|
+
type InterfaceIssue,
|
|
30
|
+
type ResolvedInterfaceEntry
|
|
31
|
+
} from '../utils/workflowInterface.js';
|
|
32
|
+
|
|
33
|
+
interface Props {
|
|
34
|
+
entry: WorkflowInterfaceEntry;
|
|
35
|
+
direction: 'inputs' | 'outputs';
|
|
36
|
+
status: ResolvedInterfaceEntry | undefined;
|
|
37
|
+
/** Candidate ports for this direction, for the binding picker. */
|
|
38
|
+
candidates: BindablePort[];
|
|
39
|
+
/** The authoring vocabulary offered by the dataType picker. */
|
|
40
|
+
dataTypes: PortDataTypeConfig[];
|
|
41
|
+
/** The issues this card explains in its footer. */
|
|
42
|
+
footerIssues: InterfaceIssue[];
|
|
43
|
+
/** Input side only: the bound port already receives another edge. */
|
|
44
|
+
alreadyConnected?: boolean;
|
|
45
|
+
/** Label of the node feeding that competing edge, when there is one. */
|
|
46
|
+
conflictingSource?: string;
|
|
47
|
+
isFirst: boolean;
|
|
48
|
+
isLast: boolean;
|
|
49
|
+
onPatch: (patch: Partial<WorkflowInterfaceEntry>) => void;
|
|
50
|
+
onMove: (delta: -1 | 1) => void;
|
|
51
|
+
onRemove: () => void;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const {
|
|
55
|
+
entry,
|
|
56
|
+
direction,
|
|
57
|
+
status,
|
|
58
|
+
candidates,
|
|
59
|
+
dataTypes,
|
|
60
|
+
footerIssues,
|
|
61
|
+
alreadyConnected = false,
|
|
62
|
+
conflictingSource,
|
|
63
|
+
isFirst,
|
|
64
|
+
isLast,
|
|
65
|
+
onPatch,
|
|
66
|
+
onMove,
|
|
67
|
+
onRemove
|
|
68
|
+
}: Props = $props();
|
|
69
|
+
|
|
70
|
+
/**
|
|
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
|
+
*/
|
|
84
|
+
// svelte-ignore state_referenced_locally
|
|
85
|
+
let fieldsOpen = $state(status?.status === 'type-mismatch');
|
|
86
|
+
|
|
87
|
+
/** Statuses still explained in the footer (the rest render inline or as the dot). */
|
|
88
|
+
const FOOTER_STATUSES = new Set(['unbound', 'dangling', 'hidden', 'over-bound']);
|
|
89
|
+
|
|
90
|
+
const isInput = $derived(direction === 'inputs');
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Options for the dataType select: the configured vocabulary, plus the
|
|
94
|
+
* entry's current value when it isn't in it (a host-custom or legacy type) —
|
|
95
|
+
* a select must never silently rewrite a stored value it cannot list.
|
|
96
|
+
*/
|
|
97
|
+
function dataTypeOptions(current: string): Array<{ id: string; name: string }> {
|
|
98
|
+
const options = dataTypes.map((dt) => ({ id: dt.id, name: dt.name }));
|
|
99
|
+
if (current && !dataTypes.some((dt) => dt.id === current || dt.aliases?.includes(current))) {
|
|
100
|
+
options.push({ id: current, name: current });
|
|
101
|
+
}
|
|
102
|
+
return options;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function bindingKey(nodeId: string, portId: string): string {
|
|
106
|
+
return `${nodeId}::${portId}`;
|
|
107
|
+
}
|
|
108
|
+
|
|
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
|
+
);
|
|
113
|
+
|
|
114
|
+
/** The bound port's own dataType, when the single binding resolves. */
|
|
115
|
+
const boundPortType = $derived(status?.targets[0]?.port.dataType);
|
|
116
|
+
|
|
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 }] };
|
|
124
|
+
// Convenience default: prefill an empty dataType from the picked port's own
|
|
125
|
+
// type. The field stays freely editable afterward — this only saves the
|
|
126
|
+
// 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
|
+
}
|
|
131
|
+
onPatch(patch);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Write one example slot back, dropping empties and collapsing an empty
|
|
136
|
+
* list to `undefined` so an untouched entry stores no `examples` key.
|
|
137
|
+
*/
|
|
138
|
+
function patchExample(exampleIndex: number, raw: string): void {
|
|
139
|
+
const next = [...(entry.examples ?? [])];
|
|
140
|
+
if (raw === '') next.splice(exampleIndex, 1);
|
|
141
|
+
else next[exampleIndex] = parseDefaultValue(raw);
|
|
142
|
+
onPatch({ examples: next.length > 0 ? next : undefined });
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function addExample(): void {
|
|
146
|
+
onPatch({ examples: [...(entry.examples ?? []), ''] });
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function removeExample(exampleIndex: number): void {
|
|
150
|
+
const next = (entry.examples ?? []).filter((_, i) => i !== exampleIndex);
|
|
151
|
+
onPatch({ examples: next.length > 0 ? next : undefined });
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function parseDefaultValue(raw: string): unknown {
|
|
155
|
+
if (raw === '') return undefined;
|
|
156
|
+
try {
|
|
157
|
+
return JSON.parse(raw);
|
|
158
|
+
} catch {
|
|
159
|
+
return raw;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function formatDefaultValue(value: unknown): string {
|
|
164
|
+
if (value === undefined) return '';
|
|
165
|
+
return typeof value === 'string' ? value : JSON.stringify(value);
|
|
166
|
+
}
|
|
167
|
+
</script>
|
|
168
|
+
|
|
169
|
+
<li
|
|
170
|
+
class="wf-interface__entry"
|
|
171
|
+
class:wf-interface__entry--error={status?.status &&
|
|
172
|
+
status.status !== 'ok' &&
|
|
173
|
+
status.status !== 'unbound'}
|
|
174
|
+
>
|
|
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>
|
|
198
|
+
</div>
|
|
199
|
+
|
|
200
|
+
<div class="wf-interface__fields">
|
|
201
|
+
<div class="wf-interface__row">
|
|
202
|
+
<label class="wf-interface__field wf-interface__field--id">
|
|
203
|
+
<span class="wf-interface__label">{m().workflowInterface.idLabel}</span>
|
|
204
|
+
<input
|
|
205
|
+
type="text"
|
|
206
|
+
value={entry.id}
|
|
207
|
+
onchange={(e) => onPatch({ id: e.currentTarget.value })}
|
|
208
|
+
/>
|
|
209
|
+
</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>
|
|
220
|
+
{#if isInput && alreadyConnected}
|
|
221
|
+
<span class="wf-interface__inline wf-interface__inline--error">
|
|
222
|
+
{m().workflowInterface.alreadyConnectedInline({ source: conflictingSource ?? '' })}
|
|
223
|
+
</span>
|
|
224
|
+
{/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}
|
|
237
|
+
</div>
|
|
238
|
+
|
|
239
|
+
<!-- Two-way, and it settles: the setter writes what the DOM already
|
|
240
|
+
reports, and assigning `open` a value it already holds fires no
|
|
241
|
+
further `toggle`. Without that the pair would be an unbounded
|
|
242
|
+
DOM/state cascade rather than a binding — and one Svelte's
|
|
243
|
+
update-depth guard could not catch, since each turn is a fresh
|
|
244
|
+
event task. -->
|
|
245
|
+
<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 })}
|
|
291
|
+
/>
|
|
292
|
+
<span class="wf-interface__label">{m().workflowInterface.requiredLabel}</span>
|
|
293
|
+
</label>
|
|
294
|
+
{/if}
|
|
295
|
+
</div>
|
|
296
|
+
|
|
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>
|
|
315
|
+
|
|
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">
|
|
323
|
+
<input
|
|
324
|
+
type="text"
|
|
325
|
+
value={formatDefaultValue(example)}
|
|
326
|
+
onchange={(e) => patchExample(exampleIndex, e.currentTarget.value)}
|
|
327
|
+
/>
|
|
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>
|
|
342
|
+
</div>
|
|
343
|
+
{/if}
|
|
344
|
+
</details>
|
|
345
|
+
|
|
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. -->
|
|
350
|
+
{#if status && FOOTER_STATUSES.has(status.status)}
|
|
351
|
+
<p class="wf-interface__status wf-interface__status--{status.status}">
|
|
352
|
+
{describeInterfaceEntryStatus(status)}
|
|
353
|
+
</p>
|
|
354
|
+
{/if}
|
|
355
|
+
{#each footerIssues as issue (issue.code)}
|
|
356
|
+
<p class="wf-interface__status wf-interface__status--{issue.severity}">
|
|
357
|
+
{issue.message}
|
|
358
|
+
</p>
|
|
359
|
+
{/each}
|
|
360
|
+
|
|
361
|
+
{#if entry.meta && Object.keys(entry.meta).length > 0}
|
|
362
|
+
<details class="wf-interface__meta">
|
|
363
|
+
<summary>{m().workflowInterface.metaDisclosure}</summary>
|
|
364
|
+
<pre>{JSON.stringify(entry.meta, null, 2)}</pre>
|
|
365
|
+
</details>
|
|
366
|
+
{/if}
|
|
367
|
+
</div>
|
|
368
|
+
|
|
369
|
+
<button
|
|
370
|
+
type="button"
|
|
371
|
+
class="wf-interface__remove"
|
|
372
|
+
onclick={onRemove}
|
|
373
|
+
aria-label={m().workflowInterface.removeEntry({ id: entry.id })}
|
|
374
|
+
>
|
|
375
|
+
<Icon icon="heroicons:trash" />
|
|
376
|
+
</button>
|
|
377
|
+
</li>
|
|
378
|
+
|
|
379
|
+
<style>
|
|
380
|
+
.wf-interface__entry {
|
|
381
|
+
display: flex;
|
|
382
|
+
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);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
.wf-interface__entry--error {
|
|
390
|
+
border-color: color-mix(in srgb, var(--fd-error) 40%, var(--fd-border-muted));
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.wf-interface__reorder {
|
|
394
|
+
display: flex;
|
|
395
|
+
flex-direction: column;
|
|
396
|
+
flex-shrink: 0;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
.wf-interface__reorder button {
|
|
400
|
+
display: flex;
|
|
401
|
+
align-items: center;
|
|
402
|
+
justify-content: center;
|
|
403
|
+
padding: 0;
|
|
404
|
+
border: none;
|
|
405
|
+
background: none;
|
|
406
|
+
color: var(--fd-muted-foreground);
|
|
407
|
+
cursor: pointer;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.wf-interface__reorder button:disabled {
|
|
411
|
+
opacity: 0.3;
|
|
412
|
+
cursor: default;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.wf-interface__fields {
|
|
416
|
+
flex: 1;
|
|
417
|
+
min-width: 0;
|
|
418
|
+
display: flex;
|
|
419
|
+
flex-direction: column;
|
|
420
|
+
gap: var(--fd-space-xs);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.wf-interface__row {
|
|
424
|
+
display: flex;
|
|
425
|
+
flex-wrap: wrap;
|
|
426
|
+
gap: var(--fd-space-xs);
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.wf-interface__field {
|
|
430
|
+
display: flex;
|
|
431
|
+
flex-direction: column;
|
|
432
|
+
gap: 0.125rem;
|
|
433
|
+
flex: 1;
|
|
434
|
+
min-width: 6rem;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.wf-interface__field--id {
|
|
438
|
+
flex: 0 0 8rem;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
.wf-interface__field--wide {
|
|
442
|
+
flex: 1 1 100%;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.wf-interface__field--checkbox {
|
|
446
|
+
flex-direction: row;
|
|
447
|
+
align-items: center;
|
|
448
|
+
gap: 0.375rem;
|
|
449
|
+
flex: 0 0 auto;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
.wf-interface__label {
|
|
453
|
+
font-size: var(--fd-text-xs);
|
|
454
|
+
color: var(--fd-muted-foreground);
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.wf-interface__field input[type='text'],
|
|
458
|
+
.wf-interface__field select {
|
|
459
|
+
padding: 0.25rem 0.375rem;
|
|
460
|
+
border: 1px solid var(--fd-border);
|
|
461
|
+
border-radius: var(--fd-radius-sm);
|
|
462
|
+
background-color: var(--fd-background);
|
|
463
|
+
color: var(--fd-foreground);
|
|
464
|
+
font-size: var(--fd-text-xs);
|
|
465
|
+
}
|
|
466
|
+
|
|
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%;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
/* Entry health at a glance; the title tooltip carries the words. */
|
|
475
|
+
.wf-interface__dot {
|
|
476
|
+
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);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.wf-interface__dot--ok {
|
|
485
|
+
background-color: var(--fd-success);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.wf-interface__dot--type-mismatch,
|
|
489
|
+
.wf-interface__dot--unbound {
|
|
490
|
+
background-color: var(--fd-warning);
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.wf-interface__dot--dangling,
|
|
494
|
+
.wf-interface__dot--hidden,
|
|
495
|
+
.wf-interface__dot--over-bound {
|
|
496
|
+
background-color: var(--fd-error);
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/* Field-anchored feedback: one short line under the field it belongs to. */
|
|
500
|
+
.wf-interface__inline {
|
|
501
|
+
display: inline-flex;
|
|
502
|
+
align-items: baseline;
|
|
503
|
+
gap: 0.375rem;
|
|
504
|
+
font-size: var(--fd-text-xs);
|
|
505
|
+
line-height: 1.4;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
.wf-interface__inline--warning {
|
|
509
|
+
color: var(--fd-warning);
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
.wf-interface__inline--error {
|
|
513
|
+
color: var(--fd-error);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.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);
|
|
523
|
+
cursor: pointer;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.wf-interface__quickfix:hover {
|
|
527
|
+
background-color: var(--fd-muted);
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/* The secondary fields live behind a disclosure so a card's resting state
|
|
531
|
+
is just identity + binding. Auto-opened when a field inside needs eyes. */
|
|
532
|
+
.wf-interface__more {
|
|
533
|
+
font-size: var(--fd-text-xs);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.wf-interface__more > summary {
|
|
537
|
+
color: var(--fd-muted-foreground);
|
|
538
|
+
cursor: pointer;
|
|
539
|
+
user-select: none;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.wf-interface__more[open] > summary {
|
|
543
|
+
margin-bottom: var(--fd-space-xs);
|
|
544
|
+
}
|
|
545
|
+
|
|
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);
|
|
549
|
+
}
|
|
550
|
+
|
|
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;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
.wf-interface__pull:hover {
|
|
567
|
+
background-color: var(--fd-muted);
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.wf-interface__examples {
|
|
571
|
+
display: flex;
|
|
572
|
+
flex-direction: column;
|
|
573
|
+
gap: 0.25rem;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
.wf-interface__example-row {
|
|
577
|
+
display: flex;
|
|
578
|
+
align-items: center;
|
|
579
|
+
gap: 0.25rem;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.wf-interface__example-row input {
|
|
583
|
+
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
|
+
}
|
|
591
|
+
|
|
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;
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.wf-interface__example-remove:hover {
|
|
602
|
+
color: var(--fd-error);
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
.wf-interface__example-add {
|
|
606
|
+
display: inline-flex;
|
|
607
|
+
align-items: center;
|
|
608
|
+
gap: 0.25rem;
|
|
609
|
+
align-self: flex-start;
|
|
610
|
+
padding: 0.125rem 0.25rem;
|
|
611
|
+
border: none;
|
|
612
|
+
background: none;
|
|
613
|
+
color: var(--fd-muted-foreground);
|
|
614
|
+
font-size: var(--fd-text-xs);
|
|
615
|
+
cursor: pointer;
|
|
616
|
+
}
|
|
617
|
+
|
|
618
|
+
.wf-interface__example-add:hover {
|
|
619
|
+
color: var(--fd-foreground);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
.wf-interface__status {
|
|
623
|
+
margin: 0;
|
|
624
|
+
font-size: var(--fd-text-xs);
|
|
625
|
+
line-height: 1.5;
|
|
626
|
+
color: var(--fd-muted-foreground);
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
.wf-interface__status--error,
|
|
630
|
+
.wf-interface__status--dangling,
|
|
631
|
+
.wf-interface__status--hidden,
|
|
632
|
+
.wf-interface__status--over-bound {
|
|
633
|
+
color: var(--fd-error);
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
.wf-interface__status--warning,
|
|
637
|
+
.wf-interface__status--unbound,
|
|
638
|
+
.wf-interface__status--type-mismatch {
|
|
639
|
+
color: var(--fd-warning);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
.wf-interface__meta {
|
|
643
|
+
font-size: var(--fd-text-xs);
|
|
644
|
+
color: var(--fd-muted-foreground);
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
.wf-interface__meta pre {
|
|
648
|
+
margin: 0.25rem 0 0;
|
|
649
|
+
padding: 0.375rem;
|
|
650
|
+
background: var(--fd-muted);
|
|
651
|
+
border-radius: var(--fd-radius-sm);
|
|
652
|
+
overflow-x: auto;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
.wf-interface__remove {
|
|
656
|
+
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);
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
.wf-interface__remove:hover {
|
|
669
|
+
color: var(--fd-error);
|
|
670
|
+
background-color: color-mix(in srgb, var(--fd-error) 10%, transparent);
|
|
671
|
+
}
|
|
672
|
+
</style>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { PortDataTypeConfig, WorkflowInterfaceEntry } from '../types/index.js';
|
|
2
|
+
import { type BindablePort, type InterfaceIssue, type ResolvedInterfaceEntry } from '../utils/workflowInterface.js';
|
|
3
|
+
interface Props {
|
|
4
|
+
entry: WorkflowInterfaceEntry;
|
|
5
|
+
direction: 'inputs' | 'outputs';
|
|
6
|
+
status: ResolvedInterfaceEntry | undefined;
|
|
7
|
+
/** Candidate ports for this direction, for the binding picker. */
|
|
8
|
+
candidates: BindablePort[];
|
|
9
|
+
/** The authoring vocabulary offered by the dataType picker. */
|
|
10
|
+
dataTypes: PortDataTypeConfig[];
|
|
11
|
+
/** The issues this card explains in its footer. */
|
|
12
|
+
footerIssues: InterfaceIssue[];
|
|
13
|
+
/** Input side only: the bound port already receives another edge. */
|
|
14
|
+
alreadyConnected?: boolean;
|
|
15
|
+
/** Label of the node feeding that competing edge, when there is one. */
|
|
16
|
+
conflictingSource?: string;
|
|
17
|
+
isFirst: boolean;
|
|
18
|
+
isLast: boolean;
|
|
19
|
+
onPatch: (patch: Partial<WorkflowInterfaceEntry>) => void;
|
|
20
|
+
onMove: (delta: -1 | 1) => void;
|
|
21
|
+
onRemove: () => void;
|
|
22
|
+
}
|
|
23
|
+
declare const WorkflowInterfaceEntryCard: import("svelte").Component<Props, {}, "">;
|
|
24
|
+
type WorkflowInterfaceEntryCard = ReturnType<typeof WorkflowInterfaceEntryCard>;
|
|
25
|
+
export default WorkflowInterfaceEntryCard;
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "A drop-in visual workflow editor for any web application. You own the backend. You own the data. You own the orchestration.",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
|
-
"version": "2.2.
|
|
6
|
+
"version": "2.2.1",
|
|
7
7
|
"author": "Shibin Das (D34dMan)",
|
|
8
8
|
"bugs": {
|
|
9
9
|
"url": "https://github.com/flowdrop-io/flowdrop/issues"
|