@flowdrop/flowdrop 2.2.2 → 2.4.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 CHANGED
@@ -5,7 +5,63 @@ 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
- ## [Unreleased]
8
+ ## [2.4.0] - 2026-08-23
9
+
10
+ ### Added
11
+
12
+ - **A port's shape now comes from the server when the server declares one.** fddo 2.x serves a JSON Schema per lane (`PortDataTypeConfig.schema`, from its port-shape registry), and `portShape()` reads that schema's `type` ahead of the client's static lane table. The table stays as the fallback — it is what answers on an older fddo, on a third-party server implementing only the port-config endpoint, and on the library's offline defaults, which carry no schemas on purpose. A site's own shape now shapes its own lane: declare `Order` as `type: object` and its ports draw `{}` without this library having heard of it.
13
+
14
+ - **Template variables drill into the fields a port's lane declares.** A template author could reach an `error` port and nothing inside it. A port with no schema of its own now resolves one from its lane, so the four fields of an error payload are offered as `error.message`, `error.code`, `error.node_id` and `error.retryable` — declared once on the lane, restated nowhere. `NodePort.schema` stays empty and stays the per-port refinement slot: what wants it is the narrower schema a run observed for this port on this node, which is per-instance information and could never travel on a payload cached per node type.
15
+ - **This needs a backend that serves it.** fddo serves lane schemas on `2.x`; anything older serves none, and autocomplete then stops at the port exactly as it did before. One caveat worth knowing: a site with a stored `port_config` entry for a lane replaces the composed entry outright, `schema` included — so a site that once customised the `error` lane sees no field list until it re-adds one. That is the port-config overlay's existing whole-entry merge semantics, not a new rule.
16
+
17
+ ### Changed
18
+
19
+ - **`getVariableSchema()`'s trailing arguments became one context object.** It had grown to eight positionals, the last three optional and one of them a service, so a call site read `..., workflowId, authProvider, fd.portCompatibility)` and could not be read without counting commas. It is now `(endpointConfig, node, nodes, edges, config, {workflowId, authProvider, portCompatibility})`. **Not a public break** — `variableService` is not exported from any package entry point; the change is listed because its docblock's examples were wrong in the released source (they omitted the first argument entirely) and are now correct.
20
+
21
+ ### Deprecated
22
+
23
+ - **`portGlyph()`** — use `SHAPE_GLYPH[portShape(checker, port)]`, which is what it does. Both it and the map shipped in 2.3.0's public surface and only one of them needed to. It keeps working until 3.0.0.
24
+
25
+ ### Fixed
26
+
27
+ - **The reserved `error` port drew `?` on every node.** fddo declares the `error` lane as `type: object` and has since its shape registry shipped; the client's lane table has no `error` entry, so the shape fell through to `unknown` while the lane chip beside it was correctly coloured red and — after the change above — while autocomplete was offering the payload's four fields. It draws `{}` now. Same class of disagreement for any served lane the table does not name.
28
+
29
+ - **Six responsive utility classes had never matched anything.** `.flowdrop-sm\:flex`, `.flowdrop-md\:hidden` and their siblings escaped the colon twice, so the selectors were never valid; nothing in the library or the demo apps used them, and this repo lints no CSS, so nothing was ever going to say so. Removed rather than repaired — two display utilities across three breakpoints is not a responsive system, and a consumer needing one can write it against their own breakpoints.
30
+
31
+ ## [2.3.0] - 2026-08-22
32
+
33
+ ### Added
34
+
35
+ - **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.
36
+ - **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`.
37
+ - **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.
38
+ - **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.
39
+ - **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.
40
+ - **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.
41
+ - **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.
42
+ - 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`.
43
+ - `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.
44
+
45
+ - **`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.
46
+
47
+ ### Fixed
48
+
49
+ - **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.
50
+
51
+ - **`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.
52
+
53
+ - **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.
54
+
55
+ ### Changed
56
+
57
+ - **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.
58
+
59
+ - **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.
60
+
61
+ - **Pipeline signal refusals are classified by the backend's `error_code`, not by its prose**
62
+ - 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.
63
+ - **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.
64
+ - 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
65
 
10
66
  ## [2.2.2] - 2026-08-18
11
67
 
@@ -577,7 +577,10 @@
577
577
  // Compute the variable schema with optional port filtering and port name prefixing
578
578
  const computedSchema = getAvailableVariables(node, workflowNodes, workflowEdges, {
579
579
  targetPortIds: variablesConfig?.ports,
580
- includePortName: variablesConfig?.includePortName
580
+ includePortName: variablesConfig?.includePortName,
581
+ // Lets a variable drill into the fields its port's LANE declares —
582
+ // `error.message` rather than only `error`.
583
+ portCompatibility: fd.portCompatibility
581
584
  });
582
585
 
583
586
  // Merge computed schema with any pre-defined schema
@@ -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
- <span
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 .fd-ports__badge {
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
- .fd-ports__badge {
289
- font-size: var(--fd-text-2xs, 0.625rem);
290
- padding: 0 var(--fd-space-1, 0.25rem);
291
- border-radius: var(--fd-radius-sm, 4px);
292
- white-space: nowrap;
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
@@ -149,8 +149,7 @@
149
149
  nodes,
150
150
  edges,
151
151
  variables,
152
- workflowId,
153
- authProvider
152
+ { workflowId, authProvider, portCompatibility: fd.portCompatibility }
154
153
  );
155
154
  } catch (error) {
156
155
  logger.error('Failed to load variable schema:', error);
@@ -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
- getDataTypeColorToken,
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
- <div class="flowdrop-flex flowdrop-gap--2">
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
- <div
223
- class="flowdrop-flex flowdrop-gap--2 flowdrop-justify--end flowdrop-items--center"
210
+ <PortTypeBadge
211
+ {checker}
212
+ port={BRANCH_LANE}
213
+ align="right"
214
+ label={branch.label || branch.name}
215
+ active={isActive}
224
216
  >
225
- {#if isActive}
226
- <span style="color: {getDataTypeColorToken(checker, 'trigger')};">
227
- <Icon icon="mdi:check-circle" />
228
- </span>
229
- {/if}
230
- <span
231
- class="flowdrop-text--xs flowdrop-font--medium"
232
- class:flowdrop-text--active={isActive}
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
- .flowdrop-workflow-node__port-content > div {
454
- min-height: var(--fd-node-port-row-height);
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
- getCategoryColorToken,
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
- <div class="flowdrop-flex flowdrop-gap--2">
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
- <div class="flowdrop-flex flowdrop-gap--2 flowdrop-justify--end">
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
- .flowdrop-workflow-node__port-content > div {
493
- min-height: var(--fd-node-port-row-height);
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,54 @@
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 { portShape, SHAPE_GLYPH, SHAPE_LABEL } 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
+ /** Resolved once — the glyph and its tooltip are two readings of one shape. */
42
+ const shape = $derived(portShape(checker, port));
43
+ const glyph = $derived(SHAPE_GLYPH[shape]);
44
+ const label = $derived(SHAPE_LABEL[shape]);
45
+ </script>
46
+
47
+ <span
48
+ class="flowdrop-port-symbol"
49
+ aria-hidden="true"
50
+ title={label}
51
+ style="--fd-port-symbol-color: {color}"
52
+ >
53
+ {glyph}
54
+ </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;