Packages

@preact/signals-core

1.14.5 · 27 Oct 2026MIT17.2M / weekRepositoryHomepagenpmAtom feed

Your version

1.13.0

4 Feb 2026Where it was published

1.14.5 is the newest release of 1.x.

In short

1 new

Release note

Minor Changes

  • Add createModel and action to signals core package

    createModel provides a structured way to create reactive model classes that encapsulate signals, computed values, and actions:

    const CounterModel = createModel((initialCount = 0) => {
        const count = signal(initialCount);
        const doubled = computed(() => count.value * 2);
    
        effect(() => {
            console.log("Count changed:", count.value);
        });
    
        return {
            count,
            doubled,
            increment() {
                count.value++;
            },
        };
    });
    
    const counter = new CounterModel(5);
    counter.increment(); // Updates are automatically batched
    counter[Symbol.dispose](); // Cleans up all effects

    Key features:

    • Factory functions can accept arguments for initialization

    • All methods are automatically wrapped as actions (batched & untracked)

    • Effects created during model construction are captured and disposed when the model is disposed via Symbol.dispose

    • TypeScript validates that models only contain signals, actions, or nested objects with signals/actions

    action is a helper that wraps a function to run batched and untracked:

    const updateAll = action(items => {
        items.forEach(item => item.value++);
    }); // All updates batched into single notification

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.