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

vue-page-stack

v3.3.0

Published

<p align="center"> <img src="https://raw.githubusercontent.com/hezhongfeng/images/master/stack.svg" width="200"> </p>

Downloads

632

Readme

vue-page-stack

vue-page-stack currently targets Vue 3. For the Vue 2 version, see v1.5.0.

English | 简体中文


A Vue 3 SPA navigation stack that preserves route state in stack order, so back navigation feels closer to a native app than a full page remount.

Example

preview

demo code

Features

  • Works on top of vue-router without changing your route definitions
  • Stores newly rendered pages on push and forward
  • Restores previous pages from the stack on back and go(-n) so local UI state can survive
  • Removes unreachable pages from the stack after back navigation
  • Replaces the current stack entry on replace
  • Emits back and forward events for direction-aware transitions
  • Supports browser back and forward buttons

Compared with KeepAlive

  • VuePageStack manages pages in navigation order instead of providing include, exclude, or max
  • KeepAlive keeps previously cached pages around until they are evicted; VuePageStack trims pages that are no longer reachable in the stack
  • Navigating to the same route again creates a fresh page, while returning to an earlier page restores its cached instance

Installation and use

Installation

pnpm install vue-page-stack

Use

import { createApp } from 'vue';
import { VuePageStackPlugin } from 'vue-page-stack';

const app = createApp(App);

app.use(VuePageStackPlugin, { router });
<template>
  <router-view v-slot="{ Component }">
    <vue-page-stack @back="onBack" @forward="onForward">
      <component :is="Component" :key="$route.fullPath" />
    </vue-page-stack>
  </router-view>
</template>

<script setup>
const onBack = () => {
  console.log('back');
};

const onForward = () => {
  console.log('forward');
};
</script>

Use a stable route key on the rendered route component. In most apps, $route.fullPath is the safest default because it treats different params and query strings as distinct stack entries.

API

Install

Use app.use to install vue-page-stack.

import { VuePageStackPlugin } from 'vue-page-stack';

//...
app.use(VuePageStackPlugin, { router });

Options:

| Attribute | Description | Type | Accepted Values | Default | | --------- | ----------- | ---- | --------------- | ------- | | router | vue-router instance | Router | router created by createRouter | required |

Events

Use the back and forward events to react to navigation direction changes.

<vue-page-stack @back="onBack" @forward="onForward">
  <component :is="Component" :key="$route.fullPath" />
</vue-page-stack>

Notes

  • The default slot should render a single route component vnode for stack behavior to apply
  • Multiple slot children are passed through unchanged
  • The implementation depends on Vue renderer internals, so upgrades should be validated with the test suite

Example app

Development

pnpm install
pnpm run build
pnpm run lint
pnpm run test:run
pnpm run test:coverage

dist/ is treated as a release artifact and is generated automatically by npm pack / npm publish through the prepack script, so it does not need to stay checked in during normal development.

Documentation

Notes

Changelog

Release-by-release changes are documented in the release notes.

Principle

The page instance management model is inspired by Vue's KeepAlive implementation.

Thanks

This plugin draws on both vue-navigation and vue-nav. Thanks for the inspiration.

Contributors ✨

Thanks goes to these wonderful people (emoji key):