@flowdrop/flowdrop 2.2.0 → 2.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/components/WorkflowInterfaceEditor.svelte +96 -654
- package/dist/components/WorkflowInterfaceEntryCard.svelte +672 -0
- package/dist/components/WorkflowInterfaceEntryCard.svelte.d.ts +25 -0
- package/dist/stores/workflowStore.svelte.js +5 -1
- package/package.json +1 -1
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
<script lang="ts">
|
|
28
28
|
import Icon from '@iconify/svelte';
|
|
29
29
|
import { m } from '../messages/index.js';
|
|
30
|
+
import WorkflowInterfaceEntryCard from './WorkflowInterfaceEntryCard.svelte';
|
|
30
31
|
import { buildHandleId } from '../utils/handleIds.js';
|
|
31
32
|
import { DEFAULT_PORT_CONFIG } from '../config/defaultPortConfig.js';
|
|
32
33
|
import type {
|
|
@@ -36,9 +37,7 @@
|
|
|
36
37
|
WorkflowInterfaceEntry
|
|
37
38
|
} from '../types/index.js';
|
|
38
39
|
import {
|
|
39
|
-
describeInterfaceEntryStatus,
|
|
40
40
|
listBindablePorts,
|
|
41
|
-
pullEntryFieldsFromPort,
|
|
42
41
|
resolveInterface,
|
|
43
42
|
validateWorkflowInterface,
|
|
44
43
|
type InterfaceIssue,
|
|
@@ -62,19 +61,6 @@
|
|
|
62
61
|
dataTypes = DEFAULT_PORT_CONFIG.dataTypes.filter((dt) => dt.enabled !== false)
|
|
63
62
|
}: Props = $props();
|
|
64
63
|
|
|
65
|
-
/**
|
|
66
|
-
* Options for one entry's dataType select: the configured vocabulary, plus
|
|
67
|
-
* the entry's current value when it isn't in it (a host-custom or legacy
|
|
68
|
-
* type) — a select must never silently rewrite a stored value it can't list.
|
|
69
|
-
*/
|
|
70
|
-
function dataTypeOptions(current: string): Array<{ id: string; name: string }> {
|
|
71
|
-
const options = dataTypes.map((dt) => ({ id: dt.id, name: dt.name }));
|
|
72
|
-
if (current && !dataTypes.some((dt) => dt.id === current || dt.aliases?.includes(current))) {
|
|
73
|
-
options.push({ id: current, name: current });
|
|
74
|
-
}
|
|
75
|
-
return options;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
64
|
type Direction = 'inputs' | 'outputs';
|
|
79
65
|
|
|
80
66
|
const SECTIONS: Array<{ key: Direction; entryDirection: 'input' | 'output' }> = [
|
|
@@ -129,11 +115,6 @@
|
|
|
129
115
|
);
|
|
130
116
|
}
|
|
131
117
|
|
|
132
|
-
/** The bound port's own dataType, when the single binding resolves. */
|
|
133
|
-
function boundPortType(status: ResolvedInterfaceEntry | undefined): string | undefined {
|
|
134
|
-
return status?.targets[0]?.port.dataType;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
118
|
function hasIssue(direction: Direction, entryId: string, code: string): boolean {
|
|
138
119
|
return issuesFor(direction, entryId).some((issue) => issue.code === code);
|
|
139
120
|
}
|
|
@@ -153,21 +134,54 @@
|
|
|
153
134
|
return source?.data?.label ?? edge.source;
|
|
154
135
|
}
|
|
155
136
|
|
|
156
|
-
/**
|
|
157
|
-
|
|
137
|
+
/**
|
|
138
|
+
* Client-side row identity for the two entry lists.
|
|
139
|
+
*
|
|
140
|
+
* Interface entries have no identity of their own to key on. `id` is a field
|
|
141
|
+
* the author edits, and every patch replaces the entry object wholesale, so
|
|
142
|
+
* neither the field nor the object reference survives an edit. Keyed by
|
|
143
|
+
* position instead, an `{#each}` reuses a row's DOM and its card component
|
|
144
|
+
* for whichever entry lands in that slot — so `WorkflowInterfaceEntryCard`'s
|
|
145
|
+
* per-row state (its open/closed disclosure) would belong to the slot rather
|
|
146
|
+
* than to the entry, and reordering two cards would leave the open one
|
|
147
|
+
* behind.
|
|
148
|
+
*
|
|
149
|
+
* So identity is minted here, kept out of the wire format entirely, and moved
|
|
150
|
+
* in lockstep with the lists by the mutators below. Initialised eagerly
|
|
151
|
+
* rather than in an effect so the `{#each}` never renders against ids that
|
|
152
|
+
* have not caught up yet.
|
|
153
|
+
*/
|
|
154
|
+
let rowIdSeq = 0;
|
|
158
155
|
|
|
159
|
-
function
|
|
160
|
-
|
|
156
|
+
function mintRowId(): string {
|
|
157
|
+
rowIdSeq += 1;
|
|
158
|
+
return `row-${rowIdSeq}`;
|
|
161
159
|
}
|
|
162
160
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
161
|
+
let rowIds = $state<Record<Direction, string[]>>({
|
|
162
|
+
inputs: entriesFor('inputs').map(mintRowId),
|
|
163
|
+
outputs: entriesFor('outputs').map(mintRowId)
|
|
164
|
+
});
|
|
166
165
|
|
|
167
|
-
/**
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Re-key a side whose list changed length from outside this component — undo,
|
|
168
|
+
* redo, a reload, another authoring surface. The mutators below keep ids and
|
|
169
|
+
* entries in step, so this never fires for a local edit.
|
|
170
|
+
*
|
|
171
|
+
* Converges: it writes only while the lengths disagree, and they agree once
|
|
172
|
+
* it has. `$effect.pre` so the new ids are in place before the `{#each}`
|
|
173
|
+
* reads them rather than one frame later.
|
|
174
|
+
*/
|
|
175
|
+
$effect.pre(() => {
|
|
176
|
+
for (const { key } of SECTIONS) {
|
|
177
|
+
if (rowIds[key].length !== entriesFor(key).length) {
|
|
178
|
+
rowIds[key] = entriesFor(key).map(mintRowId);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
function bindablePorts(direction: Direction) {
|
|
184
|
+
return listBindablePorts(workflow, entryDirectionOf(direction));
|
|
171
185
|
}
|
|
172
186
|
|
|
173
187
|
function nextId(direction: Direction): string {
|
|
@@ -183,28 +197,44 @@
|
|
|
183
197
|
}
|
|
184
198
|
|
|
185
199
|
/**
|
|
186
|
-
* Commit a direction's entry list back to the workflow,
|
|
187
|
-
*
|
|
188
|
-
*
|
|
200
|
+
* Commit a direction's entry list back to the workflow, dropping a side that
|
|
201
|
+
* ends up empty so it reads as "declares nothing on this side".
|
|
202
|
+
*
|
|
203
|
+
* Always reports an interface *object*, even when the author has emptied both
|
|
204
|
+
* sides. Reporting `undefined` there — as this did — made removing the last
|
|
205
|
+
* entry impossible: the store treats `interface: undefined` as "no interface
|
|
206
|
+
* key supplied, leave it alone", so the removal never landed and the row
|
|
207
|
+
* stayed on screen. The server draws the same distinction, and for the same
|
|
208
|
+
* reason: an absent `interface` is a partial update that must not disturb
|
|
209
|
+
* port exposures authored elsewhere (the Drupal admin form), while a present
|
|
210
|
+
* one rewrites both sides — so `{}` is what "the author emptied this" has to
|
|
211
|
+
* look like on the wire.
|
|
212
|
+
*
|
|
213
|
+
* Decision 5 (additive and optional — an interface nobody populated should
|
|
214
|
+
* not linger as `{}`) still holds: a workflow nobody has authored an
|
|
215
|
+
* interface for never reaches this function, and keeps its absent key.
|
|
189
216
|
*/
|
|
190
217
|
function commit(direction: Direction, next: WorkflowInterfaceEntry[]): void {
|
|
191
218
|
const inputs = direction === 'inputs' ? next : (workflow.interface?.inputs ?? []);
|
|
192
219
|
const outputs = direction === 'outputs' ? next : (workflow.interface?.outputs ?? []);
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
onChange({ inputs: cleanedInputs, outputs: cleanedOutputs });
|
|
220
|
+
onChange({
|
|
221
|
+
inputs: inputs.length > 0 ? inputs : undefined,
|
|
222
|
+
outputs: outputs.length > 0 ? outputs : undefined
|
|
223
|
+
});
|
|
200
224
|
}
|
|
201
225
|
|
|
202
226
|
function addEntry(direction: Direction): void {
|
|
203
227
|
const entry: WorkflowInterfaceEntry = { id: nextId(direction), dataType: '', bindings: [] };
|
|
228
|
+
// A row id of its own, so adding an entry leaves every other card — and
|
|
229
|
+
// every other card's disclosure — exactly as the author left it.
|
|
230
|
+
rowIds[direction] = [...rowIds[direction], mintRowId()];
|
|
204
231
|
commit(direction, [...entriesFor(direction), entry]);
|
|
205
232
|
}
|
|
206
233
|
|
|
207
234
|
function removeEntry(direction: Direction, index: number): void {
|
|
235
|
+
// Dropping the row id destroys that card's component, and its disclosure
|
|
236
|
+
// state with it — no bookkeeping to keep in step.
|
|
237
|
+
rowIds[direction].splice(index, 1);
|
|
208
238
|
commit(
|
|
209
239
|
direction,
|
|
210
240
|
entriesFor(direction).filter((_, i) => i !== index)
|
|
@@ -216,6 +246,10 @@
|
|
|
216
246
|
const target = index + delta;
|
|
217
247
|
if (target < 0 || target >= list.length) return;
|
|
218
248
|
[list[index], list[target]] = [list[target], list[index]];
|
|
249
|
+
// Row ids ride along, so a card's disclosure travels with the entry
|
|
250
|
+
// instead of staying behind in the slot it used to occupy.
|
|
251
|
+
const ids = rowIds[direction];
|
|
252
|
+
[ids[index], ids[target]] = [ids[target], ids[index]];
|
|
219
253
|
commit(direction, list);
|
|
220
254
|
}
|
|
221
255
|
|
|
@@ -229,71 +263,6 @@
|
|
|
229
263
|
);
|
|
230
264
|
commit(direction, list);
|
|
231
265
|
}
|
|
232
|
-
|
|
233
|
-
function handleBindingChange(direction: Direction, index: number, value: string): void {
|
|
234
|
-
if (!value) {
|
|
235
|
-
patchEntry(direction, index, { bindings: [] });
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
const [nodeId, portId] = value.split('::');
|
|
239
|
-
const patch: Partial<WorkflowInterfaceEntry> = { bindings: [{ nodeId, portId }] };
|
|
240
|
-
// Convenience default: prefill an empty dataType from the picked port's own
|
|
241
|
-
// type. The field stays freely editable afterward — this only saves the
|
|
242
|
-
// common case of typing out what the port already declares.
|
|
243
|
-
const entry = entriesFor(direction)[index];
|
|
244
|
-
if (entry && !entry.dataType) {
|
|
245
|
-
const match = bindablePorts(direction).find(
|
|
246
|
-
(b) => b.nodeId === nodeId && b.port.id === portId
|
|
247
|
-
);
|
|
248
|
-
if (match) patch.dataType = match.port.dataType;
|
|
249
|
-
}
|
|
250
|
-
patchEntry(direction, index, patch);
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
/**
|
|
254
|
-
* Write one example slot back, dropping empties and collapsing an empty
|
|
255
|
-
* list to `undefined` so an untouched entry stores no `examples` key.
|
|
256
|
-
*/
|
|
257
|
-
function patchExample(
|
|
258
|
-
direction: Direction,
|
|
259
|
-
index: number,
|
|
260
|
-
entry: WorkflowInterfaceEntry,
|
|
261
|
-
exampleIndex: number,
|
|
262
|
-
raw: string
|
|
263
|
-
): void {
|
|
264
|
-
const next = [...(entry.examples ?? [])];
|
|
265
|
-
if (raw === '') next.splice(exampleIndex, 1);
|
|
266
|
-
else next[exampleIndex] = parseDefaultValue(raw);
|
|
267
|
-
patchEntry(direction, index, { examples: next.length > 0 ? next : undefined });
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
function addExample(direction: Direction, index: number, entry: WorkflowInterfaceEntry): void {
|
|
271
|
-
patchEntry(direction, index, { examples: [...(entry.examples ?? []), ''] });
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
function removeExample(
|
|
275
|
-
direction: Direction,
|
|
276
|
-
index: number,
|
|
277
|
-
entry: WorkflowInterfaceEntry,
|
|
278
|
-
exampleIndex: number
|
|
279
|
-
): void {
|
|
280
|
-
const next = (entry.examples ?? []).filter((_, i) => i !== exampleIndex);
|
|
281
|
-
patchEntry(direction, index, { examples: next.length > 0 ? next : undefined });
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
function parseDefaultValue(raw: string): unknown {
|
|
285
|
-
if (raw === '') return undefined;
|
|
286
|
-
try {
|
|
287
|
-
return JSON.parse(raw);
|
|
288
|
-
} catch {
|
|
289
|
-
return raw;
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
function formatDefaultValue(value: unknown): string {
|
|
294
|
-
if (value === undefined) return '';
|
|
295
|
-
return typeof value === 'string' ? value : JSON.stringify(value);
|
|
296
|
-
}
|
|
297
266
|
</script>
|
|
298
267
|
|
|
299
268
|
<div class="wf-interface">
|
|
@@ -322,262 +291,28 @@
|
|
|
322
291
|
</p>
|
|
323
292
|
{:else}
|
|
324
293
|
<ul class="wf-interface__list">
|
|
325
|
-
{#each list as entry, index (index)}
|
|
294
|
+
{#each list as entry, index (rowIds[section.key][index] ?? `pending-${index}`)}
|
|
326
295
|
{@const status = statusFor(section.key, entry.id)}
|
|
327
|
-
<
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
{
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
</button>
|
|
348
|
-
<button
|
|
349
|
-
type="button"
|
|
350
|
-
disabled={index === list.length - 1}
|
|
351
|
-
onclick={() => moveEntry(section.key, index, 1)}
|
|
352
|
-
aria-label={m().workflowInterface.moveDown({ id: entry.id })}
|
|
353
|
-
>
|
|
354
|
-
<Icon icon="heroicons:chevron-down" />
|
|
355
|
-
</button>
|
|
356
|
-
</div>
|
|
357
|
-
|
|
358
|
-
<div class="wf-interface__fields">
|
|
359
|
-
<div class="wf-interface__row">
|
|
360
|
-
<label class="wf-interface__field wf-interface__field--id">
|
|
361
|
-
<span class="wf-interface__label">{m().workflowInterface.idLabel}</span>
|
|
362
|
-
<input
|
|
363
|
-
type="text"
|
|
364
|
-
value={entry.id}
|
|
365
|
-
onchange={(e) =>
|
|
366
|
-
patchEntry(section.key, index, { id: e.currentTarget.value })}
|
|
367
|
-
/>
|
|
368
|
-
</label>
|
|
369
|
-
<label class="wf-interface__field wf-interface__field--wide">
|
|
370
|
-
<span class="wf-interface__label">{m().workflowInterface.bindingLabel}</span>
|
|
371
|
-
<select
|
|
372
|
-
value={currentBindingValue(entry)}
|
|
373
|
-
onchange={(e) =>
|
|
374
|
-
handleBindingChange(section.key, index, e.currentTarget.value)}
|
|
375
|
-
>
|
|
376
|
-
<option value="">{m().workflowInterface.bindingUnbound}</option>
|
|
377
|
-
{#each bindablePorts(section.key) as candidate (bindingKey(candidate.nodeId, candidate.port.id))}
|
|
378
|
-
<option value={bindingKey(candidate.nodeId, candidate.port.id)}>
|
|
379
|
-
{candidate.nodeLabel} — {candidate.port.name} ({candidate.port.dataType})
|
|
380
|
-
</option>
|
|
381
|
-
{/each}
|
|
382
|
-
</select>
|
|
383
|
-
{#if section.key === 'inputs' && hasIssue(section.key, entry.id, 'interface-input-already-connected')}
|
|
384
|
-
<span class="wf-interface__inline wf-interface__inline--error">
|
|
385
|
-
{m().workflowInterface.alreadyConnectedInline({
|
|
386
|
-
source: conflictingSourceLabel(entry) ?? ''
|
|
387
|
-
})}
|
|
388
|
-
</span>
|
|
389
|
-
{/if}
|
|
390
|
-
</label>
|
|
391
|
-
{#if status?.targets[0]}
|
|
392
|
-
<button
|
|
393
|
-
type="button"
|
|
394
|
-
class="wf-interface__pull"
|
|
395
|
-
title={m().workflowInterface.pullFromPortTitle}
|
|
396
|
-
onclick={() =>
|
|
397
|
-
patchEntry(
|
|
398
|
-
section.key,
|
|
399
|
-
index,
|
|
400
|
-
pullEntryFieldsFromPort(status.targets[0].port)
|
|
401
|
-
)}
|
|
402
|
-
>
|
|
403
|
-
<Icon icon="heroicons:arrow-down-tray" />
|
|
404
|
-
{m().workflowInterface.pullFromPort}
|
|
405
|
-
</button>
|
|
406
|
-
{/if}
|
|
407
|
-
</div>
|
|
408
|
-
|
|
409
|
-
<details
|
|
410
|
-
class="wf-interface__more"
|
|
411
|
-
open={status?.status === 'type-mismatch' || undefined}
|
|
412
|
-
>
|
|
413
|
-
<summary>{m().workflowInterface.moreOptions}</summary>
|
|
414
|
-
<div class="wf-interface__row">
|
|
415
|
-
<label class="wf-interface__field">
|
|
416
|
-
<span class="wf-interface__label">{m().workflowInterface.nameLabel}</span>
|
|
417
|
-
<input
|
|
418
|
-
type="text"
|
|
419
|
-
value={entry.name ?? ''}
|
|
420
|
-
placeholder={m().workflowInterface.namePlaceholder}
|
|
421
|
-
onchange={(e) =>
|
|
422
|
-
patchEntry(section.key, index, {
|
|
423
|
-
name: e.currentTarget.value || undefined
|
|
424
|
-
})}
|
|
425
|
-
/>
|
|
426
|
-
</label>
|
|
427
|
-
<label class="wf-interface__field">
|
|
428
|
-
<span class="wf-interface__label">{m().workflowInterface.dataTypeLabel}</span>
|
|
429
|
-
<select
|
|
430
|
-
value={entry.dataType}
|
|
431
|
-
onchange={(e) =>
|
|
432
|
-
patchEntry(section.key, index, { dataType: e.currentTarget.value })}
|
|
433
|
-
>
|
|
434
|
-
{#if !entry.dataType}
|
|
435
|
-
<option value="" disabled selected>
|
|
436
|
-
{m().workflowInterface.dataTypePlaceholder}
|
|
437
|
-
</option>
|
|
438
|
-
{/if}
|
|
439
|
-
{#each dataTypeOptions(entry.dataType) as option (option.id)}
|
|
440
|
-
<option value={option.id}>{option.name}</option>
|
|
441
|
-
{/each}
|
|
442
|
-
</select>
|
|
443
|
-
{#if status?.status === 'type-mismatch' && boundPortType(status)}
|
|
444
|
-
<span class="wf-interface__inline wf-interface__inline--warning">
|
|
445
|
-
{m().workflowInterface.typeMismatchInline({
|
|
446
|
-
portType: boundPortType(status) ?? ''
|
|
447
|
-
})}
|
|
448
|
-
<button
|
|
449
|
-
type="button"
|
|
450
|
-
class="wf-interface__quickfix"
|
|
451
|
-
onclick={() =>
|
|
452
|
-
patchEntry(section.key, index, {
|
|
453
|
-
dataType: boundPortType(status) ?? entry.dataType
|
|
454
|
-
})}
|
|
455
|
-
>
|
|
456
|
-
{m().workflowInterface.useMatchPortType}
|
|
457
|
-
</button>
|
|
458
|
-
</span>
|
|
459
|
-
{/if}
|
|
460
|
-
</label>
|
|
461
|
-
{#if section.key === 'inputs'}
|
|
462
|
-
<label class="wf-interface__field wf-interface__field--checkbox">
|
|
463
|
-
<input
|
|
464
|
-
type="checkbox"
|
|
465
|
-
checked={entry.required ?? false}
|
|
466
|
-
onchange={(e) =>
|
|
467
|
-
patchEntry(section.key, index, {
|
|
468
|
-
required: e.currentTarget.checked || undefined
|
|
469
|
-
})}
|
|
470
|
-
/>
|
|
471
|
-
<span class="wf-interface__label"
|
|
472
|
-
>{m().workflowInterface.requiredLabel}</span
|
|
473
|
-
>
|
|
474
|
-
</label>
|
|
475
|
-
{/if}
|
|
476
|
-
</div>
|
|
477
|
-
|
|
478
|
-
<div class="wf-interface__row">
|
|
479
|
-
<label class="wf-interface__field wf-interface__field--wide">
|
|
480
|
-
<span class="wf-interface__label"
|
|
481
|
-
>{m().workflowInterface.descriptionLabel}</span
|
|
482
|
-
>
|
|
483
|
-
<input
|
|
484
|
-
type="text"
|
|
485
|
-
value={entry.description ?? ''}
|
|
486
|
-
onchange={(e) =>
|
|
487
|
-
patchEntry(section.key, index, {
|
|
488
|
-
description: e.currentTarget.value || undefined
|
|
489
|
-
})}
|
|
490
|
-
/>
|
|
491
|
-
</label>
|
|
492
|
-
<label class="wf-interface__field">
|
|
493
|
-
<span class="wf-interface__label"
|
|
494
|
-
>{m().workflowInterface.defaultValueLabel}</span
|
|
495
|
-
>
|
|
496
|
-
<input
|
|
497
|
-
type="text"
|
|
498
|
-
value={formatDefaultValue(entry.defaultValue)}
|
|
499
|
-
onchange={(e) =>
|
|
500
|
-
patchEntry(section.key, index, {
|
|
501
|
-
defaultValue: parseDefaultValue(e.currentTarget.value)
|
|
502
|
-
})}
|
|
503
|
-
/>
|
|
504
|
-
</label>
|
|
505
|
-
</div>
|
|
506
|
-
|
|
507
|
-
{#if section.key === 'inputs'}
|
|
508
|
-
<div class="wf-interface__examples">
|
|
509
|
-
<span class="wf-interface__label">
|
|
510
|
-
{m().workflowInterface.examplesLabel}
|
|
511
|
-
</span>
|
|
512
|
-
{#each entry.examples ?? [] as example, exampleIndex (exampleIndex)}
|
|
513
|
-
<div class="wf-interface__example-row">
|
|
514
|
-
<input
|
|
515
|
-
type="text"
|
|
516
|
-
value={formatDefaultValue(example)}
|
|
517
|
-
onchange={(e) =>
|
|
518
|
-
patchExample(
|
|
519
|
-
section.key,
|
|
520
|
-
index,
|
|
521
|
-
entry,
|
|
522
|
-
exampleIndex,
|
|
523
|
-
e.currentTarget.value
|
|
524
|
-
)}
|
|
525
|
-
/>
|
|
526
|
-
<button
|
|
527
|
-
type="button"
|
|
528
|
-
class="wf-interface__example-remove"
|
|
529
|
-
onclick={() => removeExample(section.key, index, entry, exampleIndex)}
|
|
530
|
-
aria-label={m().workflowInterface.removeExample}
|
|
531
|
-
>
|
|
532
|
-
<Icon icon="heroicons:x-mark" />
|
|
533
|
-
</button>
|
|
534
|
-
</div>
|
|
535
|
-
{/each}
|
|
536
|
-
<button
|
|
537
|
-
type="button"
|
|
538
|
-
class="wf-interface__example-add"
|
|
539
|
-
onclick={() => addExample(section.key, index, entry)}
|
|
540
|
-
>
|
|
541
|
-
<Icon icon="heroicons:plus" />
|
|
542
|
-
{m().workflowInterface.addExample}
|
|
543
|
-
</button>
|
|
544
|
-
</div>
|
|
545
|
-
{/if}
|
|
546
|
-
</details>
|
|
547
|
-
|
|
548
|
-
<!-- Every resolveInterface status renders in words somewhere in
|
|
549
|
-
this card — the obligation that makes this surface
|
|
550
|
-
canonical. `ok` lives on the header dot; type-mismatch and
|
|
551
|
-
already-connected render inline next to their own field;
|
|
552
|
-
the rest are explained here. -->
|
|
553
|
-
{#if status && FOOTER_STATUSES.has(status.status)}
|
|
554
|
-
<p class="wf-interface__status wf-interface__status--{status.status}">
|
|
555
|
-
{describeInterfaceEntryStatus(status)}
|
|
556
|
-
</p>
|
|
557
|
-
{/if}
|
|
558
|
-
{#each footerIssues(section.key, entry.id, status) as issue (issue.code)}
|
|
559
|
-
<p class="wf-interface__status wf-interface__status--{issue.severity}">
|
|
560
|
-
{issue.message}
|
|
561
|
-
</p>
|
|
562
|
-
{/each}
|
|
563
|
-
|
|
564
|
-
{#if entry.meta && Object.keys(entry.meta).length > 0}
|
|
565
|
-
<details class="wf-interface__meta">
|
|
566
|
-
<summary>{m().workflowInterface.metaDisclosure}</summary>
|
|
567
|
-
<pre>{JSON.stringify(entry.meta, null, 2)}</pre>
|
|
568
|
-
</details>
|
|
569
|
-
{/if}
|
|
570
|
-
</div>
|
|
571
|
-
|
|
572
|
-
<button
|
|
573
|
-
type="button"
|
|
574
|
-
class="wf-interface__remove"
|
|
575
|
-
onclick={() => removeEntry(section.key, index)}
|
|
576
|
-
aria-label={m().workflowInterface.removeEntry({ id: entry.id })}
|
|
577
|
-
>
|
|
578
|
-
<Icon icon="heroicons:trash" />
|
|
579
|
-
</button>
|
|
580
|
-
</li>
|
|
296
|
+
<WorkflowInterfaceEntryCard
|
|
297
|
+
{entry}
|
|
298
|
+
{status}
|
|
299
|
+
{dataTypes}
|
|
300
|
+
direction={section.key}
|
|
301
|
+
candidates={bindablePorts(section.key)}
|
|
302
|
+
footerIssues={footerIssues(section.key, entry.id, status)}
|
|
303
|
+
alreadyConnected={hasIssue(
|
|
304
|
+
section.key,
|
|
305
|
+
entry.id,
|
|
306
|
+
'interface-input-already-connected'
|
|
307
|
+
)}
|
|
308
|
+
conflictingSource={conflictingSourceLabel(entry)}
|
|
309
|
+
isFirst={index === 0}
|
|
310
|
+
isLast={index === list.length - 1}
|
|
311
|
+
onPatch={(patch: Partial<WorkflowInterfaceEntry>) =>
|
|
312
|
+
patchEntry(section.key, index, patch)}
|
|
313
|
+
onMove={(delta: -1 | 1) => moveEntry(section.key, index, delta)}
|
|
314
|
+
onRemove={() => removeEntry(section.key, index)}
|
|
315
|
+
/>
|
|
581
316
|
{/each}
|
|
582
317
|
</ul>
|
|
583
318
|
{/if}
|
|
@@ -645,297 +380,4 @@
|
|
|
645
380
|
flex-direction: column;
|
|
646
381
|
gap: var(--fd-space-xs);
|
|
647
382
|
}
|
|
648
|
-
|
|
649
|
-
.wf-interface__entry {
|
|
650
|
-
display: flex;
|
|
651
|
-
align-items: flex-start;
|
|
652
|
-
gap: var(--fd-space-xs);
|
|
653
|
-
padding: var(--fd-space-xs);
|
|
654
|
-
border: 1px solid var(--fd-border-muted);
|
|
655
|
-
border-radius: var(--fd-radius-md);
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
.wf-interface__entry--error {
|
|
659
|
-
border-color: color-mix(in srgb, var(--fd-error) 40%, var(--fd-border-muted));
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
.wf-interface__reorder {
|
|
663
|
-
display: flex;
|
|
664
|
-
flex-direction: column;
|
|
665
|
-
flex-shrink: 0;
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
.wf-interface__reorder button {
|
|
669
|
-
display: flex;
|
|
670
|
-
align-items: center;
|
|
671
|
-
justify-content: center;
|
|
672
|
-
padding: 0;
|
|
673
|
-
border: none;
|
|
674
|
-
background: none;
|
|
675
|
-
color: var(--fd-muted-foreground);
|
|
676
|
-
cursor: pointer;
|
|
677
|
-
}
|
|
678
|
-
|
|
679
|
-
.wf-interface__reorder button:disabled {
|
|
680
|
-
opacity: 0.3;
|
|
681
|
-
cursor: default;
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
.wf-interface__fields {
|
|
685
|
-
flex: 1;
|
|
686
|
-
min-width: 0;
|
|
687
|
-
display: flex;
|
|
688
|
-
flex-direction: column;
|
|
689
|
-
gap: var(--fd-space-xs);
|
|
690
|
-
}
|
|
691
|
-
|
|
692
|
-
.wf-interface__row {
|
|
693
|
-
display: flex;
|
|
694
|
-
flex-wrap: wrap;
|
|
695
|
-
gap: var(--fd-space-xs);
|
|
696
|
-
}
|
|
697
|
-
|
|
698
|
-
.wf-interface__field {
|
|
699
|
-
display: flex;
|
|
700
|
-
flex-direction: column;
|
|
701
|
-
gap: 0.125rem;
|
|
702
|
-
flex: 1;
|
|
703
|
-
min-width: 6rem;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
.wf-interface__field--id {
|
|
707
|
-
flex: 0 0 8rem;
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
.wf-interface__field--wide {
|
|
711
|
-
flex: 1 1 100%;
|
|
712
|
-
}
|
|
713
|
-
|
|
714
|
-
.wf-interface__field--checkbox {
|
|
715
|
-
flex-direction: row;
|
|
716
|
-
align-items: center;
|
|
717
|
-
gap: 0.375rem;
|
|
718
|
-
flex: 0 0 auto;
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
.wf-interface__label {
|
|
722
|
-
font-size: var(--fd-text-xs);
|
|
723
|
-
color: var(--fd-muted-foreground);
|
|
724
|
-
}
|
|
725
|
-
|
|
726
|
-
.wf-interface__field input[type='text'],
|
|
727
|
-
.wf-interface__field select {
|
|
728
|
-
padding: 0.25rem 0.375rem;
|
|
729
|
-
border: 1px solid var(--fd-border);
|
|
730
|
-
border-radius: var(--fd-radius-sm);
|
|
731
|
-
background-color: var(--fd-background);
|
|
732
|
-
color: var(--fd-foreground);
|
|
733
|
-
font-size: var(--fd-text-xs);
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
/* Selects size to their longest option instead of truncating it. */
|
|
737
|
-
.wf-interface__field select {
|
|
738
|
-
min-width: 8rem;
|
|
739
|
-
width: max-content;
|
|
740
|
-
max-width: 100%;
|
|
741
|
-
}
|
|
742
|
-
|
|
743
|
-
/* Entry health at a glance; the title tooltip carries the words. */
|
|
744
|
-
.wf-interface__dot {
|
|
745
|
-
flex-shrink: 0;
|
|
746
|
-
width: 0.5rem;
|
|
747
|
-
height: 0.5rem;
|
|
748
|
-
margin-top: 0.5rem;
|
|
749
|
-
border-radius: 50%;
|
|
750
|
-
background-color: var(--fd-muted-foreground);
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
.wf-interface__dot--ok {
|
|
754
|
-
background-color: var(--fd-success);
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
.wf-interface__dot--type-mismatch,
|
|
758
|
-
.wf-interface__dot--unbound {
|
|
759
|
-
background-color: var(--fd-warning);
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
.wf-interface__dot--dangling,
|
|
763
|
-
.wf-interface__dot--hidden,
|
|
764
|
-
.wf-interface__dot--over-bound {
|
|
765
|
-
background-color: var(--fd-error);
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
/* Field-anchored feedback: one short line under the field it belongs to. */
|
|
769
|
-
.wf-interface__inline {
|
|
770
|
-
display: inline-flex;
|
|
771
|
-
align-items: baseline;
|
|
772
|
-
gap: 0.375rem;
|
|
773
|
-
font-size: var(--fd-text-xs);
|
|
774
|
-
line-height: 1.4;
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
.wf-interface__inline--warning {
|
|
778
|
-
color: var(--fd-warning);
|
|
779
|
-
}
|
|
780
|
-
|
|
781
|
-
.wf-interface__inline--error {
|
|
782
|
-
color: var(--fd-error);
|
|
783
|
-
}
|
|
784
|
-
|
|
785
|
-
.wf-interface__quickfix {
|
|
786
|
-
padding: 0 0.25rem;
|
|
787
|
-
border: 1px solid var(--fd-border);
|
|
788
|
-
border-radius: var(--fd-radius-sm);
|
|
789
|
-
background-color: var(--fd-background);
|
|
790
|
-
color: var(--fd-foreground);
|
|
791
|
-
font-size: var(--fd-text-xs);
|
|
792
|
-
cursor: pointer;
|
|
793
|
-
}
|
|
794
|
-
|
|
795
|
-
.wf-interface__quickfix:hover {
|
|
796
|
-
background-color: var(--fd-muted);
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
/* The secondary fields live behind a disclosure so a card's resting state
|
|
800
|
-
is just identity + binding. Auto-opened when a field inside needs eyes. */
|
|
801
|
-
.wf-interface__more {
|
|
802
|
-
font-size: var(--fd-text-xs);
|
|
803
|
-
}
|
|
804
|
-
|
|
805
|
-
.wf-interface__more > summary {
|
|
806
|
-
color: var(--fd-muted-foreground);
|
|
807
|
-
cursor: pointer;
|
|
808
|
-
user-select: none;
|
|
809
|
-
}
|
|
810
|
-
|
|
811
|
-
.wf-interface__more[open] > summary {
|
|
812
|
-
margin-bottom: var(--fd-space-xs);
|
|
813
|
-
}
|
|
814
|
-
|
|
815
|
-
.wf-interface__more > :global(.wf-interface__row + .wf-interface__row),
|
|
816
|
-
.wf-interface__more .wf-interface__examples {
|
|
817
|
-
margin-top: var(--fd-space-xs);
|
|
818
|
-
}
|
|
819
|
-
|
|
820
|
-
.wf-interface__pull {
|
|
821
|
-
display: inline-flex;
|
|
822
|
-
align-items: center;
|
|
823
|
-
gap: 0.25rem;
|
|
824
|
-
align-self: flex-end;
|
|
825
|
-
padding: 0.25rem 0.375rem;
|
|
826
|
-
border: 1px solid var(--fd-border);
|
|
827
|
-
border-radius: var(--fd-radius-sm);
|
|
828
|
-
background-color: var(--fd-background);
|
|
829
|
-
color: var(--fd-foreground);
|
|
830
|
-
font-size: var(--fd-text-xs);
|
|
831
|
-
white-space: nowrap;
|
|
832
|
-
cursor: pointer;
|
|
833
|
-
}
|
|
834
|
-
|
|
835
|
-
.wf-interface__pull:hover {
|
|
836
|
-
background-color: var(--fd-muted);
|
|
837
|
-
}
|
|
838
|
-
|
|
839
|
-
.wf-interface__examples {
|
|
840
|
-
display: flex;
|
|
841
|
-
flex-direction: column;
|
|
842
|
-
gap: 0.25rem;
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
.wf-interface__example-row {
|
|
846
|
-
display: flex;
|
|
847
|
-
align-items: center;
|
|
848
|
-
gap: 0.25rem;
|
|
849
|
-
}
|
|
850
|
-
|
|
851
|
-
.wf-interface__example-row input {
|
|
852
|
-
flex: 1;
|
|
853
|
-
padding: 0.25rem 0.375rem;
|
|
854
|
-
border: 1px solid var(--fd-border);
|
|
855
|
-
border-radius: var(--fd-radius-sm);
|
|
856
|
-
background-color: var(--fd-background);
|
|
857
|
-
color: var(--fd-foreground);
|
|
858
|
-
font-size: var(--fd-text-xs);
|
|
859
|
-
}
|
|
860
|
-
|
|
861
|
-
.wf-interface__example-remove {
|
|
862
|
-
display: inline-flex;
|
|
863
|
-
padding: 0.125rem;
|
|
864
|
-
border: none;
|
|
865
|
-
background: none;
|
|
866
|
-
color: var(--fd-muted-foreground);
|
|
867
|
-
cursor: pointer;
|
|
868
|
-
}
|
|
869
|
-
|
|
870
|
-
.wf-interface__example-remove:hover {
|
|
871
|
-
color: var(--fd-error);
|
|
872
|
-
}
|
|
873
|
-
|
|
874
|
-
.wf-interface__example-add {
|
|
875
|
-
display: inline-flex;
|
|
876
|
-
align-items: center;
|
|
877
|
-
gap: 0.25rem;
|
|
878
|
-
align-self: flex-start;
|
|
879
|
-
padding: 0.125rem 0.25rem;
|
|
880
|
-
border: none;
|
|
881
|
-
background: none;
|
|
882
|
-
color: var(--fd-muted-foreground);
|
|
883
|
-
font-size: var(--fd-text-xs);
|
|
884
|
-
cursor: pointer;
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
.wf-interface__example-add:hover {
|
|
888
|
-
color: var(--fd-foreground);
|
|
889
|
-
}
|
|
890
|
-
|
|
891
|
-
.wf-interface__status {
|
|
892
|
-
margin: 0;
|
|
893
|
-
font-size: var(--fd-text-xs);
|
|
894
|
-
line-height: 1.5;
|
|
895
|
-
color: var(--fd-muted-foreground);
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
.wf-interface__status--error,
|
|
899
|
-
.wf-interface__status--dangling,
|
|
900
|
-
.wf-interface__status--hidden,
|
|
901
|
-
.wf-interface__status--over-bound {
|
|
902
|
-
color: var(--fd-error);
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
.wf-interface__status--warning,
|
|
906
|
-
.wf-interface__status--unbound,
|
|
907
|
-
.wf-interface__status--type-mismatch {
|
|
908
|
-
color: var(--fd-warning);
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
.wf-interface__meta {
|
|
912
|
-
font-size: var(--fd-text-xs);
|
|
913
|
-
color: var(--fd-muted-foreground);
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
.wf-interface__meta pre {
|
|
917
|
-
margin: 0.25rem 0 0;
|
|
918
|
-
padding: 0.375rem;
|
|
919
|
-
background: var(--fd-muted);
|
|
920
|
-
border-radius: var(--fd-radius-sm);
|
|
921
|
-
overflow-x: auto;
|
|
922
|
-
}
|
|
923
|
-
|
|
924
|
-
.wf-interface__remove {
|
|
925
|
-
flex-shrink: 0;
|
|
926
|
-
display: flex;
|
|
927
|
-
align-items: center;
|
|
928
|
-
justify-content: center;
|
|
929
|
-
padding: 0.25rem;
|
|
930
|
-
border: none;
|
|
931
|
-
background: none;
|
|
932
|
-
color: var(--fd-muted-foreground);
|
|
933
|
-
cursor: pointer;
|
|
934
|
-
border-radius: var(--fd-radius-sm);
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
.wf-interface__remove:hover {
|
|
938
|
-
color: var(--fd-error);
|
|
939
|
-
background-color: color-mix(in srgb, var(--fd-error) 10%, transparent);
|
|
940
|
-
}
|
|
941
383
|
</style>
|