Skip to content

Typed Ports

A small dataflow editor on declared ports: each node lists its inputs and outputs in BlowNode.Ports, with a data type, a connection limit and whether it must be connected, and the canvas enforces them while you connect - saying why when it refuses. BlowGraphValidator reports what is still missing, on the graph and in the list under it, and the values flow through in topological order.

Number
value3
Number
value4
Add
a
b
result7
Number to text
number
text7
Display
-
text
Number
value10
bit Blow

Try it

  • Drag from an output (right) to an input (left). Number ports are blue and text ports amber; while you drag, the inputs that would take the wire turn green.
  • Drag the lone Number (10) to the Display's text input: refused, and Last connection under the canvas says the types are incompatible. Drag it to the Add node's a: refused too - that input takes one wire and has it.
  • Drag Add's result into its own b: refused, since a node cannot feed itself. Add two adders and wire each one's result into the other: refused as a cycle while Prevent cycles is ticked; untick it and the loop is allowed, but the nodes on it show no value.
  • Wire Number to text into the Display: the problem list empties and the Display shows 7. Change a number's value and everything downstream follows. Click a problem in the list to go to its node.
  • Add number, Add adder and Add multiplier add a node under the graph and take you to it. A multiplier's b is optional: unwired, it multiplies by its default, 1.
  • Tick Numbers into text inputs and a number can feed the Display directly. Untick it with such a wire in place: the wire stays, and the list reports its incompatible types.
  • From the keyboard: Tab to a node, press C to start a connection (again for its next port), Tab to another node and press Enter, or Escape to give up. Type in Find a node and press Enter to go to the best match.

How it works

  • BlowNode.Ports lists BlowPorts: Id, Type, Label, DataType, MaxConnections, MinConnections and Data. The NodeTemplate draws a BlowHandle with each port's Type and Id, and the handle picks the definition up; it renders the type as data-port-type, which the colours come from.
  • Types match by BlowConnectionRules.AreTypesCompatible: a port without a type, or "*", takes anything; otherwise the comma-separated lists must share a type, ignoring case. A mismatch is refused as IncompatibleTypes.
  • ConnectionTypeCompatibility on the canvas replaces that rule - here with one that also lets "number" flow into "text". The validator gets the same function through BlowValidationRules.Ports(typeCompatibility), so the two always agree.
  • MaxConnections = 1 on every input makes a second wire TargetFull. PreventCycles refuses a wire that closes a loop (Cycle); a wire into its own node is a SelfConnection either way.
  • MinConnections = 1 makes an input required. It is not enforced while you edit - a graph is built one wire at a time - but BlowGraphValidator reports it; the result goes to the canvas's Validation parameter, which marks the node and the port and has a screen reader read the problem with the node. The multiplier's b has MinConnections = 0 and its default in Data, a payload the canvas never reads.
  • OnConnectEnd's Rejection fills Last connection, worded by BlowAriaLabels.Default.ConnectionRejected - the sentence the canvas announces. The values come from BlowGraphAlgorithms.TopologicalSort, so each node's inputs are worked out before it; BlowGraphIndex.EdgesAt finds the wire into a port.
  • The keyboard connection uses the canvas's ConnectionKey ("c" by default). FindNodes(query) ranks nodes by their label, id, type and ports, and FocusNodeAsync(id, select, durationMs) brings a node into view and gives it focus - as each Add button does after AddNodes.
An unhandled error has occurred. Reload 🗙