UNPKG

pointscape

Version:

Points manipulation: distance & angle helpers, collisions, shapes, array & math utilities — 2D coordinate system

97 lines (54 loc) 4.72 kB
# Changelog All notable changes to this project are documented in this file. ## [Unreleased] --- ## [2.3.0] — 2026-05-29 ### Breaking changes - **`scale` and `rotate` parameter order** — batch point transforms now take **`points` first**, consistent with `sort`, `center`, and `move` (single-point). Use `scale(points, scaleFactorX, scaleFactorY)` and `rotate(points, centerPoint, angleInRadians)` instead of the previous argument order. ### Fixed - **README navigation** — “Function reference” in the table of contents links to the function list; category entries link to Geometry / Positioning / Relationships / Math / Arrays / Randomization sections. ### Tooling - **Source maps**`tsup` build emits `.map` files alongside ESM/CJS output for easier debugging in consumers. - **Removed erroneous `dependencies.pointscape`** — the package no longer listed itself as an npm dependency. --- ## [2.2.0] — 2026-05-26 ### Breaking changes - **`farest` renamed to `farthest`** — the exported function and `Point.farestFromPoints` method are now `farthest` and `farthestFromPoints` respectively. Update all call sites. ### Added - **`triangleArea(point1, point2, point3)`** — computes the area of a triangle from three points. Previously an internal helper used by `area()`; now part of the public API. ### Tooling - **ESLint + Prettier** configured — `npm run lint`, `npm run lint:fix`, `npm run format`, `npm run format:check`. --- ## [2.1.1] — 2026-05-22 ### Fixes - **`tsconfig.json`** — added `"moduleResolution": "bundler"` to fix TypeScript module resolution for consumers using strict settings (`node16`, `nodenext`, `bundler`). --- ## [2.1.0] — 2026-05-22 ### Added - **`lerp(point1, point2, t)`** — linearly interpolates between two points. `t = 0` returns `point1`, `t = 1` returns `point2`, `t = 0.5` returns the midpoint. Values outside `[0, 1]` extrapolate. Useful for smooth movement, animation, and camera easing. - **Live demo page** at [arman2409.github.io/pointscape](https://arman2409.github.io/pointscape/) — interactive canvas demos for `collision`, `lerp`, `nearest`, `rotate`, `positionInCircle`, and `randomPoints`. ### Improvements - **`package.json` exports** restructured to include explicit `types` fields for both ESM and CJS, fixing TypeScript resolution in `bundler` and `node16` module modes. - **`sideEffects: false`** added — enables more aggressive tree-shaking in bundlers like webpack and Rollup. - **`engines: { "node": ">=18" }`** added — makes the Node 18 requirement machine-readable. ### Tooling - **`.nvmrc`** committed (`20`) — `nvm use` and `actions/setup-node` now work correctly. - **`dist/`** removed from the repository — built output is generated by `prepack` before `npm publish` and no longer clutters the git history. - **CI** switched from `npm ci` to `npm install` to avoid platform-specific rollup binary issues between macOS dev machines and Linux runners. - **`bun.lock` / `package-lock.json`** added to `.gitignore` — lock files are platform-specific and should not be committed. --- ## [2.0.0] — 2026-05-18 This is a **major** release so that projects using **`^1.x`** are not surprised by type or collision behavior changes ([SemVer](https://semver.org/)). ### Breaking changes - **`nearest`** returns **`Point | null`**. Empty input returns **`null`** instead of `{}`. Handle `null` everywhere you used to assume a `Point` (including **`Point.nearestFromPoints`**). - **`collision`** and **`collisionInArray`** use **Euclidean (circular) radius**. The same numeric arguments can yield **different** `true`/`false` results than 1.x if you relied on the old axis-aligned **box** check; retune thresholds or add a dedicated AABB helper if you need that shape. ### Fixes - **`collision`** now uses **Euclidean distance** (a true circular radius around each point). The previous implementation compared axis-aligned bounding boxes aligned to the second point, which incorrectly reported collisions near “corners” and did not match the documented behavior. - **`collisionInArray`** no longer imports from the package barrel (`index`), removing a fragile **circular dependency** at build/load time. ### Improvements - **`collision`** optional callback parameter is typed as **`() => void`** instead of `Function`. - **`collision`** compares squared distance internally (same semantics, avoids `Math.sqrt`). - **`Point.nearestFromPoints`** return type now matches **`nearest`** (`Point | null`). --- ## Earlier versions Older releases did not maintain a changelog in this repository. Compare tags or git history on [GitHub](https://github.com/Arman2409/pointscape) for prior changes.