@aquera/nile-flow
v0.0.9
Published
A node-based flow / graph editor for the Nile Design System
Keywords
Readme
@aquera/nile-flow
A node-based flow / graph editor for the Nile Design System — framework-agnostic
Lit web components with feature parity to Foblex Flow,
able to embed live Nile charts (@aquera/nile-visualization) inside node bodies.
Installation
npm i @aquera/nile-flowlit is the only hard dependency. Everything else is an optional peer, pulled in
only by the feature that needs it:
| Peer | Needed for |
| --- | --- |
| dagre | @aquera/nile-flow/layout-dagre |
| elkjs | @aquera/nile-flow/layout-elk |
| @aquera/nile-elements | Nile components slotted inside node bodies |
| @aquera/nile-visualization | live charts slotted inside node bodies |
Charts additionally need highcharts, which is @aquera/nile-visualization's
own peer — nile-flow neither declares nor installs it. Its provider resolves a
bundled highcharts or falls back to a window.Highcharts loaded by script tag,
which is how demo/charts.html does it.
The layout adapters import() their engine lazily, so a bundle that never calls
layoutDagre / layoutElk never pulls dagre or elkjs in.
Quick start
<nile-flow snap-radius="28" style="height: 600px">
<nile-flow-background slot="background" pattern="dots"></nile-flow-background>
<nile-flow-minimap slot="minimap"></nile-flow-minimap>
<nile-flow-node node-id="a" .position=${{ x: 60, y: 80 }}>
Any content — including <nile-chart fit .config=${cfg}>
<nile-flow-connector connector-id="a-out" type="source"
connectable-side="right" style="position:absolute; right:-6px; top:20px">
</nile-flow-connector>
</nile-flow-node>
<nile-flow-connection source="a-out" target="b-in" type="bezier" marker-end="arrow">
<span>optional label</span>
</nile-flow-connection>
</nile-flow>The app owns the graph model. The flow renders your nile-flow-node /
nile-flow-connection children and emits granular events; it never
adds/removes your data. Listen and update your model:
| Event | When |
| --- | --- |
| nile-create-connection | a drag from a connector dropped (targetConnectorId null = empty drop) |
| nile-reassign-connection | a connection endpoint dragged to a new connector / empty space |
| nile-move-nodes | node drag committed ({moves: [{id, position}]}) |
| nile-delete-selected | Delete/Backspace pressed with a selection |
| nile-create-node | a nile-flow-external-item dropped onto the canvas |
| nile-drop-to-group | nodes dropped onto a group node |
| nile-selection-change, nile-canvas-change, nile-drag-started/ended, nile-flow-loaded | state notifications |
| nile-node-intersections | node dropped across connections (emit-on-node-intersect) |
| nile-connection-waypoints-changed | a waypoint drag committed |
Elements
<nile-flow>— viewport: pan/zoom (position,scale,min/max-scale, wheel/pinch/dblclick), control schemes (control-scheme="default|scroll-pan|drag-select",triggersoverrides), snap grid (h-cell-size/v-cell-size,snap-while-dragging), connection snap (snap-radius), magnetic alignment lines (magnetic-threshold),virtualizedculling,pan-on-static-nodes(a drag that starts on a node that can't be dragged pans the canvas; a tap still selects), keyboard a11y (arrows move, Ctrl+A, Delete, +/−/0 zoom,C= keyboard connect mode). Methods:fitToScreen(),resetScaleAndCenter(),centerNode(id),zoomIn/Out(),setZoom(),select()/selectAll()/clearSelection()/getSelection(),getState(),redraw(),reset(),documentToFlow()/flowToDocument(),resolvedConfig(). All of the above can also be set as one typed object via.config(FlowConfig, grouped astransform/zoom/pan/snap) instead of a property at a time; a config and the attributes compose, andresolvedConfig()reads the effective settings — including the current view — back out.<nile-flow-node>—node-id,position,size,rotate,parent-id,group,dragging-disabled,selection-disabled,connect-on-node. Slot anything. Handles are plain attributes on any descendant:nile-flow-drag-handle,nile-flow-resize-handle="se|e|s|…",nile-flow-rotate-handle.<nile-flow-connector>—connector-id,type="source|target|source-target|outlet",multiple,disabled,category,.canBeConnectedTo(ids/categories array or predicate),connectable-side,self-connectable.<nile-flow-connection>—source/target(connector ids),type="straight|bezier|segment|adaptive-curve|custom"(+.customPath),behavior="fixed|fixed-center|floating",offset,radius,marker-start/end="arrow|circle|<custom id>",gradient-start/end,.waypoints,reassign-disabled,reassignable-start. Children = label at path midpoint.<nile-flow-background>—pattern="dots|grid|custom",size,color,.patternSvg.<nile-flow-minimap>— draggable viewport rect,min-size.<nile-flow-connection-preview>— configures the drag-to-connect preview edge.<nile-flow-external-item>— palette item;.datapayload,slot="preview"ghost.<nile-org-chart>— org chart composed from the primitives above: flat{id,name,title?,avatar?,parentId?}array in, tidy tree out (managerIdis a deprecated alias).orientation="vertical|horizontal"(top-down, or left-to-right for deep/narrow orgs — swaps the layout axes, the connector edges and the collapse chip),layout="tree|compact|grouped",renderer="canvas|dom"(canvas by default),virtualize,collapsible, andexpand-depth— how many tiers start open (0roots alone,1roots plus their direct reports, unset = the whole tree), with everything deeper behind a+chip. Collapsing/expanding animates by default — cards glide to their new places (360ms emphasized ease, both renderers) with the toggled card held still, an opening subtree unfolds from its manager and a collapsing one implodes into it and fades out;animation-disabled/animation-durationtune it, and it is paint-only so every position read stays final. Methods:fit(),collapseAll(),expandAll(),expandToDepth(n),collapse(id)/expand(id)/toggle(id)(closing a team also closes every team inside it, so reopening shows one level),zoomIn()/zoomOut()/zoomTo(scale). A drag anywhere (empty space, a line or a card) pans; a click selects.layout="grouped"packs each manager's reports level by level (a row, a single report, or a two-column IC stack on a spine), and the view follows the team you open.card-variant="ng"switches to the NG card: an accent band, avatar,name/title/captionlines, a kebab, connection dots and a detached count chip, in seven colour types (purple,blue-light,pink,green,fuchsia,gray-blue,indigo) chosen byperson.type→.colorTypeFor(person, depth)→ depth.selected-idreflects the selected card.classicstays the default card.controlsopts into an overlay toolbar:zoom(− / % / +),fit,orientation,png,pdf, orall/none. Every setting can also be passed as one typed object via.config(OrgChartConfig) instead of a property at a time — a config and the attributes compose, andresolvedConfig()reads the effective settings back out.avataron a person is a photo URL and renders in both renderers — DOM as an<img>, canvas clipped into the avatar circle (initials show until the image decodes). Events:nile-org-node-click,nile-org-collapse-change—{id, collapsed}per chip toggle,{id: null, collapsedIds}once for a bulk change —nile-org-select({person}, or{person: null}when cleared),nile-org-menu({person, anchor}on a kebab click), andnile-org-fit({scale, pan, trigger, fitsFully, animated, id?}after every fit). Fit to screen is tunable —fit-padding,fit-min-zoom,fit-max-zoom,auto-fit-disabled— andmin-zoom/max-zoombound every zoom;fit()andzoomTo()return Promises.fitToPerson(id, { team, reveal, select })moves the view to one person or their team.avatar-hiddendrops the avatar from every card and export. Seedemo/org-canvas.html.<nile-layered-graph>— a layered node-link view for hierarchies where a node can have more than one parent, e.g. user → group → role → entitlement. Pass a flat{ id, label, parentIds?, layer?, flagged? }array and a built-in, dependency-free layout places it. Hover traces a node's ancestors and descendants, a click selects, and multi-parent nodes show a×Nbadge.direction="LR|TB",edgestyle="bezier|orthogonal". Full API inDOCUMENTATION.md.
Layout adapters (optional peers)
import { layoutDagre } from '@aquera/nile-flow/layout-dagre'; // needs `dagre`
import { layoutElk } from '@aquera/nile-flow/layout-elk'; // needs `elkjs`
const positions = await layoutDagre({ nodes, edges }, { direction: 'LR', nodeGap: 40, layerGap: 90 });
positions.forEach((pos, id) => myModel.node(id).position = pos); // app appliesUndo / redo
import { FlowHistory } from '@aquera/nile-flow';
const history = new FlowHistory(flow, state => applyToMyModel(state));
history.undo(); history.redo();Charts inside nodes
Charts are plain slotted content — nile-flow has zero chart code. Pan/zoom is a
single CSS transform, so Highcharts never reflows while zooming; node resize
reflows charts only on drop. See demo/charts.html.
Notes & divergences from Foblex
- Connection hit widths are screen-constant (
vector-effect: non-scaling-stroke), and so are stroke widths down to 0.5 zoom. Below that the stroke tapers with the zoom, bottoming out at 40% weight, so a zoomed-out overview reads as hairlines instead of the edges out-inking the nodes.--nile-flow-connection-widthstill sets the base weight the taper multiplies; hit targets never taper. - Custom markers register via the
.markersproperty (shadow-DOM SVG defs can't reference document-level ids). - Node-drop-on-connection intersections approximate each path by its two half-chords through the midpoint.
- Chart interactivity (tooltips) is supported at rest; pointer events into nodes are muted during node drags/pans by design.
Develop
yarn build # tsc → dist
yarn start # dev server on demo/
yarn test # web-test-runner (build first)Release Notes
In this section, you can find the updates for each release of nile-flow. It's a
good practice to maintain detailed release notes to help users and developers
understand what changes have been made from one version to another and how these
changes might affect their projects.
Version 0.0.9 (November 11, 2026)
- Nile Access Graph: New
<nile-access-graph>element (import@aquera/nile-flow/nile-access-graph) — one subject's access as a hub-and-spoke graph: the subject in the centre, one hub per category with its count, and its items fanned out. Flat{ subject, relations, categories, items }data in; dependency-free layout on an inner<nile-flow renderer="canvas">(UIF-1411) - Nile Access Graph:
orientation—auto(default; picks the best fit for the element),horizontal,verticalorboth(four sides) (UIF-1411) - Nile Access Graph: Per-relation colour (
tone) and line style (lineStyle: solid / dashed / dotted); interactivelegend(hover to highlight, click to show / hide) (UIF-1411) - Nile Access Graph: Item
status(pending / requestable / revoked),iconper category or item, "+K more" overflow,viapath tracing, search, selection,controlsand keyboard navigation;nile-access-*events. See DOCUMENTATION.md for the full API (UIF-1411) - Nile Flow: Added optional
dash,lineCapandcustomPathtoFlowConnectionInput; off unless set, existing connections are unchanged (UIF-1411)
Version 0.0.8 (October 21, 2026)
- Nile Layered Graph: New
<nile-layered-graph>element (import@aquera/nile-flow/nile-layered-graph) — a layered node-link view for hierarchies where a node can have more than one parent, e.g. user → group → role → entitlement access paths. Flat{ id, label, sublabel?, parentIds?, type?, layer?, flagged?, flagLabel? }data in; an in-house, dependency-free layout (cycle removal, longest-path layering, dummy nodes for long edges, barycentre crossing reduction) painted on an inner<nile-flow renderer="canvas">(UIF-1386) - Nile Layered Graph: Hover or focus traces every ancestor and descendant and dims the rest to 14%; a click selects (
selectedidreflects) and keeps the trace. Multi-parent nodes show a×Nbadge;flaggednodes get an error band, border andflagLabelcaption;traceflaggedtraces every flagged node's upstream at rest (UIF-1386) - Nile Layered Graph:
direction(LR/TB),edgestyle(bezier/orthogonal),layergap,siblinggap,nodewidth,nodeheight,.layers(header captions, named layers),.typeHues/.colorTypeFor, opt-incontrols(zoom,fit,all,none) andlegend, and.config(LayeredGraphConfig). Methodsfit(),zoomIn()/zoomOut()/zoomTo(),centerNode(),select(),positions(),layersOf(),resolvedConfig(); eventsnile-layered-node-click,nile-layered-select,nile-layered-hover,nile-layered-layout; full keyboard navigation (UIF-1386) - Known limits tracked as follow-ups: best order is only checked once per crossing-reduction round (UIF-1387), cards are centred per column rather than aligned with their neighbours (UIF-1388),
demo/layered-graph.htmlis not in the package yet (UIF-1389), and changingdirectiondoes not re-fit the view (UIF-1390). Full guide:kb/reference/nile-layered-graph-0.0.8-changes.md
Version 0.0.7 (October 12, 2026)
- Nile Org Chart: Fit to screen is now configurable —
fit-padding(default 48),fit-min-zoomandfit-max-zoom(the zoom a fit may settle at; afit-min-zoomof 0.4 or more also stops the jump to 75% on large orgs), orconfig.fit: { padding, minZoom, maxZoom }(UIF-1378) - Nile Org Chart: Added
min-zoom/max-zoom(config.zoom: { min, max }), forwarded to the inner<nile-flow>— they bound wheel, pinch, toolbar,zoomTo()and every fit (UIF-1378) - Nile Org Chart: Added
auto-fit-disabled(config.fit.auto: false) to stop the automatic fits on first load and ondata/layout/orientation/expand-depthchanges; Fit,fit()and expand / collapse all still fit (UIF-1378) - Nile Org Chart: Added the
nile-org-fitevent —{ scale, pan, trigger, fitsFully, animated, id? }after every fit, withtriggerone ofinitial,data,layout,orientation,expand-depth,bulk,api,focus(UIF-1378) - Nile Org Chart:
fit(),zoomTo(),zoomIn()andzoomOut()now return a Promise that resolves once the view settles, soawait chart.fit(); chart.zoomTo(1)runs in order (UIF-1378) - Nile Org Chart: Added
fitToPerson(id, options?)— moves the view to one person's card, or withteam: trueto them and their visible team;revealopens collapsed teams above them first,selectalso selects the card,focusCardmoves keyboard focus (canvas renderer only) (UIF-1378) - Nile Org Chart: Added
avatar-hidden(config.avatarHidden) — hides the avatar on NG and classic cards, in both renderers and in PNG / PDF export; the text moves left into its place (UIF-1378)
Version 0.0.6 (October 7, 2026)
- Nile Org Chart: Reworked the open / close motion ("grow the tree") — opening a team draws its connectors stem → bus → drops, then that level's cards rise into place, and any open teams beneath grow one level at a time; closing soft-fades the leaving subtree in place. The rest of the chart never moves during a fold or a grow: it glides to its new layout after a close and before an open, and the view only moves to frame a team that would land off-screen — after it has grown (UIF-1377)
- Nile Org Chart:
animation-durationnow covers the whole open / close, however many levels it spans (default 400ms; was 360ms per transition). Connectors and collapse chips follow their cards while they glide, so lines stay square (UIF-1377) - Nile Org Chart: Closing a team now closes only that team — the teams inside it keep their own open / closed state, so reopening brings them back (reverses the 0.0.5 behaviour). A closed manager's chip keeps its open face until the fade ends;
aria-expandedupdates at once (UIF-1377) - Nile Org Chart:
layout="grouped"— every team now starts the same distance below its manager, so cards at the same depth line up across branches; a row's bus meets the manager's stem in a sharp T instead of overlapping curves (UIF-1377) - Nile Org Chart: Added toolbar controls
expand(Expand all) andcollapse(close tocollapse-depth, default 1; alsoconfig.collapse.collapseDepth), both included incontrols="all"(UIF-1377) - Nile Org Chart: Toolbar icons are now NG glyphs (
ng-minus,ng-plus,ng-fullscreen,ng-maximize,ng-minimize,ng-image,ng-file-down) rendered as<nile-glyph>by tag — register@aquera/nile-glyphin the app; without it the buttons show text labels. The orientation toggle keeps its own icons (UIF-1377) - Nile Flow: Added a per-corner connection
radius(one value, or one per corner in path order),updateConnectionsById(), and an animator-owneddrawnlength for drawing a connection on (UIF-1377) - Nile Flow: Fixed DOM-mode connection fades — the opacity now reaches the drawn SVG line (UIF-1377)
Version 0.0.5 (October 1, 2026)
- Nile Org Chart: Breaking —
renderernow defaults tocanvas(wasdom). Setrenderer="dom"to keep the old backend - Nile Org Chart: Added
parentIdon a person;managerIdstill works but is deprecated - Nile Org Chart: Added
layout="grouped"— each manager's reports pack level by level as a row, a single report, or a two-column IC stack on a spine, and the view follows the team you open on the same animation clock as the cards - Nile Org Chart: Added
cardVariant="ng", the NG card (288 × 82) — accent band, avatar,name/title/captionlines, kebab, connection dots and a detached count chip with a hover state, in seven colour types set byperson.type,colorTypeFor(person, depth)or depth.classicstays the default and is unchanged - Nile Org Chart: Added selection —
selectedId(reflected),nile-org-select({person}/{person: null}); re-clicking the selected card, clicking empty space or pressing Escape clears it. Addednile-org-menufor kebab clicks - Nile Org Chart: Added toolbar controls
zoom(− / live % / +) andorientation(horizontal / vertical), plus publiczoomIn()/zoomOut()/zoomTo(scale) - Nile Org Chart: A drag anywhere now pans, including from a card; a click still selects
- Nile Org Chart: Closing a team now closes every team inside it, so reopening shows only the next level.
expandAll()/collapseAll()are unchanged - Nile Org Chart: Smoother open / close motion — 360ms emphasized ease (was 220ms ease-out)
- Nile Flow: Added
pan-on-static-nodes— a drag that starts on a node that can't be dragged pans the canvas
Version 0.0.4 (September 28, 2026)
- Nile Flow, Nile Org Chart: Fixed dark mode — undefined
--ng-*token names now map to the ones NxtGen ships, and the--ng-*token takes precedence over the legacy--nile-colors-*layer, so both renderers follow the theme (UIF-1367) - Nile Flow, Nile Org Chart: Removed colour fallbacks, so an unresolved token fails visibly instead of staying light (UIF-1367)
- Nile Org Chart: Tokenized the canvas avatar / badge text and marquee / minimap washes; DOM and canvas avatars now match (UIF-1367)
Version 0.0.3 (September 16, 2026)
- Nile Org Chart: Added
controls, an opt-in overlay toolbar (fit,png,pdf,all,none) - Nile Org Chart: Added
toPngBlob()/toPdfBlob()anddownloadPng()/downloadPdf()— exports the full layout, renderer-independent, with a dependency-free vector PDF - Nile Org Chart: Added
nile-org-export/nile-org-export-errorevents, toolbar CSS parts and--nile-org-chart-toolbar-inset - Nile Org Chart: Fixed connector lines disappearing on collapse / expand
Version 0.0.2 (September 10, 2026)
- Nile Org Chart: Added
orientation(vertical/horizontal) —horizontaladvances tiers rightward and spreads siblings down a column, moving the connectors to the left / right card edges and the collapse chip to the right edge.layout="compact"folds all-leaf groups into an indented row rather than a column, andfit()pins the first tier to the left. Gap attributes stay physical, soh-gap/v-gapswap roles with the orientation (UIF-1351) - Nile Org Chart: Added a collapse / expand transition, on by default — cards glide to their new positions over
animation-duration(220ms, ease-out) with the toggled card held still, an opening subtree unfolding from its manager and a collapsing one imploding into it and fading out. Paint-only, so every position read stays final; skipped past ~400 moving cards and underprefers-reduced-motion. Newanimation-disabled/animation-duration(UIF-1351) - Nile Org Chart: Added
config(OrgChartConfig) andresolvedConfig()— every setting as one typed object, composing with the existing attributes rather than replacing them (UIF-1351) - Nile Flow: Added
config(FlowConfig) andresolvedConfig()— all twenty-six settings as one typed object, grouped astransform/zoom/pan/snap, composing with the existing attributes (UIF-1351) - Nile Flow: Added hover cursor affordances —
grabover the pannable canvas (crosshairin the schemes where a left-drag rubber-bands,defaultwhenpan-disabled),moveover a draggable node, and ahoverResolverhook so a canvas-mode host can claim the cursor for controls it paints itself.control-scheme,pan-disabledanddragging-disabledare now reflected (UIF-1351) - Nile Flow: Fixed double-click zoom in canvas mode — the "empty canvas only" guard walked the event path for a node element, which canvas mode has none of, so a double-click on any painted card or control zoomed. It now consults the backend hit test, matching DOM mode (UIF-1351)
- Nile Org Chart: Fixed the viewport being re-framed on a
rendererchange — switching backend repaints the same layout at the same coordinates, so it no longer discards the user's pan and zoom (UIF-1351)
Version 0.0.1 (September 08, 2026)
- Initial release of the
@aquera/nile-flowpackage (build tooling, dev server, and tests mirroring@aquera/nile-elements). (UIF-1349) - Nile Flow: Added the viewport component — pan / zoom (
position,scale,min-scale/max-scale, wheel / pinch / double-click), control schemes (default/scroll-pan/drag-selectplustriggersoverrides), snap grid (h-cell-size/v-cell-size,snap-while-dragging), connection snapping (snap-radius), magnetic alignment lines,virtualizedculling, and keyboard a11y (arrows move, Ctrl+A, Delete, +/−/0 zoom,Cfor keyboard connect mode). Emitsnile-create-connection,nile-reassign-connection,nile-move-nodes,nile-delete-selected,nile-create-node,nile-drop-to-group,nile-selection-change,nile-canvas-change,nile-drag-started/nile-drag-ended,nile-flow-loaded,nile-node-intersectionsandnile-connection-waypoints-changed(UIF-1349). - Nile Flow Node: Added the node component —
node-id,position,size,rotate,parent-id,group,dragging-disabled,selection-disabled,connect-on-node, with any slotted content andnile-flow-drag-handle/nile-flow-resize-handle/nile-flow-rotate-handleattribute handles on any descendant (UIF-1349). - Nile Flow Connector: Added the connection anchor —
connector-id,type(source/target/source-target/outlet),multiple,disabled,category,canBeConnectedTo(ids, categories or a predicate),connectable-sideandself-connectable(UIF-1349). - Nile Flow Connection: Added the edge component —
source/target,type(straight/bezier/segment/adaptive-curve/customwithcustomPath),behavior(fixed/fixed-center/floating),offset,radius,marker-start/marker-end,gradient-start/gradient-end,waypoints,reassign-disabledandreassignable-start; children render as a label at the path midpoint (UIF-1349). - Nile Flow Background: Added the canvas backdrop —
pattern(dots/grid/custom),size,colorandpatternSvg(UIF-1349). - Nile Flow Minimap: Added the minimap — draggable viewport rect with
min-size(UIF-1349). - Nile Flow Connection Preview: Added the drag-to-connect preview edge configuration (UIF-1349).
- Nile Flow External Item: Added the palette item — a
datapayload and apreviewslot for the drag ghost, dropping onto the canvas asnile-create-node(UIF-1349). - Nile Org Chart: Added an org chart composed from the flow primitives — a flat
{id, name, title?, avatar?, managerId?}array in, tidy tree out.layout(tree/compact),renderer(dom/canvas),virtualize,collapsibleandexpand-depth, with deeper tiers behind a+chip. Methodsfit(),collapseAll(),expandAll(),expandToDepth(n),collapse(id)/expand(id)/toggle(id). Emitsnile-org-node-clickandnile-org-collapse-change(UIF-1349). - Layout adapters: Added
@aquera/nile-flow/layout-dagreand@aquera/nile-flow/layout-elk— optional-peer wrappers that return positions for the app to apply; the engine is imported lazily on first call (UIF-1349). - Flow History: Added
FlowHistory, an undo / redo stack driven by the flow's state snapshots (UIF-1349).
