react-chessboard-ui 1.5.1 → 1.6.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/dist/ChessBoard/constants.d.ts +3 -0
- package/dist/index.css +1 -1
- package/dist/index.js +11 -4
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +11 -4
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Figure } from "../JSChessEngine";
|
|
1
2
|
import { ChessBoardConfig } from "./models";
|
|
2
3
|
export declare const DEFAULT_CELL_SIZE = 92;
|
|
3
4
|
export declare const DEFAULT_FIGURE_SIZE_PERCENT = 80;
|
|
@@ -11,4 +12,6 @@ export declare const DEFAULT_ARROW_COLOR = "#6ac2fd";
|
|
|
11
12
|
export declare const DEFAULT_MARKED_CELL_COLOR = "#3697ce";
|
|
12
13
|
export declare const DEFAULT_CHECKED_CELL_COLOR = "#e95b5c";
|
|
13
14
|
export declare const DEFAULT_PIECES_MAP: import("./models").ChessPiecesMap;
|
|
15
|
+
export declare const DEFAULT_CSS_HIDE_PIECES_EFFECT: string;
|
|
16
|
+
export declare const DEFAULT_HIDE_PIECES_HANDLER: (figure: Figure) => void;
|
|
14
17
|
export declare const DEFAULT_CHESSBORD_CONFIG: ChessBoardConfig;
|
package/dist/index.css
CHANGED
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","
|
|
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"};
|
|
1679
1679
|
|
|
1680
1680
|
var CHESS_PIECES_MAP = {
|
|
1681
1681
|
'pawn-white': function pawnWhite(size) {
|
|
@@ -1889,6 +1889,10 @@ var DEFAULT_ARROW_COLOR = '#6ac2fd';
|
|
|
1889
1889
|
var DEFAULT_MARKED_CELL_COLOR = '#3697ce';
|
|
1890
1890
|
var DEFAULT_CHECKED_CELL_COLOR = '#e95b5c';
|
|
1891
1891
|
var DEFAULT_PIECES_MAP = CHESS_PIECES_MAP;
|
|
1892
|
+
var DEFAULT_CSS_HIDE_PIECES_EFFECT = styles.hiddenFigureEffect;
|
|
1893
|
+
var DEFAULT_HIDE_PIECES_HANDLER = function DEFAULT_HIDE_PIECES_HANDLER(figure) {
|
|
1894
|
+
figure.color === 'white' ? figure.position = [8, figure.position[1]] : figure.position = [-1, figure.position[1]];
|
|
1895
|
+
};
|
|
1892
1896
|
var DEFAULT_CHESSBORD_CONFIG = {
|
|
1893
1897
|
cellSize: DEFAULT_CELL_SIZE,
|
|
1894
1898
|
figureSizePercent: DEFAULT_FIGURE_SIZE_PERCENT,
|
|
@@ -1900,7 +1904,9 @@ var DEFAULT_CHESSBORD_CONFIG = {
|
|
|
1900
1904
|
arrowColor: DEFAULT_ARROW_COLOR,
|
|
1901
1905
|
markedCellColor: DEFAULT_MARKED_CELL_COLOR,
|
|
1902
1906
|
checkedCellColor: DEFAULT_CHECKED_CELL_COLOR,
|
|
1903
|
-
piecesMap: DEFAULT_PIECES_MAP
|
|
1907
|
+
piecesMap: DEFAULT_PIECES_MAP,
|
|
1908
|
+
cssHidePieceEffect: DEFAULT_CSS_HIDE_PIECES_EFFECT,
|
|
1909
|
+
onHidePieces: DEFAULT_HIDE_PIECES_HANDLER
|
|
1904
1910
|
};
|
|
1905
1911
|
|
|
1906
1912
|
var getFigureCSS = function getFigureCSS(figure) {
|
|
@@ -2157,7 +2163,8 @@ var ChessBoardFiguresLayout = function ChessBoardFiguresLayout(props) {
|
|
|
2157
2163
|
return figure.position[0] === to[0] && figure.position[1] === to[1];
|
|
2158
2164
|
});
|
|
2159
2165
|
if (foundAttactedFigure && foundAttactedFigure.color !== move.figure.color) {
|
|
2160
|
-
foundAttactedFigure.
|
|
2166
|
+
foundAttactedFigure.beated = true;
|
|
2167
|
+
boardConfig.onHidePieces(foundAttactedFigure);
|
|
2161
2168
|
}
|
|
2162
2169
|
var foundFigureByPositionFrom = updatedState.find(function (figure) {
|
|
2163
2170
|
return figure.position[0] === from[0] && figure.position[1] === from[1];
|
|
@@ -2189,7 +2196,7 @@ var ChessBoardFiguresLayout = function ChessBoardFiguresLayout(props) {
|
|
|
2189
2196
|
var _cn;
|
|
2190
2197
|
return React__default.createElement("div", {
|
|
2191
2198
|
key: i,
|
|
2192
|
-
className: cn([styles.figure], (_cn = {}, _cn[
|
|
2199
|
+
className: cn([styles.figure], (_cn = {}, _cn[boardConfig.cssHidePieceEffect] = figure.beated, _cn)),
|
|
2193
2200
|
style: {
|
|
2194
2201
|
top: boardConfig.cellSize * figure.position[1] + "px",
|
|
2195
2202
|
left: boardConfig.cellSize * figure.position[0] + "px",
|