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

@tastic/core

v0.2.0

Published

Required foundation for @tastic/* game packages: Vec2 and vector math, clamp, a dt-clamped RAF game-loop hook, and environment-capability detection (touch-primary vs. keyboard-likely)

Readme

@tastic/core

Required foundation for @tastic/* game packages. Every other @tastic/* package (present and future — @tastic/physics, @tastic/input, and so on) can assume this is available and depends on it directly, so anything genuinely domain-agnostic lives here rather than being duplicated in whichever package happens to need it first.

What it does

  • Vec2 — a {x, y} type plus add/subtract/scale/length/distance/dot/normalize. Used by collision/force math, drag/aim-vector tracking, and board/layout geometry alike, so it doesn't belong to any one of those.
  • clamp(value, min, max) — keep a number within a range.
  • computeClampedDt(timestamp, lastTimestamp, maxDt) — turns the raw gap between two requestAnimationFrame timestamps into a frame-rate-independent, clamped dt multiplier, so a single simulation/tick step never represents more time than maxDt nominal frames even after a stutter or a background/foreground cycle.
  • useGameLoop(onTick, { enabled, maxDt }) — drives onTick(dt) once per frame via requestAnimationFrame for as long as enabled is true, using computeClampedDt internally. Game-specific gating (pause state, game phase) stays out of the hook — compute your own enabled boolean and pass it in.
  • useIsTouchPrimaryDevice() — best-effort environment-capability detection: is this player likely on touch (native, or a touch-primary web viewport) vs. likely to have a keyboard/mouse (a wide-viewport web browser with a fine pointer)? Useful for deciding whether to offer a keyboard-scheme picker or lean on touch/swipe controls. Always true on native.

Usage

import { clamp, computeClampedDt, distance, useGameLoop, useIsTouchPrimaryDevice, type Vec2 } from '@tastic/core'

function useMyGameLoop(step: (dt: number) => void, enabled: boolean) {
  useGameLoop(step, { enabled, maxDt: 2.5 })
}

Install (local dev via yalc)

Not published to the public npm registry yet.

cd react-native-game-core
npm run build
yalc publish

cd ../your-game
yalc add @tastic/core
npm install

Re-run npm run build && yalc push from this package after any change to propagate it to every linked consumer at once.

Peer dependencies

react (>=19.0.0) — required for the whole package. Vec2/clamp/computeClampedDt are plain, dependency-free TypeScript in source, but the package ships as one bundle alongside useGameLoop/useIsTouchPrimaryDevice, so react is needed to load any of it. This is a React Native toolkit either way, so every real consumer already has react installed regardless.