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

@byrding/vue

v0.3.3

Published

Vue 3 adapter for @byrding/core — defineStore returns a composable via shallowReactive

Readme

@byrding/vue

Vue 3 adapter. Turns a store definition into a composable.

AI agents — see the consumer agent guidance for best practices, patterns, and gotchas.

Install

npm install @byrding/vue
# or
npx jsr add @byrding/vue

defineStore(id, definition)

function defineStore<T extends Record<string, unknown>>(
  id: string,
  definition: (new () => T) | (() => T),
): (keyPaths?: string[]) => T

Returns a composable callable from any setup().

// stores/counter.ts
import { defineStore } from '@byrding/vue'

export const useCounterStore = defineStore('counter', () => {
  const store = {
    count: 0,
    get double() { return store.count * 2 },
    increment() { store.count++ },
  }
  return store
})

Using the composable

<script setup lang="ts">
import { useCounterStore } from '@/stores/counter'

const store = useCounterStore(['count'])   // selective subscription
</script>

<template>
  <button @click="store.increment()">
    count: {{ store.count }} — double: {{ store.double }}
  </button>
</template>

How it works

The composable returns a shallowReactive wrapper seeded from a spread of the core's merged store:

const reactiveStore = shallowReactive({ ...coreStore.store }) as T

The spread invokes every getter, so the wrapper holds current state values, current computed values, and stable action references.

On every core notification we re-sync the wrapper:

Object.assign(reactiveStore, coreStore.store)

Vue's template system detects which top-level properties changed value and schedules a re-render for components that read them. Because action references stay the same across syncs, templates that read actions (e.g. for @click bindings) don't re-render on state changes.

Cross-framework mutations

When a React component mutates the same shared store, the core's notify fires our syncStore callback, which re-runs Object.assign. Vue picks up the property diff and re-renders — exactly as if the mutation had come from a Vue component.

Lifecycle

If called inside a component setup(), the composable registers onUnmounted to tear down the subscription. When called outside a component context (e.g. in a Pinia-style module), getCurrentInstance() is null and the onUnmounted hook is skipped — the subscription lives for the lifetime of the module.

Peer dependencies

  • vue >= 3