Wires the 6 founder-locked canvas views agreed 2026-05-11:
• Lane layout — `meta.layout: 'lane-vertical' | 'lane-horizontal'`
on a `contains`-parent renders the group as a rounded-rect
swim-lane; children pack inside (L→R horizontal, T→B vertical).
Lanes nest: region (vertical) → phase (horizontal) → HR bubbles.
Falls back to organic d3-force when no group declares a layout
hint, so single-region provisions look unchanged.
• Child-count badge `[N]` on every foldable parent — recursive
descendant count through `contains` edges, surfaced via
PositionedNode.descendantCount. Renders independent of fold
state per the founder-locked View 4 ASCII (region keeps `[43]`
even when expanded to phases only).
• Hover dim — onMouseEnter/Leave on a node dims non-neighbor
nodes + non-incident edges to 35% opacity. Selection / host /
neighbor rings keep full opacity per spec precedence.
• Right-click → adapter actions menu — new `actions` +
`onNodeAction` props on FlowCanvasProps. Renders the supplied
NodeAction[] (filtered by per-action `enabled` predicate) in a
NodeActionsMenu (click-outside + Esc dismissal, mirrors
ProfileMenu's canonical seam).
• `triggeredBy` cross-flow badge — when FlowInstance.triggeredBy
is non-empty, a top-left banner lists the parent flows with a
`[↗ open flow]` button → onNavigateFlow callback.
• Cross-flow edges — when a Relationship's `toFlowId` references a
flow not in the current canvas, the source node renders a
"→ flow" tag that calls onNavigateFlow.
FlowPage wires onNodeAction to POST /api/v1/flows/{id}/nodes/{nodeId}
/actions/{actionId} and onNavigateFlow to the router. Default action
list (Retry/Suspend/View logs) supplied by FlowPage; adapters can
override.
Canonical seam citations (per ARCHITECT-FIRST):
• core/src/layout.ts (Agent #1) — pure layout function. Extended
with LaneDescriptor[] + descendantCount, cycle-safe lane-depth
walks reusing the existing visited-set pattern. Lane geometry
stays in canvas (the layout is pure topology).
• widgets/auth/ProfileMenu.tsx — canonical click-outside + ESC
dismissal pattern. NodeActionsMenu mirrors this verbatim so we
stay consistent without a new radix/headless-ui dependency.
Tests: 25 core (was 20, +5 for lanes + descendantCount) + 22 canvas
(was 9, +13 for lane layout, badge math, hover dim, action menu,
triggeredBy banner, cross-flow tag). FlowPage tests still 8/8 green.
No vite/next builds (Rule 7). No kubectl writes (Rule 11). Lane
geometry has zero domain knowledge — the canvas never reads "phase"
or "region" as words; everything is `meta.layout` + `meta.isGroup`
+ `contains` edges driven by the adapter.
Co-authored-by: e3mrah <1234567+e3mrah@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| src | ||
| test | ||
| package.json | ||
| README.md | ||
| tsconfig.json | ||
| vitest.config.ts | ||
@openova/flow-canvas
React SVG canvas for OpenovaFlow. Props-driven, zero OpenOva imports.
Props
<FlowCanvas
flow={flowInstance}
nodes={flowNodes}
relationships={relationships}
folded={foldedSet}
selectedNodeId={null}
hostNodeId={null}
palette={statusPalette} // adapter-supplied
families={familyDescriptors}
regions={regionDescriptors}
perNodeHints={hintMap}
onNodeOpen={(id) => /* open log pane */}
onNodeNavigate={(id) => /* deep link */}
onFoldToggle={(groupId) => /* toggle */}
onBackgroundClick={() => /* dismiss selection */}
renderDetail={(id) => <YourLogPane id={id} />}
/>
Theming via CSS variables
Import the default theme once at app root:
@import '@openova/flow-canvas/theme.css';
All canvas styling is driven by --flow-* CSS variables scoped under
.flow-canvas-host. Override individual tokens in your own stylesheet
to reskin without forking. The theme ships dark + light (light is opted
in via [data-theme="light"]).
Edge visual style table (founder-locked)
| Relationship type | Stroke | Annotation | Counted for depth? |
|---|---|---|---|
finish-to-start |
solid | normal arrow | yes |
start-to-start |
solid | "SS" tag near origin | yes |
finish-to-finish |
solid | "FF" tag near terminus | yes |
start-to-finish |
dashed | "SF" tag at midpoint | yes |
triggers |
solid | ⚡ at midpoint | yes |
contains |
NOT rendered as an edge — used for grouping only | n/a | n/a |
any with condition === 'on-failure' |
red dashed, low-opacity until pred is failed | normal arrow | NO |
Embedding example
import { FlowCanvas } from '@openova/flow-canvas'
import '@openova/flow-canvas/theme.css'
function MyPage() {
return (
<div style={{ height: '80vh' }}>
<FlowCanvas
flow={{ id: 'my-flow', status: 'running', startedAt: Date.now() }}
nodes={[/* FlowNode[] */]}
relationships={[/* Relationship[] */]}
folded={new Set()}
/>
</div>
)
}
Testing
npm test # vitest --pool=threads --maxWorkers=2 --no-isolate
npm run typecheck # tsc --noEmit -p tsconfig.json
NEVER npm run build / playwright install / playwright test.