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

@sync0/vue

v0.1.2

Published

Vue 3 adapter for @sync0/core — field() returns a Vue Ref<T>

Readme

@sync0/vue

Vue 3 adapter for @sync0/core.

field() returns a real Vue Ref<T> backed by a customRef — so v-model, computed(), watch(), and watchEffect() all work without any changes. Two composables handle server conflict state the idiomatic Vue way.


Installation

npm install @sync0/vue @sync0/core

Requires Vue ≥ 3.3.


Quick start

<script setup lang="ts">
import { computed } from 'vue';
import {
  urlField,
  storageField,
  sessionField,
  cookieField,
  useServerField,
} from '@sync0/vue';

// URL search param — survives hard refresh, back/forward
const query = urlField('', 'q');

// localStorage — persists + syncs across tabs
const theme = storageField('light', 'theme');

// sessionStorage — tab-local
const draft = sessionField('', 'draft');

// Cookie — sent with requests, SSR-readable
const locale = cookieField('en', 'locale', { maxAge: 31_536_000 });

// Server — optimistic writes, realtime push, conflict state
const { field: notes, conflict, dismiss } = useServerField('', 'notes');

// computed() works on top of any SyncRef just like a normal ref
const resultCount = computed(() => (query.value.length > 0 ? 42 : 0));
</script>

<template>
  <input v-model="query" placeholder="Search…" />
  <select v-model="theme">
    <option value="light">Light</option>
    <option value="dark">Dark</option>
  </select>

  <div v-if="conflict" class="banner">
    Updated elsewhere —
    <button @click="dismiss">Dismiss</button>
  </div>
  <textarea v-model="notes" />
</template>

All exports

import {
  field,          // full strategy object → SyncRef<T>
  localField,     // in-memory (same as ref())
  urlField,       // URL search param
  storageField,   // localStorage
  sessionField,   // sessionStorage
  cookieField,    // document.cookie
  serverField,    // server adapter (bare SyncRef, no conflict wiring)

  useServerField, // composable: { field, conflict, dismiss }
  useOnConflict,  // composable: { conflict, dismiss } for existing field

  onConflict,     // imperative conflict subscription
  configureServerAdapter,
} from '@sync0/vue';

Conflict handling — two patterns

Pattern A: combined composable (creates + wires everything in one call)

const { field: notes, conflict, dismiss } = useServerField('', 'notes');

Pattern B: separate (useful when the field is defined outside <script setup>)

const notes = serverField('', 'notes');           // SyncRef<string>
const { conflict, dismiss } = useOnConflict(notes); // reactive conflict Ref

Both composables clean up their subscription automatically via onUnmounted.


SyncRef<T>

Every field() call returns a SyncRef<T>:

type SyncRef<T> = Ref<T> & { readonly __raw: RawObservable<T> };

It is a Ref<T> in every sense — v-model, watch, computed, and .value access all work. __raw exposes the underlying engine for advanced use.


Server adapter setup

import { configureServerAdapter } from '@sync0/vue';

configureServerAdapter(new SupabaseAdapter(supabase));

Custom codec

const page = urlField(1, 'page', {
  codec: { encode: String, decode: Number },
});

Links