next-chessground 0.9.0 → 0.9.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/dist/index.es.js +2 -9
- package/dist/index.js +2 -9
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -6358,11 +6358,9 @@ const useChess = props => {
|
|
|
6358
6358
|
const [fen, setFen] = useState(props.fen || initial$1);
|
|
6359
6359
|
const [chess$1] = useState(new chess.Chess(fen));
|
|
6360
6360
|
const [lastMove, setLastMove] = useState([]);
|
|
6361
|
+
const promotion = props.lastMove && props.lastMove.promotion;
|
|
6361
6362
|
const turnColor = chess$1.turn() === 'w' ? 'white' : 'black';
|
|
6362
6363
|
const [orientation] = useState(props.orientation || turnColor);
|
|
6363
|
-
const [sideToMove] = useState(turnColor);
|
|
6364
|
-
const autoQueen = props.options && props.options.autoQueen;
|
|
6365
|
-
const promotion = autoQueen && turnColor !== sideToMove ? 'q' : '';
|
|
6366
6364
|
|
|
6367
6365
|
const onMove = (from, to, promotion) => {
|
|
6368
6366
|
const move = chess$1.move({
|
|
@@ -6492,7 +6490,7 @@ const cgProps = props => {
|
|
|
6492
6490
|
}
|
|
6493
6491
|
}
|
|
6494
6492
|
|
|
6495
|
-
if (props.
|
|
6493
|
+
if (props.drawable === false) {
|
|
6496
6494
|
cgProps.drawable = {
|
|
6497
6495
|
enabled: false
|
|
6498
6496
|
};
|
|
@@ -6546,11 +6544,6 @@ const Chessboard = (props, ref) => {
|
|
|
6546
6544
|
}
|
|
6547
6545
|
};
|
|
6548
6546
|
|
|
6549
|
-
if (props.reply && props.reply.from && props.reply.to) {
|
|
6550
|
-
const cg = ref.current.board;
|
|
6551
|
-
cg.move(props.reply.from, props.reply.to);
|
|
6552
|
-
}
|
|
6553
|
-
|
|
6554
6547
|
return /*#__PURE__*/React.createElement("div", {
|
|
6555
6548
|
className: mergeClassNames('chessground', theme.highlight && 'highlight', theme.board, theme.pieces)
|
|
6556
6549
|
}, /*#__PURE__*/React.createElement(Chessground$1, _extends({
|
package/dist/index.js
CHANGED
|
@@ -6367,11 +6367,9 @@ const useChess = props => {
|
|
|
6367
6367
|
const [fen, setFen] = React.useState(props.fen || initial$1);
|
|
6368
6368
|
const [chess$1] = React.useState(new chess.Chess(fen));
|
|
6369
6369
|
const [lastMove, setLastMove] = React.useState([]);
|
|
6370
|
+
const promotion = props.lastMove && props.lastMove.promotion;
|
|
6370
6371
|
const turnColor = chess$1.turn() === 'w' ? 'white' : 'black';
|
|
6371
6372
|
const [orientation] = React.useState(props.orientation || turnColor);
|
|
6372
|
-
const [sideToMove] = React.useState(turnColor);
|
|
6373
|
-
const autoQueen = props.options && props.options.autoQueen;
|
|
6374
|
-
const promotion = autoQueen && turnColor !== sideToMove ? 'q' : '';
|
|
6375
6373
|
|
|
6376
6374
|
const onMove = (from, to, promotion) => {
|
|
6377
6375
|
const move = chess$1.move({
|
|
@@ -6501,7 +6499,7 @@ const cgProps = props => {
|
|
|
6501
6499
|
}
|
|
6502
6500
|
}
|
|
6503
6501
|
|
|
6504
|
-
if (props.
|
|
6502
|
+
if (props.drawable === false) {
|
|
6505
6503
|
cgProps.drawable = {
|
|
6506
6504
|
enabled: false
|
|
6507
6505
|
};
|
|
@@ -6555,11 +6553,6 @@ const Chessboard = (props, ref) => {
|
|
|
6555
6553
|
}
|
|
6556
6554
|
};
|
|
6557
6555
|
|
|
6558
|
-
if (props.reply && props.reply.from && props.reply.to) {
|
|
6559
|
-
const cg = ref.current.board;
|
|
6560
|
-
cg.move(props.reply.from, props.reply.to);
|
|
6561
|
-
}
|
|
6562
|
-
|
|
6563
6556
|
return /*#__PURE__*/React__default['default'].createElement("div", {
|
|
6564
6557
|
className: mergeClassNames('chessground', theme.highlight && 'highlight', theme.board, theme.pieces)
|
|
6565
6558
|
}, /*#__PURE__*/React__default['default'].createElement(Chessground$1, _extends({
|