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

allomoney-library

v0.1.0

Published

Zero-dependency, standalone Angular Sankey diagram component.

Readme

allomoney-library

A zero-dependency, standalone Angular Sankey diagram component. A Sankey diagram visualizes flows — where quantities split, merge, and move between stages — making it ideal for budgets, cash-flow, energy/material flows, and conversion funnels.

  • No runtime dependencies beyond Angular — no D3, no charting library.
  • Standalone + signals, Angular 22.
  • Zero consumer configuration: light/dark empty-state placeholders ship inline (CSS data-URIs), so there's nothing to add to your angular.json.
  • Interactive: hover to trace a flow's chain, and optionally edit node names/values, re-point or re-value links, and add new flows in place.

Install

npm i allomoney-library

Usage

Add the provider once at bootstrap, then drop the component into any template.

// main.ts
import { bootstrapApplication } from '@angular/platform-browser';
import { provideAlloMoneyLibrary } from 'allomoney-library';
import { App } from './app/app';

bootstrapApplication(App, {
  providers: [
    provideAlloMoneyLibrary({ defaultTheme: 'light' }),
  ],
});
// app.ts
import { Component, signal } from '@angular/core';
import { AllomoneySankeyDiagram, type SankeyData } from 'allomoney-library';

@Component({
  selector: 'app-root',
  imports: [AllomoneySankeyDiagram],
  // `dataSource` is a two-way binding: in-place edits write an immutable copy
  // back through it, keeping `flows` in sync.
  template: `
    <allomoney-sankey-diagram
      [(dataSource)]="flows"
      [options]="{ theme: 'dark', currency: 'USD' }" />
  `,
})
export class App {
  readonly flows = signal<SankeyData>({
    nodes: [
      { id: 0, name: 'Income' },
      { id: 1, name: 'Rent' },
      { id: 2, name: 'Savings' },
    ],
    links: [
      { source: 0, target: 1, value: 1200 },
      { source: 0, target: 2, value: 800 },
    ],
  });
}

When dataSource is empty, null, or omitted — or every node is invalid — the component renders a themed empty state instead of a diagram. Every rejected node/link is logged to the console.

Theming

Pass theme="light" / theme="dark" (or the options form [options]="{ theme: 'dark' }", which wins if both are set), or set a library-wide default via provideAlloMoneyLibrary({ defaultTheme }). The light/dark empty-state placeholders are embedded inline in the component's CSS as data-URIs — zero configuration required, nothing to copy into your build.

API

AllomoneySankeyDiagram — inputs

| Input | Type | Default | Description | | ----- | ---- | ------- | ----------- | | dataSource | SankeyData \| null \| undefined | undefined | Nodes + links to render. Empty/null/undefined shows the empty state. Two-way ([(dataSource)]): in-place edits write an immutable copy back. | | options | SankeyOptions | {} | Presentation options and edit flags, kept separate from the graph. Any field set here overrides the matching element input below. | | theme | 'light' \| 'dark' | config defaultTheme | Visual theme; also selects the light/dark empty-state placeholder. | | currency | string \| null | null | ISO 4217 code; formats node/link values as currency, else plain 2-decimal numbers. An unknown code falls back to the plain format. | | orientation | 'horizontal' \| 'vertical' | 'horizontal' | Flow direction. | | width / height | number \| null | null (100% of container) | Rendered size in CSS pixels. Invalid or display-distorting values are ignored (logged) and the default size is used. | | noDataMessage | string | 'No Data' | Message shown in the empty state. Rendered as auto-escaped text. | | maxDisplayedNodeName | number | 17 | Max characters of a node name shown on the diagram; longer names are truncated with … (the full name stays available to assistive tech). | | legend | SankeyLegend \| null | shown, 'bottom' | Legend configuration (see below). A partial value fills only its missing fields. | | canEditNodeName / canEditNodeValue | boolean | false | Allow editing a node's name / value by double-click. | | canEditLinkValue / canEditLinkSource / canEditLinkTarget | boolean | false | Allow editing a link's value / re-pointing its source / target by double-click. | | canAddLink | boolean | false | Allow adding a new flow from a node (its editor gains a "Source for" action). | | canAggregateLinks | boolean | true | Merge parallel links (same source and target) into one summed ribbon. An aggregated ribbon's derived value cannot be edited in place. | | hideLinkValue | boolean | true | Hide each flow's on-diagram value label. Does not affect the hover tooltip, which still reports the value. |

Every field in options can also be set as the matching element input (the cases above). When both are supplied for the same field, the options value wins. Two fields are options-only (no element input):

| options field | Type | Default | Description | | --------------- | ---- | ------- | ----------- | | horizontalScrolling | boolean | true | true keeps the diagram's natural width (scrolling horizontally when it overflows) so elements stay legible; false scales it down to fit the container width. | | verticalScrolling | boolean | true | As above, for the vertical axis. |

Sizing

By default the diagram fills 100% of its container on both axes. Set width and/or height (CSS pixels) to pin a fixed size. Each must be a positive number of at least 200px, and when both are given their ratio must stay reasonably close to the diagram's natural proportions; a value that is invalid or would significantly distort the display is ignored, an error is logged to the console, and the diagram renders at its default size.

Legend

The legend (SankeyLegend) lists each node with a colour swatch. A node duplicated by a circular flow contributes one extra dashed "ghost" swatch per duplicate, matching how it is drawn on the diagram.

| Field | Type | Default | Description | | ----- | ---- | ------- | ----------- | | visibility | boolean | true | Whether the legend is shown. | | location | 'left' \| 'top' \| 'right' \| 'bottom' | 'bottom' | Where the legend sits relative to the diagram. | | isFullLegendShown | boolean | false | When true, also show each node's total incoming/outgoing sums. | | inLabel / outLabel | string | 'Deposit' / 'Withdrawal' | Labels for the incoming/outgoing totals in the full legend. Empty/whitespace falls back to the default. |

Two-way binding

dataSource is a model, so in-place editing writes an immutable copy back through it. Use [(dataSource)] to keep your signal in sync, or bind (dataSourceChange) explicitly to observe edits without owning the data.

Exported types

SankeyData, SankeyOptions, SankeyNode, SankeyLink, SankeyTheme, SankeyOrientation, SankeyLegend, LegendLocation, AlloMoneyLibraryConfig, ResolvedAlloMoneyLibraryConfig.

Exported values: provideAlloMoneyLibrary, ALLOMONEY_LIBRARY_CONFIG, DEFAULT_ALLOMONEY_LIBRARY_CONFIG.

Compatibility

  • Angular 22 (@angular/core and @angular/common ^22.0.0).

License

MIT