react-chessboard-ui 1.7.3 → 1.7.4

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 { FigureColor, GameResult, MoveData, CellPos } from "../JSChessEngine";
2
2
  import { FC } from "react";
3
3
  import { ChangeMove, ChessBoardConfig } from "./models";
4
4
  declare type ChessBoardProps = {
@@ -10,6 +10,7 @@ declare type ChessBoardProps = {
10
10
  config?: Partial<ChessBoardConfig>;
11
11
  playerColor?: FigureColor;
12
12
  viewOnly?: boolean;
13
+ moveHighlight?: [CellPos, CellPos];
13
14
  };
14
15
  export declare const ChessBoard: FC<ChessBoardProps>;
15
16
  export {};
@@ -5,6 +5,7 @@ declare type ChessBoardCellsLayoutProps = {
5
5
  boardConfig: ChessBoardConfig;
6
6
  size?: number;
7
7
  movesTrail?: [CellPos, CellPos];
8
+ moveHighlight?: [CellPos, CellPos];
8
9
  };
9
10
  export declare const ChessBoardCellsLayout: FC<ChessBoardCellsLayoutProps>;
10
11
  export {};
package/dist/index.js CHANGED
@@ -2045,7 +2045,8 @@ 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,
@@ -2060,6 +2061,8 @@ var ChessBoardCellsLayout = function ChessBoardCellsLayout(_ref) {
2060
2061
  key: "cells-layout-" + i
2061
2062
  }, movesTrail && (movesTrail[0][0] === i && movesTrail[0][1] === j || movesTrail[1][0] === i && movesTrail[1][1] === j) && React__default.createElement("div", {
2062
2063
  className: styles.movesTrail
2064
+ }), moveHighlight && (moveHighlight[0][0] === i && moveHighlight[0][1] === j || moveHighlight[1][0] === i && moveHighlight[1][1] === j) && React__default.createElement("div", {
2065
+ className: styles.movesTrail
2063
2066
  }));
2064
2067
  }));
2065
2068
  }));
@@ -2987,7 +2990,8 @@ var ChessBoard = function ChessBoard(props) {
2987
2990
  reversed = props.reversed,
2988
2991
  config = props.config,
2989
2992
  playerColor = props.playerColor,
2990
- viewOnly = props.viewOnly;
2993
+ viewOnly = props.viewOnly,
2994
+ moveHighlight = props.moveHighlight;
2991
2995
  var _useChessBoardInterac = useChessBoardInteractive({
2992
2996
  onChange: onChange,
2993
2997
  onEndGame: onEndGame,
@@ -3056,7 +3060,8 @@ var ChessBoard = function ChessBoard(props) {
3056
3060
  className: styles.chessBoard
3057
3061
  }, React__default.createElement(ChessBoardCellsLayout, {
3058
3062
  boardConfig: boardConfig,
3059
- movesTrail: boardConfig.showMovesTrail && movesTrail
3063
+ movesTrail: boardConfig.showMovesTrail && movesTrail,
3064
+ moveHighlight: moveHighlight
3060
3065
  }), React__default.createElement(ChessBoardFiguresLayout, {
3061
3066
  initialState: initialState,
3062
3067
  change: newMove,