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

@biolibs/bionet-space

v0.3.6

Published

Where things are in a lab: a tree of places, where each one stands and how big it is, the positions inside a box, where a camera should look, and what arranging by hand would have the lab say. Plain data and arithmetic, with nothing drawn

Readme

@biolibs/bionet-space

Where things are in a lab. A tree of places — rooms, freezers, shelves, racks, boxes, benches, instruments — with where each one stands and how big it is, the positions inside a box, what is stored where, and where a camera should stand to look at any of it. Plain data and arithmetic: nothing here draws anything, and nothing depends on React or three.js.

npm install @biolibs/bionet-space

A lab is a tree of places

import { arrange, type Layout } from "@biolibs/bionet-space";

const lab: Layout = {
  places: [
    { id: "room", kind: "room", name: "Main lab", parent: null, standing: { position: [0, 0, 0], size: [6, 3, 4] } },
    { id: "freezer", kind: "freezer", name: "−80", parent: "room" },
    { id: "box", kind: "box", name: "Box 1", parent: "freezer", grid: { rows: 9, columns: 9 } },
  ],
  stored: [{ item: "tube-1", place: "box", slot: { row: 0, column: 0 }, part: "p1", name: "pWren-402", amount: 20, unit: "µL" }],
};

const arranged = arrange(lab);
arranged.map((one) => one.place.id);      // [ "room", "freezer", "box" ]
arranged[2].path;                         // [ "room", "freezer", "box" ]

Sizes are in metres. A place that says where it stands is put there; one that does not is given a size for its kind and a spot inside its parent, so a lab that has only said "there is a freezer with these boxes" can still be drawn. That is what makes dimensions optional: they are lab data when a lab gives them and a sensible default when it has not.

Where to look, and where a part is

import { arrange, exampleLab, levelOf, poseFor, search } from "@biolibs/bionet-space";

const lab = exampleLab();                 // a made-up lab: a freezer, a fridge, benches, 72 boxes
const arranged = arrange(lab);

poseFor(arranged, null).target;           // the middle of the whole lab
levelOf(arranged.find((one) => one.place.id === "minus80"));   // "unit"
search(lab, "t7 promoter").length > 0;    // true

poseFor gives a camera position and target for the whole lab or any one place, turned with the place so a freezer facing a side wall is still seen from its front. search matches by name, ignoring case.

Positions in a box

slotCenter, slotSize, slotName (A1, B7) and firstFreeSlot work out a box's grid. storedWithin gives everything in a place however deep.

slotFrom("C4") reads a position the way it is written on a lid.

From a lab's own record

import { layoutFrom } from "@biolibs/bionet-space";

const layout = layoutFrom({
  places: [{ place: "f", kind: "freezer", name: "−80", parent: null, grid: null, standing: null, retired: false }],
  items: [], parts: [],
});
layout.places.map((one) => [one.id, one.parent]);   // [ [ "~room", null ], [ "f", "~room" ] ]

layoutFrom takes a lab as @biolibs/bionet records it — millimetres, retired places, items that may be nowhere — and gives a layout of what can be found. It asks for the lab by shape, so this package still depends on nothing. Places standing in no room are put in one made up for the purpose.

Arranging by hand

import { arrange, exampleLab, overlapping, standingAt, standingOf, sticking } from "@biolibs/bionet-space";

const arranged = arrange(exampleLab());
standingOf(arranged, "minus80")?.size;          // [ 0.9, 2, 0.85 ]
standingAt(arranged, "minus80", [3.1, 2.2]);    // the standing it would have with its base centred there
overlapping(arranged);                          // []  — pairs of places standing in each other
sticking(arranged);                             // []  — places stood partly outside what they are in

standingOf is the inverse of arrange: where a place stands as the lab would say it, measured from the place it is in, including for a place nobody has stood anywhere. standingAt is what a drag becomes: settled every 5 cm and kept inside the parent. standingUp is the same for a shelf, which moves up and down. quarterTurned turns one. None of them moves anything; they work out what would be said.