kokopu-react 1.2.0 → 1.4.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/CHANGELOG.md +17 -0
- package/dist/lib/ArrowMarkerIcon.js +5 -7
- package/dist/lib/Chessboard.js +27 -33
- package/dist/lib/{impl/ErrorBox.js → ErrorBox.js} +2 -2
- package/dist/lib/SquareMarkerIcon.js +1 -1
- package/dist/lib/TextMarkerIcon.js +12 -11
- package/dist/lib/css/arrow.css +1 -1
- package/dist/lib/css/chessboard.css +1 -1
- package/dist/lib/css/error_box.css +1 -1
- package/dist/lib/css/label.css +1 -1
- package/dist/lib/css/symbol.css +25 -0
- package/dist/lib/i18n.js +35 -0
- package/dist/lib/impl/ArrowTip.js +3 -8
- package/dist/lib/impl/TextSymbol.js +100 -0
- package/dist/lib/impl/colorsets.js +1 -1
- package/dist/lib/impl/piecesets.js +1 -1
- package/dist/lib/impl/util.js +6 -6
- package/dist/lib/index.js +34 -18
- package/dist/lib/markers.js +10 -10
- package/doc_src/{demo/.eslintrc.yml → .eslintrc.yml} +0 -0
- package/doc_src/demo/PageChessboardBase.js +36 -41
- package/doc_src/demo/PageChessboardEdition.js +59 -71
- package/doc_src/demo/PageChessboardMove.js +21 -28
- package/doc_src/demo/PageChessboardSmallScreens.js +16 -17
- package/doc_src/demo/demo.css +1 -1
- package/doc_src/demo/util.js +1 -1
- package/doc_src/examples/ErrorBox.md +3 -0
- package/doc_src/theming/LogoRenderer.js +50 -0
- package/doc_src/theming/kokopu-react-favicon.png +0 -0
- package/doc_src/theming/kokopu-react-logo.png +0 -0
- package/doc_src/theming/theming.css +29 -0
- package/graphic_test_app/01_marker_icons.js +6 -4
- package/graphic_test_app/02_chessboard_simple.js +1 -1
- package/graphic_test_app/03_chessboard_flipped.js +1 -1
- package/graphic_test_app/04_chessboard_annotations.js +2 -2
- package/graphic_test_app/05_chessboard_move.js +1 -1
- package/graphic_test_app/06_chessboard_theme.js +1 -1
- package/graphic_test_app/07_chessboard_click_squares.js +1 -1
- package/graphic_test_app/08_chessboard_move_pieces.js +1 -1
- package/graphic_test_app/09_chessboard_edit_arrows.js +1 -1
- package/graphic_test_app/10_chessboard_play_moves.js +1 -1
- package/graphic_test_app/11_chessboard_play_promotions.js +1 -1
- package/graphic_test_app/common/test_app.css +1 -1
- package/graphic_test_app/common/test_app.js +1 -1
- package/package.json +23 -22
- package/scripts/test_graphic/clean-graphic-output.js +1 -1
- package/scripts/test_graphic/docker-compose.yml +1 -1
- package/scripts/test_graphic/webpack-config.js +2 -1
- package/scripts/test_headless.webpack-config.js +2 -1
- package/src/ArrowMarkerIcon.js +2 -2
- package/src/Chessboard.js +16 -14
- package/src/{impl/ErrorBox.js → ErrorBox.js} +2 -2
- package/src/SquareMarkerIcon.js +1 -1
- package/src/TextMarkerIcon.js +7 -7
- package/src/css/arrow.css +1 -1
- package/src/css/chessboard.css +1 -1
- package/src/css/error_box.css +1 -1
- package/src/css/label.css +1 -1
- package/src/css/symbol.css +25 -0
- package/src/i18n.js +30 -0
- package/src/impl/ArrowTip.js +3 -7
- package/src/impl/TextSymbol.js +77 -0
- package/src/impl/colorsets.js +1 -1
- package/src/impl/piecesets.js +1 -1
- package/src/impl/util.js +2 -2
- package/src/index.js +3 -1
- package/src/markers.js +8 -7
- package/test/1_markers.js +20 -1
- package/test/2_chessboard_util.js +1 -1
- package/test/3_marker_icons_graphic.js +2 -2
- package/test/4_chessboard_graphic.js +1 -1
- package/test/5_chessboard_interaction.js +1 -1
- package/test/6_chessboard_play_moves.js +1 -1
- package/test/common/graphic.js +1 -1
- package/test/references/01_marker_icons/10.png +0 -0
- package/test/references/01_marker_icons/9.png +0 -0
- package/test/references/02_chessboard_simple/2.png +0 -0
- package/test/references/02_chessboard_simple/5.png +0 -0
- package/test/references/03_chessboard_flipped/2.png +0 -0
- package/test/references/04_chessboard_annotations/4.png +0 -0
- package/test/references/04_chessboard_annotations/5.png +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -25,8 +25,9 @@ import React from 'react';
|
|
|
25
25
|
import { Chessboard } from '../../src/index';
|
|
26
26
|
import { buildComponentDemoCode } from './util';
|
|
27
27
|
|
|
28
|
-
import Box from '@material
|
|
29
|
-
import
|
|
28
|
+
import Box from '@mui/material/Box';
|
|
29
|
+
import Stack from '@mui/material/Stack';
|
|
30
|
+
import Typography from '@mui/material/Typography';
|
|
30
31
|
|
|
31
32
|
import './demo.css';
|
|
32
33
|
|
|
@@ -63,17 +64,17 @@ export default class Page extends React.Component {
|
|
|
63
64
|
|
|
64
65
|
render() {
|
|
65
66
|
return (
|
|
66
|
-
<
|
|
67
|
+
<Stack spacing={2} mt={2}>
|
|
67
68
|
{this.renderControls()}
|
|
68
69
|
{this.renderChessboard()}
|
|
69
70
|
{this.renderCode()}
|
|
70
|
-
</
|
|
71
|
+
</Stack>
|
|
71
72
|
);
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
renderControls() {
|
|
75
76
|
return (
|
|
76
|
-
<Box
|
|
77
|
+
<Box>
|
|
77
78
|
<Typography>Resize the browser to see the chessboard adapt its size...</Typography>
|
|
78
79
|
<Typography>{`Current browser width: ${this.state.windowWidth} px`}</Typography>
|
|
79
80
|
</Box>
|
|
@@ -82,7 +83,7 @@ export default class Page extends React.Component {
|
|
|
82
83
|
|
|
83
84
|
renderChessboard() {
|
|
84
85
|
return (
|
|
85
|
-
<Box
|
|
86
|
+
<Box>
|
|
86
87
|
<Chessboard squareSize={this.state.squareSize} smallScreenLimits={this.state.limits} />
|
|
87
88
|
</Box>
|
|
88
89
|
);
|
|
@@ -102,16 +103,14 @@ export default class Page extends React.Component {
|
|
|
102
103
|
attributes.push(`squareSize={${this.state.squareSize}}`);
|
|
103
104
|
attributes.push('smallScreenLimits={limits}');
|
|
104
105
|
return (
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
</pre>
|
|
114
|
-
</Box>
|
|
106
|
+
<pre className="kokopu-demoCode">
|
|
107
|
+
{
|
|
108
|
+
'let limits = [\n' +
|
|
109
|
+
limits.join('') +
|
|
110
|
+
'];\n' +
|
|
111
|
+
buildComponentDemoCode('Chessboard', attributes)
|
|
112
|
+
}
|
|
113
|
+
</pre>
|
|
115
114
|
);
|
|
116
115
|
}
|
|
117
116
|
|
package/doc_src/demo/demo.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
package/doc_src/demo/util.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
* *
|
|
3
|
+
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
|
+
* *
|
|
6
|
+
* This program is free software: you can redistribute it and/or *
|
|
7
|
+
* modify it under the terms of the GNU Lesser General Public License *
|
|
8
|
+
* as published by the Free Software Foundation, either version 3 of *
|
|
9
|
+
* the License, or (at your option) any later version. *
|
|
10
|
+
* *
|
|
11
|
+
* This program is distributed in the hope that it will be useful, *
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
|
+
* GNU Lesser General Public License for more details. *
|
|
15
|
+
* *
|
|
16
|
+
* You should have received a copy of the GNU Lesser General *
|
|
17
|
+
* Public License along with this program. If not, see *
|
|
18
|
+
* <http://www.gnu.org/licenses/>. *
|
|
19
|
+
* *
|
|
20
|
+
******************************************************************************/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
import React from 'react';
|
|
24
|
+
import Styled from 'react-styleguidist/lib/client/rsg-components/Styled';
|
|
25
|
+
|
|
26
|
+
import logo from './kokopu-react-logo.png';
|
|
27
|
+
|
|
28
|
+
import './theming.css';
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
const styles = ({ color, fontFamily, fontSize }) => ({
|
|
32
|
+
logo: {
|
|
33
|
+
color: color.base,
|
|
34
|
+
margin: 0,
|
|
35
|
+
fontFamily: fontFamily.base,
|
|
36
|
+
fontSize: fontSize.h4,
|
|
37
|
+
fontWeight: 'normal',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
function LogoRenderer({ classes, children }) {
|
|
42
|
+
return (<>
|
|
43
|
+
<div className="kokopu-logo">
|
|
44
|
+
<img src={logo} />
|
|
45
|
+
</div>
|
|
46
|
+
<h1 className={classes.logo}>{children}</h1>
|
|
47
|
+
</>);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default Styled(styles)(LogoRenderer);
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
* *
|
|
3
|
+
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
|
+
* *
|
|
6
|
+
* This program is free software: you can redistribute it and/or *
|
|
7
|
+
* modify it under the terms of the GNU Lesser General Public License *
|
|
8
|
+
* as published by the Free Software Foundation, either version 3 of *
|
|
9
|
+
* the License, or (at your option) any later version. *
|
|
10
|
+
* *
|
|
11
|
+
* This program is distributed in the hope that it will be useful, *
|
|
12
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
|
+
* GNU Lesser General Public License for more details. *
|
|
15
|
+
* *
|
|
16
|
+
* You should have received a copy of the GNU Lesser General *
|
|
17
|
+
* Public License along with this program. If not, see *
|
|
18
|
+
* <http://www.gnu.org/licenses/>. *
|
|
19
|
+
* *
|
|
20
|
+
******************************************************************************/
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
.kokopu-logo {
|
|
24
|
+
text-align: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
footer {
|
|
28
|
+
display: none !important;
|
|
29
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -27,11 +27,13 @@ import { SquareMarkerIcon, TextMarkerIcon, ArrowMarkerIcon } from '../src/index'
|
|
|
27
27
|
testApp([ /* eslint-disable react/jsx-key */
|
|
28
28
|
<SquareMarkerIcon size={40} />,
|
|
29
29
|
<SquareMarkerIcon size={45} color="green" />,
|
|
30
|
-
<div style={{ color: 'purple' }}
|
|
30
|
+
<div style={{ color: 'purple' }}><SquareMarkerIcon size={31} /></div>,
|
|
31
31
|
<TextMarkerIcon size={41} symbol="A" />,
|
|
32
32
|
<TextMarkerIcon size={29} symbol="b" color="#0ff" />,
|
|
33
|
-
<div style={{ color: 'red' }}
|
|
33
|
+
<div style={{ color: 'red' }}><TextMarkerIcon size={53} symbol="5" /></div>,
|
|
34
34
|
<ArrowMarkerIcon size={40} />,
|
|
35
35
|
<ArrowMarkerIcon size={24} color="#888" />,
|
|
36
|
-
<div style={{ color: '#f70' }}
|
|
36
|
+
<div style={{ color: '#f70' }}><ArrowMarkerIcon size={48} /></div>,
|
|
37
|
+
<TextMarkerIcon size={47} symbol="dot" color="#00f" />,
|
|
38
|
+
<div style={{ color: 'pink' }}><TextMarkerIcon size={48} symbol="circle" /></div>,
|
|
37
39
|
]); /* eslint-enable react/jsx-key */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -34,7 +34,7 @@ let textMarkers2 = { g3: { symbol: 'H', color: 'r' }, g5: { symbol: 'M', color:
|
|
|
34
34
|
|
|
35
35
|
let squareMarkers3 = { b5: 'r', e4: 'g', h5: 'y' };
|
|
36
36
|
let arrowMarkers3 = { d1h5: 'g', a5f4: 'r', c7c3: 'y', g7g7: 'g' };
|
|
37
|
-
let textMarkers3 = 'G5c6';
|
|
37
|
+
let textMarkers3 = 'G5c6,R(plus)a1,G(times)b1,R(dot)a2,Y(circle)b2';
|
|
38
38
|
|
|
39
39
|
testApp([ /* eslint-disable react/jsx-key */
|
|
40
40
|
<Chessboard squareMarkers={squareMarkers1} arrowMarkers={arrowMarkers1} textMarkers={textMarkers1} flipped={false} coordinateVisible={true} />,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kokopu-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "A React-based library to create and display chessboard components.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"chess",
|
|
@@ -29,40 +29,41 @@
|
|
|
29
29
|
".nycrc.yml"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"kokopu": "^2.
|
|
33
|
-
"prop-types": "^15.
|
|
32
|
+
"kokopu": "^2.2.1",
|
|
33
|
+
"prop-types": "^15.8.0",
|
|
34
34
|
"react": "^17.0.2",
|
|
35
35
|
"react-draggable": "^4.4.4",
|
|
36
36
|
"react-motion": "^0.5.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@babel/cli": "^7.
|
|
40
|
-
"@babel/core": "^7.
|
|
41
|
-
"@babel/preset-env": "^7.
|
|
42
|
-
"@babel/preset-react": "^7.
|
|
43
|
-
"@
|
|
44
|
-
"@
|
|
45
|
-
"
|
|
46
|
-
"babel-
|
|
47
|
-
"
|
|
39
|
+
"@babel/cli": "^7.16.7",
|
|
40
|
+
"@babel/core": "^7.16.7",
|
|
41
|
+
"@babel/preset-env": "^7.16.7",
|
|
42
|
+
"@babel/preset-react": "^7.16.7",
|
|
43
|
+
"@emotion/react": "^11.7.1",
|
|
44
|
+
"@emotion/styled": "^11.6.0",
|
|
45
|
+
"@mui/material": "^5.2.6",
|
|
46
|
+
"babel-loader": "^8.2.3",
|
|
47
|
+
"babel-plugin-istanbul": "^6.1.1",
|
|
48
|
+
"copy-webpack-plugin": "^10.2.0",
|
|
48
49
|
"coveralls": "^3.1.1",
|
|
49
|
-
"css-loader": "^6.
|
|
50
|
-
"eslint": "^
|
|
51
|
-
"eslint-plugin-react": "^7.
|
|
52
|
-
"html-webpack-plugin": "^5.
|
|
50
|
+
"css-loader": "^6.5.1",
|
|
51
|
+
"eslint": "^8.6.0",
|
|
52
|
+
"eslint-plugin-react": "^7.28.0",
|
|
53
|
+
"html-webpack-plugin": "^5.5.0",
|
|
53
54
|
"img-diff-js": "^0.5.2",
|
|
54
|
-
"mocha": "^9.1.
|
|
55
|
+
"mocha": "^9.1.3",
|
|
55
56
|
"null-loader": "^4.0.1",
|
|
56
57
|
"nyc": "^15.1.0",
|
|
57
58
|
"prompt": "^1.2.0",
|
|
58
59
|
"react-dom": "^17.0.2",
|
|
59
60
|
"react-styleguidist": "^11.1.7",
|
|
60
|
-
"selenium-webdriver": "^4.
|
|
61
|
-
"ssh2-sftp-client": "^7.
|
|
62
|
-
"style-loader": "^3.
|
|
61
|
+
"selenium-webdriver": "^4.1.0",
|
|
62
|
+
"ssh2-sftp-client": "^7.2.1",
|
|
63
|
+
"style-loader": "^3.3.1",
|
|
63
64
|
"unit.js": "^2.1.1",
|
|
64
|
-
"webpack": "^5.
|
|
65
|
-
"webpack-cli": "^4.
|
|
65
|
+
"webpack": "^5.65.0",
|
|
66
|
+
"webpack-cli": "^4.9.1"
|
|
66
67
|
},
|
|
67
68
|
"scripts": {
|
|
68
69
|
"lint": "eslint doc_src graphic_test_app src test",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -47,6 +47,7 @@ module.exports = {
|
|
|
47
47
|
entry: entries,
|
|
48
48
|
output: {
|
|
49
49
|
path: path.resolve(__dirname, '../../build/test_graphic'),
|
|
50
|
+
hashFunction: "xxhash64", // FIXME The default hash function used by Webpack has been removed from OpenSSL.
|
|
50
51
|
},
|
|
51
52
|
plugins: plugins,
|
|
52
53
|
module: {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -32,6 +32,7 @@ module.exports = {
|
|
|
32
32
|
library: {
|
|
33
33
|
type: 'commonjs2',
|
|
34
34
|
},
|
|
35
|
+
hashFunction: "xxhash64", // FIXME The default hash function used by Webpack has been removed from OpenSSL.
|
|
35
36
|
},
|
|
36
37
|
module: {
|
|
37
38
|
rules: [
|
package/src/ArrowMarkerIcon.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -54,7 +54,7 @@ export default class ArrowMarkerIcon extends React.Component {
|
|
|
54
54
|
<ArrowTip id={this.arrowTipId} color={this.props.color} />
|
|
55
55
|
</defs>
|
|
56
56
|
<line className="kokopu-arrow" x1={halfThickness} y1={size / 2} x2={size - halfThickness * 3} y2={size / 2} stroke={this.props.color}
|
|
57
|
-
|
|
57
|
+
strokeWidth={halfThickness * 2} markerEnd={`url(#${this.arrowTipId})`} />
|
|
58
58
|
</svg>
|
|
59
59
|
);
|
|
60
60
|
}
|
package/src/Chessboard.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -29,7 +29,9 @@ import kokopu from 'kokopu';
|
|
|
29
29
|
import colorsets from './impl/colorsets';
|
|
30
30
|
import piecesets from './impl/piecesets';
|
|
31
31
|
import ArrowTip from './impl/ArrowTip';
|
|
32
|
-
import
|
|
32
|
+
import TextSymbol from './impl/TextSymbol';
|
|
33
|
+
import ErrorBox from './ErrorBox';
|
|
34
|
+
import i18n from './i18n';
|
|
33
35
|
import { parseSquareMarkers, parseTextMarkers, parseArrowMarkers } from './markers';
|
|
34
36
|
import { MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, sanitizeInteger, generateRandomId, isValidSquare, isValidVector, isValidColor, isValidSymbol } from './impl/util';
|
|
35
37
|
|
|
@@ -82,10 +84,10 @@ export default class Chessboard extends React.Component {
|
|
|
82
84
|
// Compute the current position.
|
|
83
85
|
let info = this.getPositionAndMoveInfo();
|
|
84
86
|
if (info.positionError) {
|
|
85
|
-
return <ErrorBox title=
|
|
87
|
+
return <ErrorBox title={i18n.INVALID_FEN_ERROR_TITLE} message={info.message}></ErrorBox>;
|
|
86
88
|
}
|
|
87
89
|
else if (info.moveError) {
|
|
88
|
-
return <ErrorBox title=
|
|
90
|
+
return <ErrorBox title={i18n.INVALID_NOTATION_ERROR_TITLE} message={info.message}></ErrorBox>;
|
|
89
91
|
}
|
|
90
92
|
let { position, move, positionBefore } = info;
|
|
91
93
|
|
|
@@ -271,7 +273,7 @@ export default class Chessboard extends React.Component {
|
|
|
271
273
|
return (
|
|
272
274
|
<line
|
|
273
275
|
className="kokopu-annotation kokopu-arrow kokopu-arrowDraggable kokopu-dragging" x1={xFrom} y1={yFrom} x2={xTo} y2={yTo}
|
|
274
|
-
stroke={colorset[this.props.editedArrowColor]}
|
|
276
|
+
stroke={colorset[this.props.editedArrowColor]} strokeWidth={strokeWidth} markerEnd={`url(#${arrowTipId})`}
|
|
275
277
|
/>
|
|
276
278
|
);
|
|
277
279
|
}
|
|
@@ -346,9 +348,9 @@ export default class Chessboard extends React.Component {
|
|
|
346
348
|
x += squareSize / 2;
|
|
347
349
|
y += squareSize / 2;
|
|
348
350
|
result.push(
|
|
349
|
-
<
|
|
350
|
-
{value.symbol}
|
|
351
|
-
</
|
|
351
|
+
<g key={'txtm-' + sq} className="kokopu-annotation">
|
|
352
|
+
<TextSymbol x={x} y={y} size={squareSize} symbol={value.symbol} color={colorset[value.color]} />
|
|
353
|
+
</g>
|
|
352
354
|
);
|
|
353
355
|
});
|
|
354
356
|
return result;
|
|
@@ -375,7 +377,7 @@ export default class Chessboard extends React.Component {
|
|
|
375
377
|
result.push(
|
|
376
378
|
<line
|
|
377
379
|
key={'arm-' + vect} className="kokopu-annotation kokopu-arrow" x1={xFrom} y1={yFrom} x2={xTo} y2={yTo}
|
|
378
|
-
stroke={colorset[color]}
|
|
380
|
+
stroke={colorset[color]} strokeWidth={strokeWidth} markerEnd={`url(#${arrowTipId})`}
|
|
379
381
|
/>
|
|
380
382
|
);
|
|
381
383
|
});
|
|
@@ -399,7 +401,7 @@ export default class Chessboard extends React.Component {
|
|
|
399
401
|
return (
|
|
400
402
|
<line
|
|
401
403
|
className="kokopu-annotation kokopu-arrow" x1={xFrom} y1={yFrom} x2={x} y2={y} stroke={colorset['highlight']}
|
|
402
|
-
|
|
404
|
+
strokeWidth={squareSize * STROKE_THICKNESS_FACTOR} markerEnd={`url(#${this.getArrowTipId('highlight')})`}
|
|
403
405
|
/>
|
|
404
406
|
);
|
|
405
407
|
}
|
|
@@ -418,14 +420,14 @@ export default class Chessboard extends React.Component {
|
|
|
418
420
|
let x = Math.round(-RANK_COORDINATE_WIDTH_FACTOR * fontSize) / 2;
|
|
419
421
|
let y = (this.props.flipped ? rank + 0.5 : 7.5 - rank) * squareSize;
|
|
420
422
|
let label = RANK_LABELS[rank];
|
|
421
|
-
return <text key={'rank-' + label} className="kokopu-coordinate kokopu-label" x={x} y={y}
|
|
423
|
+
return <text key={'rank-' + label} className="kokopu-coordinate kokopu-label" x={x} y={y} fontSize={fontSize}>{label}</text>;
|
|
422
424
|
}
|
|
423
425
|
|
|
424
426
|
renderFileCoordinate(squareSize, fontSize, file) {
|
|
425
427
|
let x = (this.props.flipped ? 7.5 - file : 0.5 + file) * squareSize;
|
|
426
428
|
let y = 8 * squareSize + Math.round(FILE_COORDINATE_HEIGHT_FACTOR * fontSize) / 2;
|
|
427
429
|
let label = FILE_LABELS[file];
|
|
428
|
-
return <text key={'file-' + label} className="kokopu-coordinate kokopu-label" x={x} y={y}
|
|
430
|
+
return <text key={'file-' + label} className="kokopu-coordinate kokopu-label" x={x} y={y} fontSize={fontSize}>{label}</text>;
|
|
429
431
|
}
|
|
430
432
|
|
|
431
433
|
handleWindowResize() {
|
|
@@ -938,7 +940,7 @@ function parsePosition(position) {
|
|
|
938
940
|
}
|
|
939
941
|
}
|
|
940
942
|
else {
|
|
941
|
-
return { error: true, message:
|
|
943
|
+
return { error: true, message: i18n.INVALID_POSITION_ATTRIBUTE_ERROR_MESSAGE };
|
|
942
944
|
}
|
|
943
945
|
}
|
|
944
946
|
|
|
@@ -965,7 +967,7 @@ function parseMove(position, move) {
|
|
|
965
967
|
}
|
|
966
968
|
}
|
|
967
969
|
else {
|
|
968
|
-
return { error: true, message:
|
|
970
|
+
return { error: true, message: i18n.INVALID_MOVE_ATTRIBUTE_ERROR_MESSAGE };
|
|
969
971
|
}
|
|
970
972
|
}
|
|
971
973
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
import PropTypes from 'prop-types';
|
|
24
24
|
import React from 'react';
|
|
25
25
|
|
|
26
|
-
import '
|
|
26
|
+
import './css/error_box.css';
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
/**
|
package/src/SquareMarkerIcon.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/******************************************************************************
|
|
2
2
|
* *
|
|
3
3
|
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021 Yoann Le Montagner <yo35 -at- melix.net>
|
|
4
|
+
* Copyright (C) 2021-2022 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
5
|
* *
|
|
6
6
|
* This program is free software: you can redistribute it and/or *
|
|
7
7
|
* modify it under the terms of the GNU Lesser General Public License *
|