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

@loader-kit/spec

v1.0.0

Published

Schema, built-in indicators and reference evaluator for LoaderKit indicator specs

Readme

@loader-kit/spec

The indicator spec of LoaderKit: loading indicators described as data and rendered natively on Android, iOS, macOS, Windows and the web.

This package holds what every engine shares:

  • the TypeScript types of a spec (schema version 1) and defineIndicator() to write one,
  • validate(), which lists every problem of a spec,
  • the 50 built-in indicators (BUILTIN_INDICATORS, BUILTIN_INDICATOR_NAMES),
  • the reference evaluator (evaluate(), prepareIndicator(), timeForCycleProgress()), whose output every engine must reproduce,
  • the JSON Schema of a spec, for editors and tools (@loader-kit/spec/schema.json),
  • the reference geometry of the progress indicators (resolveProgress(), progressCommands(), ProgressAnimator), which turns options and time into draw commands that every platform reproduces.

To draw indicators in a browser, use @loader-kit/web.

Install

npm install @loader-kit/spec

Write and check a spec

import { defineIndicator, validate } from '@loader-kit/spec';

export const Pulse = defineIndicator({
  name: 'Pulse',
  duration: 1,
  params: { count: 3 },
  layout: { type: 'row', count: { $param: 'count' }, gap: 0.1 },
  shape: { type: 'circle' },
  stagger: { each: 0.12 },
  tracks: [{ property: 'scale', keyTimes: [0, 0.5, 1], values: [1, 0.3, 1], easing: 'easeInOut' }],
});

validate(JSON.parse(userJson)); // [] when the spec is valid, else one message per problem

defineIndicator() throws an InvalidIndicatorError with the same messages.

Evaluate

import { BUILTIN_INDICATORS, prepareIndicator } from '@loader-kit/spec';

const indicator = prepareIndicator(BUILTIN_INDICATORS.BallPulse, { count: 5 });
indicator.evaluate(0.4); // the state of every element 0.4 s into the animation
indicator.evaluate(indicator.timeForCycleProgress(0.25)); // a frozen frame

Progress geometry

import { ProgressAnimator, progressCommands, resolveProgress } from '@loader-kit/spec';

const options = resolveProgress({ type: 'circular', variant: 'segmented' });
const animator = new ProgressAnimator(0);
animator.setValue(0.6, performance.now() / 1000, true); // glide to 0.6
animator.step(1 / 60, options.speed, false);            // once per frame
const { x, y, commands } = progressCommands(options, animator.state, 48, 48);

The commands (line, arc, polyline, circle, rect, strokeRect, polygon, sector, text, clip) use solid, linear, radial or conic paints. drawProgress() in @loader-kit/web draws them on a canvas.

Lite entry

@loader-kit/spec/lite has the same API without BUILTIN_INDICATORS and the progress drawing code (ProgressAnimator, progressCommands(), progressGridOrder(), progressHasAmbientMotion(), progressLabel() and the ProgressDrawing type). It is for hosts whose native views do the drawing, such as React Native, where the bundler keeps every module it reaches. BUILTIN_INDICATOR_NAMES is still there.

import { BUILTIN_INDICATOR_NAMES, resolveProgress, validate } from '@loader-kit/spec/lite';

JSON Schema

Spec files can name the schema so editors offer completion and checks:

{
  "$schema": "https://maitrungduc1410.github.io/loader-kit/schema/v1.json",
  "schemaVersion": 1,
  "name": "Pulse"
}

The same file ships in this package as @loader-kit/spec/schema.json. The schema catches typos and wrong types; rules that span several fields (such as keyTimes and values lengths) are checked by validate() only.

Built-in indicators are stable. Writing your own spec is experimental: the schema may change in a minor release until it is declared stable.

See the spec guide and the playground.

License

MIT