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

@domecs/core

v1.0.0

Published

DOMECS core: World, entities, components, queries, systems, events, time.

Readme

@domecs/core

Core DOMECS runtime: entities, components, queries, systems, events, plugins, time, RNG, and snapshots.

DOMECS is an ECS-first framework for DOM-heavy browser apps and games. This package is intentionally renderer-agnostic; pair it with @domecs/dom for DOM views and @domecs/input for browser input collection.

Status: v1.0 — stable.

Install

npm install @domecs/core

Quick start

import {
  createWorld,
  defineComponent,
  entry,
  Has,
  type World,
} from '@domecs/core'

const Position = defineComponent<{ x: number; y: number }>('Position')
const Velocity = defineComponent<{ dx: number; dy: number }>('Velocity')

const world = createWorld({ seed: 123, fixedStep: 1 / 60 })

world.spawn([
  entry(Position, { x: 0, y: 0 }),
  entry(Velocity, { dx: 1, dy: 0 }),
])

world.system(
  'move',
  { schedule: 'fixed', query: [Position, Velocity] },
  ({ world }) => {
    const w = world as World
    for (const { id, value: pos } of w.iterEntitiesWith(Position)) {
      const vel = w.getComponent(id, Velocity)
      if (!vel) continue
      pos.x += vel.dx
      pos.y += vel.dy
      w.markChanged(id, Position)
    }
  },
)

world.step(1 / 60)

for (const entity of world.query(Has(Position)).entities) {
  console.log(entity.id, entity.Position)
}

Main API

  • createWorld(options) — create an ECS world.
  • defineComponent<T>(name, options?) — define typed component handles.
  • defineResource<T>(name, options?) — define a world-level named value (score, level, gravity); world.getResource(R) / setResource(R, v) / markResourceChanged(R). React to changes with OnChangedResource(R).
  • entry(component, value) — typed helper for heterogeneous spawn arrays.
  • world.spawn(...) / world.despawn(...) — manage entities.
  • world.addComponent(...), getComponent(...), removeComponent(...) — manage component data.
  • world.query(...) / world.observe(...) — query and observe entity sets.
  • Query helpers: Has, Not, Or, And, OnAdded, OnRemoved, OnChanged, Where, OnChangedResource.
  • world.system(name, def, fn) — register tick, fixed, event, once, or reactive systems.
  • defineEvent<T>(name), world.emit(...), world.on(...) — buffered events.
  • world.turn(type, payload, dt?) — fire-and-forget turn-based command.
  • world.action(type, payload, opts?) — turn-based command with a structured { accepted, consumedTurn, reason?, events, snapshot? } result; the verdict comes from an optional opts.resolve.
  • world.snapshot() / world.restore(...) — serialize and restore world state.
  • world.use(plugin) — install plugins.

Related packages

  • @domecs/dom — retained-mode DOM renderer.
  • @domecs/input — browser input collector plugin.

License

MIT