react-chessboard-ui 0.4.0 → 1.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.
- package/README.md +1 -1
- package/dist/index.js +32 -24
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +32 -24
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ yarn add react-chessboard-ui
|
|
|
22
22
|
## Usage example
|
|
23
23
|
```tsx
|
|
24
24
|
import React from 'react';
|
|
25
|
-
import { ChessBoard } from '
|
|
25
|
+
import { ChessBoard } from 'react-chessboard-ui'; // ChessBoard is a base component of react-chessboard-ui
|
|
26
26
|
|
|
27
27
|
import 'react-chessboard-ui/dist/index.css'; // required import css for ChessBoard
|
|
28
28
|
|
package/dist/index.js
CHANGED
|
@@ -1478,36 +1478,44 @@ var prepareCastlingByFEN = function prepareCastlingByFEN(castlingNotation, state
|
|
|
1478
1478
|
if (castlingNotation === '-') return state;
|
|
1479
1479
|
var preparedState = [].concat(state);
|
|
1480
1480
|
if (castlingNotation.includes('K')) {
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1481
|
+
if (!!preparedState[preparedState.length - 1][preparedState.length - 1].figure) {
|
|
1482
|
+
preparedState[preparedState.length - 1][preparedState.length - 1].figure = _extends({}, preparedState[preparedState.length - 1][preparedState.length - 1].figure, {
|
|
1483
|
+
touched: false
|
|
1484
|
+
});
|
|
1485
|
+
preparedState[preparedState.length - 1][4].figure = _extends({}, preparedState[preparedState.length - 1][4].figure, {
|
|
1486
|
+
touched: false
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1487
1489
|
}
|
|
1488
1490
|
if (castlingNotation.includes('Q')) {
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1491
|
+
if (!!preparedState[preparedState.length - 1][0].figure) {
|
|
1492
|
+
preparedState[preparedState.length - 1][0].figure = _extends({}, preparedState[preparedState.length - 1][0].figure, {
|
|
1493
|
+
touched: false
|
|
1494
|
+
});
|
|
1495
|
+
preparedState[preparedState.length - 1][4].figure = _extends({}, preparedState[preparedState.length - 1][4].figure, {
|
|
1496
|
+
touched: false
|
|
1497
|
+
});
|
|
1498
|
+
}
|
|
1495
1499
|
}
|
|
1496
1500
|
if (castlingNotation.includes('k')) {
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1501
|
+
if (!!preparedState[0][preparedState.length - 1].figure) {
|
|
1502
|
+
preparedState[0][preparedState.length - 1].figure = _extends({}, preparedState[0][preparedState.length - 1].figure, {
|
|
1503
|
+
touched: false
|
|
1504
|
+
});
|
|
1505
|
+
preparedState[0][4].figure = _extends({}, preparedState[0][4].figure, {
|
|
1506
|
+
touched: false
|
|
1507
|
+
});
|
|
1508
|
+
}
|
|
1503
1509
|
}
|
|
1504
1510
|
if (castlingNotation.includes('q')) {
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
+
if (!!preparedState[0][0].figure) {
|
|
1512
|
+
preparedState[0][0].figure = _extends({}, preparedState[0][preparedState.length - 1].figure, {
|
|
1513
|
+
touched: false
|
|
1514
|
+
});
|
|
1515
|
+
preparedState[0][4].figure = _extends({}, preparedState[0][4].figure, {
|
|
1516
|
+
touched: false
|
|
1517
|
+
});
|
|
1518
|
+
}
|
|
1511
1519
|
}
|
|
1512
1520
|
return preparedState;
|
|
1513
1521
|
};
|