react-chessboard-ui 1.7.3 → 2.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.
@@ -1,4 +1,4 @@
1
- import { FigureColor, GameResult, MoveData } from "../JSChessEngine";
1
+ import { PieceColor, GameResult, MoveData, SquarePos } from "../JSChessEngine";
2
2
  import { FC } from "react";
3
3
  import { ChangeMove, ChessBoardConfig } from "./models";
4
4
  declare type ChessBoardProps = {
@@ -8,8 +8,9 @@ declare type ChessBoardProps = {
8
8
  change?: ChangeMove;
9
9
  reversed?: boolean;
10
10
  config?: Partial<ChessBoardConfig>;
11
- playerColor?: FigureColor;
11
+ playerColor?: PieceColor;
12
12
  viewOnly?: boolean;
13
+ moveHighlight?: [SquarePos, SquarePos];
13
14
  };
14
15
  export declare const ChessBoard: FC<ChessBoardProps>;
15
16
  export {};
@@ -1,10 +1,11 @@
1
1
  import { FC } from "react";
2
2
  import { ChessBoardConfig } from "./models";
3
- import { CellPos } from "../JSChessEngine";
3
+ import { SquarePos } from "../JSChessEngine";
4
4
  declare type ChessBoardCellsLayoutProps = {
5
5
  boardConfig: ChessBoardConfig;
6
6
  size?: number;
7
- movesTrail?: [CellPos, CellPos];
7
+ movesTrail?: [SquarePos, SquarePos];
8
+ moveHighlight?: [SquarePos, SquarePos];
8
9
  };
9
10
  export declare const ChessBoardCellsLayout: FC<ChessBoardCellsLayoutProps>;
10
11
  export {};
@@ -1,17 +1,17 @@
1
1
  import { FC } from "react";
2
- import { CellPos } from "../JSChessEngine";
2
+ import { SquarePos } from "../JSChessEngine";
3
3
  import { ChessBoardConfig } from "./models";
4
4
  declare type ChessBoardControlLayoutProps = {
5
5
  size?: number;
6
6
  boardConfig: ChessBoardConfig;
7
- onClick: (position: CellPos) => void;
8
- onGrabStart: (position: CellPos) => void;
9
- onGrabStartRight: (position: CellPos) => void;
10
- onGrabEnd: (position: CellPos) => void;
11
- onGrabEndRight: (position: CellPos) => void;
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
12
  onGrabbing: (x: number, y: number) => void;
13
- onRightClick: (position: CellPos) => void;
14
- onGrabbingCell: (position: CellPos) => void;
13
+ onRightClick: (position: SquarePos) => void;
14
+ onGrabbingCell: (position: SquarePos) => void;
15
15
  };
16
16
  export declare const ChessBoardControlLayout: FC<ChessBoardControlLayoutProps>;
17
17
  export {};
@@ -1,15 +1,15 @@
1
1
  import { FC } from "react";
2
- import { CellPos, Figure } from "../JSChessEngine";
2
+ import { SquarePos, Piece } from "../JSChessEngine";
3
3
  import { ChessBoardConfig } from "./models";
4
4
  declare type ChessBoardInteractiveLayoutProps = {
5
5
  size?: number;
6
6
  boardConfig: ChessBoardConfig;
7
- selectedPos: CellPos;
8
- possibleMoves: CellPos[];
9
- markedCells: CellPos[];
10
- holdedFigure?: Figure;
11
- grabbingPos: CellPos;
12
- onHasCheck: (cellPos: CellPos) => boolean;
7
+ selectedPos: SquarePos;
8
+ possibleMoves: SquarePos[];
9
+ markedCells: SquarePos[];
10
+ holdedFigure?: Piece;
11
+ grabbingPos: SquarePos;
12
+ onHasCheck: (cellPos: SquarePos) => boolean;
13
13
  };
14
14
  export declare const ChessBoardInteractiveLayout: FC<ChessBoardInteractiveLayoutProps>;
15
15
  export {};
@@ -1,11 +1,11 @@
1
1
  import { FC } from 'react';
2
- import { Figure, FigureColor } from '../JSChessEngine';
2
+ import { Piece, PieceColor } from '../JSChessEngine';
3
3
  import { ChessBoardConfig } from './models';
4
4
  interface FigurePickerProps {
5
5
  boardConfig: ChessBoardConfig;
6
- color: FigureColor;
6
+ color: PieceColor;
7
7
  forPawnTransform?: boolean;
8
- onSelect: (figure: Figure) => void;
8
+ onSelect: (figure: Piece) => void;
9
9
  }
10
10
  export declare const FigurePicker: FC<FigurePickerProps>;
11
11
  export {};
@@ -1,18 +1,26 @@
1
- import { Figure } from "../JSChessEngine";
1
+ import { Piece } from "../JSChessEngine";
2
2
  import { ChessBoardConfig } from "./models";
3
- export declare const DEFAULT_CELL_SIZE = 92;
4
- export declare const DEFAULT_FIGURE_SIZE_PERCENT = 80;
5
- export declare const FACTOR_FOR_SIZE_CIRCLE_MARK = 4.6;
3
+ export declare const DEFAULT_FACTOR_FOR_SIZE_CIRCLE_MARK = 4.6;
6
4
  export declare const DEFAULT_CIRCLE_MARK_COLOR = "#3697ce";
7
- export declare const DEFAULT_WHITE_CELL_COLOR = "#fafafc";
8
- export declare const DEFAULT_BLACK_CELL_COLOR = "#d8d9e6";
5
+ export declare const DEFAULT_WHITE_CELL_COLOR: string;
6
+ export declare const DEFAULT_BLACK_CELL_COLOR: string;
9
7
  export declare const DEFAULT_SELECTED_CELL_COLOR = "#e3f1fe";
10
8
  export declare const DEFAULT_SELECTED_CELL_BORDER = "3px solid #6ac2fd";
11
9
  export declare const DEFAULT_ARROW_COLOR = "#6ac2fd";
12
10
  export declare const DEFAULT_MARKED_CELL_COLOR = "#3697ce";
13
11
  export declare const DEFAULT_CHECKED_CELL_COLOR = "#e95b5c";
14
12
  export declare const DEFAULT_PIECES_MAP: import("./models").ChessPiecesMap;
15
- export declare const DEFAULT_CSS_HIDE_PIECES_EFFECT: string;
16
13
  export declare const DEFAULT_SHOW_MOVES_TRAIL = true;
17
- export declare const DEFAULT_HIDE_PIECES_HANDLER: (figure: Figure) => void;
14
+ export declare const DEFAULT_HIDE_PIECES_HANDLER: (figure: Piece) => 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;
18
26
  export declare const DEFAULT_CHESSBORD_CONFIG: ChessBoardConfig;
@@ -1,9 +1,9 @@
1
- import { Cell, CellPos, Figure, FigureColor, MoveData } from "../JSChessEngine";
1
+ import { Cell, SquarePos, Piece, PieceColor, MoveData } from "../JSChessEngine";
2
2
  import { ChessBoardConfig } from "./models";
3
3
  /**
4
4
  * Возвращает класс для фигуры в клетке
5
5
  */
6
- export declare const getFigureCSS: (figure: Figure) => string;
6
+ export declare const getFigureCSS: (figure: Piece) => string;
7
7
  /**
8
8
  * Возвращает белая ли клетка
9
9
  */
@@ -16,20 +16,20 @@ export declare const getFilledArrayBySize: (size: number) => number[];
16
16
  * Возвращает только массив фигурам у которых
17
17
  * есть поле position
18
18
  */
19
- export declare const mapCellsToFiguresArray: (boardState: Cell[][]) => Figure[];
19
+ export declare const mapCellsToFiguresArray: (boardState: Cell[][]) => Piece[];
20
20
  /**
21
21
  *
22
22
  * @param possibleMoves Список возможных ходов
23
23
  * @param position позиция для проверки
24
24
  */
25
- export declare const checkIsPossibleMove: (possibleMoves: CellPos[], position: CellPos) => boolean;
25
+ export declare const checkIsPossibleMove: (possibleMoves: SquarePos[], position: import("../JSChessEngine").CellPos) => boolean;
26
26
  /**
27
27
  * Проверяет находится ли проверяемая позиция в
28
28
  * наборе позиций
29
29
  * @param positions набор позиций
30
30
  * @param pos позиция
31
31
  */
32
- export declare const checkPositionsHas: (positions: CellPos[] | undefined, pos: CellPos) => boolean;
32
+ export declare const checkPositionsHas: (positions: SquarePos[] | undefined, pos: import("../JSChessEngine").CellPos) => boolean;
33
33
  /**
34
34
  * Проверяет, является ли ход рокеровкой
35
35
  * @param moveData
@@ -39,7 +39,7 @@ export declare const checkIsCastlingMove: (moveData: MoveData) => boolean;
39
39
  /**
40
40
  * Проверка клетки, на то есть ли шах
41
41
  */
42
- export declare const hasCheck: (cell: Cell, currentColor: FigureColor, linesWithCheck: CellPos[][]) => boolean;
42
+ export declare const hasCheck: (cell: Cell, currentColor: PieceColor, linesWithCheck: SquarePos[][]) => boolean;
43
43
  export declare const degrees: (a: number, b: number) => number;
44
44
  export declare const calcAngle: (start: number[], end: number[]) => number;
45
45
  export declare const getChessBoardConfig: (config: Partial<ChessBoardConfig> | undefined) => ChessBoardConfig;
@@ -48,16 +48,16 @@ export declare const getChessBoardConfig: (config: Partial<ChessBoardConfig> | u
48
48
  * @param color цвет фигур
49
49
  * @param forPawnTransform только фигуры для превращения пешки
50
50
  */
51
- export declare const getFiguresByColor: (color: FigureColor, forPawnTransform?: boolean) => Figure[];
51
+ export declare const getFiguresByColor: (color: PieceColor, forPawnTransform?: boolean) => Piece[];
52
52
  /**
53
53
  * Корректирует позицию захвата курсором
54
54
  * коррекция происходит по сроллу
55
55
  */
56
- export declare const correctGrabbingPosByScroll: (pos: CellPos) => CellPos;
56
+ export declare const correctGrabbingPosByScroll: (pos: import("../JSChessEngine").CellPos) => import("../JSChessEngine").CellPos;
57
57
  /**
58
58
  * Корректирует указатели стрелки
59
59
  */
60
- export declare const correctGrabbingPosForArrow: (pos: CellPos, boardConfig: ChessBoardConfig) => CellPos;
60
+ export declare const correctGrabbingPosForArrow: (pos: import("../JSChessEngine").CellPos, boardConfig: ChessBoardConfig) => import("../JSChessEngine").CellPos;
61
61
  /**
62
62
  * Создание тэга для хранение состояния
63
63
  * разворота доски
@@ -7,6 +7,10 @@ export interface Figure {
7
7
  touched?: boolean;
8
8
  position?: CellPos;
9
9
  }
10
+ export declare type Piece = Figure;
11
+ export declare type PieceColor = FigureColor;
12
+ export declare type SquarePos = CellPos;
13
+ export declare type PieceType = FigureType;
10
14
  export declare type CellColor = 'white' | 'black';
11
15
  export interface Cell {
12
16
  figure?: Figure;
package/dist/index.css CHANGED
@@ -44,11 +44,19 @@
44
44
  z-index: 5;
45
45
  }
46
46
 
47
- ._3vcXe {
47
+ ._1YsOr {
48
48
  box-sizing: border-box;
49
+ border: 3px solid #6ac2fd;
50
+ background-color: #e3f1fe;
49
51
  }
50
52
 
51
- ._2yJs1 {}
53
+ ._3MMcp {
54
+ box-shadow: inset 0 0 30px #3697ce;
55
+ }
56
+
57
+ ._KLkVN {
58
+ box-shadow: inset 0 0 30px #e95b5c;
59
+ }
52
60
 
53
61
  ._27yHq {
54
62
  display: flex;
@@ -59,17 +67,15 @@
59
67
  ._UYGA_ {
60
68
  border-radius: 100%;
61
69
  opacity: 0.8;
70
+ background-color: #3697ce;
71
+ pointer-events: all;
62
72
  }
63
73
 
64
74
  ._2XKSc {
65
75
  display: flex;
66
76
  }
67
77
 
68
- ._ssFQn {}
69
-
70
- ._1407I {}
71
-
72
- ._19mE- {
78
+ ._2QHnf {
73
79
  position: absolute;
74
80
  display: flex;
75
81
  justify-content: center;
@@ -84,11 +90,11 @@
84
90
  -webkit-user-drag: none;
85
91
  }
86
92
 
87
- ._3u_-s {
93
+ ._3z25q {
88
94
  transition: none;
89
95
  }
90
96
 
91
- ._3SfMJ {
97
+ ._10meo {
92
98
  opacity: .4;
93
99
  }
94
100
 
@@ -97,10 +103,6 @@
97
103
  transform: rotate(-90deg);
98
104
  }
99
105
 
100
- ._Zly-L {}
101
-
102
- ._31pmr {}
103
-
104
106
  ._12Bbd {
105
107
  position: absolute;
106
108
  width: 20px;
@@ -121,18 +123,18 @@
121
123
  transform: rotate(90deg);
122
124
  }
123
125
 
124
- ._13OXq {
126
+ ._3gVhA {
125
127
  display: flex;
126
128
  justify-content: center;
127
129
  }
128
130
 
129
- ._16zCe {
131
+ ._3EtmA {
130
132
  background-position: center;
131
133
  background-size: cover;
132
134
  cursor: pointer;
133
135
  }
134
136
 
135
- ._1ZGj2 {
137
+ ._2xZM1 {
136
138
  z-index: 101;
137
139
  position: absolute;
138
140
  top: 0;
@@ -152,3 +154,11 @@
152
154
  box-shadow: inset 0 0 11px #3697ce80 !important;
153
155
  background-color: #B8E6FE;
154
156
  }
157
+
158
+ ._1B0qo {
159
+ background-color: #fafafc;
160
+ }
161
+
162
+ ._1NBqS {
163
+ background-color: #d8d9e6;
164
+ }
package/dist/index.js CHANGED
@@ -1675,7 +1675,7 @@ var stateToFEN = function stateToFEN(state, currentColor, countMoves) {
1675
1675
  return positionsFEN + " " + colorFEN + " " + casttlingFEN + " " + beatedFieldFEN + " " + blackMoves + " " + countMoves;
1676
1676
  };
1677
1677
 
1678
- var styles = {"chessBoard":"_3XI6H","figuresLayout":"_2SyRK","controlLayout":"_3OVc8","controlLayoutGrabbing":"_G0IIl","interactiveLayout":"_3THn5","selectedCell":"_3vcXe","controlCell":"_2yJs1","interactiveCell":"_27yHq","possibleMoveMark":"_UYGA_","row":"_2XKSc","cell":"_ssFQn","cellLight":"_1407I","figure":"_19mE-","holdedFigure":"_3u_-s","bluredFigure":"_3SfMJ","hiddenFigureEffect":"_2YKzU","markedCell":"_Zly-L","checkedCell":"_31pmr","arrow":"_12Bbd","arrowEnd":"_1BC3I","figurePicker":"_13OXq","figurePickerItem":"_16zCe","chessBoardFigurePicker":"_1ZGj2","movesTrail":"_1RqCc"};
1678
+ var styles = {"chessBoard":"_3XI6H","figuresLayout":"_2SyRK","controlLayout":"_3OVc8","controlLayoutGrabbing":"_G0IIl","interactiveLayout":"_3THn5","selectedSquare":"_1YsOr","pickedSquare":"_3MMcp","checkedSquare":"_KLkVN","interactiveCell":"_27yHq","possibleMoveMark":"_UYGA_","row":"_2XKSc","piece":"_2QHnf","holdedPiece":"_3z25q","bluredPiece":"_10meo","hiddenFigureEffect":"_2YKzU","arrow":"_12Bbd","arrowEnd":"_1BC3I","piecePicker":"_3gVhA","piecePickerItem":"_3EtmA","chessBoardPiecePicker":"_2xZM1","movesTrail":"_1RqCc","lightSquare":"_1B0qo","darkSquare":"_1NBqS"};
1679
1679
 
1680
1680
  var CHESS_PIECES_MAP = {
1681
1681
  'pawn-white': function pawnWhite(size) {
@@ -1877,36 +1877,41 @@ var CHESS_PIECES_MAP = {
1877
1877
  }
1878
1878
  };
1879
1879
 
1880
- var DEFAULT_CELL_SIZE = 92;
1881
- var DEFAULT_FIGURE_SIZE_PERCENT = 80;
1882
- var FACTOR_FOR_SIZE_CIRCLE_MARK = 4.6;
1880
+ var DEFAULT_FACTOR_FOR_SIZE_CIRCLE_MARK = 4.6;
1883
1881
  var DEFAULT_CIRCLE_MARK_COLOR = '#3697ce';
1884
- var DEFAULT_WHITE_CELL_COLOR = '#fafafc';
1885
- var DEFAULT_BLACK_CELL_COLOR = '#d8d9e6';
1886
- var DEFAULT_SELECTED_CELL_COLOR = '#e3f1fe';
1887
- var DEFAULT_SELECTED_CELL_BORDER = '3px solid #6ac2fd';
1888
1882
  var DEFAULT_ARROW_COLOR = '#6ac2fd';
1889
- var DEFAULT_MARKED_CELL_COLOR = '#3697ce';
1890
- var DEFAULT_CHECKED_CELL_COLOR = '#e95b5c';
1891
1883
  var DEFAULT_PIECES_MAP = CHESS_PIECES_MAP;
1892
- var DEFAULT_CSS_HIDE_PIECES_EFFECT = styles.hiddenFigureEffect;
1893
1884
  var DEFAULT_SHOW_MOVES_TRAIL = true;
1894
1885
  var DEFAULT_HIDE_PIECES_HANDLER = function DEFAULT_HIDE_PIECES_HANDLER(figure) {
1895
1886
  figure.color === 'white' ? figure.position = [8, figure.position[1]] : figure.position = [-1, figure.position[1]];
1896
1887
  };
1888
+ var DEFAULT_SQUARE_SIZE = 92;
1889
+ var DEFAULT_PIECE_SIZE_PERCENT = 80;
1890
+ var DEFAULT_HIDE_PIECE_EFFECT_CLASS_NAME = styles.hiddenFigureEffect;
1891
+ var DEFAULT_LIGHT_SQUARE_CLASS_NAME = undefined;
1892
+ var DEFAULT_DARK_SQUARE_CLASS_NAME = undefined;
1893
+ var DEFAULT_PICKED_SQUARE_CLASS_NAME = undefined;
1894
+ var DEFAULT_CHECKED_SQUARE_CLASS_NAME = undefined;
1895
+ var DEFAULT_SQUARE_HIGLIGHT_CLASS_NAME = undefined;
1896
+ var DEFAULT_SELECTED_SQUARE_CLASS_NAME = undefined;
1897
+ var DEFAULT_HOLDED_PIECE_CLASS_NAME = undefined;
1898
+ var DEFAULT_POSSIBLE_MOVE_MARK_CLASS_NAME = undefined;
1897
1899
  var DEFAULT_CHESSBORD_CONFIG = {
1898
- cellSize: DEFAULT_CELL_SIZE,
1899
- figureSizePercent: DEFAULT_FIGURE_SIZE_PERCENT,
1900
+ squareSize: DEFAULT_SQUARE_SIZE,
1901
+ pieceSizePercent: DEFAULT_PIECE_SIZE_PERCENT,
1902
+ lightSquareClassName: DEFAULT_LIGHT_SQUARE_CLASS_NAME,
1903
+ darkSquareClassName: DEFAULT_DARK_SQUARE_CLASS_NAME,
1904
+ pickedSquareClassName: DEFAULT_PICKED_SQUARE_CLASS_NAME,
1905
+ selectedSquareClassName: DEFAULT_SELECTED_SQUARE_CLASS_NAME,
1906
+ holdedPieceClassName: DEFAULT_HOLDED_PIECE_CLASS_NAME,
1907
+ checkedSquareClassName: DEFAULT_CHECKED_SQUARE_CLASS_NAME,
1908
+ squareHighlightClassName: DEFAULT_SQUARE_HIGLIGHT_CLASS_NAME,
1900
1909
  circleMarkColor: DEFAULT_CIRCLE_MARK_COLOR,
1901
- whiteCellColor: DEFAULT_WHITE_CELL_COLOR,
1902
- blackCellColor: DEFAULT_BLACK_CELL_COLOR,
1903
- selectedCellColor: DEFAULT_SELECTED_CELL_COLOR,
1904
- selectedCellBorder: DEFAULT_SELECTED_CELL_BORDER,
1910
+ factorForSizeCircleMark: DEFAULT_FACTOR_FOR_SIZE_CIRCLE_MARK,
1911
+ possibleMoveMarkClassName: DEFAULT_POSSIBLE_MOVE_MARK_CLASS_NAME,
1905
1912
  arrowColor: DEFAULT_ARROW_COLOR,
1906
- markedCellColor: DEFAULT_MARKED_CELL_COLOR,
1907
- checkedCellColor: DEFAULT_CHECKED_CELL_COLOR,
1908
1913
  piecesMap: DEFAULT_PIECES_MAP,
1909
- cssHidePieceEffect: DEFAULT_CSS_HIDE_PIECES_EFFECT,
1914
+ hidePieceEffectClassName: DEFAULT_HIDE_PIECE_EFFECT_CLASS_NAME,
1910
1915
  showMovesTrail: DEFAULT_SHOW_MOVES_TRAIL,
1911
1916
  onHidePieces: DEFAULT_HIDE_PIECES_HANDLER
1912
1917
  };
@@ -1986,12 +1991,7 @@ var calcAngle = function calcAngle(start, end) {
1986
1991
  };
1987
1992
  var getChessBoardConfig = function getChessBoardConfig(config) {
1988
1993
  if (!config) return DEFAULT_CHESSBORD_CONFIG;
1989
- var configKeyes = Object.keys(DEFAULT_CHESSBORD_CONFIG);
1990
- var buildedConfig = {};
1991
- configKeyes.forEach(function (key) {
1992
- buildedConfig[key] = config[key] || DEFAULT_CHESSBORD_CONFIG[key];
1993
- });
1994
- return buildedConfig;
1994
+ return _extends({}, DEFAULT_CHESSBORD_CONFIG, config);
1995
1995
  };
1996
1996
  var getFiguresByColor = function getFiguresByColor(color, forPawnTransform) {
1997
1997
  if (forPawnTransform === void 0) {
@@ -2021,7 +2021,7 @@ var correctGrabbingPosByScroll = function correctGrabbingPosByScroll(pos) {
2021
2021
  return [pos[0] - window.scrollX, pos[1] - window.scrollY];
2022
2022
  };
2023
2023
  var correctGrabbingPosForArrow = function correctGrabbingPosForArrow(pos, boardConfig) {
2024
- return [pos[0] * boardConfig.cellSize + (boardConfig.cellSize / 2 - 10), pos[1] * boardConfig.cellSize + boardConfig.cellSize / 2];
2024
+ return [pos[0] * boardConfig.squareSize + (boardConfig.squareSize / 2 - 10), pos[1] * boardConfig.squareSize + boardConfig.squareSize / 2];
2025
2025
  };
2026
2026
  var createHtmlReversedStateHolder = function createHtmlReversedStateHolder() {
2027
2027
  if (!window) return;
@@ -2045,21 +2045,25 @@ var ChessBoardCellsLayout = function ChessBoardCellsLayout(_ref) {
2045
2045
  var _ref$size = _ref.size,
2046
2046
  size = _ref$size === void 0 ? BASE_BOARD_SIZE : _ref$size,
2047
2047
  boardConfig = _ref.boardConfig,
2048
- movesTrail = _ref.movesTrail;
2048
+ movesTrail = _ref.movesTrail,
2049
+ moveHighlight = _ref.moveHighlight;
2049
2050
  return React__default.createElement("div", null, getFilledArrayBySize(size).map(function (_, j) {
2050
2051
  return React__default.createElement("div", {
2051
2052
  className: styles.row,
2052
2053
  key: "cells-layout-" + j
2053
2054
  }, getFilledArrayBySize(size).map(function (_, i) {
2055
+ var _cn;
2054
2056
  return React__default.createElement("div", {
2055
2057
  style: {
2056
- width: boardConfig.cellSize,
2057
- height: boardConfig.cellSize,
2058
- backgroundColor: getIsLightCell(j, i) ? boardConfig.whiteCellColor : boardConfig.blackCellColor
2058
+ width: boardConfig.squareSize,
2059
+ height: boardConfig.squareSize
2059
2060
  },
2061
+ className: cn((_cn = {}, _cn[styles.lightSquare] = !boardConfig.lightSquareClassName && getIsLightCell(j, i), _cn[styles.darkSquare] = !boardConfig.darkSquareClassName && !getIsLightCell(j, i), _cn[boardConfig.lightSquareClassName] = !!boardConfig.lightSquareClassName && getIsLightCell(j, i), _cn[boardConfig.darkSquareClassName] = !!boardConfig.darkSquareClassName && !getIsLightCell(j, i), _cn)),
2060
2062
  key: "cells-layout-" + i
2061
2063
  }, movesTrail && (movesTrail[0][0] === i && movesTrail[0][1] === j || movesTrail[1][0] === i && movesTrail[1][1] === j) && React__default.createElement("div", {
2062
- className: styles.movesTrail
2064
+ className: cn(styles.movesTrail, boardConfig.squareHighlightClassName)
2065
+ }), moveHighlight && (moveHighlight[0][0] === i && moveHighlight[0][1] === j || moveHighlight[1][0] === i && moveHighlight[1][1] === j) && React__default.createElement("div", {
2066
+ className: cn(styles.movesTrail, boardConfig.squareHighlightClassName)
2063
2067
  }));
2064
2068
  }));
2065
2069
  }));
@@ -2196,20 +2200,20 @@ var ChessBoardFiguresLayout = function ChessBoardFiguresLayout(props) {
2196
2200
  });
2197
2201
  }, [reversed, initialState]);
2198
2202
  return React__default.createElement("div", {
2199
- className: styles.figuresLayout
2203
+ className: styles.piecesLayout
2200
2204
  }, actualState.map(function (figure, i) {
2201
2205
  var _cn;
2202
2206
  return React__default.createElement("div", {
2203
2207
  key: i,
2204
- className: cn([styles.figure], (_cn = {}, _cn[boardConfig.cssHidePieceEffect] = figure.beated, _cn)),
2208
+ className: cn([styles.piece], (_cn = {}, _cn[boardConfig.hidePieceEffectClassName] = figure.beated, _cn)),
2205
2209
  style: {
2206
- top: boardConfig.cellSize * figure.position[1] + "px",
2207
- left: boardConfig.cellSize * figure.position[0] + "px",
2210
+ top: boardConfig.squareSize * figure.position[1] + "px",
2211
+ left: boardConfig.squareSize * figure.position[0] + "px",
2208
2212
  transition: !!change && animated ? 'all .15s ease-out' : 'none',
2209
- width: boardConfig.cellSize,
2210
- height: boardConfig.cellSize
2213
+ width: boardConfig.squareSize,
2214
+ height: boardConfig.squareSize
2211
2215
  }
2212
- }, boardConfig.piecesMap[getFigureCSS(figure)] && boardConfig.piecesMap[getFigureCSS(figure)](boardConfig.figureSizePercent + "%"));
2216
+ }, boardConfig.piecesMap[getFigureCSS(figure)] && boardConfig.piecesMap[getFigureCSS(figure)](boardConfig.pieceSizePercent + "%"));
2213
2217
  }));
2214
2218
  };
2215
2219
 
@@ -2283,8 +2287,8 @@ var ChessBoardControlLayout = function ChessBoardControlLayout(props) {
2283
2287
  key: "control-layout-" + i,
2284
2288
  className: styles.controlCell,
2285
2289
  style: {
2286
- width: boardConfig.cellSize,
2287
- height: boardConfig.cellSize
2290
+ width: boardConfig.squareSize,
2291
+ height: boardConfig.squareSize
2288
2292
  },
2289
2293
  onClick: function onClick() {
2290
2294
  return handleClick([i, j]);
@@ -2738,7 +2742,7 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
2738
2742
  return hasCheck(cell, currentColor, linesWithCheck);
2739
2743
  };
2740
2744
  var startRenderArrow = function startRenderArrow(pos) {
2741
- var startPos = [(pos[0] + 1) * boardConfig.cellSize - boardConfig.cellSize / 2 - 10, (pos[1] + 1) * boardConfig.cellSize - boardConfig.cellSize / 2];
2745
+ var startPos = [(pos[0] + 1) * boardConfig.squareSize - boardConfig.squareSize / 2 - 10, (pos[1] + 1) * boardConfig.squareSize - boardConfig.squareSize / 2];
2742
2746
  setStartArrowCoord(startPos);
2743
2747
  };
2744
2748
  var endRenderArrow = function endRenderArrow(_ref3) {
@@ -2841,16 +2845,16 @@ var HoldedFigure = function HoldedFigure(props) {
2841
2845
  boardConfig = props.boardConfig;
2842
2846
  var isCanShowFigure = holdedFigure && grabbingPos[0] > -1 && grabbingPos[1] > -1;
2843
2847
  return isCanShowFigure && React__default.createElement("div", {
2844
- className: cn([styles.figure, styles.holdedFigure]),
2848
+ className: cn([styles.piece, styles.holdedPiece]),
2845
2849
  style: {
2846
2850
  position: 'fixed',
2847
2851
  zIndex: 6,
2848
- top: grabbingPos[1] - boardConfig.cellSize / 2 + "px",
2849
- left: grabbingPos[0] - boardConfig.cellSize / 2 + "px",
2850
- width: boardConfig.cellSize,
2851
- height: boardConfig.cellSize
2852
+ top: grabbingPos[1] - boardConfig.squareSize / 2 + "px",
2853
+ left: grabbingPos[0] - boardConfig.squareSize / 2 + "px",
2854
+ width: boardConfig.squareSize,
2855
+ height: boardConfig.squareSize
2852
2856
  }
2853
- }, " ", boardConfig.piecesMap[getFigureCSS(holdedFigure)](boardConfig.figureSizePercent + "%"));
2857
+ }, " ", boardConfig.piecesMap[getFigureCSS(holdedFigure)](boardConfig.pieceSizePercent + "%"));
2854
2858
  };
2855
2859
 
2856
2860
  var BASE_BOARD_SIZE$2 = 8;
@@ -2877,27 +2881,23 @@ var ChessBoardInteractiveLayout = function ChessBoardInteractiveLayout(props) {
2877
2881
  }, getFilledArrayBySize(size).map(function (_, i) {
2878
2882
  var _cn, _cn2;
2879
2883
  return React__default.createElement("div", {
2880
- className: cn(styles.interactiveCell, (_cn = {}, _cn[styles.selectedCell] = selectedPos[0] === i && selectedPos[1] === j, _cn[styles.markedCell] = checkIsPossibleMove(markedCells, [i, j]), _cn[styles.checkedCell] = onHasCheck([i, j]), _cn)),
2884
+ className: cn(styles.interactiveCell, (_cn = {}, _cn[styles.selectedSquare + " " + boardConfig.selectedSquareClassName] = selectedPos[0] === i && selectedPos[1] === j, _cn[styles.pickedSquare + " " + boardConfig.pickedSquareClassName] = checkIsPossibleMove(markedCells, [i, j]), _cn[styles.checkedSquare + " " + boardConfig.checkedSquareClassName] = onHasCheck([i, j]), _cn)),
2881
2885
  key: "interactive-layout-" + i,
2882
2886
  style: {
2883
- width: boardConfig.cellSize,
2884
- height: boardConfig.cellSize,
2885
- backgroundColor: selectedPos[0] === i && selectedPos[1] === j ? boardConfig.selectedCellColor : 'transparent',
2886
- border: selectedPos[0] === i && selectedPos[1] === j ? boardConfig.selectedCellBorder : 'none',
2887
- boxShadow: checkIsPossibleMove(markedCells, [i, j]) ? "inset 0 0 30px " + boardConfig.markedCellColor : onHasCheck([i, j]) ? "inset 0 0 30px " + boardConfig.checkedCellColor : 'none'
2887
+ width: boardConfig.squareSize,
2888
+ height: boardConfig.squareSize
2888
2889
  }
2889
2890
  }, selectedPos[0] === i && selectedPos[1] === j && holdedFigure && React__default.createElement("div", {
2890
- className: cn([styles.figure, styles.holdedFigure], (_cn2 = {}, _cn2[styles.bluredFigure] = grabbingPos[0] !== -1, _cn2)),
2891
+ className: cn([styles.piece, styles.holdedPiece], (_cn2 = {}, _cn2[styles.bluredPiece] = grabbingPos[0] !== -1, _cn2)),
2891
2892
  style: {
2892
- width: boardConfig.cellSize,
2893
- height: boardConfig.cellSize
2893
+ width: boardConfig.squareSize,
2894
+ height: boardConfig.squareSize
2894
2895
  }
2895
- }, boardConfig.piecesMap[getFigureCSS(holdedFigure)](boardConfig.figureSizePercent + "%")), checkIsPossibleMove(possibleMoves, [i, j]) && React__default.createElement("div", {
2896
- className: styles.possibleMoveMark,
2896
+ }, boardConfig.piecesMap[getFigureCSS(holdedFigure)](boardConfig.pieceSizePercent + "%")), checkIsPossibleMove(possibleMoves, [i, j]) && React__default.createElement("div", {
2897
+ className: cn([styles.possibleMoveMark, boardConfig.possibleMoveMarkClassName]),
2897
2898
  style: {
2898
- width: boardConfig.cellSize / FACTOR_FOR_SIZE_CIRCLE_MARK,
2899
- height: boardConfig.cellSize / FACTOR_FOR_SIZE_CIRCLE_MARK,
2900
- backgroundColor: boardConfig.circleMarkColor
2899
+ width: boardConfig.squareSize / boardConfig.factorForSizeCircleMark,
2900
+ height: boardConfig.squareSize / boardConfig.factorForSizeCircleMark
2901
2901
  }
2902
2902
  }));
2903
2903
  }));
@@ -2963,19 +2963,19 @@ var FigurePicker = function FigurePicker(props) {
2963
2963
  onSelect(figure);
2964
2964
  }, [onSelect]);
2965
2965
  return React__default.createElement("div", {
2966
- className: styles.figurePicker
2966
+ className: styles.piecePicker
2967
2967
  }, getFiguresByColor(color, forPawnTransform).map(function (figure) {
2968
2968
  return React__default.createElement("div", {
2969
2969
  key: figure.type,
2970
- className: styles.figurePickerItem,
2970
+ className: styles.piecePickerItem,
2971
2971
  style: {
2972
- width: boardConfig.cellSize,
2973
- height: boardConfig.cellSize
2972
+ width: boardConfig.squareSize,
2973
+ height: boardConfig.squareSize
2974
2974
  },
2975
2975
  onClick: function onClick() {
2976
2976
  return handleChange(figure);
2977
2977
  }
2978
- }, boardConfig.piecesMap[getFigureCSS(figure)](boardConfig.figureSizePercent + "%"));
2978
+ }, boardConfig.piecesMap[getFigureCSS(figure)](boardConfig.pieceSizePercent + "%"));
2979
2979
  }));
2980
2980
  };
2981
2981
 
@@ -2987,7 +2987,8 @@ var ChessBoard = function ChessBoard(props) {
2987
2987
  reversed = props.reversed,
2988
2988
  config = props.config,
2989
2989
  playerColor = props.playerColor,
2990
- viewOnly = props.viewOnly;
2990
+ viewOnly = props.viewOnly,
2991
+ moveHighlight = props.moveHighlight;
2991
2992
  var _useChessBoardInterac = useChessBoardInteractive({
2992
2993
  onChange: onChange,
2993
2994
  onEndGame: onEndGame,
@@ -3056,7 +3057,8 @@ var ChessBoard = function ChessBoard(props) {
3056
3057
  className: styles.chessBoard
3057
3058
  }, React__default.createElement(ChessBoardCellsLayout, {
3058
3059
  boardConfig: boardConfig,
3059
- movesTrail: boardConfig.showMovesTrail && movesTrail
3060
+ movesTrail: boardConfig.showMovesTrail && movesTrail,
3061
+ moveHighlight: moveHighlight
3060
3062
  }), React__default.createElement(ChessBoardFiguresLayout, {
3061
3063
  initialState: initialState,
3062
3064
  change: newMove,
@@ -3088,7 +3090,7 @@ var ChessBoard = function ChessBoard(props) {
3088
3090
  onRightClick: markCell,
3089
3091
  onGrabbingCell: handleGrabbingCell
3090
3092
  }), showFigurePicker && React__default.createElement("div", {
3091
- className: styles.chessBoardFigurePicker
3093
+ className: styles.chessBoardPiecePicker
3092
3094
  }, React__default.createElement(FigurePicker, {
3093
3095
  boardConfig: boardConfig,
3094
3096
  color: currentColor,