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

@cesarvenzac/figures

v0.1.4

Published

Small 3D figures for the agents in your interface: a cube, a sphere, a pyramid, a block or a cloud with two eyes, saying what each is doing with their eyes and the way they move.

Readme

@cesarvenzac/figures

Small figures for the agents in your interface: a cube, a sphere, a pyramid, a block or a cloud, really in 3D, with two eyes painted on its face.

The five figures, a cube, a sphere, a pyramid, a block and a cloud, in the same mood at once: thinking, the cube solving itself like a Rubik's cube; at work; then done, with stars for eyes as the cube bursts, the sphere splashes, the pyramid launches its capstone, the block spins its dials and the cloud gets a rainbow

They have no mouth, arms or hats. They say everything with their eyes and the way they move, as Anki's Cozmo does: lids cut into the eyes for each expression, or the eyes become a shape (^ ^, stars, hearts, × ×), the head turning and tipping with them. Each shape has acts of its own: the cube solves itself like a Rubik's cube while it thinks, the block turns its dials like a cryptex, the pyramid's capstone floats, the sphere has moons, the cloud rains while it works. Give one a mood and it shows it, and reacts as it changes: it celebrates a finished run, loses its colour at a failed one, yawns when it's switched off.

The docs are at cesarvenzac.com/figures, and the figures to make, pet and watch in the Lab.

npm install @cesarvenzac/figures

Use

import { figureFor } from "@cesarvenzac/figures";
import { AgentFigure } from "@cesarvenzac/figures/react";

const ada = figureFor("Ada"); // { shape: "sphere", energy: "calm", habit: "wave", palette: 6 }

<AgentFigure figure={ada} mood="thinking" size={48} />;

A figure is four choices, plain data you can store: its shape (cube, sphere, pyramid, block, cloud), its energy (calm, lively, bouncy: how big and quick it moves), its habit (what it does while it waits: look, hum, nap, spin, wave, morph) and its palette (a colourway, 1 to 8). figureFor(word) makes one from any word, the same word the same figure every time, so an agent's name is enough. readFigure(value) reads a stored one back, filling in anything missing or unknown; isFigure(value) says whether a value is a whole figure.

Moods

What the agent it stands for is doing. Each mood has its expression and its loop:

| Mood | Shows | | --- | --- | | idle | Waiting: breathing, blinking, doing its habit now and then | | thinking | Setting up: looking up and aside, the cube scrambling and solving itself | | working | At work: eyes narrowed and scanning, each shape busy its own way | | happy | Done, something to look at: happy eyes, turning into a star now and then | | trouble | In trouble: squeezed eyes, worrying, shaking now and then | | sleep | Switched off: eyes shut, grey and dim, z's |

As the mood changes it reacts (reactionTo(from, to) says which): to sleep, it dozes off, and from sleep to any other mood, it wakes; to happy, it celebrates (the cube bursts and snaps back, the sphere splashes, the pyramid launches its capstone, the block spins its dials like a slot machine, the cloud gets a rainbow); to trouble, it fails; into work (thinking or working, from neither), it gets going; and from happy back to idle, its finished run seen to, it nods. Between thinking and working, or to idle from thinking, working or trouble, it carries on without one.

AgentFigure

<AgentFigure
  figure={ada}
  mood="working"
  size={48} // its box, in pixels; the canvas overhangs it for its halo, shadow and hops
  look // turns toward the pointer on a desktop (default true)
  react // smiles and bounces when the link or button it's in is hovered (default true)
  pet // clicked, it's petted, and the link it's in doesn't open (default true)
  grab={false} // dragged, it turns, springing home when let go
  still={false} // drawn once, never moving
  drain={0} // 0 to 1: greys it, for an agent running out of budget, say
/>

look, react, pet and grab work only while it moves: with still, under reduced motion and while it's off screen, a hover does nothing, it can't be turned, and a click isn't caught, so the link it's in opens as it would without it. Asleep (sleep), it doesn't look at the pointer or smile at a hover, and a click is caught but doesn't pet it.

