react-chessboard-ui 2.14.0 → 3.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,8 +1,12 @@
1
- # react-chessboard-ui ♟️
1
+ # react-chessboard-ui
2
2
 
3
3
  [![NPM](https://img.shields.io/npm/v/react-chessboard-ui.svg)](https://www.npmjs.com/package/react-chessboard-ui)
4
4
  [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
5
5
 
6
+ React chessboard UI with a built-in chess engine, FEN-based state control, legal move handling, drag-and-drop pieces, game-end callbacks, and styling hooks.
7
+
8
+ Use it when you need a playable chessboard in a React app without combining a board renderer, a separate chess engine, and custom move/state glue yourself.
9
+
6
10
  <p align="center">
7
11
  <img src="./blob/default.png?raw=true" width="23%" alt="Default react-chessboard-ui board" />
8
12
  <img src="./blob/customization.png?raw=true" width="23%" alt="Customized react-chessboard-ui board" />
@@ -10,86 +14,168 @@
10
14
  <img src="./blob/all_queens.png?raw=true" width="23%" alt="React chessboard with custom pieces" />
11
15
  </p>
12
16
 
13
- An all-in-one React chessboard component with both the chess engine and UI included. Drop it into your React app and get a ready-to-use chessboard without wiring up separate chess logic, move validation, or board state tools. Control the board position with simple FEN notation and react to moves or game-end events through callbacks.
17
+ ## Features
14
18
 
15
- ## 📘 **Full documentation**: [https://react-chessboard-ui.dev/](https://react-chessboard-ui.dev/)
19
+ - **Board UI and chess logic in one package**: render the board, validate moves, and receive game events from one component.
20
+ - **FEN-first state**: initialize positions, load puzzles, or render custom board sizes from FEN.
21
+ - **Ready to play**: drag-and-drop pieces, legal move handling, turn switching, callbacks, and game-end detection are included.
22
+ - **Customizable**: override square classes, piece rendering, sizes, highlights, arrows, and interaction behavior.
23
+ - **No required CSS import**: package styles are injected automatically when `ChessBoard` is imported.
16
24
 
17
- ---
25
+ ## Installation
18
26
 
19
- ## 🚀 Features
27
+ ```bash
28
+ npm install react-chessboard-ui
29
+ ```
20
30
 
21
- - 🎯 Fully controlled via FEN strings
22
- - ♟️ Built-in chess engine and ready-made board UI
23
- - ✅ Move validation included
24
- - ♻️ React functional component with hooks support
25
- - 🎨 Customizable styles (via CSS or override)
26
- - ♟️ Game-end and move-change callbacks
27
- - 🧩 No extra chess packages or setup required
31
+ ```bash
32
+ yarn add react-chessboard-ui
33
+ ```
28
34
 
29
- ---
35
+ ## Quick Start
30
36
 
31
- ## Why react-chessboard-ui?
37
+ ```tsx
38
+ import type { FC } from "react";
39
+ import { ChessBoard } from "react-chessboard-ui";
32
40
 
33
- `react-chessboard-ui` is designed for developers who need a React chessboard, chess UI, and chess engine in one package. It is not just a board renderer: it provides drag-and-drop chess pieces, FEN-based position control, legal move handling, game-end detection, and customization options out of the box.
41
+ export const App: FC = () => {
42
+ return (
43
+ <ChessBoard
44
+ FEN="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
45
+ onChange={(move) => {
46
+ console.log("Move:", move);
47
+ }}
48
+ onEndGame={(result) => {
49
+ console.log("Game ended:", result);
50
+ }}
51
+ />
52
+ );
53
+ };
54
+ ```
34
55
 
35
- ---
56
+ ## Key Examples
36
57
 
37
- ## 📦 Installation
58
+ ### Training Position
38
59
 
39
- Install via npm:
60
+ ```tsx
61
+ import { ChessBoard } from "react-chessboard-ui";
40
62
 
41
- ```bash
42
- npm install react-chessboard-ui
63
+ export function TrainingBoard() {
64
+ return (
65
+ <ChessBoard
66
+ FEN="r1bqkbnr/pppp1ppp/2n5/4p3/2B1P3/5N2/PPPP1PPP/RNBQK2R w KQkq - 2 3"
67
+ playerColor="white"
68
+ moveHighlight={[[2, 5], [3, 3]]}
69
+ arrows={[{ start: [2, 5], end: [3, 3], color: "#1d9bf0" }]}
70
+ onChange={(move) => console.log("User move:", move)}
71
+ onEndGame={console.log}
72
+ />
73
+ );
74
+ }
43
75
  ```
44
76
 
45
- Or using yarn:
77
+ ### Custom Board Size From FEN
46
78
 
47
- ```bash
48
- yarn add react-chessboard-ui
49
- ```
79
+ The board size is derived from the FEN rows. This example renders a 12x12 board:
50
80
 
51
- ---
81
+ ```tsx
82
+ import { ChessBoard } from "react-chessboard-ui";
52
83
 
53
- ## 💡 Usage Example
84
+ export function CustomSizeBoard() {
85
+ return (
86
+ <ChessBoard
87
+ FEN="qqrnbqkbnrqq/pppppppppppp/12/12/12/12/12/12/12/12/PPPPPPPPPPPP/QQRNBQKBNRQQ w - - 0 1"
88
+ onChange={console.log}
89
+ onEndGame={console.log}
90
+ />
91
+ );
92
+ }
93
+ ```
94
+ <p align="center">
95
+ <img src="./blob/12x12.png?raw=true" width="70%" style="max-width: 450px" alt="Default react-chessboard-ui board" />
96
+ </p>
97
+
98
+ ### Style the Board With CSS Classes
54
99
 
55
100
  ```tsx
56
- import React from 'react';
57
- import { ChessBoard } from 'react-chessboard-ui';
58
- import 'react-chessboard-ui/dist/index.css'; // Required CSS
101
+ import { ChessBoard } from "react-chessboard-ui";
102
+ import "./board.css";
59
103
 
60
- export const App = () => {
104
+ export function StyledBoard() {
61
105
  return (
62
106
  <ChessBoard
63
107
  FEN="rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
64
- onChange={handleChangePosition}
65
- onEndGame={handleEndGame}
108
+ config={{
109
+ squareSize: 72,
110
+ pieceSizePercent: 92,
111
+ lightSquareClassName: "light-square",
112
+ darkSquareClassName: "dark-square",
113
+ selectedSquareClassName: "selected-square",
114
+ squareHighlightClassName: "move-highlight",
115
+ }}
116
+ onChange={console.log}
117
+ onEndGame={console.log}
66
118
  />
67
119
  );
68
- };
120
+ }
69
121
  ```
70
122
 
71
- ## Full customizable
123
+ ```css
124
+ .light-square {
125
+ background: #f7f7f2;
126
+ }
72
127
 
73
- ### 📘 **Documentation for customization**: [https://react-chessboard-ui.dev/properties/config/](https://react-chessboard-ui.dev/properties/config/)
128
+ .dark-square {
129
+ background: #9aa77f;
130
+ }
74
131
 
132
+ .selected-square {
133
+ outline: 3px solid #1d9bf0;
134
+ outline-offset: -3px;
135
+ }
75
136
 
76
- ---
137
+ .move-highlight {
138
+ box-shadow: inset 0 0 0 4px rgba(29, 155, 240, 0.35);
139
+ }
140
+ ```
77
141
 
78
- ## 👥 Authors
142
+ ## API Overview
79
143
 
80
- Created by:
144
+ | Prop | Type | Description |
145
+ | --- | --- | --- |
146
+ | `FEN` | `string` | Required. Board position in FEN notation. |
147
+ | `onChange` | `(moveData: MoveData) => void` | Required. Called after a user move. |
148
+ | `onEndGame` | `(result: GameResult) => void` | Required. Called when the engine detects a game result. |
149
+ | `onClick` | `(data: ClickData) => void` | Called when a board cell is clicked. |
150
+ | `change` | `ChangeMove` | Applies an external move to the board. |
151
+ | `reversed` | `boolean` | Renders the board from the opposite side. |
152
+ | `config` | `Partial<ChessBoardConfig>` | Board sizing, classes, piece map, and visual configuration. |
153
+ | `playerColor` | `"white" \| "black"` | Restricts interaction to one color. |
154
+ | `viewOnly` | `boolean` | Disables user moves. |
155
+ | `moveHighlight` | `[SquarePos, SquarePos]` | Highlights a move path. |
156
+ | `arrows` | `Array<{ start: number[]; end: number[]; color?: string }>` | Draws arrows on the board. |
157
+ | `toggleTurn` | `boolean` | Enables or disables automatic turn switching. Defaults to `true`. |
81
158
 
82
- - [Tatiana Utbanova](https://www.linkedin.com/in/tatiana-utbanova-6415b8271/) - Design owner
83
- - [Alexander Utbanov](https://linkedin.com/in/alexander-utbanov-a9670a210/) - Code owner
159
+ ## FEN Notes
160
+
161
+ - `FEN` controls the initial board state and can be replaced from React state.
162
+ - A number in a FEN row means that many consecutive empty cells.
163
+ - Standard 8x8 chess positions and larger custom boards are supported.
164
+
165
+ ## Documentation
84
166
 
85
- ---
167
+ - Full documentation: [https://react-chessboard-ui.dev/](https://react-chessboard-ui.dev/)
168
+ - Customization docs: [https://react-chessboard-ui.dev/properties/config/](https://react-chessboard-ui.dev/properties/config/)
86
169
 
87
- ## 📄 License
170
+ ## Authors
88
171
 
89
- MIT © [react-chessboard-ui](https://github.com/)
172
+ - [Tatiana Utbanova](https://www.linkedin.com/in/tatiana-utbanova-6415b8271/) - Design owner
173
+ - [Alexander Utbanov](https://linkedin.com/in/alexander-utbanov-a9670a210/) - Code owner
90
174
 
91
- ---
175
+ ## License
92
176
 
93
- ## 🧠 Keywords (for discoverability)
177
+ MIT
178
+ _________
179
+ ## Keywords
94
180
 
95
181
  `react` `react-chess` `react-chessboard` `react-chessboard-ui` `js-chess` `chess` `chessboard` `chessboard component` `chess engine`
@@ -1,8 +1,8 @@
1
- import { FC } from 'react';
2
- interface ArrowProps {
3
- start: number[];
4
- end: number[];
5
- color: string;
6
- }
7
- export declare const Arrow: FC<ArrowProps>;
8
- export {};
1
+ import { FC } from 'react';
2
+ interface ArrowProps {
3
+ start: number[];
4
+ end: number[];
5
+ color: string;
6
+ }
7
+ export declare const Arrow: FC<ArrowProps>;
8
+ export {};
@@ -1,15 +1,15 @@
1
- import { FC } from "react";
2
- import { CellPos } from "../JSChessEngine";
3
- import { ArrowCoords, ChessBoardConfig } from "./models";
4
- declare type ArrowLayoutType = {
5
- startArrowCoord: CellPos;
6
- arrowsCoords: ArrowCoords[];
7
- externalArrowsCoords?: ArrowCoords[];
8
- externalArrows?: (ArrowCoords & {
9
- color?: string;
10
- })[];
11
- grabbingPos: CellPos;
12
- boardConfig: ChessBoardConfig;
13
- };
14
- export declare const ArrowLayout: FC<ArrowLayoutType>;
15
- export {};
1
+ import { FC } from 'react';
2
+ import { CellPos } from '../JSChessEngine';
3
+ import { ArrowCoords, ChessBoardConfig } from './models';
4
+ type ArrowLayoutType = {
5
+ startArrowCoord: CellPos;
6
+ arrowsCoords: ArrowCoords[];
7
+ externalArrowsCoords?: ArrowCoords[];
8
+ externalArrows?: (ArrowCoords & {
9
+ color?: string;
10
+ })[];
11
+ grabbingPos: CellPos;
12
+ boardConfig: ChessBoardConfig;
13
+ };
14
+ export declare const ArrowLayout: FC<ArrowLayoutType>;
15
+ export {};
@@ -1,22 +1,22 @@
1
- import { PieceColor, GameResult, MoveData, SquarePos } from "../JSChessEngine";
2
- import { FC } from "react";
3
- import { ArrowCoords, ChangeMove, ChessBoardConfig, ClickData } from "./models";
4
- declare type ChessBoardProps = {
5
- FEN: string;
6
- onChange: (moveData: MoveData) => void;
7
- onEndGame: (result: GameResult) => void;
8
- onClick?: (data: ClickData) => void;
9
- change?: ChangeMove;
10
- reversed?: boolean;
11
- config?: Partial<ChessBoardConfig>;
12
- playerColor?: PieceColor;
13
- viewOnly?: boolean;
14
- moveHighlight?: [SquarePos, SquarePos];
15
- moveArrows?: ArrowCoords[];
16
- arrows?: (ArrowCoords & {
17
- color?: string;
18
- })[];
19
- toggleTurn?: boolean;
20
- };
21
- export declare const ChessBoard: FC<ChessBoardProps>;
22
- export {};
1
+ import { PieceColor, GameResult, MoveData, SquarePos } from '../JSChessEngine';
2
+ import { FC } from 'react';
3
+ import { ArrowCoords, ChangeMove, ChessBoardConfig, ClickData } from './models';
4
+ type ChessBoardProps = {
5
+ FEN: string;
6
+ onChange: (moveData: MoveData) => void;
7
+ onEndGame: (result: GameResult) => void;
8
+ onClick?: (data: ClickData) => void;
9
+ change?: ChangeMove;
10
+ reversed?: boolean;
11
+ config?: Partial<ChessBoardConfig>;
12
+ playerColor?: PieceColor;
13
+ viewOnly?: boolean;
14
+ moveHighlight?: [SquarePos, SquarePos];
15
+ moveArrows?: ArrowCoords[];
16
+ arrows?: (ArrowCoords & {
17
+ color?: string;
18
+ })[];
19
+ toggleTurn?: boolean;
20
+ };
21
+ export declare const ChessBoard: FC<ChessBoardProps>;
22
+ export {};
@@ -1,11 +1,11 @@
1
- import { FC } from "react";
2
- import { ChessBoardConfig } from "./models";
3
- import { SquarePos } from "../JSChessEngine";
4
- declare type ChessBoardCellsLayoutProps = {
5
- boardConfig: ChessBoardConfig;
6
- size?: number;
7
- movesTrail?: [SquarePos, SquarePos];
8
- moveHighlight?: [SquarePos, SquarePos];
9
- };
10
- export declare const ChessBoardCellsLayout: FC<ChessBoardCellsLayoutProps>;
11
- export {};
1
+ import { FC } from 'react';
2
+ import { ChessBoardConfig } from './models';
3
+ import { SquarePos } from '../JSChessEngine';
4
+ type ChessBoardCellsLayoutProps = {
5
+ boardConfig: ChessBoardConfig;
6
+ size?: number;
7
+ movesTrail?: [SquarePos, SquarePos];
8
+ moveHighlight?: [SquarePos, SquarePos];
9
+ };
10
+ export declare const ChessBoardCellsLayout: FC<ChessBoardCellsLayoutProps>;
11
+ export {};
@@ -1,17 +1,17 @@
1
- import { FC } from "react";
2
- import { SquarePos } from "../JSChessEngine";
3
- import { ChessBoardConfig } from "./models";
4
- declare type ChessBoardControlLayoutProps = {
5
- size?: number;
6
- boardConfig: ChessBoardConfig;
7
- onClick: (position: SquarePos) => void;
8
- onGrabStart: (position: SquarePos) => void;
9
- onGrabStartRight: (position: SquarePos) => void;
10
- onGrabEnd: (position: SquarePos) => void;
11
- onGrabEndRight: (position: SquarePos) => void;
12
- onGrabbing: (x: number, y: number) => void;
13
- onRightClick: (position: SquarePos) => void;
14
- onGrabbingCell: (position: SquarePos) => void;
15
- };
16
- export declare const ChessBoardControlLayout: FC<ChessBoardControlLayoutProps>;
17
- export {};
1
+ import { FC } from 'react';
2
+ import { SquarePos } from '../JSChessEngine';
3
+ import { ChessBoardConfig } from './models';
4
+ type ChessBoardControlLayoutProps = {
5
+ size?: number;
6
+ boardConfig: ChessBoardConfig;
7
+ onClick: (position: SquarePos) => void;
8
+ onGrabStart: (position: SquarePos) => void;
9
+ onGrabStartRight: (position: SquarePos) => void;
10
+ onGrabEnd: (position: SquarePos) => void;
11
+ onGrabEndRight: (position: SquarePos) => void;
12
+ onGrabbing: (x: number, y: number) => void;
13
+ onRightClick: (position: SquarePos) => void;
14
+ onGrabbingCell: (position: SquarePos) => void;
15
+ };
16
+ export declare const ChessBoardControlLayout: FC<ChessBoardControlLayoutProps>;
17
+ export {};
@@ -1,12 +1,12 @@
1
- import { Cell } from "../JSChessEngine";
2
- import { FC } from "react";
3
- import { ChangeMove, ChessBoardConfig } from "./models";
4
- declare type ChessBoardFiguresLayoutProps = {
5
- initialState: Cell[][];
6
- change?: ChangeMove;
7
- reversed?: boolean;
8
- animated?: boolean;
9
- boardConfig: ChessBoardConfig;
10
- };
11
- export declare const ChessBoardFiguresLayout: FC<ChessBoardFiguresLayoutProps>;
12
- export {};
1
+ import { Cell } from '../JSChessEngine';
2
+ import { FC } from 'react';
3
+ import { ChangeMove, ChessBoardConfig } from './models';
4
+ type ChessBoardFiguresLayoutProps = {
5
+ initialState: Cell[][];
6
+ change?: ChangeMove;
7
+ reversed?: boolean;
8
+ animated?: boolean;
9
+ boardConfig: ChessBoardConfig;
10
+ };
11
+ export declare const ChessBoardFiguresLayout: FC<ChessBoardFiguresLayoutProps>;
12
+ export {};
@@ -1,15 +1,15 @@
1
- import { FC } from "react";
2
- import { SquarePos, Piece } from "../JSChessEngine";
3
- import { ChessBoardConfig } from "./models";
4
- declare type ChessBoardInteractiveLayoutProps = {
5
- size?: number;
6
- boardConfig: ChessBoardConfig;
7
- selectedPos: SquarePos;
8
- possibleMoves: SquarePos[];
9
- markedCells: SquarePos[];
10
- holdedFigure?: Piece;
11
- grabbingPos: SquarePos;
12
- onHasCheck: (cellPos: SquarePos) => boolean;
13
- };
14
- export declare const ChessBoardInteractiveLayout: FC<ChessBoardInteractiveLayoutProps>;
15
- export {};
1
+ import { FC } from 'react';
2
+ import { SquarePos, Piece } from '../JSChessEngine';
3
+ import { ChessBoardConfig } from './models';
4
+ type ChessBoardInteractiveLayoutProps = {
5
+ size?: number;
6
+ boardConfig: ChessBoardConfig;
7
+ selectedPos: SquarePos;
8
+ possibleMoves: SquarePos[];
9
+ markedCells: SquarePos[];
10
+ holdedFigure?: Piece;
11
+ grabbingPos: SquarePos;
12
+ onHasCheck: (cellPos: SquarePos) => boolean;
13
+ };
14
+ export declare const ChessBoardInteractiveLayout: FC<ChessBoardInteractiveLayoutProps>;
15
+ export {};
@@ -1,11 +1,11 @@
1
- import { FC } from 'react';
2
- import { Piece, PieceColor } from '../JSChessEngine';
3
- import { ChessBoardConfig } from './models';
4
- interface FigurePickerProps {
5
- boardConfig: ChessBoardConfig;
6
- color: PieceColor;
7
- forPawnTransform?: boolean;
8
- onSelect: (figure: Piece) => void;
9
- }
10
- export declare const FigurePicker: FC<FigurePickerProps>;
11
- export {};
1
+ import { FC } from 'react';
2
+ import { Piece, PieceColor } from '../JSChessEngine';
3
+ import { ChessBoardConfig } from './models';
4
+ interface FigurePickerProps {
5
+ boardConfig: ChessBoardConfig;
6
+ color: PieceColor;
7
+ forPawnTransform?: boolean;
8
+ onSelect: (figure: Piece) => void;
9
+ }
10
+ export declare const FigurePicker: FC<FigurePickerProps>;
11
+ export {};
@@ -1,10 +1,10 @@
1
- import { CellPos, Figure } from "../JSChessEngine";
2
- import { FC } from "react";
3
- import { ChessBoardConfig } from "./models";
4
- declare type HoldedFigureProps = {
5
- holdedFigure?: Figure;
6
- grabbingPos: CellPos;
7
- boardConfig: ChessBoardConfig;
8
- };
9
- export declare const HoldedFigure: FC<HoldedFigureProps>;
10
- export {};
1
+ import { CellPos, Figure } from '../JSChessEngine';
2
+ import { FC } from 'react';
3
+ import { ChessBoardConfig } from './models';
4
+ type HoldedFigureProps = {
5
+ holdedFigure?: Figure;
6
+ grabbingPos: CellPos;
7
+ boardConfig: ChessBoardConfig;
8
+ };
9
+ export declare const HoldedFigure: FC<HoldedFigureProps>;
10
+ export {};
@@ -1,2 +1,2 @@
1
- import { ChessPiecesMap } from "./models";
2
- export declare const CHESS_PIECES_MAP: ChessPiecesMap;
1
+ import { ChessPiecesMap } from './models';
2
+ export declare const CHESS_PIECES_MAP: ChessPiecesMap;
@@ -1,26 +1,26 @@
1
- import { Piece } from "../JSChessEngine";
2
- import { ChessBoardConfig } from "./models";
3
- export declare const DEFAULT_FACTOR_FOR_SIZE_CIRCLE_MARK = 4.6;
4
- export declare const DEFAULT_CIRCLE_MARK_COLOR = "#3697ce";
5
- export declare const DEFAULT_WHITE_CELL_COLOR: string;
6
- export declare const DEFAULT_BLACK_CELL_COLOR: string;
7
- export declare const DEFAULT_SELECTED_CELL_COLOR = "#e3f1fe";
8
- export declare const DEFAULT_SELECTED_CELL_BORDER = "3px solid #6ac2fd";
9
- export declare const DEFAULT_ARROW_COLOR = "#6ac2fd";
10
- export declare const DEFAULT_MARKED_CELL_COLOR = "#3697ce";
11
- export declare const DEFAULT_CHECKED_CELL_COLOR = "#e95b5c";
12
- export declare const DEFAULT_PIECES_MAP: import("./models").ChessPiecesMap;
13
- export declare const DEFAULT_SHOW_MOVES_TRAIL = true;
14
- export declare const DEFAULT_HIDE_PIECES_HANDLER: (figure: Piece, boardSize?: number) => void;
15
- export declare const DEFAULT_SQUARE_SIZE = 92;
16
- export declare const DEFAULT_PIECE_SIZE_PERCENT = 80;
17
- export declare const DEFAULT_HIDE_PIECE_EFFECT_CLASS_NAME: string;
18
- export declare const DEFAULT_LIGHT_SQUARE_CLASS_NAME: string;
19
- export declare const DEFAULT_DARK_SQUARE_CLASS_NAME: string;
20
- export declare const DEFAULT_PICKED_SQUARE_CLASS_NAME: string;
21
- export declare const DEFAULT_CHECKED_SQUARE_CLASS_NAME: string;
22
- export declare const DEFAULT_SQUARE_HIGLIGHT_CLASS_NAME: string;
23
- export declare const DEFAULT_SELECTED_SQUARE_CLASS_NAME: string;
24
- export declare const DEFAULT_HOLDED_PIECE_CLASS_NAME: string;
25
- export declare const DEFAULT_POSSIBLE_MOVE_MARK_CLASS_NAME: string;
26
- export declare const DEFAULT_CHESSBORD_CONFIG: ChessBoardConfig;
1
+ import { Piece } from '../JSChessEngine';
2
+ import { ChessBoardConfig } from './models';
3
+ export declare const DEFAULT_FACTOR_FOR_SIZE_CIRCLE_MARK = 4.6;
4
+ export declare const DEFAULT_CIRCLE_MARK_COLOR = "#3697ce";
5
+ export declare const DEFAULT_WHITE_CELL_COLOR: string;
6
+ export declare const DEFAULT_BLACK_CELL_COLOR: string;
7
+ export declare const DEFAULT_SELECTED_CELL_COLOR = "#e3f1fe";
8
+ export declare const DEFAULT_SELECTED_CELL_BORDER = "3px solid #6ac2fd";
9
+ export declare const DEFAULT_ARROW_COLOR = "#6ac2fd";
10
+ export declare const DEFAULT_MARKED_CELL_COLOR = "#3697ce";
11
+ export declare const DEFAULT_CHECKED_CELL_COLOR = "#e95b5c";
12
+ export declare const DEFAULT_PIECES_MAP: import('./models').ChessPiecesMap;
13
+ export declare const DEFAULT_SHOW_MOVES_TRAIL = true;
14
+ export declare const DEFAULT_HIDE_PIECES_HANDLER: (figure: Piece, boardSize?: number) => void;
15
+ export declare const DEFAULT_SQUARE_SIZE = 92;
16
+ export declare const DEFAULT_PIECE_SIZE_PERCENT = 80;
17
+ export declare const DEFAULT_HIDE_PIECE_EFFECT_CLASS_NAME: string;
18
+ export declare const DEFAULT_LIGHT_SQUARE_CLASS_NAME: string;
19
+ export declare const DEFAULT_DARK_SQUARE_CLASS_NAME: string;
20
+ export declare const DEFAULT_PICKED_SQUARE_CLASS_NAME: string;
21
+ export declare const DEFAULT_CHECKED_SQUARE_CLASS_NAME: string;
22
+ export declare const DEFAULT_SQUARE_HIGLIGHT_CLASS_NAME: string;
23
+ export declare const DEFAULT_SELECTED_SQUARE_CLASS_NAME: string;
24
+ export declare const DEFAULT_HOLDED_PIECE_CLASS_NAME: string;
25
+ export declare const DEFAULT_POSSIBLE_MOVE_MARK_CLASS_NAME: string;
26
+ export declare const DEFAULT_CHESSBORD_CONFIG: ChessBoardConfig;
@@ -1 +1 @@
1
- export * from './ChessBoard';
1
+ export * from './ChessBoard';
@@ -0,0 +1,39 @@
1
+ import { ReactElement } from 'react';
2
+ import { SquarePos, Piece, MoveData, Cell, CellPos, FigureColor } from '../JSChessEngine';
3
+ export interface ChessPiecesMap {
4
+ [key: string]: (size: string) => ReactElement;
5
+ }
6
+ export type ChessBoardConfig = {
7
+ squareSize: number;
8
+ pieceSizePercent: number;
9
+ lightSquareClassName: string;
10
+ darkSquareClassName: string;
11
+ pickedSquareClassName: string;
12
+ checkedSquareClassName: string;
13
+ hidePieceEffectClassName: string;
14
+ squareHighlightClassName: string;
15
+ selectedSquareClassName: string;
16
+ holdedPieceClassName: string;
17
+ possibleMoveMarkClassName: string;
18
+ factorForSizeCircleMark: number;
19
+ circleMarkColor: string;
20
+ arrowColor: string;
21
+ piecesMap: ChessPiecesMap;
22
+ showMovesTrail: boolean;
23
+ onHidePieces: (piece: Piece) => void;
24
+ };
25
+ export type ChangeMove = {
26
+ move: MoveData;
27
+ withTransition?: boolean;
28
+ attackedPos?: SquarePos;
29
+ transformTo?: Piece;
30
+ };
31
+ export type ArrowCoords = {
32
+ start: number[];
33
+ end: number[];
34
+ };
35
+ export type ClickData = {
36
+ cellData: Cell;
37
+ pos: CellPos;
38
+ currentColor: FigureColor;
39
+ };