@mirasen/react-chessboard 1.1.1 → 1.2.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
@@ -298,10 +298,25 @@ When `true`, promotion automatically selects a queen. When omitted or `false`, t
298
298
 
299
299
  ### `checkSquare`
300
300
 
301
- Highlights the king's square when in check. Pass the king's square string (e.g. `'e1'`) to show a red glow; pass `null` or omit to clear it. The chessboard does not detect check itself — your rules layer (e.g. `chess.js`) is responsible for determining when and which square to highlight.
301
+ Type: `SquareString | ColorInput | null`
302
+
303
+ Highlights the king's square when in check with a red radial glow. Pass `null` or omit to remove the highlight. The chessboard does not detect check itself — your rules layer (e.g. `chess.js`) is responsible for determining when to apply it.
304
+
305
+ Two forms are accepted:
306
+
307
+ **Color shorthand** — pass the side to move (`'w'`/`'b'` or `'white'`/`'black'`); the extension auto-locates the king on the board. Recommended when integrating with a rules engine like chess.js:
308
+
309
+ ```tsx
310
+ <Chessboard
311
+ checkSquare={chess.isCheck() ? chess.turn() : null}
312
+ ...
313
+ />
314
+ ```
315
+
316
+ **Explicit square** — pass the king's square string directly if you already know it:
302
317
 
303
318
  ```tsx
304
- <Chessboard checkSquare={chess.isCheck() ? kingSquare : null} ... />
319
+ <Chessboard checkSquare={chess.isCheck() ? 'e1' : null} ... />
305
320
  ```
306
321
 
307
322
  ### `className` and `style`
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Chessboard as CoreChessboard, ColorInput, MovabilityInput, MoveOutput, MoveRequestInput, PositionInput, SquareString } from '@mirasen/chessboard';
1
+ import type { ColorInput, Chessboard as CoreChessboard, MovabilityInput, MoveOutput, MoveRequestInput, PositionInput, SquareString } from '@mirasen/chessboard';
2
2
  import type { CSSProperties } from 'react';
3
3
  export type ChessboardHandle = CoreChessboard;
4
4
  export type BoardOrientation = ColorInput;
@@ -17,7 +17,7 @@ export type ChessboardProps = {
17
17
  movability?: MovabilityInput;
18
18
  onUIMove?: (move: MoveOutput) => void;
19
19
  autoPromoteToQueen?: boolean;
20
- checkSquare?: SquareString | null;
20
+ checkSquare?: SquareString | ColorInput | null;
21
21
  className?: string;
22
22
  style?: CSSProperties;
23
23
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mirasen/react-chessboard",
3
3
  "description": "A React chessboard component with built-in interaction, promotion, animation, and chess.js integration.",
4
- "version": "1.1.1",
4
+ "version": "1.2.1",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "mirasen",
@@ -15,7 +15,7 @@
15
15
  "typescript",
16
16
  "svg"
17
17
  ],
18
- "homepage": "https://mirasen.io/chessboard/",
18
+ "homepage": "https://mirasen.io/chessboard",
19
19
  "repository": {
20
20
  "type": "git",
21
21
  "url": "git+https://github.com/mirasen-io/react-chessboard.git"
@@ -56,12 +56,12 @@
56
56
  "LICENSE"
57
57
  ],
58
58
  "dependencies": {
59
- "@mirasen/chessboard": "^1.4.0"
59
+ "@mirasen/chessboard": "^1.5.0"
60
60
  },
61
61
  "peerDependencies": {
62
+ "chess.js": "^1.4.0",
62
63
  "react": ">=18",
63
- "react-dom": ">=18",
64
- "chess.js": "^1.4.0"
64
+ "react-dom": ">=18"
65
65
  },
66
66
  "peerDependenciesMeta": {
67
67
  "chess.js": {
@@ -69,28 +69,28 @@
69
69
  }
70
70
  },
71
71
  "devDependencies": {
72
- "@changesets/cli": "^3.0.0",
73
- "@eslint/compat": "^2.0.0",
72
+ "@changesets/cli": "^3.0.3",
73
+ "@eslint/compat": "^2.1.1",
74
74
  "@eslint/js": "^10.0.1",
75
- "@testing-library/react": "^16.3.2",
76
- "@types/node": "^26.0.0",
77
- "@types/react": "^18.3.0",
78
- "@types/react-dom": "^18.3.0",
79
- "@vitest/coverage-v8": "^4.0.3",
80
- "eslint": "^10.0.2",
81
- "eslint-config-prettier": "^10.1.2",
82
- "globals": "^17.4.0",
83
- "jsdom": "^30.0.0",
84
- "prettier": "^3.5.3",
85
- "publint": "^0.3.11",
86
- "react": "^18.3.1",
87
- "react-dom": "^18.3.1",
88
- "rimraf": "^6.0.1",
75
+ "@testing-library/react": "^16.3.3",
76
+ "@types/node": "^26.6.3",
77
+ "@types/react": "^19.3.0",
78
+ "@types/react-dom": "^19.3.0",
79
+ "@vitest/coverage-v8": "^5.0.2",
80
+ "eslint": "^10.11.0",
81
+ "eslint-config-prettier": "^10.1.8",
82
+ "globals": "^17.12.0",
83
+ "jsdom": "^30.1.1",
84
+ "prettier": "^3.9.9",
85
+ "publint": "^0.3.24",
86
+ "react": "^19.3.0",
87
+ "react-dom": "^19.3.0",
88
+ "rimraf": "^6.1.3",
89
89
  "typescript": "^6.0.3",
90
- "typescript-eslint": "^8.57.2",
91
- "vitest": "^4.0.3"
90
+ "typescript-eslint": "^8.70.1",
91
+ "vitest": "^5.0.0"
92
92
  },
93
93
  "engines": {
94
- "node": ">=20"
94
+ "node": ">=22"
95
95
  }
96
96
  }