npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@foblex/flow-elk-layout

v18.6.1

Published

ELK.js layout engine adapter for Foblex Flow.

Downloads

1,186

Readme

@foblex/flow-elk-layout

@foblex/flow-elk-layout adds a manual layout adapter for ELK.js in Foblex Flow.

Use this package when you need richer layout strategies than a simple directed tree and want access to layered, radial, force-style, or other ELK.js algorithms while still rendering and interacting through Foblex Flow.

Install

The easiest path is:

ng add @foblex/flow-elk-layout

If your app already manages Flow styles on its own, you can skip the default theme wiring:

ng add @foblex/flow-elk-layout --skipTheme

For Nx workspaces:

nx g @foblex/flow-elk-layout:add

ng add ensures these packages are present and only adds the missing ones:

  • @foblex/flow
  • @foblex/platform
  • @foblex/mediator
  • @foblex/2d
  • @foblex/utils
  • the ELK.js package itself

It also adds node_modules/@foblex/flow/styles/default.scss to application styles when the theme entry is missing.

If you prefer manual installation:

npm install @foblex/flow @foblex/flow-elk-layout @foblex/platform@^1.0.4 @foblex/mediator@^1.1.3 @foblex/2d@^1.2.2 @foblex/utils@^1.1.1

The underlying elkjs package is shipped as a runtime dependency of this package, so you do not need to install it separately.

What The Engine Does

ElkLayoutEngine calculates node positions from:

  • node ids
  • optional node sizes
  • source/target connections
  • shared layout options such as direction, spacing, and algorithm
  • optional ELK.js-specific layoutOptions

The engine returns only calculated node positions. Your app remains responsible for state management and for applying those positions to your own graph model.

For non-directional algorithms such as force, radial, random, or packing-oriented modes, the example integration can switch connectors into calculate mode so connection anchors follow the actual node geometry instead of a fixed left/right or top/bottom rule.

Minimal Setup

import { Component, inject } from '@angular/core';
import {
  EFLayoutDirection,
  IFLayoutConnection,
  IFLayoutNode,
  provideFLayout,
} from '@foblex/flow';
import {
  EElkLayoutAlgorithm,
  ElkLayoutEngine,
} from '@foblex/flow-elk-layout';

@Component({
  standalone: true,
  providers: [provideFLayout(ElkLayoutEngine)],
  template: '',
})
export class WorkflowLayoutExample {
  private readonly _layout = inject(ElkLayoutEngine);

  protected async relayout(): Promise<void> {
    const nodes: IFLayoutNode[] = [
      { id: 'A' },
      { id: 'B' },
      { id: 'C' },
    ];
    const connections: IFLayoutConnection[] = [
      { source: 'A', target: 'B' },
      { source: 'A', target: 'C' },
    ];

    const result = await this._layout.calculate(nodes, connections, {
      direction: EFLayoutDirection.TOP_BOTTOM,
      algorithm: EElkLayoutAlgorithm.LAYERED,
      nodeGap: 32,
      layerGap: 48,
      layoutOptions: {
        'elk.layered.spacing.nodeNodeBetweenLayers': '64',
      },
    });

    const positions = new Map(result.nodes.map((node) => [node.id, node.position]));

    console.log(positions.get('A'));
  }
}

Main Options

  • direction: EFLayoutDirection
  • algorithm: EElkLayoutAlgorithm
  • nodeGap: spacing between nodes
  • layerGap: spacing between layout layers
  • defaultNodeSize: fallback size when a node does not provide size
  • layoutOptions: raw ELK.js options passed through to the engine

Available algorithms:

  • EElkLayoutAlgorithm.FIXED
  • EElkLayoutAlgorithm.BOX
  • EElkLayoutAlgorithm.RANDOM
  • EElkLayoutAlgorithm.LAYERED
  • EElkLayoutAlgorithm.STRESS
  • EElkLayoutAlgorithm.MRTREE
  • EElkLayoutAlgorithm.RADIAL
  • EElkLayoutAlgorithm.FORCE
  • EElkLayoutAlgorithm.DISCO
  • EElkLayoutAlgorithm.SPORE_OVERLAP
  • EElkLayoutAlgorithm.SPORE_COMPACTION
  • EElkLayoutAlgorithm.RECT_PACKING

Typical Integration Flow

  1. Build your own graph data.
  2. Convert it to IFLayoutNode[] and IFLayoutConnection[].
  3. Call calculate(...).
  4. Merge returned positions into your view model.
  5. Render nodes in f-flow.

Example

When To Choose ELK.js

Choose ELK.js when you want:

  • more layout algorithms
  • richer spacing and routing controls
  • denser or less tree-like graphs
  • an engine you can tune further through raw ELK.js options