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

@sometic/core

v1.0.7

Published

Framework-independent lifecycle, environment and shared primitive contracts for the Sometic ecosystem.

Readme

@sometic/core

Framework-independent lifecycle, environment, and shared primitive contracts for the Sometic ecosystem.

@sometic/core is the foundation package every other Sometic module builds on. It ships small, SSR-safe primitives for runtime detection, cleanup, typed errors, controllable state, and async orchestration without tying you to React, Vue, or any other UI stack. You get production contracts that stay dependency-light and tree-shakeable via root or subpath imports.

Sometic is a portable application behavior system, not a visual UI kit. Core exists so behavior engines (events, stores, forms, auth, HTTP, accessibility) share one vocabulary for dispose, environment, controlled vs uncontrolled values, and typed failure. Adapters stay thin because the hard lifecycle work lives here, not in framework wrappers. Your styling system remains yours; core never forces fonts, CSS frameworks, or component chrome.

Out of the box you get SSR-safe environment helpers (canUseDom, isServerEnvironment), createId / createPrefixedId, disposable stacks, SometicError with stable codes, Result helpers, plugin/adapter/lifecycle contract types, createControllableState for controlled and uncontrolled values, createAsyncOperation with concurrency and abort, plus utilities such as debounce, throttle, anySignal, and safe JSON helpers. Prefer subpaths like @sometic/core/utils when you want the smallest import graph.

In the ecosystem, core sits under every foundation and feature package. Install it whenever you use Sometic, or pull it alone for disposable/async patterns in any TypeScript app. Related packages include @sometic/events, @sometic/store, @sometic/styling, @sometic/accessibility, @sometic/theme, and @sometic/positioning. Start with the product intro at https://sometic.dev/guide/introduction.

Modules

| Module | Subpath | Purpose | | ------------------ | ---------------------------------- | ------------------------------------------------ | | Environment | @sometic/core/environment | SSR-safe runtime and DOM capability detection | | Id | @sometic/core/id | Stable unique and prefixed ids | | Disposable | @sometic/core/disposable | Cleanup contracts and DisposableStack | | Error | @sometic/core/error | Typed errors with stable codes | | Result | @sometic/core/result | Explicit success and failure values | | Contracts | @sometic/core/contracts | Plugin, adapter, and lifecycle types | | Controllable state | @sometic/core/controllable-state | Controlled and uncontrolled value ownership | | Async operation | @sometic/core/async-operation | Pending, success, error, and abort orchestration | | Utils | @sometic/core/utils | Debounce, throttle, abort helpers, safe JSON |

Used by

| Package | How it uses core | | -------------------------------------------------------------------------------- | ------------------------------------------- | | @sometic/events | Disposable subscriptions and cleanup | | @sometic/store | Errors, utils, disposable store lifecycle | | @sometic/styling | Shared contracts for unstyled primitives | | @sometic/accessibility | Disposable focus, dismiss, announcer layers | | @sometic/dom | Environment-safe DOM controllers | | @sometic/http | Async, abort, and typed error boundaries | | @sometic/auth | Session lifecycle and disposable cleanup | | @sometic/forms | Controllable field state and async submit | | @sometic/validation | Result-shaped validation outcomes | | Framework adapters (@sometic/react, Vue, and siblings) | Thin bindings over core contracts |

Install

pnpm add @sometic/core
npm install @sometic/core
yarn add @sometic/core

Usage

Controllable state and disposable cleanup:

import { createControllableState, createDisposable, DisposableStack } from "@sometic/core";

const value = createControllableState({
    defaultValue: "",
    onChange: (next) => {
        console.log(next);
    },
});

value.set("hello");

const stack = new DisposableStack();
stack.use(
    createDisposable(() => {
        value.reset();
    }),
);
stack.dispose();

Async operations with abort-aware concurrency:

import { createAsyncOperation, isBrowserEnvironment } from "@sometic/core";

const loadUser = createAsyncOperation(
    async (signal, userId: string) => {
        const response = await fetch(`/api/users/${userId}`, { signal });
        if (!response.ok) {
            throw new Error("request failed");
        }
        return response.json() as Promise<{ id: string }>;
    },
    { concurrency: "latest" },
);

if (isBrowserEnvironment()) {
    await loadUser.execute("42");
}

CDN

Docs: https://sometic.dev/primitives/core.

Simple script

<script src="https://cdn.jsdelivr.net/npm/@sometic/[email protected]/dist/cdn/sometic-core.iife.js"></script>
<script>
    const id = SometicCore.createId();
</script>

Module script

<script type="module">
    import { createId } from "https://cdn.jsdelivr.net/npm/@sometic/[email protected]/dist/cdn/sometic-core.esm.js";

    const id = createId();
</script>

Peers / when not to use

No peer dependencies. Do not treat core as a UI kit or className helper. Prefer @sometic/events for typed pub/sub and @sometic/store for application state. Skip core only if you are not integrating with Sometic at all.

Docs

License

MIT