pts 0.12.9 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,80 +1,92 @@
1
- # Pts
2
-
3
- ![image](./assets/pts-gif-10.gif)
4
-
5
- Pts is a typescript/javascript library for visualization and creative-coding.
6
-
7
- **Get started at [ptsjs.org](https://ptsjs.org)**.
8
-
9
- Please give it a try, [file issues](https://github.com/williamngan/pts/issues), and send feedbacks to [@williamngan](https://twitter.com/williamngan). Thank you!
10
-
11
- ---
12
-
13
- ### Usage
14
-
15
- **Option 1**
16
- Get the latest `pts.js` or `pts.min.js` (in [dist](https://github.com/williamngan/pts/tree/master/dist) folder). Alternatively use a CDN service like [cdnjs](https://cdnjs.com/libraries/pts) or [jsdelivr](https://cdn.jsdelivr.net/gh/williamngan/pts/dist/pts.min.js) or [unpkg](https://unpkg.com/pts/dist/pts.min.js). Then add it to your html page like this:
17
- ```html
18
- <script type="text/javascript" src="path/to/pts.js"></script>
19
- ```
20
- Pts is pretty lightweight. Currently at ~100kb minified and 30kb gzipped.
21
-
22
-
23
- **Option 2:**
24
- Install via `npm install pts`. Then you can choose to import some parts of Pts into your project as needed.
25
- ```js
26
- import {CanvasSpace, Pt, Group, Line} from 'pts';
27
- ```
28
-
29
- To quickly get started, try download or clone these repos:
30
- - [pts-starter-kit](https://github.com/williamngan/pts-starter-kit): Get started with a sample app using npm and webpack
31
- - [pts-react-example](https://github.com/williamngan/pts-react-example): Try an example of using Pts with React.
32
- - [react-pts-canvas](https://www.npmjs.com/package/react-pts-canvas): Use it in your React project by extending react-pts-canvas component
33
-
34
- **Get Started**
35
- Read the [guides](https://ptsjs.org/guide/get-started-0100) and take a look at the [demos](https://ptsjs.org/demo/?name=circle.intersectCircle2D) and their source code.
36
- If you need help, please don't hesitate to [file an issue](https://github.com/williamngan/pts/issues).
37
-
38
- ---
39
-
40
- ### For development
41
-
42
- Pts is written in typescript. You can clone or fork this project and build it as follows:
43
-
44
- #### Build and test
45
-
46
- Clone this repo and install dependencies via `npm install`.
47
-
48
- ```bash
49
- npm start
50
- npm run build
51
- npm test
52
- ```
53
-
54
- #### Generate documentations
55
- Run this to generate Pts styled documentations. (Requires python 3.6)
56
- ```bash
57
- npm run docs
58
- ```
59
-
60
- If you prefer to generate default typedocs, run this:
61
- ```bash
62
- typedoc --readme none --out typedocs src --name Pts
63
- ```
64
-
65
- ---
66
-
67
- ### Contributing
68
-
69
- We appreciate your support and feedbacks!
70
-
71
- Please file issues if you find bugs and have feature requests. If you are able to send small PRs to improve Pts or fix bugs, that would be awesome too.
72
-
73
- For larger PRs, please ping [@williamngan](https://twitter.com/williamngan) to discuss first.
74
-
75
- ---
76
-
77
- ### License
78
- Apache License 2.0. See LICENSE file for details.
79
- Copyright © 2017-today by William Ngan and contributors.
80
-
1
+ # Pts
2
+
3
+ ![Pts examples](https://raw.githubusercontent.com/williamngan/pts/master/assets/pts-gif-10.gif)
4
+
5
+ Pts is a TypeScript and JavaScript library for visualization and creative coding.
6
+
7
+ **Get started at [ptsjs.org](https://ptsjs.org).** Please try it, [file issues](https://github.com/williamngan/pts/issues), and send feedback to [@williamngan](https://twitter.com/williamngan).
8
+
9
+ ## Usage
10
+
11
+ ### Browser script
12
+
13
+ Download `pts.js` or `pts.min.js` from the [dist directory](https://github.com/williamngan/pts/tree/master/dist), or use a CDN such as [cdnjs](https://cdnjs.com/libraries/pts), [jsDelivr](https://cdn.jsdelivr.net/npm/pts/dist/pts.min.js), or [unpkg](https://unpkg.com/pts/dist/pts.min.js).
14
+
15
+ ```html
16
+ <script src="path/to/pts.min.js"></script>
17
+ ```
18
+
19
+ The classic script exposes the library as `globalThis.Pts`.
20
+
21
+ ### Package
22
+
23
+ Install the package:
24
+
25
+ ```bash
26
+ npm install pts
27
+ ```
28
+
29
+ Pts is ESM-first and also provides a CommonJS compatibility entry.
30
+
31
+ ```js
32
+ import { CanvasSpace, Group, Line, Pt } from "pts";
33
+ ```
34
+
35
+ ```js
36
+ const { CanvasSpace, Group, Line, Pt } = require("pts");
37
+ ```
38
+
39
+ Starter projects and integrations:
40
+
41
+ - [pts-starter-kit](https://github.com/williamngan/pts-starter-kit)
42
+ - [pts-react-example](https://github.com/williamngan/pts-react-example)
43
+ - [react-pts-canvas](https://www.npmjs.com/package/react-pts-canvas)
44
+
45
+ Read the [guides](https://ptsjs.org/guide/Get-started-0100.html) and explore the [demos](https://ptsjs.org/demo/?name=circle.intersectCircle2D).
46
+
47
+ ## Development
48
+
49
+ The maintained build environment is Node 24.18 or newer in the Node 24 line. The published library is also exercised on current Node 20 and 22 releases.
50
+
51
+ ```bash
52
+ pnpm install --frozen-lockfile
53
+ pnpm exec playwright install chromium
54
+ pnpm check
55
+ ```
56
+
57
+ Useful individual commands include:
58
+
59
+ ```bash
60
+ pnpm build
61
+ pnpm typecheck
62
+ pnpm test
63
+ pnpm test:browser
64
+ pnpm test:integrations
65
+ pnpm check:package
66
+ pnpm format
67
+ pnpm format:watch
68
+ ```
69
+
70
+ `pnpm check` 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 the maintained React, Vue, `skia-canvas`, and single-file vanilla fixtures in [`test/integrations`](./test/integrations).
71
+
72
+ Prettier defines the repository's formatting rules. Run `pnpm format` once or keep `pnpm format:watch` running to reformat 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.
73
+
74
+ ### Generate documentation
75
+
76
+ 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`](./docs.md), [`guide.md`](./guide.md), and [`llms.txt`](./llms.txt) for agents and other clients that cannot navigate the documentation SPA:
77
+
78
+ ```bash
79
+ pnpm run docs
80
+ ```
81
+
82
+ 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.
83
+
84
+ ## Contributing
85
+
86
+ Issues and small pull requests are welcome. For larger changes, please start a discussion with [@williamngan](https://twitter.com/williamngan).
87
+
88
+ ## License
89
+
90
+ Apache License 2.0. See [LICENSE](./LICENSE).
91
+
92
+ Copyright © 2017-present William Ngan and contributors.