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

@phcdevworks/spectre-shell-signals

v1.0.0

Published

Minimal, framework-agnostic reactive primitives package for Spectre applications.

Readme

@phcdevworks/spectre-shell-signals

GitHub issues GitHub pull requests License

@phcdevworks/spectre-shell-signals is the minimal reactive-primitives package for Spectre applications.

Maintained by PHCDevworks as part of the Spectre suite, it provides a small, framework-agnostic foundation for writable signals, derived values, and reactive effects. The package is intentionally narrow: it owns primitive reactivity only so sibling packages can build on predictable synchronous semantics without inheriting a broader state-management framework.

This package is published as @phcdevworks/spectre-shell-signals. Its source repository is hosted at phcdevworks/spectre-shell-signals.

Key capabilities

  • Writable signals with explicit .value reads and writes
  • Lazy computed values with dependency tracking and cached recomputation
  • Reactive effects with cleanup before re-run and on disposal
  • Synchronous, readable behavior that is portable across runtimes
  • Small public API surface designed to resist scope drift

Installation

npm install @phcdevworks/spectre-shell-signals

Quick start

import { computed, effect, signal } from "@phcdevworks/spectre-shell-signals";

const count = signal(0);
const doubled = computed(() => count.value * 2);

const stop = effect(() => {
  console.log(doubled.value);
});

count.value = 1;
stop();

Effects can also register cleanup work that runs before the next execution and when the effect is disposed:

import { effect, signal } from "@phcdevworks/spectre-shell-signals";

const enabled = signal(true);

const stop = effect((onCleanup) => {
  if (!enabled.value) {
    return;
  }

  const id = setInterval(() => {
    console.log("tick");
  }, 1000);

  onCleanup(() => clearInterval(id));
});

enabled.value = false;
stop();

What this package owns

  • signal<T>(initialValue) for writable reactive values
  • computed<T>(fn) for lazy derived values
  • effect(fn) for reactive side effects
  • Dependency tracking, invalidation, and cleanup/disposal behavior
  • Minimal TypeScript types for the public API

This package should stay at the primitive reactivity layer.

What this package does not own

  • Global stores, app-wide state containers, or business logic state layers
  • Routers, navigation state, URL params, or shell orchestration
  • DOM bindings, renderer integrations, or framework lifecycle adapters
  • Async cache/query behavior, persistence, streams, or event buses
  • Devtools, inspectors, dashboards, or plugin systems

If a feature is not directly required for signal, computed, effect, tracking, invalidation, or disposal, it does not belong here.

Package exports / API surface

Runtime exports:

  • signal
  • computed
  • effect

Type exports:

  • Signal<T>
  • Computed<T>
  • EffectCallback
  • EffectCleanup
  • StopEffect

Behavior summary:

  • signal(initialValue) returns an object with a tracked .value getter and invalidating setter
  • computed(fn) is lazy, cached, and recomputes only when read after invalidation
  • effect(fn) runs immediately, tracks reads during execution, and returns a stop function
  • onCleanup handlers run before the next effect execution and when the effect is stopped
  • Signal writes use Object.is to skip unchanged updates

Relationship to the rest of Spectre

Spectre keeps responsibilities separate:

  • @phcdevworks/spectre-tokens owns visual language, semantic roles, and token contracts
  • @phcdevworks/spectre-ui owns token-driven styling, Tailwind helpers, and class recipes
  • @phcdevworks/spectre-shell owns thin shell composition and runtime surface
  • @phcdevworks/spectre-shell-router owns URL resolution and navigation primitives
  • @phcdevworks/spectre-shell-signals owns reactive primitives only

That separation keeps the reactivity layer portable and prevents it from becoming a general-purpose runtime or state framework.

Development

Install dependencies, then run the package checks:

npm run check

Key source areas:

  • src/signal.ts
  • src/computed.ts
  • src/effect.ts
  • src/internals/node.ts
  • src/internals/tracking.ts
  • tests/signals.test.ts

Contributing

When contributing:

  • keep the API tiny and explicit
  • prefer implementation clarity over abstraction-heavy design
  • avoid adding framework concepts or store-like helpers
  • add tests before changing reactive semantics
  • run npm run check before opening a pull request

Scope discipline is part of the package contract.

License

MIT © PHCDevworks. See LICENSE.