GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Semantic-Org/Nav-Router: A browser-native Navigation API based router

BranchesTags
Open more actions menu

Latest commit

 

History

199 Commits
199 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
ai
ai
 
 
docs
docs
 
 
examples
examples
 
 
integrations
integrations
 
 
packages
packages
 
 
src
src
 
 
tools/hooks
tools/hooks
 
 
.gitignore
.gitignore
 
 
.node-version
.node-version
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
dprint.json
dprint.json
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 

Repository files navigation

Nav Router

A thin router built on the browser's Navigation API

  • One route tree for paths, params, guards, data and views
  • Typed params and query, coerced before your code reads them
  • Nested layouts and named slots
  • Lazy views, loaded with their route
  • Plugins you import only if you use them
  • About 12 KB brotli, with no framework required

Nav Router leaves navigation to the platform. The browser's Navigation API intercepts links, history, focus and scroll, and the router adds what an app declares on top: which route a URL matches, who may enter it, what data it loads and what it shows.

import { lazy, router } from 'nav-router';

export const app = router({
  title: 'Acme',
  layout: RootLayout,
  index: { path: '/', view: HomePage },
  routes: {
    team: {
      path: '/team/:org',
      layout: TeamLayout,
      data: ({ params, signal }) => api.team(params.org, { signal }),
      routes: {
        members: {
          path: '/team/:org/members',
          view: lazy(() => import('./members.js')),
        },
        settings: {
          path: '/team/:org/settings',
          permission: ({ user }) => user?.role === 'admin',
          view: SettingsPage,
        },
      },
    },
  },
});

app.start();

Read the Docs to Learn More.

Packages

Package Description
nav-router The router and the reactive scaffold integrations build on
@nav-router/plugins The plugins, each installed by importing it
@nav-router/solid Nav Router for Solid
@nav-router/core The router under its scoped name, a thin re-export

Examples

Each example is a small Vite app. Install once at the root, then run one by name.

npm install
npm run flat     # a flat route table
npm run nested   # nested layouts and slots
npm run solid    # the same app as Solid components

License

ISC

About

A browser-native Navigation API based router

Resources

Readme
ISC license
Activity
Custom properties

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.