kokopu-react 1.6.0 → 1.7.2
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/.nycrc.yml +1 -1
- package/CHANGELOG.md +13 -0
- package/README.md +2 -2
- package/dist/lib/Chessboard.js +27 -19
- package/dist/lib/Movetext.js +5 -5
- package/dist/lib/impl/colorsets.js +44 -44
- package/dist/lib/impl/util.js +1 -1
- package/dist/lib/markers.js +7 -7
- package/doc_src/demo/PageChessboardInteraction.js +4 -3
- package/doc_src/demo/PageChessboardMove.js +36 -5
- package/doc_src/demo/demo.css +4 -0
- package/{graphic_test_app → graphic_test_src}/01_marker_icons.js +0 -0
- package/{graphic_test_app → graphic_test_src}/02_chessboard_simple.js +0 -0
- package/{graphic_test_app → graphic_test_src}/03_chessboard_flipped.js +0 -0
- package/{graphic_test_app → graphic_test_src}/04_chessboard_annotations.js +8 -8
- package/{graphic_test_app → graphic_test_src}/05_chessboard_move.js +4 -4
- package/{graphic_test_app → graphic_test_src}/06_chessboard_theme.js +2 -2
- package/{graphic_test_app → graphic_test_src}/07_chessboard_click_squares.js +0 -0
- package/{graphic_test_app → graphic_test_src}/08_chessboard_move_pieces.js +1 -1
- package/{graphic_test_app → graphic_test_src}/09_chessboard_edit_arrows.js +0 -0
- package/{graphic_test_app → graphic_test_src}/10_chessboard_play_moves.js +1 -1
- package/{graphic_test_app → graphic_test_src}/11_chessboard_play_promotions.js +0 -0
- package/{graphic_test_app → graphic_test_src}/12_movetext_simple.js +0 -0
- package/{graphic_test_app → graphic_test_src}/13_movetext_error.js +0 -0
- package/{graphic_test_app → graphic_test_src}/14_movetext_html.js +0 -0
- package/{graphic_test_app → graphic_test_src}/15_movetext_options.js +0 -4
- package/{graphic_test_app → graphic_test_src}/16_movetext_interaction.js +0 -0
- package/{graphic_test_app → graphic_test_src}/common/dummy.pgn +0 -0
- package/{graphic_test_app → graphic_test_src}/common/games.pgn +0 -0
- package/{graphic_test_app → graphic_test_src}/common/heartbeat.txt +0 -0
- package/{graphic_test_app → graphic_test_src}/common/smiley.png +0 -0
- package/{graphic_test_app → graphic_test_src}/common/test_app.css +0 -0
- package/{graphic_test_app → graphic_test_src}/common/test_app.js +3 -2
- package/graphics/chess_sprites/cburnett/bb.svg +45 -0
- package/graphics/chess_sprites/cburnett/bk.svg +47 -0
- package/graphics/chess_sprites/cburnett/bn.svg +37 -0
- package/graphics/chess_sprites/cburnett/bp.svg +19 -0
- package/graphics/chess_sprites/cburnett/bq.svg +58 -0
- package/graphics/chess_sprites/cburnett/br.svg +60 -0
- package/graphics/chess_sprites/cburnett/bx.svg +56 -0
- package/graphics/chess_sprites/cburnett/wb.svg +48 -0
- package/graphics/chess_sprites/cburnett/wk.svg +26 -0
- package/graphics/chess_sprites/cburnett/wn.svg +37 -0
- package/graphics/chess_sprites/cburnett/wp.svg +19 -0
- package/graphics/chess_sprites/cburnett/wq.svg +60 -0
- package/graphics/chess_sprites/cburnett/wr.svg +44 -0
- package/graphics/chess_sprites/cburnett/wx.svg +56 -0
- package/graphics/chess_sprites/generate_sprites.sh +135 -0
- package/graphics/chess_sprites/mmonge/celtic-bx.svg +112 -0
- package/graphics/chess_sprites/mmonge/celtic-wx.svg +111 -0
- package/graphics/chess_sprites/mmonge/celtic.svg +1576 -0
- package/graphics/chess_sprites/mmonge/eyes-spatial-bx.svg +101 -0
- package/graphics/chess_sprites/mmonge/eyes-spatial-wx.svg +100 -0
- package/graphics/chess_sprites/mmonge/eyes.svg +2538 -0
- package/graphics/chess_sprites/mmonge/fantasy-bx.svg +112 -0
- package/graphics/chess_sprites/mmonge/fantasy-wx.svg +111 -0
- package/graphics/chess_sprites/mmonge/fantasy.svg +5497 -0
- package/graphics/chess_sprites/mmonge/fantasy_alt.svg +3742 -0
- package/graphics/chess_sprites/mmonge/freak.svg +3479 -0
- package/graphics/chess_sprites/mmonge/prmi.svg +6776 -0
- package/graphics/chess_sprites/mmonge/skulls-bx.svg +124 -0
- package/graphics/chess_sprites/mmonge/skulls-wx.svg +111 -0
- package/graphics/chess_sprites/mmonge/skulls.svg +12978 -0
- package/graphics/chess_sprites/mmonge/spatial.svg +1223 -0
- package/package.json +30 -24
- package/scripts/{test_graphic/clean-graphic-output.js → clean-graphic-output.js} +1 -1
- package/scripts/docker-compose.yml +14 -0
- package/scripts/{test_graphic/webpack-config.js → test-graphic.webpack.config.js} +7 -6
- package/scripts/{test_headless.webpack-config.js → test-headless.webpack.config.js} +2 -1
- package/src/Chessboard.js +27 -19
- package/src/Movetext.js +5 -5
- package/src/impl/colorsets.js +44 -44
- package/src/impl/util.js +1 -1
- package/src/markers.js +7 -7
- package/test/1_markers.js +14 -14
- package/test/common/graphic.js +2 -2
- package/test/references/04_chessboard_annotations/0.png +0 -0
- package/test/references/04_chessboard_annotations/1.png +0 -0
- package/test/references/04_chessboard_annotations/2.png +0 -0
- package/test/references/04_chessboard_annotations/3.png +0 -0
- package/test/references/04_chessboard_annotations/4.png +0 -0
- package/test/references/04_chessboard_annotations/5.png +0 -0
- package/test/references/05_chessboard_move/3.png +0 -0
- package/test/references/05_chessboard_move/4.png +0 -0
- package/test/references/05_chessboard_move/5.png +0 -0
- package/test/references/05_chessboard_move/6.png +0 -0
- package/test/references/06_chessboard_theme/0.png +0 -0
- package/test/references/06_chessboard_theme/1.png +0 -0
- package/test/references/06_chessboard_theme/2.png +0 -0
- package/test/references/06_chessboard_theme/3.png +0 -0
- package/test/references/06_chessboard_theme/4.png +0 -0
- package/test/references/06_chessboard_theme/5.png +0 -0
- package/test/references/06_chessboard_theme/6.png +0 -0
- package/test/references/06_chessboard_theme/7.png +0 -0
- package/test/references/06_chessboard_theme/8.png +0 -0
- package/test/references/08_chessboard_move_pieces/over_arrow_marker.png +0 -0
- package/test/references/08_chessboard_move_pieces/over_square_marker.png +0 -0
- package/test/references/08_chessboard_move_pieces/over_text_marker.png +0 -0
- package/test/references/09_chessboard_edit_arrows/base_1.png +0 -0
- package/test/references/09_chessboard_edit_arrows/base_2.png +0 -0
- package/test/references/09_chessboard_edit_arrows/null_vector.png +0 -0
- package/test/references/09_chessboard_edit_arrows/over_arrow_marker.png +0 -0
- package/test/references/09_chessboard_edit_arrows/over_square_marker.png +0 -0
- package/test/references/10_chessboard_play_moves/castling_move.png +0 -0
- package/test/references/10_chessboard_play_moves/regular_move_2.png +0 -0
- package/scripts/test_graphic/docker-compose.yml +0 -14
package/test/1_markers.js
CHANGED
|
@@ -28,7 +28,7 @@ describe('Flatten square markers', () => {
|
|
|
28
28
|
|
|
29
29
|
it('Re4', () => { test.value(flattenSquareMarkers({ e4: 'r' })).is('Re4'); });
|
|
30
30
|
it('Gd3,Yh8', () => { test.value(flattenSquareMarkers({ h8: 'y', d3: 'g' })).is('Gd3,Yh8'); });
|
|
31
|
-
it('Ga1,Yc5,Rd2,
|
|
31
|
+
it('Ga1,Yc5,Rd2,Bh7,Yh8', () => { test.value(flattenSquareMarkers({ c5: 'y', h8: 'y', a1: 'g', h7: 'b', d2: 'r' })).is('Ga1,Yc5,Rd2,Bh7,Yh8'); });
|
|
32
32
|
it('<empty>', () => { test.value(flattenSquareMarkers({})).is(''); });
|
|
33
33
|
|
|
34
34
|
it('Wrong square', () => { test.value(flattenSquareMarkers({ e1: 'r', k9: 'g', whatever: 'y' })).is('Re1'); });
|
|
@@ -40,13 +40,13 @@ describe('Parse square markers', () => {
|
|
|
40
40
|
|
|
41
41
|
it('Re4', () => { test.value(parseSquareMarkers('Re4')).is({ e4: 'r' }); });
|
|
42
42
|
it('Gd3,Yh8', () => { test.value(parseSquareMarkers('Gd3,Yh8')).is({ h8: 'y', d3: 'g' }); });
|
|
43
|
-
it('Ga1,Yc5,Rd2,
|
|
43
|
+
it('Ga1,Yc5,Rd2,Bh7,Yh8', () => { test.value(parseSquareMarkers(' Ga1, Yh8,Yc5 ,Rd2, Bh7 ')).is({ c5: 'y', h8: 'y', a1: 'g', h7: 'b', d2: 'r' }); });
|
|
44
44
|
it('<empty>', () => { test.value(parseSquareMarkers('')).is({}); });
|
|
45
45
|
it('<blank>', () => { test.value(parseSquareMarkers(' ')).is({}); });
|
|
46
46
|
|
|
47
47
|
it('Wrong square', () => { test.value(parseSquareMarkers('Rg9,Ye1')).is({ e1: 'y' }); });
|
|
48
48
|
it('Duplicated square', () => { test.value(parseSquareMarkers('Ra3,Ya3')).is({ a3: 'y' }); });
|
|
49
|
-
it('Wrong color', () => { test.value(parseSquareMarkers('Ga6,
|
|
49
|
+
it('Wrong color', () => { test.value(parseSquareMarkers('Ga6,Cg5')).is({ a6: 'g' }); });
|
|
50
50
|
it('Wrong format', () => { test.value(parseSquareMarkers('Something Ra2 invalid, Ye4, G g3')).is({ e4: 'y' }); });
|
|
51
51
|
});
|
|
52
52
|
|
|
@@ -58,13 +58,13 @@ describe('Flatten text markers', () => {
|
|
|
58
58
|
h8: { symbol: '1', color: 'y' },
|
|
59
59
|
d3: { symbol: 'z', color: 'g' },
|
|
60
60
|
})).is('Gzd3,Y1h8'); });
|
|
61
|
-
it('G2a1,YMc5,RLd2,Rxh7,
|
|
61
|
+
it('G2a1,YMc5,RLd2,Rxh7,Bwh8', () => { test.value(flattenTextMarkers({
|
|
62
62
|
c5: { symbol: 'M', color: 'y' },
|
|
63
|
-
h8: { symbol: 'w', color: '
|
|
63
|
+
h8: { symbol: 'w', color: 'b' },
|
|
64
64
|
a1: { symbol: '2', color: 'g' },
|
|
65
65
|
h7: { symbol: 'x', color: 'r' },
|
|
66
66
|
d2: { symbol: 'L', color: 'r' },
|
|
67
|
-
})).is('G2a1,YMc5,RLd2,Rxh7,
|
|
67
|
+
})).is('G2a1,YMc5,RLd2,Rxh7,Bwh8'); });
|
|
68
68
|
it('Multi-character symbols', () => { test.value(flattenTextMarkers({
|
|
69
69
|
a1: { symbol: 'A', color: 'y' },
|
|
70
70
|
a7: { symbol: 'plus', color: 'g' },
|
|
@@ -104,9 +104,9 @@ describe('Parse text markers', () => {
|
|
|
104
104
|
h8: { symbol: '1', color: 'y' },
|
|
105
105
|
d3: { symbol: 'z', color: 'g' },
|
|
106
106
|
}); });
|
|
107
|
-
it('G2a1,YMc5,RLd2,Rxh7,
|
|
107
|
+
it('G2a1,YMc5,RLd2,Rxh7,Bwh8', () => { test.value(parseTextMarkers(' G2a1, Rxh7 ,YMc5 ,RLd2,Bwh8 ')).is({
|
|
108
108
|
c5: { symbol: 'M', color: 'y' },
|
|
109
|
-
h8: { symbol: 'w', color: '
|
|
109
|
+
h8: { symbol: 'w', color: 'b' },
|
|
110
110
|
a1: { symbol: '2', color: 'g' },
|
|
111
111
|
h7: { symbol: 'x', color: 'r' },
|
|
112
112
|
d2: { symbol: 'L', color: 'r' },
|
|
@@ -123,7 +123,7 @@ describe('Parse text markers', () => {
|
|
|
123
123
|
|
|
124
124
|
it('Wrong square', () => { test.value(parseTextMarkers('RHg9,Yxe1')).is({ e1: { symbol: 'x', color: 'y' } }); });
|
|
125
125
|
it('Duplicated square', () => { test.value(parseTextMarkers('Rka3,Gba3')).is({ a3: { symbol: 'b', color: 'g' } }); });
|
|
126
|
-
it('Wrong color', () => { test.value(parseTextMarkers('G3a6,
|
|
126
|
+
it('Wrong color', () => { test.value(parseTextMarkers('G3a6,CAg5')).is({ a6: { symbol: '3', color: 'g' } }); });
|
|
127
127
|
it('Wrong symbol', () => { test.value(parseTextMarkers('Rb2,RAg5,G.d3,Yabcde7')).is({ g5: { symbol: 'A', color: 'r' } }); });
|
|
128
128
|
it('Wrong multi-character symbol', () => { test.value(parseTextMarkers('RZb2,Y(whatever)e4')).is({ b2: { symbol: 'Z', color: 'r' } }); });
|
|
129
129
|
it('Wrong format', () => { test.value(parseTextMarkers('Something RHa2 invalid, Yqe4, G g3')).is({ e4: { symbol: 'q', color: 'y' } }); });
|
|
@@ -134,8 +134,8 @@ describe('Flatten arrow markers', () => {
|
|
|
134
134
|
|
|
135
135
|
it('Re4d6', () => { test.value(flattenArrowMarkers({ e4d6: 'r' })).is('Re4d6'); });
|
|
136
136
|
it('Gd3b4,Yh8h7', () => { test.value(flattenArrowMarkers({ h8h7: 'y', d3b4: 'g' })).is('Gd3b4,Yh8h7'); });
|
|
137
|
-
it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,
|
|
138
|
-
.is('Ga1h8,Yc5a1,Rd2d2,Rh7h8,
|
|
137
|
+
it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5', () => { test.value(flattenArrowMarkers({ c5a1: 'y', h8c5: 'b', a1h8: 'g', h7h8: 'r', d2d2: 'r' }))
|
|
138
|
+
.is('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5'); });
|
|
139
139
|
it('<empty>', () => { test.value(flattenArrowMarkers({})).is(''); });
|
|
140
140
|
|
|
141
141
|
it('Wrong vector', () => { test.value(flattenArrowMarkers({ e1c2: 'r', a1b9: 'g', c0d2: 'r', i3d4: 'r', f2k3: 'g', whatever: 'y' })).is('Re1c2'); });
|
|
@@ -147,13 +147,13 @@ describe('Parse arrow markers', () => {
|
|
|
147
147
|
|
|
148
148
|
it('Re4d6', () => { test.value(parseArrowMarkers('Re4d6')).is({ e4d6: 'r' }); });
|
|
149
149
|
it('Gd3b4,Yh8h7', () => { test.value(parseArrowMarkers('Gd3b4,Yh8h7')).is({ h8h7: 'y', d3b4: 'g' }); });
|
|
150
|
-
it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,
|
|
151
|
-
.is({ c5a1: 'y', h8c5: '
|
|
150
|
+
it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5', () => { test.value(parseArrowMarkers(' Bh8c5,Ga1h8 , Yc5a1 , Rd2d2,Rh7h8 '))
|
|
151
|
+
.is({ c5a1: 'y', h8c5: 'b', a1h8: 'g', h7h8: 'r', d2d2: 'r' }); });
|
|
152
152
|
it('<empty>', () => { test.value(parseArrowMarkers('')).is({}); });
|
|
153
153
|
it('<blank>', () => { test.value(parseArrowMarkers(' ')).is({}); });
|
|
154
154
|
|
|
155
155
|
it('Wrong vector', () => { test.value(parseArrowMarkers('Re1c2,Ga1b9,Rc0d2,Ri3d4,Gf2k3')).is({ e1c2: 'r' }); });
|
|
156
156
|
it('Duplicated vector', () => { test.value(parseArrowMarkers('Ya3b4,Ra3b4')).is({ a3b4: 'r' }); });
|
|
157
|
-
it('Wrong color', () => { test.value(parseArrowMarkers('Ga6c5,
|
|
157
|
+
it('Wrong color', () => { test.value(parseArrowMarkers('Ga6c5,Cg5e2')).is({ a6c5: 'g' }); });
|
|
158
158
|
it('Wrong format', () => { test.value(parseArrowMarkers('Something Rb1a2 invalid, Ye4c7, G g3b1')).is({ e4c7: 'y' }); });
|
|
159
159
|
});
|
package/test/common/graphic.js
CHANGED
|
@@ -34,8 +34,8 @@ const coverageDir = rootDir + '/build/.nyc_output';
|
|
|
34
34
|
const UNREACHABLE_TEST_CLIENT_MESSAGE =
|
|
35
35
|
'Cannot reach the dockerized selenium webbrowser used for graphic tests (probably because the test environment is not running).\n' +
|
|
36
36
|
'\n' +
|
|
37
|
-
'Use command `npm run
|
|
38
|
-
'Do not forget to run `npm run
|
|
37
|
+
'Use command `npm run test_env:start` to start the test environment.\n' +
|
|
38
|
+
'Do not forget to run `npm run test_env:stop` when finished.\n';
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
/**
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
version: "3.7"
|
|
2
|
-
|
|
3
|
-
services:
|
|
4
|
-
web-client:
|
|
5
|
-
image: selenium/standalone-firefox:4.1.4-20220427
|
|
6
|
-
shm_size: '2gb'
|
|
7
|
-
ports:
|
|
8
|
-
- 4444:4444 # Driver (http://localhost:4444)
|
|
9
|
-
- 7900:7900 # VNC (http://localhost:7900, pass: secret)
|
|
10
|
-
volumes:
|
|
11
|
-
- type: bind
|
|
12
|
-
source: ../..
|
|
13
|
-
target: /app
|
|
14
|
-
read_only: true
|