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 🙏

© 2025 – Pkg Stats / Ryan Hefner

reactor-navigation

v1.1.2

Published

state-machine-driven navigation variability system

Readme

Reactor

Reactor is a state-data-driven navigation variability system.

Concept and Principles

Reactor is a Redux-inspired and state-driven navigation variability system. The developer composes inheritable navigation specifications in JavaScript at compile time, and calculates the runtime navigation specifications based on variability metadata.

This allows the developer to enable multiple navigations for the application, without having to write different versions of the app, or having a lot of if-else blocks during navigation.

By adopting the reactive data-driven paradigm, Reactor also serves as a powerful general-purpose modern router.

Data-Drive UI

The first principle is that UI is completely state driven. At any point in time, statically defined view state combines with run-time values to create the entire view.

This makes the app very easy to debug. To reconstruct a user's journey, simply log the state transitions and run-time values.

Composable Flowcharts

The second principle is that, the developer defines the navigation flowchart as an array of aforementioned states statically, then Reactor traverses this flowchart at runtime. This flowchart dictates the app's navigation.

To enable variability, the flowchart syntax is designed to allow inheritance and composition. Inheritance enable variations of flowchart structure; while composition enables different sub-navigation workflows to stitch together.

Getting Started

Installation:

yarn add reactor-navigation
// or
npm install --save reactor-navigation

Initialization:

// see docs below
const spec = ...

// an object that maps component name to component class
// i.e. { 'login/forgot-password': ForgotPasswordComponent }
const components = ...

// options
// { usePushState: true } to use HTML5 push state
// { customGetPath: () => {} } custom way to calculate navigation path from browser URL
// { customRouting: (path) => {} } custom way to update url based on navigation path
const options = ...

const { reactorReducer, ReactorRoot } = Reactor.initialize({
  spec,
  components,
  options
});

Writing navigation specs:

// regular navigation node
const homeDashboard = {
  name: 'home-dashboard',
  customMetadata: {
    displayMobileNativeMenu: true
  },
  path: {
    segment: '',
    urlAccess: true
  },
  views: [
    {
      type: 'main',
      component: 'dashboard'
    }
  ],
  transitions: [
    {
      name: 'view-report",
      to: 'detailed-report'
    },
    {
      name: 'logout',
      to: 'login-page'
    }
  ]
};

// decision node
const decision = {
  name: 'decision-can-schedule-alert',
  type: 'decision',
  outcomes: [
    {
      attribute: 'role',
      value: 'admin',
      name: 'yes'
    },
    {
      attribute: 'role',
      value: 'guest',
      name: 'no'
    }
  ]
};

// overall export
const spec = {
  name: 'US control',
  metadata: {
    region: 'us',
    segment: 'app',
    initialSegment: 'app',
    fallbackSegment: '404'
  },
  navSpecs: [
    homeDashboard,
    decision
  ]
};

Hooking up ReactorRoot:

To finally hook up navigation, simple wrap the app in ReactorRoot.

const renderApp = () => {
  ReactDOM.render(
    <ReactorRoot state={Store.getStore().getState()} />,
    document.getElementById('container')
  );
};

Store.getStore().subscribe(renderApp);
renderApp();

Contribution

We welcome contributions. Feel free to contact one of the committers if you have questions.

Build

Global dependencies:

Node.js 8.10.0
NPM 5.6.0
Yarn 1.7.0

To install local dependencies:

yarn

To run tests:

yarn test

Pull Request Process

To contribute, please fork the repo, and submit PRs against the master branch here.

Each PR must have the following:

  1. A brief explanation of the changes
  2. A brief explanation of the code design
  3. 100% unit test coverage

One of the committers will provide an initial review within 72 hours.

Release Process

We currently follow a very light weight process. Since only production-ready code can be merged into "master" branch, we are happy to make a release any time.

Versioning is done in separate commits pushed by committers. We follow semver.

Committers

Max You [email protected]