@chessviewer-org/chess-viewer 1.0.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,48 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@chessvision-org/chess-vision` are documented here.
4
+ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versioning follows [Semantic Versioning](https://semver.org/).
5
+
6
+ ---
7
+
8
+ ## [Unreleased]
9
+
10
+ ### Added
11
+
12
+ - **`generateDiagram` `coordColor` option** — configurable rank/file coordinate
13
+ label color. Accepts a hex string or the names `'white'` / `'black'` (e.g. the
14
+ result of `themeCoordinateColor`), so coordinates stay legible on dark boards.
15
+ Defaults to `'#000000'` for backward compatibility.
16
+
17
+ ---
18
+
19
+ ## [1.0.0] - 2026-06-27
20
+
21
+ Initial public release of the ChessVision utility toolkit.
22
+
23
+ ### Added
24
+
25
+ - **`generateDiagram(options)`** — Self-contained SVG chess diagram from a FEN string. No DOM, no network. Supports coordinates, board flip, custom colors, thin frame, and accessible `aria-label`.
26
+ - **FEN parser** — `parseFEN()` returns an 8×8 `BoardMatrix`. Throws `FENParseError` on invalid input.
27
+ - **FEN validators** — `validateFEN()`, `getFENValidationError()`, `validateFENDetailed()` for quick checks and detailed user-facing error messages.
28
+ - **Full FEN record** — `parseFENRecord()` / `buildFENRecord()` parse and serialize all six FEN fields (board, side to move, castling, en passant, clocks), plus `toggleActiveColor()`, `fenPlacementField()`, and `normalizeFEN()`.
29
+ - **Board utilities** — `boardToFEN()`, `createEmptyBoard()`, `isBoardEmpty()`, `pieceToName()`, `describeBoardPosition()`.
30
+ - **Board manipulation** — pure, immutable helpers `cloneBoard`, `getPieceAt`, `setPieceAt`, `removePieceAt`, `movePiece`, `flipBoard`, `listPieces`, `countPieces`, `materialBalance`, `findKing`, `hasBothKings`. Squares accept algebraic strings or `[row, col]` indices.
31
+ - **Inline piece SVGs** — All 12 CBurnett/Lichess-style piece SVGs embedded (`getPieceSVG()`, `PIECES`). No CDN dependency.
32
+ - **Color utilities** — `hexToRgb`, `rgbToHex`, `rgbToHsv`, `hsvToRgb`, `hexToHsv`, `hsvToHex`, `relativeLuminance`, `contrastRatio`, `bestTextColor`.
33
+ - **Board themes** — `BOARD_THEMES` with 20 named themes (Classic, Ocean, Forest, …).
34
+ - **Piece sets** — `PIECE_SETS` (23 Lichess-compatible sets), `PIECE_SET_POPULARITY` ranking.
35
+ - **Quality presets** — `QUALITY_PRESETS` for print (300/600 DPI) and social (900/1200 DPI) export.
36
+ - **Theme & preset lookups** — `getBoardTheme`, `listThemeIds`, `getPieceSet`, `pieceSetsByPopularity`, `getQualityPreset`, `themeContrast`, `themeCoordinateColor`.
37
+ - **Constants** — `DEFAULT_LIGHT_SQUARE`, `DEFAULT_DARK_SQUARE`, `STARTING_FEN`, `EMPTY_FEN`.
38
+ - **Validation helpers** — `isValidHexColor`, `sanitizeHexColor`, `sanitizeFileName`, `sanitizeInput`, `safeJSONParse`, `isRecord`.
39
+ - **History utilities** — `createHistoryEntry`, `calculateStatus`, `touchEntry`, `sortByMostRecent`, `sortArchivedByArchiveDate`, `mergeById`, `applyFilters`, `partitionByArchiveStatus`, `convertToArchivedEntry` plus all associated types.
40
+ - **Coordinate math** — `squareToIndices`, `indicesToSquare`, `getSquareBounds`, `isLightSquare`, `getCoordinateParams`, `getDisplayCoordinates`.
41
+ - **Image utilities** — `readImageDimensions()` reads PNG/JPEG pixel dimensions straight from the header (no decoding, no DOM); `physicalSize()` converts pixels to print inches/mm at a given DPI.
42
+ - **DPI encoder** — `changeDPI()` rewrites PNG `pHYs` chunk and JPEG JFIF DPI metadata. Works in Node.js and browsers.
43
+ - Full TypeScript types shipped — no `@types/…` needed.
44
+ - Dual ESM + CJS build (`dist/index.js` + `dist/index.cjs`).
45
+ - 107 unit tests with the Node.js native test runner.
46
+
47
+ [Unreleased]: https://github.com/chessvision-org/chess-vision-utils/compare/v1.0.0...HEAD
48
+ [1.0.0]: https://github.com/chessvision-org/chess-vision-utils/releases/tag/v1.0.0