@flowdrop/flowdrop 2.2.2 → 2.3.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.
- package/CHANGELOG.md +34 -1
- package/dist/components/form/FormPorts.svelte +14 -23
- package/dist/components/nodes/GatewayNode.svelte +31 -98
- package/dist/components/nodes/WorkflowNode.stories.svelte +51 -0
- package/dist/components/nodes/WorkflowNode.svelte +7 -70
- package/dist/components/ports/PortLaneChip.svelte +35 -0
- package/dist/components/ports/PortLaneChip.svelte.d.ts +11 -0
- package/dist/components/ports/PortShapeSymbol.svelte +52 -0
- package/dist/components/ports/PortShapeSymbol.svelte.d.ts +19 -0
- package/dist/components/ports/PortTypeBadge.svelte +133 -0
- package/dist/components/ports/PortTypeBadge.svelte.d.ts +43 -0
- package/dist/config/defaultPortConfig.d.ts +12 -2
- package/dist/config/defaultPortConfig.js +94 -5
- package/dist/editor/index.d.ts +3 -0
- package/dist/editor/index.js +16 -0
- package/dist/services/pipelineSignalService.js +51 -3
- package/dist/styles/base.css +56 -0
- package/dist/styles/tokens.css +2 -0
- package/dist/utils/colors.d.ts +19 -3
- package/dist/utils/colors.js +30 -20
- package/dist/utils/config.js +8 -5
- package/dist/utils/portShape.d.ts +101 -0
- package/dist/utils/portShape.js +185 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,7 +5,40 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
## [
|
|
8
|
+
## [2.3.0] - 2026-08-22
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- **A port says what SHAPE it carries, separately from which LANE it belongs to** — every port row on the canvas and in the inspector now draws a small coloured glyph for its JSON-Schema shape (`S` text, `#` number, `B` true/false, `[]` list, `{}` object, `?` unknown, `T` trigger, `()` callable) beside a quiet outlined chip holding the lane's name. Colour used to carry both facts at once and so carried neither well: `messages` and `json` are different lanes with different colours, but nothing on screen said one was a list and the other an object. Now the glyph says the shape, the colour still says the lane, and the whole treatment survives with colour stripped.
|
|
13
|
+
- **This is a visual change on every node.** The lane chip is outlined rather than filled, and it now reads the lane's served display name (`String Array`) where it used to print the raw id (`string[]`). The id moves into the chip's tooltip, which previously just repeated the text. Badging the id is why authors read `datetime` and `messages` on a canvas, and why naming pressure landed on lane ids that other repos pin — with the name in the chip, ids go back to being machine keys and a site can ship a lane called "Customer Order" whose id is `order`.
|
|
14
|
+
- **The row is laid out as two columns.** The shape glyph sits against the node's outer edge beside its handle and the lane chip against the node's inside, with the port name filling the space between and ellipsizing when it runs out. Both columns hold their x-position down the whole node, so shape is scannable vertically — which is what earns it the row's one saturated mark. The cost is that the chip now sits further from the name it describes.
|
|
15
|
+
- **Where the shape comes from.** The server's `NodePort` carries no JSON Schema type — `schema?` has been declared "for template autocomplete" since 2.0 and no producer has ever populated it — so the shape is derived from the lane by a static table. That ships against every backend, including older fddo and third-party servers implementing only the port-config endpoint. It cannot tell `integer` from `number` (the server already collapses both onto lane `number`, so nothing is lost) and it answers `?` for a site-defined lane, which is honest rather than wrong.
|
|
16
|
+
- **The media lanes `file`, `image`, `audio`, and `video` draw `?`.** Asked directly, the reference backend has no answer: they are served vocabulary with no declaring port, and its schema-type→lane resolver cannot emit them. "A URI string" was a plausible guess with nothing behind it.
|
|
17
|
+
- **A gateway's branch rows get the same treatment, in the same order** — a branch reads `(Trigger) Name [T]` against the node's right edge like every other output row, so the shape glyphs line up as one column beside their handles. The gateway draws its rows through `PortTypeBadge` instead of composing them itself, which is the only reason the order can no longer disagree between the two; the badge grew a `label`, an `active` flag and a leading slot for it, because a branch is an authored control-flow path with no port id and no port name. `active` is a flag rather than a class name on purpose: Svelte's scoped CSS does not reach into a child component, so a caller passing its own class would hand over one that never applies.
|
|
18
|
+
- **The lane id is now mouse-only.** It lives in the chip's `title`, which is not reachable by keyboard or screen reader; the served name in the chip text is. The glyph itself is `aria-hidden`: it restates the lane beside it, so announcing it would add an utterance per port and no information.
|
|
19
|
+
- New exports from `@flowdrop/flowdrop/editor`: `portShape`, `portGlyph`, `SHAPE_GLYPH`, the `PortShape` type, and the `PortTypeBadge` component. New public CSS classes `.flowdrop-port-symbol`, `.flowdrop-badge--outline`, and `.flowdrop-badge--sm`. The symbol chip takes only its colour inline, as `--fd-port-symbol-color`; everything else about it — including the tint ratios and the `--fd-port-skin-color` override — is in the stylesheet, so a consumer can restyle it without `!important`.
|
|
20
|
+
- `portShape(checker, port)` is the seam for improving the source: a release where the server declares a shape per lane, or populates `NodePort.schema`, changes that one function and no call site. It takes the port-compatibility checker — the same source colour reads — so a lane resolves to a shape exactly as it resolves to a colour: aliases followed, casing ignored, served vocabulary first. A lane with a colour and no shape would draw a coloured `?`; the two tables are now asserted total over each other.
|
|
21
|
+
|
|
22
|
+
- **`pipelineSignalService` has tests** — it had none. Every refusal it returns drives a different user-visible explanation, and the mapping was entirely unasserted. Both classification paths are now pinned, along with accepted-is-not-applied, the unsupported-backend case, and the synthesized-message fallback.
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- **On library defaults, no port could connect to anything** — `createDefaultConfig()` shipped `ports` as `{dataTypes: [], compatibilityRules: [], defaultDataType: 'mixed'}`. That reads as a permissive default and is the exact opposite of one: `buildCompatibilityMap()` seeds itself from `dataTypes`, so an empty list means every port refuses every edge, and the `mixed` default named a lane the list never declared. It points at `DEFAULT_PORT_CONFIG` now — the shipped defaults are the default.
|
|
27
|
+
|
|
28
|
+
- **`DEFAULT_PORT_CONFIG` was missing three lanes** — `any`, `mixed` and `messages`. Absent is not "unstyled": a lane the list never declares is compatible with nothing, not even another port of its own lane, so a `messages` port on library defaults would not wire up at all. `mixed` is now the sink and carries rules in both directions — it is worn by outputs as much as inputs, so letting things in is only half the job, and an alias of `trigger` would not have covered the other half because aliases copy the outgoing set only. `defaultDataType` becomes `mixed`: a port with no declared lane constrains nothing. The ids now match the backend's `PortDataType` enum exactly, and nothing enforces that they keep matching — until the port config is generated, a lane added server-side has to be added here in the same change.
|
|
29
|
+
|
|
30
|
+
- **The `messages` lane had no colour at all** — its config named `var(--fd-node-fuchsia)`, a token referenced in exactly one place in the library and defined in none. Every use resolved to nothing: the chip tint, the shape symbol and the port handle all fell out as invalid at computed-value time, and the `--fd-node-slate` fallback could not catch it (the property _was_ set — to a string naming an undefined property). The token is now defined in both themes, `#d946ef` light and `#e879f9` dark, following the ramp's own construction. It also stopped being survivable: deriving the fallback colour map from the shipped config (below) copies the broken value into the pre-load path, where `messages` previously fell through to a valid slate.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- **The sink `mixed` is slate, not teal** — a port that constrains nothing has nothing to claim, and slate is already the colour an unrecognised lane falls back to. On teal it sat in the media family beside `video`, sharing a hue with the one thing it is definitionally not. Its glyph was already `?`; now the colour agrees. **The served port config decides this at runtime** — a backend still serving teal for `mixed` still renders teal, so fddo moves with it.
|
|
35
|
+
|
|
36
|
+
- **The fallback data-type colour map is derived from the shipped port config, not hand-maintained** — `DEFAULT_DATA_TYPE_COLORS` was a third, independent colour list, and it had drifted from `DEFAULT_PORT_CONFIG`: `mixed` was orange against the config's teal, and the typed-array lanes (`string[]`, `json[]`, …) and `messages` had no entry at all, so they painted slate. It only applies before the backend's port config loads — which is exactly when the first render happens, so it was seen. The legacy spellings that were never lane ids (`text`, `list`, `integer`, `float`, `object`, `document`, `picture`, `sound`, `movie`, `branch`) survive as an explicit alias layer.
|
|
37
|
+
|
|
38
|
+
- **Pipeline signal refusals are classified by the backend's `error_code`, not by its prose**
|
|
39
|
+
- All three of the reference backend's signal refusals answer `409`, so `classifyRefusal()` told them apart by matching substrings of the human `error` string — `terminal`, `already pending`, `no active pause`. That made the server's wording load-bearing across a repository boundary: a reword that dropped a substring silently reclassified the refusal, the operator was shown the wrong explanation, and nothing errored on either side. The backend now publishes a stable `error_code` beside `error` (`PIPELINE_TERMINAL`, `INWARD_SIGNAL_ALREADY_PENDING`, `NO_ACTIVE_PAUSE`), and it is preferred whenever present.
|
|
40
|
+
- **The substring path stays as the fallback**, because this client talks to backends it does not ship with and one predating the codes still answers a 409 with nothing but prose. It is removed when the oldest supported backend emits codes, not when the newest does.
|
|
41
|
+
- An `error_code` this client does not recognise now yields `rejected` rather than falling through to the substring guess: an unmapped code still proves the backend classified the refusal deliberately, so guessing from its wording would override a considered answer.
|
|
9
42
|
|
|
10
43
|
## [2.2.2] - 2026-08-18
|
|
11
44
|
|
|
@@ -26,10 +26,11 @@
|
|
|
26
26
|
} from '../../types/index.js';
|
|
27
27
|
import { dynamicPortToNodePort } from '../../types/index.js';
|
|
28
28
|
import { getInstance } from '../../stores/getInstance.svelte.js';
|
|
29
|
-
import { getPortColorToken, getPortBackgroundColorForPort } from '../../utils/colors.js';
|
|
30
29
|
import { byDefaultOrder, isPortExposed, orderPortsFor } from '../../utils/portUtils.js';
|
|
31
30
|
import { buildHandleId } from '../../utils/handleIds.js';
|
|
32
31
|
import { interfaceBoundTooltip } from '../../utils/workflowInterface.js';
|
|
32
|
+
import PortShapeSymbol from '../ports/PortShapeSymbol.svelte';
|
|
33
|
+
import PortLaneChip from '../ports/PortLaneChip.svelte';
|
|
33
34
|
import FormToggle from './FormToggle.svelte';
|
|
34
35
|
import Icon from '@iconify/svelte';
|
|
35
36
|
|
|
@@ -165,21 +166,9 @@
|
|
|
165
166
|
<Icon icon="heroicons:chevron-down" />
|
|
166
167
|
</button>
|
|
167
168
|
</div>
|
|
169
|
+
<PortShapeSymbol {checker} {port} />
|
|
168
170
|
<span class="fd-ports__name" title={port.name}>{port.name}</span>
|
|
169
|
-
<
|
|
170
|
-
class="fd-ports__badge"
|
|
171
|
-
title={port.dataType}
|
|
172
|
-
style="background-color:{getPortBackgroundColorForPort(
|
|
173
|
-
checker,
|
|
174
|
-
port,
|
|
175
|
-
15
|
|
176
|
-
)};color:{getPortColorToken(
|
|
177
|
-
checker,
|
|
178
|
-
port
|
|
179
|
-
)};border:1px solid {getPortBackgroundColorForPort(checker, port, 30)}"
|
|
180
|
-
>
|
|
181
|
-
{port.dataType}
|
|
182
|
-
</span>
|
|
171
|
+
<PortLaneChip {checker} {port} />
|
|
183
172
|
{#if boundEntry}
|
|
184
173
|
<span
|
|
185
174
|
class="fd-ports__bound"
|
|
@@ -246,9 +235,11 @@
|
|
|
246
235
|
}
|
|
247
236
|
|
|
248
237
|
/* The switch alone carries the state now that its label is screen-reader
|
|
249
|
-
only, so dim the row to keep "hidden" legible at a glance.
|
|
238
|
+
only, so dim the row to keep "hidden" legible at a glance. The chips are
|
|
239
|
+
child components, so their halves of the rule have to be :global. */
|
|
250
240
|
.fd-ports__item--hidden .fd-ports__name,
|
|
251
|
-
.fd-ports__item--hidden .
|
|
241
|
+
.fd-ports__item--hidden :global(.flowdrop-port-symbol),
|
|
242
|
+
.fd-ports__item--hidden :global(.flowdrop-badge) {
|
|
252
243
|
opacity: 0.55;
|
|
253
244
|
}
|
|
254
245
|
|
|
@@ -285,14 +276,14 @@
|
|
|
285
276
|
white-space: nowrap;
|
|
286
277
|
}
|
|
287
278
|
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
max-width: 10ch;
|
|
279
|
+
/* Keep a long lane name from pushing the toggle off the row — "String Array"
|
|
280
|
+
is already 12ch, and a site may name a lane anything. The chip is a child
|
|
281
|
+
component, so the rule has to be :global. */
|
|
282
|
+
.fd-ports__item :global(.flowdrop-badge) {
|
|
283
|
+
max-width: 12ch;
|
|
294
284
|
overflow: hidden;
|
|
295
285
|
text-overflow: ellipsis;
|
|
286
|
+
white-space: nowrap;
|
|
296
287
|
}
|
|
297
288
|
|
|
298
289
|
/* Interface-bound marker: same --fd-ring token as the canvas handle ring
|
|
@@ -16,11 +16,8 @@
|
|
|
16
16
|
import Icon from '@iconify/svelte';
|
|
17
17
|
import NodeConfigButton from './NodeConfigButton.svelte';
|
|
18
18
|
import { getNodeIcon } from '../../utils/icons.js';
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
getCategoryColorToken,
|
|
22
|
-
getPortBackgroundColor
|
|
23
|
-
} from '../../utils/colors.js';
|
|
19
|
+
import { getDataTypeColorToken, getCategoryColorToken } from '../../utils/colors.js';
|
|
20
|
+
import PortTypeBadge from '../ports/PortTypeBadge.svelte';
|
|
24
21
|
import { getInstance } from '../../stores/getInstance.svelte.js';
|
|
25
22
|
import { orderPortsFor, isPortVisible } from '../../utils/portUtils.js';
|
|
26
23
|
import { buildHandleId } from '../../utils/handleIds.js';
|
|
@@ -57,6 +54,17 @@
|
|
|
57
54
|
* Falls back to the original label if not set.
|
|
58
55
|
* This allows users to customize the node title per-instance via config.
|
|
59
56
|
*/
|
|
57
|
+
/**
|
|
58
|
+
* What the shape/lane chips need to draw a branch row.
|
|
59
|
+
*
|
|
60
|
+
* A branch is an authored control-flow path, not a `NodePort`: it has no port
|
|
61
|
+
* id, and it always carries the trigger lane. So this is one frozen literal
|
|
62
|
+
* for every branch on every gateway, rather than a fabricated port per row —
|
|
63
|
+
* and with no id, a branch named `error` cannot trip the reserved-error
|
|
64
|
+
* colour exception the way a real `error` output does.
|
|
65
|
+
*/
|
|
66
|
+
const BRANCH_LANE = { type: 'output', dataType: 'trigger' } as const;
|
|
67
|
+
|
|
60
68
|
const displayTitle = $derived((props.data.config?.instanceTitle as string) || props.data.label);
|
|
61
69
|
|
|
62
70
|
/**
|
|
@@ -175,27 +183,7 @@
|
|
|
175
183
|
|
|
176
184
|
<!-- Port Info: padding lives here so handle position is simple -->
|
|
177
185
|
<div class="flowdrop-workflow-node__port-content flowdrop-flex--1 flowdrop-min-w--0">
|
|
178
|
-
<
|
|
179
|
-
<span class="flowdrop-text--xs flowdrop-font--medium">{port.name}</span>
|
|
180
|
-
<span
|
|
181
|
-
class="flowdrop-badge flowdrop-badge--sm"
|
|
182
|
-
style="background-color: {getPortBackgroundColor(
|
|
183
|
-
checker,
|
|
184
|
-
port.dataType,
|
|
185
|
-
15
|
|
186
|
-
)}; color: {getDataTypeColorToken(
|
|
187
|
-
checker,
|
|
188
|
-
port.dataType
|
|
189
|
-
)}; border: 1px solid {getPortBackgroundColor(checker, port.dataType, 30)};"
|
|
190
|
-
>
|
|
191
|
-
{port.dataType}
|
|
192
|
-
</span>
|
|
193
|
-
{#if port.required}
|
|
194
|
-
<span class="flowdrop-badge flowdrop-badge--error flowdrop-badge--sm"
|
|
195
|
-
>Required</span
|
|
196
|
-
>
|
|
197
|
-
{/if}
|
|
198
|
-
</div>
|
|
186
|
+
<PortTypeBadge {checker} {port} showRequired />
|
|
199
187
|
{#if port.description}
|
|
200
188
|
<p class="flowdrop-text--xs flowdrop-text--gray flowdrop-truncate">
|
|
201
189
|
{port.description}
|
|
@@ -219,34 +207,21 @@
|
|
|
219
207
|
<div
|
|
220
208
|
class="flowdrop-workflow-node__port-content flowdrop-flex--1 flowdrop-min-w--0 flowdrop-text--right"
|
|
221
209
|
>
|
|
222
|
-
<
|
|
223
|
-
|
|
210
|
+
<PortTypeBadge
|
|
211
|
+
{checker}
|
|
212
|
+
port={BRANCH_LANE}
|
|
213
|
+
align="right"
|
|
214
|
+
label={branch.label || branch.name}
|
|
215
|
+
active={isActive}
|
|
224
216
|
>
|
|
225
|
-
{#
|
|
226
|
-
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
>
|
|
234
|
-
{branch.label || branch.name}
|
|
235
|
-
</span>
|
|
236
|
-
<span
|
|
237
|
-
class="flowdrop-badge flowdrop-badge--sm"
|
|
238
|
-
style="background-color: {getPortBackgroundColor(
|
|
239
|
-
checker,
|
|
240
|
-
'trigger',
|
|
241
|
-
15
|
|
242
|
-
)}; color: {getDataTypeColorToken(
|
|
243
|
-
checker,
|
|
244
|
-
'trigger'
|
|
245
|
-
)}; border: 1px solid {getPortBackgroundColor(checker, 'trigger', 30)};"
|
|
246
|
-
>
|
|
247
|
-
trigger
|
|
248
|
-
</span>
|
|
249
|
-
</div>
|
|
217
|
+
{#snippet leading()}
|
|
218
|
+
{#if isActive}
|
|
219
|
+
<span style="color: {getDataTypeColorToken(checker, 'trigger')};">
|
|
220
|
+
<Icon icon="mdi:check-circle" />
|
|
221
|
+
</span>
|
|
222
|
+
{/if}
|
|
223
|
+
{/snippet}
|
|
224
|
+
</PortTypeBadge>
|
|
250
225
|
</div>
|
|
251
226
|
|
|
252
227
|
<!-- Output Handle: one grid row (20px) from the top so it aligns with the label, at node edge -->
|
|
@@ -449,36 +424,15 @@
|
|
|
449
424
|
}
|
|
450
425
|
|
|
451
426
|
/* Each line in a port occupies one 20px grid row: a label-only port
|
|
452
|
-
centers its single row, a label + description fills both.
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
align-items: center;
|
|
456
|
-
}
|
|
427
|
+
centers its single row, a label + description fills both. The label row
|
|
428
|
+
is <PortTypeBadge>, which owns that row height itself — scoped CSS does
|
|
429
|
+
not reach into a child component. */
|
|
457
430
|
|
|
458
431
|
.flowdrop-workflow-node__port-content > p {
|
|
459
432
|
min-height: var(--fd-node-port-row-height);
|
|
460
433
|
line-height: var(--fd-node-port-row-height);
|
|
461
434
|
}
|
|
462
435
|
|
|
463
|
-
.flowdrop-badge {
|
|
464
|
-
padding: 2px 4px;
|
|
465
|
-
border-radius: var(--fd-radius-sm);
|
|
466
|
-
font-size: 10px;
|
|
467
|
-
font-weight: 500;
|
|
468
|
-
text-transform: uppercase;
|
|
469
|
-
letter-spacing: 0.05em;
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
.flowdrop-badge--error {
|
|
473
|
-
background-color: var(--fd-error);
|
|
474
|
-
color: var(--fd-error-foreground);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
.flowdrop-badge--sm {
|
|
478
|
-
font-size: 10px;
|
|
479
|
-
padding: 2px 4px;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
436
|
.workflow-node__no-branches {
|
|
483
437
|
display: flex;
|
|
484
438
|
align-items: center;
|
|
@@ -502,26 +456,10 @@
|
|
|
502
456
|
}
|
|
503
457
|
|
|
504
458
|
/* Utility classes */
|
|
505
|
-
.flowdrop-flex {
|
|
506
|
-
display: flex;
|
|
507
|
-
}
|
|
508
|
-
|
|
509
459
|
.flowdrop-flex--1 {
|
|
510
460
|
flex: 1;
|
|
511
461
|
}
|
|
512
462
|
|
|
513
|
-
.flowdrop-gap--2 {
|
|
514
|
-
gap: var(--fd-space-xs);
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
.flowdrop-items--center {
|
|
518
|
-
align-items: center;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
.flowdrop-justify--end {
|
|
522
|
-
justify-content: flex-end;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
463
|
.flowdrop-min-w--0 {
|
|
526
464
|
min-width: 0;
|
|
527
465
|
}
|
|
@@ -540,11 +478,6 @@
|
|
|
540
478
|
color: var(--fd-muted-foreground);
|
|
541
479
|
}
|
|
542
480
|
|
|
543
|
-
.flowdrop-text--active {
|
|
544
|
-
color: var(--fd-success);
|
|
545
|
-
font-weight: 600;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
481
|
.flowdrop-font--medium {
|
|
549
482
|
font-weight: 500;
|
|
550
483
|
}
|
|
@@ -135,3 +135,54 @@
|
|
|
135
135
|
})}
|
|
136
136
|
/>
|
|
137
137
|
</Story>
|
|
138
|
+
|
|
139
|
+
<!--
|
|
140
|
+
Density is where the shape symbols earn their keep: on a two-port node any
|
|
141
|
+
treatment reads fine, and the specimen sheet only separated the variants once
|
|
142
|
+
a node carried ten. This story is the regression guard for that — there is no
|
|
143
|
+
visual-regression harness in this repo, so eyeballing this story IS the
|
|
144
|
+
coverage.
|
|
145
|
+
|
|
146
|
+
It spans every shape in the vocabulary: S # B [] {} ? T (), including the
|
|
147
|
+
reserved `error` output (red, `{}`), a `messages` port (teal lane, `[]`
|
|
148
|
+
glyph — the two facts the treatment exists to separate) and a site-defined
|
|
149
|
+
lane that honestly resolves to `?`.
|
|
150
|
+
-->
|
|
151
|
+
<Story name="Dense (every shape)">
|
|
152
|
+
<NodeDecorator
|
|
153
|
+
data={createSampleNodeData({
|
|
154
|
+
label: 'Everything Node',
|
|
155
|
+
metadata: {
|
|
156
|
+
id: 'everything',
|
|
157
|
+
name: 'Everything Node',
|
|
158
|
+
description: 'One port per shape in the vocabulary',
|
|
159
|
+
category: 'processing',
|
|
160
|
+
version: '1.0.0',
|
|
161
|
+
type: 'workflow',
|
|
162
|
+
icon: 'mdi:shape-outline',
|
|
163
|
+
inputs: [
|
|
164
|
+
{ id: 'prompt', name: 'Prompt', type: 'input', dataType: 'string', required: true },
|
|
165
|
+
{ id: 'temperature', name: 'Temperature', type: 'input', dataType: 'number' },
|
|
166
|
+
{ id: 'stream', name: 'Stream', type: 'input', dataType: 'boolean' },
|
|
167
|
+
{ id: 'tags', name: 'Tags', type: 'input', dataType: 'string[]' },
|
|
168
|
+
{ id: 'history', name: 'Chat History', type: 'input', dataType: 'messages' },
|
|
169
|
+
{ id: 'options', name: 'Options', type: 'input', dataType: 'json' },
|
|
170
|
+
{ id: 'payload', name: 'Payload', type: 'input', dataType: 'mixed' },
|
|
171
|
+
{ id: 'order', name: 'Order', type: 'input', dataType: 'order' },
|
|
172
|
+
{ id: 'attachment', name: 'Attachment', type: 'input', dataType: 'image' },
|
|
173
|
+
{ id: 'trigger', name: 'Trigger', type: 'input', dataType: 'trigger' },
|
|
174
|
+
{ id: 'tools', name: 'Tools', type: 'input', dataType: 'tool' }
|
|
175
|
+
],
|
|
176
|
+
outputs: [
|
|
177
|
+
{ id: 'text', name: 'Text', type: 'output', dataType: 'string' },
|
|
178
|
+
{ id: 'count', name: 'Count', type: 'output', dataType: 'number' },
|
|
179
|
+
{ id: 'matched', name: 'Matched', type: 'output', dataType: 'boolean' },
|
|
180
|
+
{ id: 'items', name: 'Items', type: 'output', dataType: 'json[]' },
|
|
181
|
+
{ id: 'result', name: 'Result', type: 'output', dataType: 'json' },
|
|
182
|
+
{ id: 'done', name: 'Done', type: 'output', dataType: 'trigger' },
|
|
183
|
+
{ id: 'error', name: 'Error', type: 'output', dataType: 'json' }
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
})}
|
|
187
|
+
/>
|
|
188
|
+
</Story>
|
|
@@ -18,11 +18,8 @@
|
|
|
18
18
|
import Icon from '@iconify/svelte';
|
|
19
19
|
import { getNodeIcon } from '../../utils/icons.js';
|
|
20
20
|
import NodeConfigButton from './NodeConfigButton.svelte';
|
|
21
|
-
import {
|
|
22
|
-
|
|
23
|
-
getPortColorToken,
|
|
24
|
-
getPortBackgroundColorForPort
|
|
25
|
-
} from '../../utils/colors.js';
|
|
21
|
+
import { getCategoryColorToken, getPortColorToken } from '../../utils/colors.js';
|
|
22
|
+
import PortTypeBadge from '../ports/PortTypeBadge.svelte';
|
|
26
23
|
import { getInstance } from '../../stores/getInstance.svelte.js';
|
|
27
24
|
import { orderPortsFor, isPortVisible } from '../../utils/portUtils.js';
|
|
28
25
|
import { buildHandleId } from '../../utils/handleIds.js';
|
|
@@ -217,27 +214,7 @@
|
|
|
217
214
|
|
|
218
215
|
<!-- Port Info: padding lives here so handle position is simple -->
|
|
219
216
|
<div class="flowdrop-workflow-node__port-content flowdrop-flex--1 flowdrop-min-w--0">
|
|
220
|
-
<
|
|
221
|
-
<span class="flowdrop-text--xs flowdrop-font--medium">{port.name}</span>
|
|
222
|
-
<span
|
|
223
|
-
class="flowdrop-badge flowdrop-badge--sm"
|
|
224
|
-
style="background-color: {getPortBackgroundColorForPort(
|
|
225
|
-
checker,
|
|
226
|
-
port,
|
|
227
|
-
15
|
|
228
|
-
)}; color: {getPortColorToken(
|
|
229
|
-
checker,
|
|
230
|
-
port
|
|
231
|
-
)}; border: 1px solid {getPortBackgroundColorForPort(checker, port, 30)};"
|
|
232
|
-
>
|
|
233
|
-
{port.dataType}
|
|
234
|
-
</span>
|
|
235
|
-
{#if port.required}
|
|
236
|
-
<span class="flowdrop-badge flowdrop-badge--error flowdrop-badge--sm"
|
|
237
|
-
>Required</span
|
|
238
|
-
>
|
|
239
|
-
{/if}
|
|
240
|
-
</div>
|
|
217
|
+
<PortTypeBadge {checker} {port} showRequired />
|
|
241
218
|
{#if port.description}
|
|
242
219
|
<p class="flowdrop-text--xs flowdrop-text--gray flowdrop-truncate">
|
|
243
220
|
{port.description}
|
|
@@ -261,22 +238,7 @@
|
|
|
261
238
|
<div
|
|
262
239
|
class="flowdrop-workflow-node__port-content flowdrop-flex--1 flowdrop-min-w--0 flowdrop-text--right"
|
|
263
240
|
>
|
|
264
|
-
<
|
|
265
|
-
<span class="flowdrop-text--xs flowdrop-font--medium">{port.name}</span>
|
|
266
|
-
<span
|
|
267
|
-
class="flowdrop-badge flowdrop-badge--sm"
|
|
268
|
-
style="background-color: {getPortBackgroundColorForPort(
|
|
269
|
-
checker,
|
|
270
|
-
port,
|
|
271
|
-
15
|
|
272
|
-
)}; color: {getPortColorToken(
|
|
273
|
-
checker,
|
|
274
|
-
port
|
|
275
|
-
)}; border: 1px solid {getPortBackgroundColorForPort(checker, port, 30)};"
|
|
276
|
-
>
|
|
277
|
-
{port.dataType}
|
|
278
|
-
</span>
|
|
279
|
-
</div>
|
|
241
|
+
<PortTypeBadge {checker} {port} align="right" />
|
|
280
242
|
{#if port.description}
|
|
281
243
|
<p class="flowdrop-text--xs flowdrop-text--gray flowdrop-truncate">
|
|
282
244
|
{port.description}
|
|
@@ -488,36 +450,15 @@
|
|
|
488
450
|
}
|
|
489
451
|
|
|
490
452
|
/* Each line in a port occupies one 20px grid row: a label-only port
|
|
491
|
-
centers its single row, a label + description fills both.
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
align-items: center;
|
|
495
|
-
}
|
|
453
|
+
centers its single row, a label + description fills both. The label row
|
|
454
|
+
is <PortTypeBadge>, which owns that row height itself — scoped CSS does
|
|
455
|
+
not reach into a child component. */
|
|
496
456
|
|
|
497
457
|
.flowdrop-workflow-node__port-content > p {
|
|
498
458
|
min-height: var(--fd-node-port-row-height);
|
|
499
459
|
line-height: var(--fd-node-port-row-height);
|
|
500
460
|
}
|
|
501
461
|
|
|
502
|
-
.flowdrop-badge {
|
|
503
|
-
padding: 2px 4px;
|
|
504
|
-
border-radius: var(--fd-radius-sm);
|
|
505
|
-
font-size: 10px;
|
|
506
|
-
font-weight: 500;
|
|
507
|
-
text-transform: uppercase;
|
|
508
|
-
letter-spacing: 0.05em;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
.flowdrop-badge--error {
|
|
512
|
-
background-color: var(--fd-error);
|
|
513
|
-
color: var(--fd-error-foreground);
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
.flowdrop-badge--sm {
|
|
517
|
-
font-size: 10px;
|
|
518
|
-
padding: 2px 4px;
|
|
519
|
-
}
|
|
520
|
-
|
|
521
462
|
/* Handle overrides: hover scale (base 20px/12px from base.css) */
|
|
522
463
|
:global(.flowdrop-workflow-node__handle:hover) {
|
|
523
464
|
transform: translateY(-50%) scale(1.2);
|
|
@@ -540,10 +481,6 @@
|
|
|
540
481
|
align-items: center;
|
|
541
482
|
}
|
|
542
483
|
|
|
543
|
-
.flowdrop-justify--end {
|
|
544
|
-
justify-content: flex-end;
|
|
545
|
-
}
|
|
546
|
-
|
|
547
484
|
.flowdrop-min-w--0 {
|
|
548
485
|
min-width: 0;
|
|
549
486
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Port lane chip — the lane's human name, quietly.
|
|
3
|
+
|
|
4
|
+
Outlined, never filled (the row's one saturated element is the shape symbol
|
|
5
|
+
beside it). The chip shows the lane's served **name** and keeps the raw id in
|
|
6
|
+
the tooltip.
|
|
7
|
+
|
|
8
|
+
That way round on purpose. Badging the id is why authors read `string[]`,
|
|
9
|
+
`datetime` and `messages` on the canvas, and why naming pressure lands on lane
|
|
10
|
+
ids — "should it be `message[]`?" is really "the badge reads badly", and the
|
|
11
|
+
badge has had a `name` field available and unused all along. With the name in
|
|
12
|
+
the chip, ids go back to being machine keys and a site can ship a lane called
|
|
13
|
+
"Customer Order" whose id is `order`. The id stays one hover away, because it
|
|
14
|
+
is what an author needs when writing `x-data-type` or debugging a refused
|
|
15
|
+
wire.
|
|
16
|
+
-->
|
|
17
|
+
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
import type { PortCompatibilityChecker } from '../../utils/connections.js';
|
|
20
|
+
|
|
21
|
+
interface Props {
|
|
22
|
+
checker: PortCompatibilityChecker;
|
|
23
|
+
/** Structural, for the same reason as PortShapeSymbol's. */
|
|
24
|
+
port: { dataType: string };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
let { checker, port }: Props = $props();
|
|
28
|
+
|
|
29
|
+
/** The served display name for the lane, falling back to the id itself. */
|
|
30
|
+
const laneName = $derived(checker.getDataTypeConfig(port.dataType)?.name ?? port.dataType);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<span class="flowdrop-badge flowdrop-badge--sm flowdrop-badge--outline" title={port.dataType}>
|
|
34
|
+
{laneName}
|
|
35
|
+
</span>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PortCompatibilityChecker } from '../../utils/connections.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
checker: PortCompatibilityChecker;
|
|
4
|
+
/** Structural, for the same reason as PortShapeSymbol's. */
|
|
5
|
+
port: {
|
|
6
|
+
dataType: string;
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
declare const PortLaneChip: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type PortLaneChip = ReturnType<typeof PortLaneChip>;
|
|
11
|
+
export default PortLaneChip;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
Port shape symbol — the one saturated mark on a port row.
|
|
3
|
+
|
|
4
|
+
A glyph in a small chip saying what SHAPE the port carries (`S` text, `[]`
|
|
5
|
+
list, `{}` object, …), tinted with the port's lane colour. The lane's own id
|
|
6
|
+
rides beside it in an outlined chip (PortLaneChip), so shape and lane stop
|
|
7
|
+
competing for the single colour channel. See utils/portShape.ts for where the
|
|
8
|
+
shape comes from.
|
|
9
|
+
|
|
10
|
+
Only the lane colour is set inline, as one custom property; the chip's tints
|
|
11
|
+
are computed from it in the stylesheet (styles/base.css), so a consumer can
|
|
12
|
+
restyle `.flowdrop-port-symbol` without fighting an inline declaration. The
|
|
13
|
+
`--fd-port-skin-color` override wins there too, exactly as it does on handles.
|
|
14
|
+
|
|
15
|
+
The glyph is `aria-hidden`: it is derived from the lane id in the chip beside
|
|
16
|
+
it, which screen readers already announce. Saying "list" before every port
|
|
17
|
+
name adds an utterance per port and no information.
|
|
18
|
+
-->
|
|
19
|
+
|
|
20
|
+
<script lang="ts">
|
|
21
|
+
import type { PortCompatibilityChecker } from '../../utils/connections.js';
|
|
22
|
+
import { getPortColorToken } from '../../utils/colors.js';
|
|
23
|
+
import { portGlyph, portShapeLabel } from '../../utils/portShape.js';
|
|
24
|
+
|
|
25
|
+
interface Props {
|
|
26
|
+
/** The instance's port-compatibility checker — the source of lane colour. */
|
|
27
|
+
checker: PortCompatibilityChecker;
|
|
28
|
+
/**
|
|
29
|
+
* The port to draw. Structural rather than a `NodePort`, because a gateway
|
|
30
|
+
* branch is not a port and should not have to pretend it has an id to be
|
|
31
|
+
* rendered — see GatewayNode. An absent id simply never matches the
|
|
32
|
+
* reserved `error` output.
|
|
33
|
+
*/
|
|
34
|
+
port: { id?: string; type?: string; dataType: string };
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let { checker, port }: Props = $props();
|
|
38
|
+
|
|
39
|
+
/** Lane colour, or the reserved error output's red. */
|
|
40
|
+
const color = $derived(getPortColorToken(checker, port));
|
|
41
|
+
const glyph = $derived(portGlyph(checker, port));
|
|
42
|
+
const label = $derived(portShapeLabel(checker, port));
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
<span
|
|
46
|
+
class="flowdrop-port-symbol"
|
|
47
|
+
aria-hidden="true"
|
|
48
|
+
title={label}
|
|
49
|
+
style="--fd-port-symbol-color: {color}"
|
|
50
|
+
>
|
|
51
|
+
{glyph}
|
|
52
|
+
</span>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { PortCompatibilityChecker } from '../../utils/connections.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** The instance's port-compatibility checker — the source of lane colour. */
|
|
4
|
+
checker: PortCompatibilityChecker;
|
|
5
|
+
/**
|
|
6
|
+
* The port to draw. Structural rather than a `NodePort`, because a gateway
|
|
7
|
+
* branch is not a port and should not have to pretend it has an id to be
|
|
8
|
+
* rendered — see GatewayNode. An absent id simply never matches the
|
|
9
|
+
* reserved `error` output.
|
|
10
|
+
*/
|
|
11
|
+
port: {
|
|
12
|
+
id?: string;
|
|
13
|
+
type?: string;
|
|
14
|
+
dataType: string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
declare const PortShapeSymbol: import("svelte").Component<Props, {}, "">;
|
|
18
|
+
type PortShapeSymbol = ReturnType<typeof PortShapeSymbol>;
|
|
19
|
+
export default PortShapeSymbol;
|