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

terrarium-renderer

v0.1.5

Published

Canvas land and water ecosystem scenes with nest inspection

Readme

terrarium-renderer

Canvas land and water ecosystem scenes, distinct plants and fruit, ground decorations, litter, decomposers, ten pot finishes, movement animation, plant tooltips and nest inspection. This package has no runtime dependencies and does not simulate, save, score or upload ecosystems.

import { createScene } from 'terrarium-renderer';
const renderer = createScene(canvas, 'en');
renderer.setState(snapshot);
// When the view is removed:
renderer.dispose();

Use an 800×500 canvas and scale its CSS width to fit the container. createScene includes a clickable 4×4 nest viewer; createLandRenderer draws without the viewer. createWaterScene draws fish and aquatic plants. Creating interactive viewers requires a browser document; importing the package does not access the DOM.

LandScene and WaterScene describe display snapshots. Supply gridSize (default 5), facility positions and enabled states. Nest snapshots supply foodCapacity for the storage label. Land plants supply their computed flower stage and optional seedHead flag. Sunflower and mint use separate stems, leaves and flowers; ladybugs have spotted red wing cases, and aphids and ladybugs are drawn on their current host plant; soil supplies computed daylight, and bugs supply flying. Optional plant health and land leafDamage drive foliage color, brown patches, wilting, transparent bite holes and edge notches. Missing condition fields retain healthy foliage with no inferred damage. The caller records feeding and regrowth; rendering never changes state. The caller owns these rules. Snapshots are never mutated. setState(snapshot, recordedAtMs) on the interactive land scene uses recorded time for nest hatching labels. Replay timing and page controls belong to the caller.

Run npm run build, npm run typecheck and npm test before publishing. Build output contains native ESM and TypeScript declarations.

Nest.size optionally expands the interior grid from 4×4 to 8×8; omitted values render 4×4. Extra Nest.entrances are surface coordinates opening the same colony. Large interiors scroll horizontally on narrow displays. Occupancy, expansion and filled-soil rules belong to the caller.

Water plants may supply a computed flower (bud or bloom); the renderer does not infer flowering from stage or age. Waterlilies have floating pads, hornwort has whorled foliage, and duckweed has paired fronds and hanging roots. Neon tetras have blue/red stripes; corydoras have spotted bodies and barbels. compost_bin renders a wooden land bin. These species add no simulation or runtime dependencies.

Daisies and lavender use caller-supplied flower stages and foliage health; bees and butterflies have distinct silhouettes. Optional water eggs carry coordinates, species, health and incubation hours, drawn as translucent eggs with growing embryos. Fish with juvenile: true use a smaller silhouette. The caller computes pollination, incubation and age; omitted fields preserve existing snapshots.

LandScene.economy.pots accepts plot coordinates and a pot kind: clay, porcelain, spring, slow, still, reservoir, drainage, shade, sun, or healing. The renderer draws silhouettes and motifs without applying effects.

watermelon, melon and wheat grow from stage like the other crops: a spreading vine with lobed leaves and a striped fruit, a compact vine with round leaves and a netted melon, and upright blades with golden ears from stage 2. fruitReady enlarges the watermelon and adds a pale patch, brightens the melon, and warms the wheat ears.

Land and water animation defaults to at most 30 frames per second and shares one animation-frame callback across canvases. setSceneActive(canvas, false) suspends a canvas without discarding its state; resume with true. setSceneFrameRate(canvas, fps) accepts 1–60. Removing or pausing every canvas cancels the shared callback. dispose() releases its scheduler registration. The caller controls page visibility and scroll pauses.

renderSceneFrame(canvas) paints the latest supplied state once without starting or resuming animation. It can prepare a preview before the canvas enters the viewport, including while scrolling. renderLandFrame(canvas, state) and renderWaterFrame(canvas, state, now?) paint a snapshot synchronously without creating a renderer; renderWaterFrame takes an optional timestamp for plant sway and fish tails.

Importing the package installs CanvasRenderingContext2D.roundRect when the engine lacks it, so drawing call sites stay unchanged. installCanvasPolyfills() is exported for hosts that import drawing modules directly.