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.
Press Tab to move between the nodes and edges of the diagram.
Press Enter or Space to select it, Shift with Enter to add it to the selection, the arrow keys to move the selected nodes, Delete to remove them and Escape to clear the selection. Press C to start a connection from it.
Press Enter or Space to select it, Delete to remove it and Escape to clear the selection. Press C to move its end to another node.
bit BlowTry 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.PortslistsBlowPorts:Id,Type,Label,DataType,MaxConnections,MinConnectionsandData. TheNodeTemplatedraws aBlowHandlewith each port'sTypeandId, and the handle picks the definition up; it renders the type asdata-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 asIncompatibleTypes. ConnectionTypeCompatibilityon the canvas replaces that rule - here with one that also lets"number"flow into"text". The validator gets the same function throughBlowValidationRules.Ports(typeCompatibility), so the two always agree.MaxConnections = 1on every input makes a second wireTargetFull.PreventCyclesrefuses a wire that closes a loop (Cycle); a wire into its own node is aSelfConnectioneither way.MinConnections = 1makes an input required. It is not enforced while you edit - a graph is built one wire at a time - butBlowGraphValidatorreports it; the result goes to the canvas'sValidationparameter, which marks the node and the port and has a screen reader read the problem with the node. The multiplier's b hasMinConnections = 0and its default inData, a payload the canvas never reads.OnConnectEnd'sRejectionfills Last connection, worded byBlowAriaLabels.Default.ConnectionRejected- the sentence the canvas announces. The values come fromBlowGraphAlgorithms.TopologicalSort, so each node's inputs are worked out before it;BlowGraphIndex.EdgesAtfinds 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, andFocusNodeAsync(id, select, durationMs)brings a node into view and gives it focus - as each Add button does afterAddNodes.