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

@equinor/fusion-framework-module-navigation

v7.0.0

Published

Navigation module for Fusion Framework providing routing and navigation capabilities using React Router 7

Readme

@equinor/fusion-framework-module-navigation

Routing and navigation module for Fusion Framework with observable state management and automatic basename localization.

Features

  • Path localization — consumers work with clean paths (/users) while the history stack receives full paths (/apps/my-app/users).
  • Observable state — navigation state exposed as an RxJS observable (state$) with shareReplay semantics.
  • Multiple history types — browser (pathname), hash (#/path), and memory (no URL changes).
  • Router compatibilitycreateRouter() creates @remix-run/router instances wired to the framework history.
  • Navigation blocking — intercept navigations with history.block() and optionally retry.
  • Telemetry & events — dispatches NavigateEvent / NavigatedEvent and tracks actions via the telemetry module.

Installation

pnpm add @equinor/fusion-framework-module-navigation

Usage

Enable the module

import { enableNavigation } from '@equinor/fusion-framework-module-navigation';

// Minimal — basename only
enableNavigation(configurator, '/apps/my-app');

// Advanced — full configuration
enableNavigation(configurator, {
  configure: (config) => {
    config.setBasename('/apps/my-app');
    config.setHistory(createHistory('browser'));
  },
});

Programmatic navigation

const navigation = framework.modules.navigation;

navigation.push('/users');             // adds history entry
navigation.replace('/login');          // replaces current entry
navigation.push('/users', { id: 1 }); // with state

console.log(navigation.path.pathname); // '/users' — basename removed

Observable navigation state

import { filter } from 'rxjs';

navigation.state$.subscribe(({ action, location }) => {
  console.log(action, location.pathname); // 'PUSH' '/users'
});

navigation.state$.pipe(
  filter(({ action }) => action === 'POP'),
).subscribe(({ location }) => {
  console.log('Back/forward to', location.pathname);
});

Create href / URL

// basename = '/apps/my-app'
navigation.createHref('/users');
// → '/apps/my-app/users'

navigation.createURL('/users');
// → URL { pathname: '/apps/my-app/users', ... }

Router integration (legacy)

Note: Prefer @equinor/fusion-framework-react-router for new applications.

import type { AgnosticRouteObject } from '@remix-run/router';

const routes: AgnosticRouteObject[] = [
  { path: '/', element: <Home /> },
  { path: '/users/:id', element: <UserDetail /> },
];

const router = navigation.createRouter(routes);

Always use navigation.createRouter() instead of createBrowserRouter() directly—creating a router outside the provider breaks basename handling and state synchronisation.

History types

| Factory argument | Class | Description | |---|---|---| | 'browser' | BrowserHistory | Pathname-based routing via the History API. Default. | | 'hash' | BrowserHistory (hash stack) | Hash-fragment routing (#/path). No server config needed. | | 'memory' | MemoryHistory | In-memory history. Ideal for widgets, tests, and SSR. |

import { createHistory } from '@equinor/fusion-framework-module-navigation';

const browserHistory = createHistory('browser');
const hashHistory    = createHistory('hash');
const memoryHistory  = createHistory('memory');

Navigation blocking

const unblock = navigation.history.block((transition) => {
  if (hasUnsavedChanges) {
    showConfirmDialog(() => {
      unblock();          // remove blocker first
      transition.retry(); // then retry navigation
    });
  } else {
    unblock();
    transition.retry();
  }
});

API Reference

Functions

| Export | Description | |---|---| | enableNavigation(configurator, opts?) | Registers the navigation module on a configurator. | | createHistory(type, ...args) | Factory for BrowserHistory, hash-based BrowserHistory, or MemoryHistory. |

Classes

| Export | Description | |---|---| | NavigationProvider | Module provider — manages state, localization, and lifecycle. | | NavigationConfigurator | Fluent config builder with Zod validation. | | BrowserHistory | History backed by browser pushState / replaceState. | | MemoryHistory | History backed by in-memory storage. |

Interfaces & Types

| Export | Description | |---|---| | INavigationProvider | Public contract for the navigation provider. | | INavigationConfigurator | Configuration shape (basename, history, telemetry, eventProvider). | | History | History instance contract (observable state + navigation methods). | | Path | { pathname, search, hash } | | Location | Path extended with state and key. | | To | string \| Partial<Path> — target for navigation operations. | | Action | Enum: Pop, Push, Replace. | | NavigationUpdate | { delta, action, location } emitted by state$. |

Events

| Event | When | Cancelable | |---|---|---| | NavigateEvent (onNavigate) | Before navigation | Yes | | NavigatedEvent (onNavigated) | After navigation | No |

Configuration

| Option | Type | Default | Description | |---|---|---|---| | basename | string | undefined | URL path prefix stripped from / prepended to consumer paths. | | history | History | Browser history (or memory in Node) | History instance created via createHistory(). | | telemetry | ITelemetryProvider | Auto-resolved | Tracks navigation events and errors. | | eventProvider | IEventModuleProvider | Auto-resolved | Dispatches onNavigate / onNavigated events. |

See Also