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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@data-trees/solid-reactivity-decorators

v1.0.9

Published

A collection of decorators to make your classes reactive, using SolidJS

Downloads

919

Readme

Solid Reactivity Decorators

A collection of decorators to make your classes reactive, using SolidJS.

Why?

  • Core to reactive applications is the ability to react to changes in dependencies.
  • When building a reactive application that is not a web application, there aren't many options for libraries.
  • This library provides a decorator interface for creating reactive classes, and keeps the code clean and readable.

Installation

NOTE: [email protected] and @solid-primitives/[email protected] are peer dependencies.

npm install solid-reactivity-decorators solid-js @solid-primitives/memo

Usage

import { reactive, effect, memo, getter, signal } from '@data-trees/solid-reactivity-decorators';

@reactive
class MyClass implements IReactive {
  declare destroy: () => void;
  @signal nameSignal: string = 'Dan';
  
  @effect
  doStuff() {
    console.log('Doing stuff', this.name);
  }

  @memo({ isLazy: true })
  getName() {
    console.log('lazy memo', this.name);
    return this.nameSignal[0]();
  }

  @memo({ isLazy: false })
  getName2() {
    console.log('non-lazy memo', this.name);
    return this.nameSignal[0]();
  }

  @getter({ isLazy: false })
  get name() {
    console.log('getter is', this.nameSignal[0]());
    return this.nameSignal[0]();
  }
  
  set name(value: string) {
    this.nameSignal[1](value);
  }
}

// NOTE: The logs might not work the same way in your application,
// but the idea is the same
const myClass = new MyClass();
// getter is Dan
// Doing stuff Dan
// non-lazy memo Dan
myClass.name = 'Daniel';
// getter is Dan
// 'Doing stuff', Daniel
// non-lazy memo Daniel
myClass.getName();
// lazy memo Daniel

API

@reactive

This decorator is required on a class that uses the other decorators.

  • Creates a SolidJS root
  • Handles the onDestroy lifecycle method
  • Tracks the effects created in the class
  • Class will throw if it is not decorated with this decorator

@effect

  • Creates a SolidJS effect
  • Will be run when any of the signals used in the method are updated

@memo({ isLazy?: boolean = false } = { isLazy: false })

  • Creates a SolidJS memo
  • Will be run when any of the signals used in the method are updated
  • Can be configured to be lazy with the isLazy option, so that it only runs when called directly, and not every time dependencies are updated.

@getter({ isLazy?: boolean = false } = { isLazy: false })

  • Same as memo but used for getters

@signal

  • Creates a signal property that can be listened to