Repository navigation
ireko 0.1.0
The first version. It needs Node.js 22.12 or later, or a current browser. It is ESM only, and it has no runtime dependencies.
- The engine.
layout(input, options)andcreateEngine(config)give boxes with absolute positions, routed edges, the bounds and the findings of an audit. The output is plain data, and the same input gives the same output. - Two passes. The measure pass goes from the leaves up, and the place pass goes from the root down. Thus a strategy knows the size of each child subtree, and no two subtrees overlap. The engine uses loops, not recursion, so a deep tree does not overflow the stack.
- A strategy and a mode for each node. The strategy
gridputs the children in rows and columns, andradialputs them on a ring or an arc. The modelinkedputs the children around the node, with edges. The modenestedputs them inside the box of the node. - Two more strategies.
treepacks the subtrees of a row by their shapes, so a small subtree fits under the edge of a large one (a tidy tree).layersputs the children in layers in the direction of the edges between them (a flowchart). - Fit. A nested container with a size grows (
grow), makes its content smaller (scale), or cuts it at its edge (clip). - Routers.
straight,orthogonalandavoid. The routeravoidgoes around the other boxes. A tree edge goes in the direction of the strategy of its parent, so the orthogonal router draws the edges of an organization chart. Each edge can have a label. - The audit. Each layout examines itself, and gives findings for overlaps, boxes outside their container, bad options, unknown strategies, limits and failed strategies or routers. With
strict: true, the engine throws anIrekoErrorfor each error. - Label sizes.
fitText()gives ameasurefunction: each box fits its label. Its default width is an estimate that needs no font engine.widthOfCanvas()fromireko/rendergives exact widths in a browser. - Extension points.
defineStrategy,defineRouterandcreateEngine({ strategies, routers }). A strategy can ask for the shapes of the subtrees (shapes: true), and it gets the edges between its children. A router can ask for the boxes near each edge (obstacles: true). An option schema for each strategy gives the defaults, the checks and the controls of the playground. - The builder.
grid,radial,tree,layers,grid.nestedandbuilder<O>(type)make an input in TypeScript. - The text language (
ireko/text).parsegives an input or the place of the first syntax error.printwrites the canonical text. - The renderers.
toSVGandmountSvg(ireko/svg),mountDom(ireko/dom) andmountCanvas(ireko/canvas). The live renderers have pan, zoom, selection, picking and an animation from one layout to the next.ireko/renderhas the themes and the viewport. - React (
ireko/react).useLayout,LayoutSvg(static, for server rendering) andLayoutView(a live renderer). - React Flow (
ireko/xyflow).layoutFlowgives positions to the nodes of a flow and sizes to its groups (sub-flows).toXYFlow,PolylineEdgeandGroupNodedraw a layout in React Flow 12. - Examples (
ireko/examples). Sixteen inputs, the same as the gallery of the site.