To set it outright rather than by mood: expression (one of EXPRESSIONS: neutral, happy, sad, tired, thinking, working, listening, speaking, sleeping, surprised, trouble, love, excited, failed) and motion (a loop to move in, one of LOOPS). play makes a move once, and again whenever its at changes (or its motion): not as the page renders again, nor as the figure comes back on screen. One asked for while the figure holds still waits until it moves. Keep it in state and set it when the move is wanted:

import { useState } from "react";
import type { Once } from "@cesarvenzac/figures";

function Ada() {
  const [play, setPlay] = useState<{ motion: Once; at: number }>();
  return (
    <>
      <AgentFigure figure={ada} play={play} />
      <button onClick={() => setPlay({ motion: "spin", at: Date.now() })}>Spin</button>
    </>
  );
}

The moves are MOVES (hop, bounce, spin, turn, flip, nod, shake, wave, pop, melt, love) and the reactions REACTIONS (pet, celebrate, fail, start, doze, wake). aim ({ x, y }, −1 to 1 each way, right and down) says where it looks, in place of the pointer; lift (a function of the frame's time, 0 to 1) hops it off the ground as it walks, its shadow staying put. Both are read every frame. className and style go on its box, after its own styles.

Every figure on a page notices the others: when one is petted, finishes or fails, the rest turn to look, and now and then one glances at whichever is busy. A hover on a link or button the figure is in makes it smile; to react to another element's hover, mark it data-figure-host.

It's a drawing, hidden from assistive tech: put words beside it saying who it is and what it's doing. It holds still under reduced motion and while it's off screen. Until its shader is ready it's a flat drawing, from the server on, which the 3D one fades in over where it stands; where there's no WebGL 2 it stays flat.

Colours

Each colourway is three colours, main, light and deep, which its material flows through (COLOURWAYS: blue, green, sun, pink, violet, teal, orange, red). Give one your own with colours, and the eyes theirs with ink (INK, a near black, unless you do). Any CSS colour works, and a custom property is read from the page's root, so your tokens stay the one place they're said:

<AgentFigure figure={ada} colours={{ main: "var(--brand)", light: "var(--brand-light)", deep: "var(--brand-deep)" }} ink="var(--ink)" />

AgentDot is a figure's colours alone, as a dot, where a whole figure wouldn't read (a table's row): <AgentDot figure={ada} size={8} />, with colours too.

A still

svgOf(figure, expression?, colours?, size?, id?) writes a figure as an SVG file, seen from the front: for an email, a social card, anywhere a live figure can't go. It runs anywhere, Node included.

import { figureFor, svgOf } from "@cesarvenzac/figures";

svgOf(figureFor("Ada"), "happy", {}, 128); // '<svg xmlns="http://www.w3.org/2000/svg" …'

Cost

Every figure on a page is drawn by one WebGL 2 context, raymarching the shapes in a fragment shader, and copied onto its own canvas; the canvas is at most 512 device pixels across, and a figure is drawn every frame only while something happens, every other frame while it only breathes, and not at all off screen. They all share one frame loop and one pointer listener.

The shader is big, and a slow or software driver takes seconds over it (headless Chromium's SwiftShader spends two on its first draw), so it's made ready without holding up the page: compiled with KHR_parallel_shader_compile where the browser has it, else once the page is idle, then drawn once on a single pixel, each step waited for a frame at a time, never asked about before it's done. The page answers throughout; the figures show their flat drawings meanwhile.

Development

npm ci
npm test
npm run typecheck
npm run check # packed as npm publishes it, then installed and run as a user's would be

This repository is a copy. The package is developed inside the site it was made for, whose repository is private, and every release copies it here and publishes it to npm from here, with provenance. Issues are welcome; pull requests are read, and their changes made at the source.

Licence

MIT. The material is the one the site's Aura experiment drew, on MaterialX's Perlin noise.