Skip to content

Lines in a node's middle, between its inputs' names and its outputs' (meta.body) - #290

Merged
endrix merged 3 commits into
mainfrom
feat/node-body-lines
Dec 4, 2026
Merged

endrix merged 3 commits into
mainfrom
feat/node-body-lines

Conversation

@endrix

@endrix endrix commented Dec 4, 2026

Copy link
Copy Markdown
Owner

What

A producer can now give a node meta.body, lines drawn in its middle:

  • the lines form a column centred between the names of its inputs and of its outputs (where the flow runs down, between the inputs' row and the outputs' row);
  • each line starts at the column's left edge, in the fixed-width font of a node's lines;
  • the column takes the place of the family's mark.

The node grows to fit:

  • it is wider between its names by the width of the column;
  • it is taller when the column has more lines than the node has rows.

A long line wraps onto the next after a space or a comma instead of being cut, up to NODE_BODY_MAX_LINES (12). When there is more, the last line ends in …. Wrapping reads a value only as far as it is drawn, so a value of a million characters costs nothing.

On the wire:

  • the server says where the column is (wf:nodeBody: lines, top, left, right, width), and the client draws it there (node-body.ts);
  • a line's kind is the product's to colour (node-body-<kind>).

Why

mlir-viewer will put an unnamed operation's attributes there (predicate ult, value dense<…>), between its operands and its results. The gray band at the bottom will then hold only the operation's name for a named node. That mlir-viewer PR follows.

Checks

  • New tests:
    • server, test/node-body.test.ts: placement in both directions, growth, wrapping, the cap, a huge value;
    • client, test/node-body.test.ts: reading the argument, the column's placement, the view and the CSS.
  • Suites: diagram-server 1219 passed, diagram-client 1304 passed.
  • typecheck (5/5, including the client in strict mode) and check:neutrality (5/5) pass.
  • Rendered headless through mlir-viewer, in both directions and with a wrapped dense constant.

https://claude.ai/code/session_011UYzzShRuBLgefHUrAbqya

…puts'

A producer gives a node `meta.body`: lines drawn in a column centred
between the names of its inputs and of its outputs (under the inputs'
and over the outputs' where the flow runs down), in the fixed-width font
of a node's lines, taking the place of the family's mark. The node is
wider between its names by the column, and taller when the column has
more lines than the node has rows. A long line is broken onto the next
rather than cut, after a space or a comma, up to NODE_BODY_MAX_LINES,
the last ending in an ellipsis; a huge value is read no further than
drawn. The server says where the column is (`wf:nodeBody`), the client
draws it there (node-body.ts).

Claude-Session: https://claude.ai/code/session_011UYzzShRuBLgefHUrAbqya
…its left

A value broken onto several lines reads as one when its lines start at
the same place; the column, as wide as its longest line, is centred
between the names. Changelog entry for meta.body.

Claude-Session: https://claude.ai/code/session_011UYzzShRuBLgefHUrAbqya
- A node with middle lines keeps the least height a node has: one line
  no longer makes it shorter than the same node without.
- A line's kind that is no class name is dropped on the client too, for
  the middle lines and the bottom lines (a product's own model is not
  checked by the server): it no longer throws while drawing.
- A product colours a kind with text.node-body-text.node-body-<kind>,
  which outranks the stock rule; said in the stylesheet and changelog.
- A long line is read up to its bound, never through a character the
  bound would split.
- Tested: blank padding after twelve lines adds no ellipsis.

Claude-Session: https://claude.ai/code/session_011UYzzShRuBLgefHUrAbqya
@endrix

endrix commented Dec 4, 2026

Copy link
Copy Markdown
Owner Author

Review (/code-review medium) addressed in the latest commit:

  • minHeight floor: kept. A node with one middle line is as tall as the same node without one.
  • Unchecked kind on the client: dropped when it is no class name, for node-body and for node-line alike (the second was pre-existing).
  • CSS specificity: the stylesheet and CHANGELOG now name the selector a product must write, text.node-body-text.node-body-<kind>.
  • Surrogate split at the read bound: no longer possible.
  • Ellipsis after blank padding: not reachable. A blank or non-string item is skipped before the cap is checked, and a test now covers it.
  • Text elements at every zoom: kept as the platform does for every text. Export and the measuring render need them in the DOM, and zoom-detail hides them with display: none. mlir-viewer still budgets attribute rows (4, or 1 above 1000 nodes), so a typical node draws far fewer than 12 lines.

https://claude.ai/code/session_011UYzzShRuBLgefHUrAbqya

@endrix
endrix merged commit d40775b into main Dec 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant