react-chessboard-ui 1.2.0 → 1.2.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.
|
@@ -9,6 +9,7 @@ declare type UseChessBoardInteractiveProps = {
|
|
|
9
9
|
export declare const useChessBoardInteractive: (props: UseChessBoardInteractiveProps) => {
|
|
10
10
|
fromPos: CellPos;
|
|
11
11
|
newMove: ChangeMove;
|
|
12
|
+
animated: boolean;
|
|
12
13
|
boardConfig: ChessBoardConfig;
|
|
13
14
|
markedCells: CellPos[];
|
|
14
15
|
grabbingPos: CellPos;
|
|
@@ -24,6 +25,7 @@ export declare const useChessBoardInteractive: (props: UseChessBoardInteractiveP
|
|
|
24
25
|
showFigurePicker: boolean;
|
|
25
26
|
markCell: (cellPos: CellPos) => void;
|
|
26
27
|
setNewMove: import("react").Dispatch<import("react").SetStateAction<ChangeMove>>;
|
|
28
|
+
setAnimated: import("react").Dispatch<import("react").SetStateAction<boolean>>;
|
|
27
29
|
handleClick: (cellPos: CellPos) => void;
|
|
28
30
|
clearFromPos: () => void;
|
|
29
31
|
handleGrabEnd: (cellPos: CellPos, withTransition?: boolean) => void;
|
package/dist/index.js
CHANGED
|
@@ -2139,7 +2139,7 @@ var ChessBoardFiguresLayout = function ChessBoardFiguresLayout(props) {
|
|
|
2139
2139
|
width: boardConfig.cellSize,
|
|
2140
2140
|
height: boardConfig.cellSize
|
|
2141
2141
|
}
|
|
2142
|
-
}, boardConfig.piecesMap[getFigureCSS(figure)]('80%'));
|
|
2142
|
+
}, boardConfig.piecesMap[getFigureCSS(figure)] && boardConfig.piecesMap[getFigureCSS(figure)]('80%'));
|
|
2143
2143
|
}));
|
|
2144
2144
|
};
|
|
2145
2145
|
|
|
@@ -2297,6 +2297,9 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
|
|
|
2297
2297
|
var _useState21 = React.useState([-1, -1]),
|
|
2298
2298
|
targetPos = _useState21[0],
|
|
2299
2299
|
setTargetPos = _useState21[1];
|
|
2300
|
+
var _useState22 = React.useState(false),
|
|
2301
|
+
animated = _useState22[0],
|
|
2302
|
+
setAnimated = _useState22[1];
|
|
2300
2303
|
var clearFromPos = function clearFromPos() {
|
|
2301
2304
|
return setFromPos([-1, -1]);
|
|
2302
2305
|
};
|
|
@@ -2513,6 +2516,7 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
|
|
|
2513
2516
|
return;
|
|
2514
2517
|
}
|
|
2515
2518
|
onChange(moveData);
|
|
2519
|
+
setAnimated(withTransition);
|
|
2516
2520
|
setNewMove({
|
|
2517
2521
|
move: moveData,
|
|
2518
2522
|
withTransition: withTransition,
|
|
@@ -2536,6 +2540,7 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
|
|
|
2536
2540
|
attackedPos = _moveFigureByClick.attackedPos;
|
|
2537
2541
|
if (!moveData) return;
|
|
2538
2542
|
onChange(moveData);
|
|
2543
|
+
setAnimated(withTransition);
|
|
2539
2544
|
setNewMove({
|
|
2540
2545
|
move: moveData,
|
|
2541
2546
|
withTransition: withTransition,
|
|
@@ -2633,6 +2638,7 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
|
|
|
2633
2638
|
return {
|
|
2634
2639
|
fromPos: fromPos,
|
|
2635
2640
|
newMove: newMove,
|
|
2641
|
+
animated: animated,
|
|
2636
2642
|
boardConfig: boardConfig,
|
|
2637
2643
|
markedCells: markedCells,
|
|
2638
2644
|
grabbingPos: grabbingPos,
|
|
@@ -2648,6 +2654,7 @@ var useChessBoardInteractive = function useChessBoardInteractive(props) {
|
|
|
2648
2654
|
showFigurePicker: showFigurePicker,
|
|
2649
2655
|
markCell: markCell,
|
|
2650
2656
|
setNewMove: setNewMove,
|
|
2657
|
+
setAnimated: setAnimated,
|
|
2651
2658
|
handleClick: handleClick,
|
|
2652
2659
|
clearFromPos: clearFromPos,
|
|
2653
2660
|
handleGrabEnd: handleGrabEnd,
|
|
@@ -2819,9 +2826,6 @@ var ChessBoard = function ChessBoard(props) {
|
|
|
2819
2826
|
reversed = props.reversed,
|
|
2820
2827
|
config = props.config,
|
|
2821
2828
|
playerColor = props.playerColor;
|
|
2822
|
-
var _useState = React.useState(false),
|
|
2823
|
-
animated = _useState[0],
|
|
2824
|
-
setAnimated = _useState[1];
|
|
2825
2829
|
var _useChessBoardInterac = useChessBoardInteractive({
|
|
2826
2830
|
onChange: onChange,
|
|
2827
2831
|
onEndGame: onEndGame,
|
|
@@ -2829,6 +2833,7 @@ var ChessBoard = function ChessBoard(props) {
|
|
|
2829
2833
|
}),
|
|
2830
2834
|
fromPos = _useChessBoardInterac.fromPos,
|
|
2831
2835
|
newMove = _useChessBoardInterac.newMove,
|
|
2836
|
+
animated = _useChessBoardInterac.animated,
|
|
2832
2837
|
boardConfig = _useChessBoardInterac.boardConfig,
|
|
2833
2838
|
markedCells = _useChessBoardInterac.markedCells,
|
|
2834
2839
|
grabbingPos = _useChessBoardInterac.grabbingPos,
|
|
@@ -2842,6 +2847,7 @@ var ChessBoard = function ChessBoard(props) {
|
|
|
2842
2847
|
showFigurePicker = _useChessBoardInterac.showFigurePicker,
|
|
2843
2848
|
markCell = _useChessBoardInterac.markCell,
|
|
2844
2849
|
setNewMove = _useChessBoardInterac.setNewMove,
|
|
2850
|
+
setAnimated = _useChessBoardInterac.setAnimated,
|
|
2845
2851
|
handleClick = _useChessBoardInterac.handleClick,
|
|
2846
2852
|
handleGrabEnd = _useChessBoardInterac.handleGrabEnd,
|
|
2847
2853
|
handleGrabbing = _useChessBoardInterac.handleGrabbing,
|