ireko
npm install irekoapp nested {
web { home cart search }
api { auth orders }
data { users events }
}What it does
Section titled “What it does”ireko (入れ子) is the Japanese word for a set of boxes that fit inside each other. A diagram is a tree of nodes. Each node selects two things for its children:
- The strategy: how to arrange the children. The built-in strategies are
grid,radial,tree(a tidy tree) andlayers(a flowchart), and you can add your own. - The mode: where the children go. In the
nestedmode, the children are inside the box of the node. In thelinkedmode, they are around it, and edges connect them.
One layout gives plain data: boxes, routed edges and findings. Any renderer can draw it.
Two passes, no overlaps
The engine measures each subtree before it places it. A large subtree gets a large cell.
A strategy for each container
A grid of rings of grids: each container selects its own layout and its own mode.
Tidy trees
The tree strategy packs each subtree by its shape. A small team fits under the edge of a large one.
Flowcharts
The layers strategy follows the edges between the children. A cycle turns around, and a stage can nest.
Edges around boxes
The avoid router draws horizontal and vertical segments that go around the other boxes.
React Flow sub-flows
Give layoutFlow your nodes and edges. Groups get a size, and children get positions inside them.
Watch it work
Section titled “Watch it work”Use it in your code
Section titled “Use it in your code”import { grid, layout, radial } from "ireko";import { toSVG } from "ireko/svg";
const root = grid.nested("system", radial.nested("web", "home", "cart", "search"), grid("api", "auth", "orders"));
const result = layout({ root });result.nodes; // { id, x, y, width, height, container, ... } for each boxresult.issues; // the findings of the audit: an empty listdocument.body.innerHTML = toSVG(result);The quick start has the steps for React, React Flow and the server.