Skip to content

[DS 2.0] Move the node shell to the DS 2.0 geometry and derive ConnectableItem width - #123

Draft
librowski wants to merge 2 commits into
ds2-canvas-portsfrom
ds2-canvas-node-geometry
Draft

[DS 2.0] Move the node shell to the DS 2.0 geometry and derive ConnectableItem width#123
librowski wants to merge 2 commits into
ds2-canvas-portsfrom
ds2-canvas-node-geometry

Conversation

@librowski

@librowski librowski commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Two commits, reviewed together because the second is a consequence of the first.

1. Node shell geometry (@workflowbuilder/ui, patch)

node-panel.module.css: --wb-public-node-width 16.125rem (258px) -> 241px, the design master, expressed in px because it is a canvas dimension (the canvas zoom scales the transform, not the font size). --wb-public-node-padding and --wb-public-node-gap bind to the node head roles from the token export, --wb-ds-canvas-node-head-h-pad and --wb-ds-canvas-node-head-gap (8px each, confirmed by design as the master values), instead of the generic space-100 step. Rendered padding and gap are unchanged; the exported canvas-node-inset / gap-inner roles (16/12px) were confirmed as orphans and are not used. Public variable names are unchanged; consumer overrides keep working. Start, Workflow and AI templates keep their own --wb-public-node-gap: 0.

Cold-load check before the change: the initial viewport fit uses DOM-measured sizes, not the measured values stored in fixtures (fit differs between 258 and 241 exactly as the narrower bounds predict, nodes render at 241 from the first frame, transform stable afterwards). The visible two-stage fit on template selection is pre-existing (template-selector calls fitView() after the initial fit) and width-independent.

2. ConnectableItem width (@workflowbuilder/sdk, patch)

The old cap width - 6 * padding + 2 * hpad + 2 * border used an undocumented factor that only approximated the real horizontal insets (48px subtracted vs 40px real), and its + padding/border terms assumed content-box while the SDK applies a global border-box reset - at 241px the old rule allows 219px where a section offers 201px, so a long label could overflow its section by 18px.

New rule: width - 2 * (node padding + node border) - 2 * var(--wb-sdk-connectable-item-inset), where each wrapping container declares the inset it adds: NodeSection (padding + border) for Decision branches and NodeInfoWrapper (0.625rem + 1px) for AI tool rows, both giving 201px. The variable is internal (--wb-sdk-*), not a public extension point. Rationale in connectable-item-width.decision-log.md; DECISION-LOGS.md regenerated.

Verification

Build, check:built-css, ui and sdk tests, typecheck, stylelint. Visual pass in Demo (Simple Workflow, Call Flow, User Registration) and AI Studio (Support Triage, AI Debate), light and dark, fitView and 100%: every node 241px, shell padding 8px, no viewport jump after reload, no clipped titles, Decision branch rows exactly 201px with the section inset applied. Not covered: execution markers (need a run).

Known, pre-existing and out of scope: a Decision node in the DOWN layout lays its branches out in one horizontal row and min-width: max-content lets that row widen the node (621px measured with three branches). Whether the fixed 241px rule covers DOWN is a design decision tracked separately.

@librowski
librowski marked this pull request as draft September 7, 2026 12:07
@librowski
librowski force-pushed the ds2-canvas-node-geometry branch 2 times, most recently from 9c7ecef to f13bccd Compare September 7, 2026 12:36
@librowski
librowski force-pushed the ds2-canvas-node-geometry branch from f13bccd to 7fe5aad Compare September 9, 2026 16:49
…and gap tokens)

Width follows the design master as a canvas dimension in px (it must not
scale with the root font size). Padding and vertical gap bind to the node
head roles canvas-node-head-h-pad and canvas-node-head-gap from the token
export (8px each) instead of the generic space-100 step.
…sets

Replaces the undocumented 6 * padding factor with named insets (shell
padding + border, plus the wrapping container's own inset declared via
--wb-sdk-connectable-item-inset). The old content-box correction terms
are dropped because the SDK applies a global border-box reset.
@librowski
librowski force-pushed the ds2-canvas-node-geometry branch from 7fe5aad to a5f952e Compare September 9, 2026 21:38
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