@mirasen/react-chessboard 1.1.1 → 1.2.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/README.md +17 -2
- package/dist/types.d.ts +2 -2
- package/package.json +4 -4
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
|
-
|
|
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() ?
|
|
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,
|
|
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.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"mirasen",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
"LICENSE"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@mirasen/chessboard": "^1.
|
|
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": {
|