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

@axis-dsl/desmos

v2.5.0

Published

The Desmos calculator API: its TypeScript surface, its constants, and the script URL every host loads

Readme

@axis-dsl/desmos

The Desmos calculator API, typed: its TypeScript surface, its style enums, and the script URL every host loads. Written for Axis, useful to anything that drives Desmos from TypeScript.

npm install @axis-dsl/desmos

Desmos ships no types, so these are hand-written against the API docs for the version every host loads, DESMOS_API_VERSION. Nothing is bundled or vendored — the calculator itself is loaded at runtime from desmos.com with your API key.

Usage

import {
  AXIS_DESMOS_API_KEY,
  desmosScriptUrl,
  type Calculator,
  type DesmosNamespace,
  type DesmosExpression,
} from '@axis-dsl/desmos';

const script = document.createElement('script');
script.src = desmosScriptUrl(AXIS_DESMOS_API_KEY);
script.onload = () => {
  const Desmos = (window as unknown as { Desmos: DesmosNamespace }).Desmos;
  const calculator: Calculator = Desmos.GraphingCalculator(element, { expressions: false });

  const expressions: DesmosExpression[] = [
    { id: 'f', type: 'expression', latex: 'y=x^2', color: '#c74440' },
  ];
  calculator.setExpressions(expressions);
};

Note which setter you are calling. Desmos has two shapes for an expression: setExpression takes the API's, and setState takes the serialized graph state's — and only the latter carries a folder. Axis applies everything with setState for that reason. Expression types both, so the properties that belong to just one are marked: sliderBounds and playing are the API's, slider, folderId and clickableInfo are the state's. A property given to the wrong setter is dropped rather than reported.

AXIS_DESMOS_API_KEY is the Axis project's own key, which the extension, the playground, the docs site and the harness all default to. Anything you build and ship yourself should use your own - get one at desmos.com/api.

Not only types

The style enums and the API constants are real runtime values, which is why this is a package rather than a .d.ts:

import { LineStyle, PointStyle, DESMOS_SCRIPT_ORIGIN } from '@axis-dsl/desmos';

const dashed = { id: 'g', type: 'expression', latex: 'y=x', lineStyle: LineStyle.DASHED };

DESMOS_SCRIPT_ORIGIN is the one a host that sandboxes the calculator has to name in its Content-Security-Policy.

API

| Export | | | -------------------------------------------------------------------------- | ----------------------------------------------------------------------- | | DesmosNamespace | The window.Desmos global installed by calculator.js | | Calculator / BasicCalculator | A calculator instance and its methods | | CalculatorOptions and the other option interfaces | What the constructors take | | ExpressionState (Expression, Table, Note, Folder, GraphImage) | The five things a graph's expression list is made of | | TickerState, SliderState, ClickableInfo, TableColumn, … | The pieces of a graph state they carry | | LineStyle, PointStyle, DragMode, LabelOrientation, AxisArrowMode | The style enums, as runtime values | | GraphState, MathBounds, ScreenshotOptions, HelperExpression, … | The rest of the runtime surface | | DesmosProduct / stateProduct(state) / DESMOS_PRODUCT_CONSTRUCTORS | Which calculator a state belongs to, and the constructor that builds it | | desmosScriptUrl(apiKey) | The calculator.js URL for a key | | DESMOS_API_VERSION / DESMOS_SCRIPT_ORIGIN / DESMOS_DOCS_URL | The version these types are written against, and where it is served | | AXIS_DESMOS_API_KEY | The Axis project's key, every Axis host's default |

MIT