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

multi-scenario-viewer

v1.0.0

Published

A React component library for visualizing multi-scenario flows with merged and individual views

Readme

Multi Scenario Flow Viewer

A React component library for visualizing multi-scenario flows with merged and individual views.

Features

  • Multi-scenario visualization: Display multiple workflow scenarios in a single diagram
  • Merged view: Shows consolidated flow with all scenarios combined
  • Individual view: Shows each scenario separately for detailed analysis
  • Interactive: Hover effects, scenario filtering, and scrollable views
  • Customizable: Configurable colors, line widths, and node sizes
  • TypeScript support: Full type definitions included

Installation

npm install multi-scenario-viewer

Usage

Basic Example

import React from 'react';
import { MultiScenarioFlowViewer, IndividualScenarioViewer } from 'multi-scenario-viewer';
import type { ScenarioFlow } from 'multi-scenario-viewer';

const scenarios: ScenarioFlow[] = [
  {
    id: "1",
    label: "正常系フロー",
    color: "#4f83cc",
    path: ["Start", "注文", "確認", "出荷", "完了"]
  },
  {
    id: "2",
    label: "在庫切れ時",
    color: "#e57373",
    path: ["Start", "注文", "確認", "エラー通知", "完了"]
  },
  {
    id: "3",
    label: "支払いエラー時",
    color: "#ffa726",
    path: ["Start", "注文", "支払いエラー", "エラー通知", "完了"],
    strokeWidth: 3 // Custom line width
  }
];

function App() {
  return (
    <div style={{ display: 'flex', gap: '20px' }}>
      {/* Merged flow view */}
      <div>
        <h2>Merged Flow</h2>
        <MultiScenarioFlowViewer 
          scenarios={scenarios}
          width={600}
          height={400}
        />
      </div>
      
      {/* Individual scenarios view */}
      <div>
        <h2>Individual Scenarios</h2>
        <IndividualScenarioViewer
          scenarios={scenarios}
          width={700}
          height={400}
        />
      </div>
    </div>
  );
}

API Reference

MultiScenarioFlowViewer

Props for the merged flow viewer component.

| Prop | Type | Default | Description | |------|------|---------|-------------| | scenarios | ScenarioFlow[] | required | Array of scenario flow definitions | | width | number | 800 | Width of the viewer in pixels | | height | number | 600 | Height of the viewer in pixels | | nodeRadius | number | 16 | Radius of flow nodes in pixels | | edgeWidth | number | 2 | Width of flow edges in pixels |

IndividualScenarioViewer

Props for the individual scenarios viewer component.

| Prop | Type | Default | Description | |------|------|---------|-------------| | scenarios | ScenarioFlow[] | required | Array of scenario flow definitions | | width | number | 400 | Width of the viewer in pixels | | height | number | 600 | Height of the viewer in pixels | | nodeRadius | number | 12 | Radius of flow nodes in pixels | | edgeWidth | number | 1.5 | Default width of flow edges in pixels |

ScenarioFlow

Type definition for scenario flow data.

type ScenarioFlow = {
  id: string;           // Unique identifier for the scenario
  label: string;        // Display name for the scenario
  color: string;        // Color for the scenario (hex, rgb, etc.)
  path: string[];       // Array of step names in the flow
  strokeWidth?: number; // Optional custom line width for this scenario
};

Advanced Usage

Custom Styling

const customScenarios: ScenarioFlow[] = [
  {
    id: "premium",
    label: "プレミアム会員",
    color: "#9c27b0",
    path: ["Start", "注文", "会員特典", "優先処理", "高速出荷", "追跡", "完了"],
    strokeWidth: 3 // Thicker line for premium flow
  },
  {
    id: "standard",
    label: "通常フロー",
    color: "#4f83cc",
    path: ["Start", "注文", "確認", "出荷", "完了"],
    strokeWidth: 1 // Thinner line for standard flow
  }
];

Event Handling

The components include built-in interactions:

  • Hover effects: Tooltips show scenario information when hovering over nodes
  • Scenario filtering: Click scenario buttons to highlight specific flows
  • Scrolling: Automatic scroll support for large diagrams

Development

Building the Library

npm run build

This creates both ESM and CommonJS builds in the dist folder.

Running the Demo

npm run dev

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.