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

ngx-component-graph

v0.0.5

Published

[The Demo](https://blckwolf5851.github.io/ngx-component-graph/)

Readme

NgxComponentGraph

The Demo

Documentation

This library is the component graph version of ngx-graph, it is also very similar to angular version of react-flow-renderer.

ngx-graph provided the ability to use svgs as nodes, this library extends its functionality and allows user to pass in any angular component to be nodes of the graph. Specifically the features include:

  1. Customize node style from your component
  2. Pass in different component for each node
  3. Customize edges
  4. Panzoom
  5. Drag and drop
  6. Extending Node type to adding payload and carry extra data

Basic Usage

This example shows how you can pass custom style and data into the nodes.

image

<ngx-component-graph
  [nodes]="raw_nodes"
  [edges]="raw_edges"
  [viewportWidth]="600"
  [viewportHeight]="400"
>
</ngx-component-graph>

Where raw_nodes and raw_edges are defined in .ts file as:

import { Edge, Node } from 'ngx-component-graph';

// This is how you can pass in your own data
interface CustomNode extends Node {
  payload?: object;
}

  raw_edges: Edge[] = [
    {
      id: '1',
      source: 'node1',
      target: 'node2',
    },
    {
      id: '2',
      source: 'node3',
      target: 'node4',
    },
    {
      id: '3',
      source: 'node1',
      target: 'node3',
    },
    {
      id: '4',
      source: 'node2',
      target: 'node5',
    },
  ];
  raw_nodes: CustomNode[] = [
    {
      id: 'node1',
      style: { width: '200px', border: 'dotted 4px #cc3' }, // pass custom style to node
      payload: { title: 'Nice component!' }, // carry custom data for display
    },
    {
      id: 'node2',
      style: { width: '300px', border: 'dotted 2px #ccc' },
    },
    {
      id: 'node3',
    },
    {
      id: 'node4',
    },
    {
      id: 'node5',
    },
  ];

Custom Templates

If you want to add custom components into each node, or customize the handle / edges. You would want to pass your components into the templates, in example below, an angular material expansion-panel + card is passed into nodes. This example is an extension of above example, all the styles and data extension are used.

Alt Text

<ngx-component-graph
  [nodes]="raw_nodes"
  [edges]="raw_edges"
  [viewportWidth]="600"
  [viewportHeight]="400"
>
  <!-- Custom Drag Handle (changed color and shape) -->
  <ng-template #handleTemplate>
    <svg width="24px" fill="currentColor" viewBox="0 0 24 24">
      <rect fill="#cc3" x="15" y="5" width="20" height="20" rx="5"></rect>
    </svg>
  </ng-template>
  <!-- Custom Nodes (passed in components) -->
  <ng-template #nodeTemplate let-node>
    <mat-accordion>
      <mat-expansion-panel hideToggle>
        <mat-expansion-panel-header>
          <mat-panel-title>
            {{
              node.payload ? node.payload.title : "placeholder"
            }}</mat-panel-title
          >
        </mat-expansion-panel-header>
        <mat-card class="example-card">
          <mat-card-header>
            <div mat-card-avatar class="example-header-image"></div>
            <mat-card-title>Shiba Inu</mat-card-title>
            <mat-card-subtitle>Dog Breed</mat-card-subtitle>
          </mat-card-header>
          <img
            mat-card-image
            src="https://material.angular.io/assets/img/examples/shiba2.jpg"
            alt="Photo of a Shiba Inu"
          />
          <mat-card-content>
            <p>
              The Shiba Inu is the smallest of the six original and distinct
              spitz breeds of dog from Japan. A small, agile dog that copes very
              well with mountainous terrain, the Shiba Inu was originally bred
              for hunting.
            </p>
          </mat-card-content>
          <mat-card-actions>
            <button mat-button>LIKE</button>
            <button mat-button>SHARE</button>
          </mat-card-actions>
        </mat-card>
      </mat-expansion-panel>
    </mat-accordion>
  </ng-template>
  <!-- Custom Edges (just changed the color here) -->
  <ng-template #edgeTemplate let-edge>
    <svg:path [attr.d]="edge.bezierPath" fill="transparent" stroke="green" />
  </ng-template>
</ngx-component-graph>

Feedback

For feedback and questions, email [email protected]