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

astro-viewer

v3.3.0

Published

Astrobrowser 3d engine.

Readme

🌌 AstroViewer

License: Dual TypeScript WebGL

AstroViewer is a lightweight 3D engine for HiPS (Hierarchical Progressive Surveys) visualisation and exploration, written in TypeScript and WebGL.
It powers the next generation of Astrobrowser and provides a simple API for embedding 3D HiPS viewers, catalogue overlays, footprints, and camera/navigation controls in any web project.

Licensing

AstroViewer is distributed under a dual-license model:

  • a commercial license for proprietary or revenue-generating use
  • a separate non-commercial, source-available license for personal, academic, research, evaluation, or other non-commercial use

The non-commercial option is not an OSI open source license. See LICENSE.md, LICENSE-COMMERCIAL.md, and LICENSE-NONCOMMERCIAL.md for the repository-level licensing structure.

The commercial posture of astro-viewer also depends on the licensing alignment of its first-party dependency chain. See DEPENDENCY-LICENSING.md.


📦 Bundles

AstroViewer builds the following bundles in the dist/ directory:

| File | Description | |------|--------------| | astroviewer.js | UMD bundle for browser environments | | astroviewer.min.js | Minified UMD bundle | | astroviewer.cjs | CommonJS build for Node.js | | *.map | Source maps for debugging |


🪐 Quick Start (Browser)

Copy the bundle into your project and link it in your HTML page:

<script src="./javascripts/astroviewer.js"></script>

Then you can use the global astroviewer object directly.
Here is a minimal example that loads a HiPS survey and starts the viewer.

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>AstroViewer Demo</title>
  <script src="./javascripts/astroviewer.js"></script>
</head>
<body onload="run();">
  <canvas id="astrocanvas"></canvas>
  <script>
    let window.AstroAPI = undefined;

    async function run() {
      const AC = new astroviewer.AstroViewer();
      window.AstroAPI = AC;

      const hipsUrl = "https://alasky.cds.unistra.fr/DSS/DSSColor/";
      const resp = await fetch(hipsUrl + "properties");
      const propsText = await resp.text();

      const desc = new astroviewer.HiPSDescriptor(propsText, hipsUrl);
      window.AstroAPI.activateHiPS(desc);
      window.AstroAPI.run();
    }
  </script>
</body>
</html>

🧩 Node.js / TypeScript Usage

You can also use AstroViewer as a Node module:

npm install astro-viewer

Then import from your code:

// ESM
import { AstroViewer, HiPSDescriptor } from 'astro-viewer';

// or CommonJS
const { AstroViewer, HiPSDescriptor } = require('astro-viewer');

🧪 Development Web Interface

AstroViewer includes a development web UI to explore features such as HiPS loading, FoV control, catalogue management, and footprints.
You need Node.js ≥ 22 installed.

Clone this repository and run:

npm run all

This command will:

  • Compile the TypeScript source
  • Build the bundles
  • Prepare the web testing interface
  • Start a local web server

You should see output similar to:

Serving HTTP on 0.0.0.0 port 8080

Then open one of the links in your browser (e.g. http://127.0.0.1:8080) to start exploring AstroViewer.


🛠️ Build Scripts

| Command | Description | |----------|--------------| | npm run clean | Remove dist and lib-esm directories | | npm run dev | Build in development mode and watch for changes | | npm run prod | Production build (minified and with source maps) | | npm run web | Copy bundles and assets into the public folder | | npm run all | Full build + launch development web UI |


📚 API Overview

Main exported classes and utilities:

  • AstroViewer — main application controller
  • HiPSDescriptor — handles HiPS metadata and configuration
  • FootprintSetGL — renders observation footprints
  • CatalogueGL — renders astronomical catalogues
  • FoV and related geometry/color-map utilities — camera and rendering helpers


🔧 API Reference & Usage

Below is a practical overview of the most commonly exposed methods via the UMD global astroviewer (browser) or the module exports (Node/ESM).

Note: The bundles only include what is exported from src/index.ts. If your build exposes additional methods, follow the same patterns shown here.

Core Lifecycle

new AstroViewer(options?)

Create the viewer controller.

// Browser (UMD)
const AC = new astroviewer.AstroViewer({
  canvas: document.getElementById('astrocanvas'), // optional; defaults to #astrocanvas
  antialias: true                                  // optional
});
// Node/ESM
import { AstroViewer } from 'astro-viewer';
const AC = new AstroViewer();

run()

Start the render loop and event handling.

AC.run();

HiPS Datasets

activateHiPS(descriptor: HiPSDescriptor)

Activate a HiPS dataset for rendering.

const hipsUrl = "https://alasky.cds.unistra.fr/DSS/DSSColor/";
const props = await (await fetch(hipsUrl + "properties")).text();
const desc = new astroviewer.HiPSDescriptor(props, hipsUrl);

AC.activateHiPS(desc);

toggleInsideSphere()

Toggle the point-of-view (outside vs inside the HiPS sphere).

AC.toggleInsideSphere();   // outside <-> inside

Camera & Navigation

goTo(raDeg: number, decDeg: number)

Move the camera to a sky coordinate (ICRS).

AC.goTo(287.0, 12.5);

Overlays & Grids

toggleHealpixGrid()

Show/hide the HEALPix grid overlay.

AC.toggleHealpixGrid();

Catalogues

showCatalogue(catalogue: CatalogueGL)

Render a catalogue layer.

AC.showCatalogue(cat);

hideCatalogue(catalogue: CatalogueGL, isVisible: boolean)

Toggle visibility without removing it.

AC.hideCatalogue(cat, false);  // hide
AC.hideCatalogue(cat, true);   // show

deleteCatalogue(catalogue: CatalogueGL)

Remove a catalogue layer completely.

AC.deleteCatalogue(cat);

changeCatalogueColor(catalogue: CatalogueGL, hexColor: string)

Change the colour of rendered catalogue points/sources.

AC.changeCatalogueColor(cat, "#ff8800");

Footprints (Observations)

The following methods mirror the catalogue API, but for observation footprints.

showFootprintSet(footprintSet: FootprintSetGL)

const footprints = tapRepo.obsList.find(o => o.name === "observations.some_collection");
AC.showFootprintSet(footprints);

hideFootprintSet(footprintSet: FootprintSetGL, isVisible: boolean)

AC.hideFootprintSet(footprints, false); // hide
AC.hideFootprintSet(footprints, true);  // show

deleteFootprintSet(footprintSet: FootprintSetGL)

AC.deleteFootprintSet(footprints);

changeFootprintSetColor(footprintSet: FootprintSetGL, hexColor: string)

AC.changeFootprintSetColor(footprints, "#00ffaa");

Events & Utilities (if exported)

Depending on your build, you may also have helpers like:

getCenterCoordinates()

Return the current ICRS center of the viewport.

const coords = AC.getCenterCoordinates();

toggleInsideSphere()

AC.toggleInsideSphere();

If a method above is not present in your build, it means it’s not exported by src/index.ts.
To inspect what’s available in the UMD build, open your page and run:

console.log(Object.keys(astroviewer));
console.log(Object.getOwnPropertyNames(astroviewer.AstroViewer.prototype));

📜 License

This repository uses a dual-license model.
Commercial use requires a separate written agreement.
Non-commercial use is available under the source-available terms in LICENSE-NONCOMMERCIAL.md.
See also LICENSE.md and LICENSE-COMMERCIAL.md.


🔗 Links