About this project
Pts is a TypeScript and JavaScript library aimed at visualization and creative coding. It provides primitives for drawing and animating on canvas, and is distributed both as a browser script and as an npm package.
Usage options
- Browser script: download pts.js or pts.min.js from the dist directory, or load from a CDN such as cdnjs, jsDelivr or unpkg. The classic script exposes the library as globalThis.Pts.
- Package: install with npm install pts. The library is ESM-first and also provides a CommonJS compatibility entry, so it can be imported with import { CanvasSpace, Group, Line, Pt } from "pts" or required with require("pts").
Starter projects and integrations listed in the README include pts-starter-kit, pts-react-example, and the react-pts-canvas npm package. Guides and demos are available on the project site.
Development
The maintained build environment is Node 24.18 or newer in the Node 24 line, and the published library is also exercised on current Node 20 and 22 releases. Setup uses pnpm install --frozen-lockfile, pnpm exec playwright install chromium, and pnpm check. Individual commands include build, typecheck, test, test:browser, test:integrations, check:package, format and format:watch.
The pnpm check command validates formatting, linting, types, unit tests, deterministic documentation, documentation and bundle behavior in a real browser, reproducible artifacts, the packed package, ESM and CommonJS resolution, declarations, and tree-shaking. Its packed-package integration suite also builds and runs maintained React, Vue, skia-canvas, and single-file vanilla fixtures under test/integrations.
Prettier defines the repository formatting rules. Running pnpm format once, or keeping pnpm format:watch running, reformats maintained source files as they change. The recommended VS Code extension and workspace settings also enable Prettier on save, while pnpm check rejects unformatted changes in CI.
Documentation generation
The documentation generator uses TypeDoc's Node API to rebuild the custom static documentation JSON from explicit source entry points. It also generates docs.md, guide.md, and llms.txt for agents and other clients that cannot navigate the documentation SPA. Generated documentation is checked in; pnpm check:docs regenerates it in memory, reports stale or extra files, and exercises navigation, search, anchors, and responsive layouts in Chromium.
Contributing and license
Issues and small pull requests are welcome; larger changes should start with a discussion with the maintainer. The project is licensed under Apache License 2.0, copyright 2017-present William Ngan and contributors.
Comments
0 Rating appears after 10 ratings
Sign in to join the discussion.