kokopu-react 3.0.1 → 3.1.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/CHANGELOG.md +10 -0
- package/dist/lib/chessboard/BoardProperties.d.ts +91 -0
- package/dist/lib/chessboard/BoardProperties.js +43 -0
- package/dist/lib/chessboard/BoardProperties.js.map +1 -0
- package/dist/lib/chessboard/Chessboard.css +7 -5
- package/dist/lib/chessboard/Chessboard.d.ts +36 -58
- package/dist/lib/chessboard/Chessboard.js +33 -97
- package/dist/lib/chessboard/Chessboard.js.map +1 -1
- package/dist/lib/chessboard/ChessboardImpl.d.ts +22 -0
- package/dist/lib/chessboard/ChessboardImpl.js +8 -6
- package/dist/lib/chessboard/ChessboardImpl.js.map +1 -1
- package/dist/lib/chessboard/Draggable.d.ts +22 -0
- package/dist/lib/chessboard/Draggable.js +7 -5
- package/dist/lib/chessboard/Draggable.js.map +1 -1
- package/dist/lib/chessboard/Motion.d.ts +22 -0
- package/dist/lib/chessboard/Motion.js +7 -5
- package/dist/lib/chessboard/Motion.js.map +1 -1
- package/dist/lib/chessboard/colorsets.d.ts +22 -0
- package/dist/lib/chessboard/colorsets.js +7 -5
- package/dist/lib/chessboard/colorsets.js.map +1 -1
- package/dist/lib/chessboard/piecesets.d.ts +22 -0
- package/dist/lib/chessboard/piecesets.js +7 -5
- package/dist/lib/chessboard/piecesets.js.map +1 -1
- package/dist/lib/errorbox/ErrorBox.css +7 -5
- package/dist/lib/errorbox/ErrorBox.d.ts +22 -0
- package/dist/lib/errorbox/ErrorBox.js +7 -5
- package/dist/lib/errorbox/ErrorBox.js.map +1 -1
- package/dist/lib/errorbox/parsing.d.ts +57 -0
- package/dist/lib/errorbox/parsing.js +140 -0
- package/dist/lib/errorbox/parsing.js.map +1 -0
- package/dist/lib/exception.d.ts +22 -0
- package/dist/lib/exception.js +7 -5
- package/dist/lib/exception.js.map +1 -1
- package/dist/lib/i18n.d.ts +27 -0
- package/dist/lib/i18n.js +13 -5
- package/dist/lib/i18n.js.map +1 -1
- package/dist/lib/icons/AnnotationSymbolShape.css +7 -5
- package/dist/lib/icons/AnnotationSymbolShape.d.ts +22 -0
- package/dist/lib/icons/AnnotationSymbolShape.js +7 -5
- package/dist/lib/icons/AnnotationSymbolShape.js.map +1 -1
- package/dist/lib/icons/ArrowMarkerIcon.d.ts +22 -0
- package/dist/lib/icons/ArrowMarkerIcon.js +7 -5
- package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -1
- package/dist/lib/icons/ArrowTip.d.ts +22 -0
- package/dist/lib/icons/ArrowTip.js +7 -5
- package/dist/lib/icons/ArrowTip.js.map +1 -1
- package/dist/lib/icons/ChessPieceIcon.d.ts +22 -0
- package/dist/lib/icons/ChessPieceIcon.js +7 -5
- package/dist/lib/icons/ChessPieceIcon.js.map +1 -1
- package/dist/lib/icons/SquareMarkerIcon.d.ts +22 -0
- package/dist/lib/icons/SquareMarkerIcon.js +7 -5
- package/dist/lib/icons/SquareMarkerIcon.js.map +1 -1
- package/dist/lib/icons/TextMarkerIcon.d.ts +22 -0
- package/dist/lib/icons/TextMarkerIcon.js +7 -5
- package/dist/lib/icons/TextMarkerIcon.js.map +1 -1
- package/dist/lib/icons/arrow.css +7 -5
- package/dist/lib/index.d.ts +26 -1
- package/dist/lib/index.js +9 -5
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/movetext/Movetext.css +7 -18
- package/dist/lib/movetext/Movetext.d.ts +31 -43
- package/dist/lib/movetext/Movetext.js +22 -72
- package/dist/lib/movetext/Movetext.js.map +1 -1
- package/dist/lib/movetext/MovetextImpl.d.ts +29 -28
- package/dist/lib/movetext/MovetextImpl.js +22 -99
- package/dist/lib/movetext/MovetextImpl.js.map +1 -1
- package/dist/lib/movetext/fonts.css +7 -5
- package/dist/lib/movetext/htmlFilter.d.ts +22 -0
- package/dist/lib/movetext/htmlFilter.js +21 -19
- package/dist/lib/movetext/htmlFilter.js.map +1 -1
- package/dist/lib/movetext/moveFormatter.d.ts +22 -0
- package/dist/lib/movetext/moveFormatter.js +7 -5
- package/dist/lib/movetext/moveFormatter.js.map +1 -1
- package/dist/lib/navigationboard/NavigationBoard.d.ts +118 -0
- package/dist/lib/navigationboard/NavigationBoard.js +112 -0
- package/dist/lib/navigationboard/NavigationBoard.js.map +1 -0
- package/dist/lib/navigationboard/NavigationField.css +36 -0
- package/dist/lib/navigationboard/NavigationField.d.ts +81 -0
- package/dist/lib/navigationboard/NavigationField.js +154 -0
- package/dist/lib/navigationboard/NavigationField.js.map +1 -0
- package/dist/lib/navigationboard/NavigationToolbar.css +51 -0
- package/dist/lib/navigationboard/NavigationToolbar.d.ts +41 -0
- package/dist/lib/navigationboard/NavigationToolbar.js +124 -0
- package/dist/lib/navigationboard/NavigationToolbar.js.map +1 -0
- package/dist/lib/sanitization.d.ts +22 -0
- package/dist/lib/sanitization.js +7 -5
- package/dist/lib/sanitization.js.map +1 -1
- package/dist/lib/types.d.ts +22 -0
- package/dist/lib/types.js +7 -5
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/util.d.ts +22 -0
- package/dist/lib/util.js +7 -5
- package/dist/lib/util.js.map +1 -1
- package/doc_src/demo/PageChessboardBase.tsx +7 -5
- package/doc_src/demo/PageChessboardInteraction.tsx +32 -22
- package/doc_src/demo/PageChessboardMove.tsx +24 -5
- package/doc_src/demo/PageChessboardSmallScreens.tsx +7 -5
- package/doc_src/demo/PageMovetextBase.tsx +7 -5
- package/doc_src/demo/PageMovetextInteraction.tsx +7 -5
- package/doc_src/demo/PageNavigationBoardBase.tsx +194 -0
- package/doc_src/demo/PageNavigationBoardUncontrolledVsControlled.tsx +114 -0
- package/doc_src/demo/decs.d.ts +7 -5
- package/doc_src/demo/demo.css +7 -5
- package/doc_src/demo/game-3.pgn +10 -0
- package/doc_src/demo/util.ts +7 -5
- package/doc_src/examples/Movetext.md +1 -1
- package/doc_src/examples/NavigationBoard.md +15 -0
- package/doc_src/theming/LogoRenderer.js +7 -5
- package/doc_src/theming/theming.css +7 -5
- package/package.json +27 -26
- package/scripts/doc.styleguide.config.js +19 -7
- package/scripts/docker-compose.yml +3 -3
- package/scripts/test-graphic.webpack.config.js +7 -5
- package/scripts/test-headless.webpack.config.js +7 -5
- package/src/chessboard/BoardProperties.ts +131 -0
- package/src/chessboard/Chessboard.css +7 -5
- package/src/chessboard/Chessboard.tsx +48 -175
- package/src/chessboard/ChessboardImpl.tsx +7 -5
- package/src/chessboard/Draggable.tsx +7 -5
- package/src/chessboard/Motion.tsx +7 -5
- package/src/chessboard/colorsets.ts +7 -5
- package/src/chessboard/piecesets.ts +7 -5
- package/src/decs.d.ts +7 -5
- package/src/errorbox/ErrorBox.css +7 -5
- package/src/errorbox/ErrorBox.tsx +7 -5
- package/src/errorbox/parsing.tsx +158 -0
- package/src/exception.ts +7 -5
- package/src/i18n.ts +14 -5
- package/src/icons/AnnotationSymbolShape.css +7 -5
- package/src/icons/AnnotationSymbolShape.tsx +7 -5
- package/src/icons/ArrowMarkerIcon.tsx +7 -5
- package/src/icons/ArrowTip.tsx +7 -5
- package/src/icons/ChessPieceIcon.tsx +7 -5
- package/src/icons/SquareMarkerIcon.tsx +7 -5
- package/src/icons/TextMarkerIcon.tsx +7 -5
- package/src/icons/arrow.css +7 -5
- package/src/index.ts +12 -6
- package/src/movetext/Movetext.css +7 -18
- package/src/movetext/Movetext.tsx +27 -90
- package/src/movetext/MovetextImpl.tsx +35 -120
- package/src/movetext/fonts.css +7 -5
- package/src/movetext/htmlFilter.tsx +7 -5
- package/src/movetext/moveFormatter.tsx +7 -5
- package/src/navigationboard/NavigationBoard.tsx +231 -0
- package/src/navigationboard/NavigationField.css +36 -0
- package/src/navigationboard/NavigationField.tsx +185 -0
- package/src/navigationboard/NavigationToolbar.css +51 -0
- package/src/navigationboard/NavigationToolbar.tsx +174 -0
- package/src/sanitization.ts +7 -5
- package/src/types.ts +7 -5
- package/src/util.ts +7 -5
- package/test/01_types.js +7 -5
- package/test/02_chessboard_util.js +7 -5
- package/test/03_error_box_graphic.js +7 -5
- package/test/04_icons_graphic.js +7 -5
- package/test/05_chessboard_graphic.js +9 -5
- package/test/06_chessboard_animation.js +7 -5
- package/test/07_chessboard_interaction.js +7 -5
- package/test/08_chessboard_play_moves.js +7 -5
- package/test/09_chessboard_small_screens.js +28 -5
- package/test/10_movetext_graphic.js +12 -5
- package/test/11_movetext_interaction.js +19 -13
- package/test/12_navigation_board.js +168 -0
- package/test/common/graphic.js +7 -5
- package/test/graphic_references/05_chessboard_graphic/move/illegal_null-move.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/null-move.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_bottom_component.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_top_component.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_bottom_component.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_top_component.png +0 -0
- package/test/graphic_references/10_movetext_graphic/format_move/format_text.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/wrong_piece_symbol_value.png +0 -0
- package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected_without_callback.png +0 -0
- package/test/graphic_references/12_navigation_board/controlled/default.png +0 -0
- package/test/graphic_references/12_navigation_board/controlled/forbidden_navigation_0.png +0 -0
- package/test/graphic_references/12_navigation_board/controlled/forbidden_navigation_1.png +0 -0
- package/test/graphic_references/12_navigation_board/controlled/invalid_node_id.png +0 -0
- package/test/graphic_references/12_navigation_board/controlled/no_callback_defined_0.png +0 -0
- package/test/graphic_references/12_navigation_board/controlled/no_callback_defined_1.png +0 -0
- package/test/graphic_references/12_navigation_board/controlled/overriding_initial_node_id.png +0 -0
- package/test/graphic_references/12_navigation_board/controlled/regular_navigation_0.png +0 -0
- package/test/graphic_references/12_navigation_board/controlled/regular_navigation_1.png +0 -0
- package/test/graphic_references/12_navigation_board/controlled/regular_navigation_2.png +0 -0
- package/test/graphic_references/12_navigation_board/controlled/regular_navigation_3.png +0 -0
- package/test/graphic_references/12_navigation_board/error/pgn_parsing_error.png +0 -0
- package/test/graphic_references/12_navigation_board/error/wrong_game_type.png +0 -0
- package/test/graphic_references/12_navigation_board/theme/custom_1.png +0 -0
- package/test/graphic_references/12_navigation_board/theme/custom_2.png +0 -0
- package/test/graphic_references/12_navigation_board/theme/large.png +0 -0
- package/test/graphic_references/12_navigation_board/theme/small.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_beginning_0.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_beginning_1.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_beginning_2.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_end_0.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_end_1.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_end_2.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/initial_state_at_end.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/initial_state_at_specific_id.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/initial_state_default.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/initial_state_default_with_game_index.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/initial_state_on_null-move.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/navigation_with_keys_0.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/navigation_with_keys_1.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/navigation_with_keys_2.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/navigation_with_keys_3.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/navigation_with_keys_4.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/regular_flipping_0.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/regular_flipping_1.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_0.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_1.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_2.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_3.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_4.png +0 -0
- package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_5.png +0 -0
- package/test/graphic_test_app/03_error_box_graphic/base.tsx +7 -5
- package/test/graphic_test_app/03_error_box_graphic/localization.tsx +7 -5
- package/test/graphic_test_app/04_icons_graphic/chess_piece.tsx +7 -5
- package/test/graphic_test_app/04_icons_graphic/marker.tsx +7 -5
- package/test/graphic_test_app/05_chessboard_graphic/annotations.tsx +7 -5
- package/test/graphic_test_app/05_chessboard_graphic/base.tsx +7 -5
- package/test/graphic_test_app/05_chessboard_graphic/chess_variants.tsx +7 -5
- package/test/graphic_test_app/05_chessboard_graphic/flipped.tsx +7 -5
- package/test/graphic_test_app/05_chessboard_graphic/move.tsx +9 -5
- package/test/graphic_test_app/05_chessboard_graphic/theme.tsx +7 -5
- package/test/graphic_test_app/06_chessboard_animation/base_1.tsx +7 -5
- package/test/graphic_test_app/06_chessboard_animation/base_2.tsx +7 -5
- package/test/graphic_test_app/06_chessboard_animation/base_3.tsx +7 -5
- package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +7 -5
- package/test/graphic_test_app/07_chessboard_interaction/click_squares.tsx +7 -5
- package/test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx +7 -5
- package/test/graphic_test_app/07_chessboard_interaction/error.tsx +7 -5
- package/test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx +7 -5
- package/test/graphic_test_app/08_chessboard_play_moves/base.tsx +7 -5
- package/test/graphic_test_app/08_chessboard_play_moves/promotions.tsx +7 -5
- package/test/graphic_test_app/09_chessboard_small_screens/base.tsx +7 -5
- package/test/graphic_test_app/09_chessboard_small_screens/top_bottom_components.tsx +48 -0
- package/test/graphic_test_app/10_movetext_graphic/base.tsx +7 -5
- package/test/graphic_test_app/10_movetext_graphic/error.tsx +7 -5
- package/test/graphic_test_app/10_movetext_graphic/format_move.tsx +31 -0
- package/test/graphic_test_app/10_movetext_graphic/html.tsx +7 -5
- package/test/graphic_test_app/10_movetext_graphic/options.tsx +8 -5
- package/test/graphic_test_app/11_movetext_interaction/error.tsx +7 -5
- package/test/graphic_test_app/11_movetext_interaction/select_moves.tsx +8 -5
- package/test/graphic_test_app/12_navigation_board/controlled.tsx +43 -0
- package/test/graphic_test_app/12_navigation_board/error.tsx +34 -0
- package/test/graphic_test_app/12_navigation_board/theme.tsx +38 -0
- package/test/graphic_test_app/12_navigation_board/uncontrolled.tsx +56 -0
- package/test/graphic_test_app/common/decs.d.ts +7 -5
- package/test/graphic_test_app/common/test_app.css +7 -5
- package/test/graphic_test_app/common/test_app.tsx +7 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
ChangeLog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
3.1.0 (March 3, 2024)
|
|
5
|
+
---------------------
|
|
6
|
+
* Add support for null-moves in `Chessboard`.
|
|
7
|
+
* Add top/bottom auxilliary components in `Chessboard`.
|
|
8
|
+
* Add `NavigationBoard` (see [#6](https://github.com/yo35/kokopu-react/issues/6)).
|
|
9
|
+
|
|
10
|
+
3.0.2 (January 20, 2024)
|
|
11
|
+
------------------------
|
|
12
|
+
* Minor fixes in dependencies.
|
|
13
|
+
|
|
4
14
|
3.0.1 (July 14, 2023)
|
|
5
15
|
---------------------
|
|
6
16
|
* Add documentation regarding Webpack configuration.
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* -------------------------------------------------------------------------- *
|
|
3
|
+
* *
|
|
4
|
+
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
|
+
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
+
* Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
|
+
* *
|
|
8
|
+
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
|
+
* modify it under the terms of the GNU Lesser General Public License *
|
|
10
|
+
* as published by the Free Software Foundation, either version 3 of *
|
|
11
|
+
* the License, or (at your option) any later version. *
|
|
12
|
+
* *
|
|
13
|
+
* Kokopu-React is distributed in the hope that it will be useful, *
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
16
|
+
* GNU Lesser General Public License for more details. *
|
|
17
|
+
* *
|
|
18
|
+
* You should have received a copy of the GNU Lesser General *
|
|
19
|
+
* Public License along with this program. If not, see *
|
|
20
|
+
* <http://www.gnu.org/licenses/>. *
|
|
21
|
+
* *
|
|
22
|
+
* -------------------------------------------------------------------------- */
|
|
23
|
+
import { AnnotationColor } from '../types';
|
|
24
|
+
/**
|
|
25
|
+
* Define a limit applicable to the parameters of a {@link Chessboard} on small-screen devices.
|
|
26
|
+
*/
|
|
27
|
+
export interface SmallScreenLimit {
|
|
28
|
+
width: number;
|
|
29
|
+
squareSize?: number;
|
|
30
|
+
coordinateVisible?: boolean;
|
|
31
|
+
turnVisible?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Properties in relation to the appearance of a `Chessboard` component (excluding properties related to move display).
|
|
35
|
+
*/
|
|
36
|
+
export interface StaticBoardGraphicProps {
|
|
37
|
+
/**
|
|
38
|
+
* Size of the squares (in pixels). Must be an integer between `Chessboard.minSquareSize()` and `Chessboard.maxSquareSize()`.
|
|
39
|
+
*/
|
|
40
|
+
squareSize: number;
|
|
41
|
+
/**
|
|
42
|
+
* Whether the row and column coordinates are visible or not.
|
|
43
|
+
*/
|
|
44
|
+
coordinateVisible: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the turn flag is visible or not.
|
|
47
|
+
*/
|
|
48
|
+
turnVisible: boolean;
|
|
49
|
+
/**
|
|
50
|
+
* Color theme ID. Must be a property of `Chessboard.colorsets()`.
|
|
51
|
+
*/
|
|
52
|
+
colorset: string;
|
|
53
|
+
/**
|
|
54
|
+
* Piece theme ID. Must be a property of `Chessboard.piecesets()`.
|
|
55
|
+
*/
|
|
56
|
+
pieceset: string;
|
|
57
|
+
/**
|
|
58
|
+
* Limits applicable on small-screen devices. For instance, if set to
|
|
59
|
+
* ```
|
|
60
|
+
* [
|
|
61
|
+
* { width: 768, squareSize: 40 },
|
|
62
|
+
* { width: 375, squareSize: 24, coordinateVisible: false }
|
|
63
|
+
* ]
|
|
64
|
+
* ```
|
|
65
|
+
* then on screens with resolution ≤768 pixels, the square size will be limited to 40 (whatever the value
|
|
66
|
+
* of the `squareSize` attribute); in addition, on screens with resolution ≤375 pixels, the square size
|
|
67
|
+
* will be limited to 24 and the row and column coordinates will always be hidden (whatever the value of the
|
|
68
|
+
* `coordinateVisible` attribute).
|
|
69
|
+
*/
|
|
70
|
+
smallScreenLimits?: SmallScreenLimit[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Properties in relation to the appearance of a `Chessboard` component (including properties related to move display).
|
|
74
|
+
*/
|
|
75
|
+
export interface DynamicBoardGraphicProps extends StaticBoardGraphicProps {
|
|
76
|
+
/**
|
|
77
|
+
* Whether moves are highlighted with an arrow or not.
|
|
78
|
+
*/
|
|
79
|
+
moveArrowVisible: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Color of the move arrow.
|
|
82
|
+
*/
|
|
83
|
+
moveArrowColor: AnnotationColor;
|
|
84
|
+
/**
|
|
85
|
+
* Whether moves are animated or not.
|
|
86
|
+
*/
|
|
87
|
+
animated: boolean;
|
|
88
|
+
}
|
|
89
|
+
export declare const DEFAULT_SQUARE_SIZE = 40;
|
|
90
|
+
export declare function defaultStaticBoardProps(): StaticBoardGraphicProps;
|
|
91
|
+
export declare function defaultDynamicBoardProps(): DynamicBoardGraphicProps;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* -------------------------------------------------------------------------- *
|
|
3
|
+
* *
|
|
4
|
+
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
|
+
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
+
* Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
|
+
* *
|
|
8
|
+
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
|
+
* modify it under the terms of the GNU Lesser General Public License *
|
|
10
|
+
* as published by the Free Software Foundation, either version 3 of *
|
|
11
|
+
* the License, or (at your option) any later version. *
|
|
12
|
+
* *
|
|
13
|
+
* Kokopu-React is distributed in the hope that it will be useful, *
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
16
|
+
* GNU Lesser General Public License for more details. *
|
|
17
|
+
* *
|
|
18
|
+
* You should have received a copy of the GNU Lesser General *
|
|
19
|
+
* Public License along with this program. If not, see *
|
|
20
|
+
* <http://www.gnu.org/licenses/>. *
|
|
21
|
+
* *
|
|
22
|
+
* -------------------------------------------------------------------------- */
|
|
23
|
+
import { DEFAULT_COLORSET } from './colorsets';
|
|
24
|
+
import { DEFAULT_PIECESET } from './piecesets';
|
|
25
|
+
export const DEFAULT_SQUARE_SIZE = 40;
|
|
26
|
+
export function defaultStaticBoardProps() {
|
|
27
|
+
return {
|
|
28
|
+
squareSize: DEFAULT_SQUARE_SIZE,
|
|
29
|
+
coordinateVisible: true,
|
|
30
|
+
turnVisible: true,
|
|
31
|
+
colorset: DEFAULT_COLORSET,
|
|
32
|
+
pieceset: DEFAULT_PIECESET,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
export function defaultDynamicBoardProps() {
|
|
36
|
+
return {
|
|
37
|
+
...defaultStaticBoardProps(),
|
|
38
|
+
moveArrowVisible: true,
|
|
39
|
+
moveArrowColor: 'b',
|
|
40
|
+
animated: false,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=BoardProperties.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BoardProperties.js","sourceRoot":"","sources":["../../../src/chessboard/BoardProperties.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;gFAqBgF;AAIhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAmF/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAGtC,MAAM,UAAU,uBAAuB;IACtC,OAAO;QACN,UAAU,EAAE,mBAAmB;QAC/B,iBAAiB,EAAE,IAAI;QACvB,WAAW,EAAE,IAAI;QACjB,QAAQ,EAAE,gBAAgB;QAC1B,QAAQ,EAAE,gBAAgB;KAC1B,CAAC;AACH,CAAC;AAGD,MAAM,UAAU,wBAAwB;IACvC,OAAO;QACN,GAAG,uBAAuB,EAAE;QAC5B,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,GAAG;QACnB,QAAQ,EAAE,KAAK;KACf,CAAC;AACH,CAAC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* -------------------------------------------------------------------------- *
|
|
2
3
|
* *
|
|
3
|
-
*
|
|
4
|
-
*
|
|
4
|
+
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
|
+
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
+
* Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
7
|
* *
|
|
6
|
-
*
|
|
8
|
+
* Kokopu-React is free software: you can redistribute it and/or *
|
|
7
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
8
10
|
* as published by the Free Software Foundation, either version 3 of *
|
|
9
11
|
* the License, or (at your option) any later version. *
|
|
10
12
|
* *
|
|
11
|
-
*
|
|
13
|
+
* Kokopu-React is distributed in the hope that it will be useful, *
|
|
12
14
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
15
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
16
|
* GNU Lesser General Public License for more details. *
|
|
@@ -1,16 +1,30 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* -------------------------------------------------------------------------- *
|
|
3
|
+
* *
|
|
4
|
+
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
|
+
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
+
* Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
|
+
* *
|
|
8
|
+
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
|
+
* modify it under the terms of the GNU Lesser General Public License *
|
|
10
|
+
* as published by the Free Software Foundation, either version 3 of *
|
|
11
|
+
* the License, or (at your option) any later version. *
|
|
12
|
+
* *
|
|
13
|
+
* Kokopu-React is distributed in the hope that it will be useful, *
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
16
|
+
* GNU Lesser General Public License for more details. *
|
|
17
|
+
* *
|
|
18
|
+
* You should have received a copy of the GNU Lesser General *
|
|
19
|
+
* Public License along with this program. If not, see *
|
|
20
|
+
* <http://www.gnu.org/licenses/>. *
|
|
21
|
+
* *
|
|
22
|
+
* -------------------------------------------------------------------------- */
|
|
1
23
|
import * as React from 'react';
|
|
2
24
|
import { MoveDescriptor, Position, Square } from 'kokopu';
|
|
3
25
|
import { Colorset, Pieceset, AnnotationColor, SquareMarkerSet, TextMarkerSet, ArrowMarkerSet } from '../types';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
*/
|
|
7
|
-
export interface SmallScreenLimit {
|
|
8
|
-
width: number;
|
|
9
|
-
squareSize?: number;
|
|
10
|
-
coordinateVisible?: boolean;
|
|
11
|
-
turnVisible?: boolean;
|
|
12
|
-
}
|
|
13
|
-
export interface ChessboardProps {
|
|
26
|
+
import { StaticBoardGraphicProps, DynamicBoardGraphicProps } from './BoardProperties';
|
|
27
|
+
export interface ChessboardProps extends DynamicBoardGraphicProps {
|
|
14
28
|
/**
|
|
15
29
|
* Displayed position. Can be a [kokopu.Position](https://kokopu.yo35.org/docs/current/classes/Position.html) object,
|
|
16
30
|
* a [FEN string](https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation),
|
|
@@ -23,8 +37,8 @@ export interface ChessboardProps {
|
|
|
23
37
|
position: Position | string;
|
|
24
38
|
/**
|
|
25
39
|
* Displayed move (optional), defined either as a [kokopu.MoveDescriptor](https://kokopu.yo35.org/docs/current/classes/MoveDescriptor.html) object
|
|
26
|
-
* or as a [SAN string](https://en.wikipedia.org/wiki/Algebraic_notation_(chess)) (e.g. `'Nf3'`).
|
|
27
|
-
* a legal move in position defined in attribute `position`.
|
|
40
|
+
* or as a [SAN string](https://en.wikipedia.org/wiki/Algebraic_notation_(chess)) (e.g. `'Nf3'`). Use `'--'` for a null-move.
|
|
41
|
+
* In all cases, the move must be a legal move in position defined in attribute `position`.
|
|
28
42
|
*/
|
|
29
43
|
move?: MoveDescriptor | string;
|
|
30
44
|
/**
|
|
@@ -45,52 +59,6 @@ export interface ChessboardProps {
|
|
|
45
59
|
* Whether the board is flipped (i.e. seen from Black's point of view) or not.
|
|
46
60
|
*/
|
|
47
61
|
flipped: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Size of the squares (in pixels). Must be an integer between `Chessboard.minSquareSize()` and `Chessboard.maxSquareSize()`.
|
|
50
|
-
*/
|
|
51
|
-
squareSize: number;
|
|
52
|
-
/**
|
|
53
|
-
* Whether the row and column coordinates are visible or not.
|
|
54
|
-
*/
|
|
55
|
-
coordinateVisible: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Whether the turn flag is visible or not.
|
|
58
|
-
*/
|
|
59
|
-
turnVisible: boolean;
|
|
60
|
-
/**
|
|
61
|
-
* Whether moves are highlighted with an arrow or not.
|
|
62
|
-
*/
|
|
63
|
-
moveArrowVisible: boolean;
|
|
64
|
-
/**
|
|
65
|
-
* Color of the move arrow.
|
|
66
|
-
*/
|
|
67
|
-
moveArrowColor: AnnotationColor;
|
|
68
|
-
/**
|
|
69
|
-
* Whether moves are animated or not.
|
|
70
|
-
*/
|
|
71
|
-
animated: boolean;
|
|
72
|
-
/**
|
|
73
|
-
* Color theme ID. Must be a property of `Chessboard.colorsets()`.
|
|
74
|
-
*/
|
|
75
|
-
colorset: string;
|
|
76
|
-
/**
|
|
77
|
-
* Piece theme ID. Must be a property of `Chessboard.piecesets()`.
|
|
78
|
-
*/
|
|
79
|
-
pieceset: string;
|
|
80
|
-
/**
|
|
81
|
-
* Limits applicable on small-screen devices. For instance, if set to
|
|
82
|
-
* ```
|
|
83
|
-
* [
|
|
84
|
-
* { width: 768, squareSize: 40 },
|
|
85
|
-
* { width: 375, squareSize: 24, coordinateVisible: false }
|
|
86
|
-
* ]
|
|
87
|
-
* ```
|
|
88
|
-
* then on screens with resolution ≤768 pixels, the square size will be limited to 40 (whatever the value
|
|
89
|
-
* of the `squareSize` attribute); in addition, on screens with resolution ≤375 pixels, the square size
|
|
90
|
-
* will be limited to 24 and the row and column coordinates will always be hidden (whatever the value of the
|
|
91
|
-
* `coordinateVisible` attribute).
|
|
92
|
-
*/
|
|
93
|
-
smallScreenLimits?: SmallScreenLimit[];
|
|
94
62
|
/**
|
|
95
63
|
* Type of action allowed with the mouse on the chessboard. If undefined, then the user cannot interact with the component.
|
|
96
64
|
*
|
|
@@ -120,6 +88,16 @@ export interface ChessboardProps {
|
|
|
120
88
|
* Callback invoked when a move is played (only if `interactionMode` is set to `'playMoves'`).
|
|
121
89
|
*/
|
|
122
90
|
onMovePlayed?: (move: string) => void;
|
|
91
|
+
/**
|
|
92
|
+
* Optional component, to be rendered above the chessboard, and customized with the same square-size / coordinate-visible / turn-visible
|
|
93
|
+
* parameter values as actually used for the chessboard (which may be different from what is defined in props because of small-screen limits).
|
|
94
|
+
*/
|
|
95
|
+
topComponent?: (attr: Pick<StaticBoardGraphicProps, 'squareSize' | 'coordinateVisible' | 'turnVisible'>) => JSX.Element;
|
|
96
|
+
/**
|
|
97
|
+
* Optional component, to be rendered below the chessboard, and customized with the same square-size / coordinate-visible / turn-visible
|
|
98
|
+
* parameter values as actually used for the chessboard (which may be different from what is defined in props because of small-screen limits).
|
|
99
|
+
*/
|
|
100
|
+
bottomComponent?: (attr: Pick<StaticBoardGraphicProps, 'squareSize' | 'coordinateVisible' | 'turnVisible'>) => JSX.Element;
|
|
123
101
|
}
|
|
124
102
|
interface ChessboardState {
|
|
125
103
|
windowWidth: number;
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* -------------------------------------------------------------------------- *
|
|
2
3
|
* *
|
|
3
|
-
*
|
|
4
|
-
*
|
|
4
|
+
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
|
+
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
+
* Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
7
|
* *
|
|
6
|
-
*
|
|
8
|
+
* Kokopu-React is free software: you can redistribute it and/or *
|
|
7
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
8
10
|
* as published by the Free Software Foundation, either version 3 of *
|
|
9
11
|
* the License, or (at your option) any later version. *
|
|
10
12
|
* *
|
|
11
|
-
*
|
|
13
|
+
* Kokopu-React is distributed in the hope that it will be useful, *
|
|
12
14
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
15
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
16
|
* GNU Lesser General Public License for more details. *
|
|
@@ -19,16 +21,15 @@
|
|
|
19
21
|
* *
|
|
20
22
|
* -------------------------------------------------------------------------- */
|
|
21
23
|
import * as React from 'react';
|
|
22
|
-
import {
|
|
24
|
+
import { Position, isSquare, isSquareCouple } from 'kokopu';
|
|
23
25
|
import { IllegalArgument } from '../exception';
|
|
24
|
-
import { i18n } from '../i18n';
|
|
25
26
|
import { sanitizeString, sanitizeBoolean, sanitizePartialObject, sanitizeInteger, sanitizeBoundedInteger, sanitizeOptional } from '../sanitization';
|
|
26
27
|
import { MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, isAnnotationColor, isAnnotationSymbol, parseSquareMarkers, parseTextMarkers, parseArrowMarkers } from '../types';
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
28
|
+
import { DEFAULT_SQUARE_SIZE, defaultDynamicBoardProps } from './BoardProperties';
|
|
29
|
+
import { colorsets } from './colorsets';
|
|
30
|
+
import { piecesets } from './piecesets';
|
|
29
31
|
import { ChessboardImpl, chessboardSize } from './ChessboardImpl';
|
|
30
|
-
import {
|
|
31
|
-
const DEFAULT_SQUARE_SIZE = 40;
|
|
32
|
+
import { parsePosition, parseMove } from '../errorbox/parsing';
|
|
32
33
|
/**
|
|
33
34
|
* SVG image representing a chessboard diagram. Optionally, the user may interact with the board (move pieces, click on squares...).
|
|
34
35
|
* Annotations such as square markers or arrows can also be added to the board.
|
|
@@ -52,16 +53,20 @@ export class Chessboard extends React.Component {
|
|
|
52
53
|
}
|
|
53
54
|
render() {
|
|
54
55
|
// Validate the position and move attributes.
|
|
55
|
-
const positionInfo = parsePosition(this.props.position);
|
|
56
|
+
const positionInfo = parsePosition(this.props.position, 'Chessboard');
|
|
56
57
|
if (positionInfo.error) {
|
|
57
|
-
return
|
|
58
|
+
return positionInfo.errorBox;
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
const moveInfo = parseMove(position, this.props.move);
|
|
60
|
+
let position = positionInfo.position;
|
|
61
|
+
const moveInfo = parseMove(position, this.props.move, 'Chessboard');
|
|
61
62
|
if (moveInfo.error) {
|
|
62
|
-
return
|
|
63
|
+
return moveInfo.errorBox;
|
|
64
|
+
}
|
|
65
|
+
const move = moveInfo.type === 'regular' ? moveInfo.move : undefined;
|
|
66
|
+
if (moveInfo.type === 'null-move') {
|
|
67
|
+
position = new Position(position);
|
|
68
|
+
position.playNullMove();
|
|
63
69
|
}
|
|
64
|
-
const move = moveInfo.move;
|
|
65
70
|
// Validate the markers
|
|
66
71
|
const sqm = parseMarkers(this.props.squareMarkers, 'squareMarkers', parseSquareMarkers, isSquare, isAnnotationColor);
|
|
67
72
|
const txtm = parseMarkers(this.props.textMarkers, 'textMarkers', parseTextMarkers, isSquare, isTextMarkerElement);
|
|
@@ -89,13 +94,21 @@ export class Chessboard extends React.Component {
|
|
|
89
94
|
const actualSquareSize = computeSquareSizeForSmallScreens(squareSize, smallScreenLimits, this.state.windowWidth);
|
|
90
95
|
const actualCoordinateVisible = computeCoordinateVisibleForSmallScreens(coordinateVisible, smallScreenLimits, this.state.windowWidth);
|
|
91
96
|
const actualTurnVisible = computeTurnVisibleForSmallScreens(turnVisible, smallScreenLimits, this.state.windowWidth);
|
|
97
|
+
const auxilliaryComponentAttr = {
|
|
98
|
+
squareSize: actualSquareSize,
|
|
99
|
+
coordinateVisible: actualCoordinateVisible,
|
|
100
|
+
turnVisible: actualTurnVisible,
|
|
101
|
+
};
|
|
92
102
|
// Validate the interaction attributes and the callbacks.
|
|
93
103
|
const interactionMode = this.getInteractionModeAndValidateEditedArrowColor();
|
|
94
104
|
const { onPieceMoved, onSquareClicked, onArrowEdited, onMovePlayed } = this.props;
|
|
95
105
|
// Build a key so that a new `ChessboardImpl` component is instantiated each time the position or the move changes
|
|
96
106
|
// (mandatory to ensure that the move animation works properly and that the internal state of the component remains consistent).
|
|
97
107
|
const key = `${position.variant()}|${position.fen()}|${move ? position.notation(move) : ''}`;
|
|
98
|
-
return (React.createElement(
|
|
108
|
+
return (React.createElement(React.Fragment, null,
|
|
109
|
+
this.props.topComponent ? this.props.topComponent(auxilliaryComponentAttr) : undefined,
|
|
110
|
+
React.createElement(ChessboardImpl, { key: key, position: position, move: move, squareMarkers: sqm, textMarkers: txtm, arrowMarkers: arm, flipped: flipped, squareSize: actualSquareSize, coordinateVisible: actualCoordinateVisible, turnVisible: actualTurnVisible, moveArrowVisible: moveArrowVisible, moveArrowColor: this.props.moveArrowColor, animated: animated, colorset: colorset, pieceset: pieceset, interactionMode: interactionMode, editedArrowColor: this.props.editedArrowColor, onPieceMoved: onPieceMoved, onSquareClicked: onSquareClicked, onArrowEdited: onArrowEdited, onMovePlayed: onMovePlayed }),
|
|
111
|
+
this.props.bottomComponent ? this.props.bottomComponent(auxilliaryComponentAttr) : undefined));
|
|
99
112
|
}
|
|
100
113
|
getInteractionModeAndValidateEditedArrowColor() {
|
|
101
114
|
const interactionMode = sanitizeOptional(this.props.interactionMode, sanitizeString);
|
|
@@ -136,7 +149,7 @@ export class Chessboard extends React.Component {
|
|
|
136
149
|
* Return the maximum square size that would allow the chessboard to fit in a rectangle of size `width x height`.
|
|
137
150
|
*/
|
|
138
151
|
static adaptSquareSize(width, height, attr) {
|
|
139
|
-
let { coordinateVisible, turnVisible, smallScreenLimits } = sanitizePartialObject(attr, () => new IllegalArgument('Chessboard.
|
|
152
|
+
let { coordinateVisible, turnVisible, smallScreenLimits } = sanitizePartialObject(attr, () => new IllegalArgument('Chessboard.adaptSquareSize()', 'attr'));
|
|
140
153
|
// Sanitize the arguments.
|
|
141
154
|
width = sanitizeInteger(width, () => new IllegalArgument('Chessboard.adaptSquareSize()', 'width'));
|
|
142
155
|
height = sanitizeInteger(height, () => new IllegalArgument('Chessboard.adaptSquareSize()', 'height'));
|
|
@@ -209,16 +222,9 @@ export class Chessboard extends React.Component {
|
|
|
209
222
|
}
|
|
210
223
|
}
|
|
211
224
|
Chessboard.defaultProps = {
|
|
225
|
+
...defaultDynamicBoardProps(),
|
|
212
226
|
position: 'start',
|
|
213
227
|
flipped: false,
|
|
214
|
-
squareSize: DEFAULT_SQUARE_SIZE,
|
|
215
|
-
coordinateVisible: true,
|
|
216
|
-
turnVisible: true,
|
|
217
|
-
moveArrowVisible: true,
|
|
218
|
-
moveArrowColor: 'b',
|
|
219
|
-
animated: false,
|
|
220
|
-
colorset: DEFAULT_COLORSET,
|
|
221
|
-
pieceset: DEFAULT_PIECESET,
|
|
222
228
|
};
|
|
223
229
|
/**
|
|
224
230
|
* Compute the actual square size taking into account the given small-screen limits and window width.
|
|
@@ -261,76 +267,6 @@ function computeSmallScreenLimits(smallScreenLimits, windowWidth, getter) {
|
|
|
261
267
|
}
|
|
262
268
|
return bestAttributeValue;
|
|
263
269
|
}
|
|
264
|
-
/**
|
|
265
|
-
* Try to interpret the given object as a chess position.
|
|
266
|
-
*/
|
|
267
|
-
function parsePosition(position) {
|
|
268
|
-
if (position instanceof Position) {
|
|
269
|
-
return { error: false, position: position };
|
|
270
|
-
}
|
|
271
|
-
else if (position === 'start' || position === 'empty') {
|
|
272
|
-
return { error: false, position: new Position(position) };
|
|
273
|
-
}
|
|
274
|
-
else if (typeof position === 'string') {
|
|
275
|
-
try {
|
|
276
|
-
const { variant, fen } = splitGameVariantAndFEN(position);
|
|
277
|
-
const result = new Position(variant, 'empty');
|
|
278
|
-
result.fen(fen);
|
|
279
|
-
return { error: false, position: result };
|
|
280
|
-
}
|
|
281
|
-
catch (e) {
|
|
282
|
-
// istanbul ignore else
|
|
283
|
-
if (e instanceof kokopuException.InvalidFEN) {
|
|
284
|
-
return { error: true, message: e.message };
|
|
285
|
-
}
|
|
286
|
-
else {
|
|
287
|
-
throw e;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
else {
|
|
292
|
-
throw new IllegalArgument('Chessboard', 'position');
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Look for an optional 'chess-variant:' prefix in the position attribute.
|
|
297
|
-
*/
|
|
298
|
-
function splitGameVariantAndFEN(position) {
|
|
299
|
-
const separatorIndex = position.indexOf(':');
|
|
300
|
-
if (separatorIndex < 0) {
|
|
301
|
-
return { variant: 'regular', fen: position };
|
|
302
|
-
}
|
|
303
|
-
const variant = position.substring(0, separatorIndex);
|
|
304
|
-
return isGameVariant(variant) ? { variant: variant, fen: position.substring(separatorIndex + 1) } : { variant: 'regular', fen: position };
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Try to interpret the given object `move` as a move descriptor based on the given position.
|
|
308
|
-
*/
|
|
309
|
-
function parseMove(position, move) {
|
|
310
|
-
if (move === undefined || move === null) {
|
|
311
|
-
return { error: false, move: undefined };
|
|
312
|
-
}
|
|
313
|
-
else if (move instanceof MoveDescriptor) {
|
|
314
|
-
return { error: false, move: move };
|
|
315
|
-
}
|
|
316
|
-
else if (typeof move === 'string') {
|
|
317
|
-
try {
|
|
318
|
-
return { error: false, move: position.notation(move) };
|
|
319
|
-
}
|
|
320
|
-
catch (e) {
|
|
321
|
-
// istanbul ignore else
|
|
322
|
-
if (e instanceof kokopuException.InvalidNotation) {
|
|
323
|
-
return { error: true, message: e.message };
|
|
324
|
-
}
|
|
325
|
-
else {
|
|
326
|
-
throw e;
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
else {
|
|
331
|
-
throw new IllegalArgument('Chessboard', 'move');
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
270
|
/**
|
|
335
271
|
* Try to interpret the given object as a list of markers.
|
|
336
272
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chessboard.js","sourceRoot":"","sources":["../../../src/chessboard/Chessboard.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;gFAmBgF;AAGhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,cAAc,EAAE,QAAQ,EAAuB,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;A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EAAE,eAAe,CAAC;aAC5E,CAAC;QACH,CAAC,CAAC,CAAC;IACJ,CAAC;AACF,CAAC"}
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* -------------------------------------------------------------------------- *
|
|
3
|
+
* *
|
|
4
|
+
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
|
+
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
+
* Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
|
+
* *
|
|
8
|
+
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
|
+
* modify it under the terms of the GNU Lesser General Public License *
|
|
10
|
+
* as published by the Free Software Foundation, either version 3 of *
|
|
11
|
+
* the License, or (at your option) any later version. *
|
|
12
|
+
* *
|
|
13
|
+
* Kokopu-React is distributed in the hope that it will be useful, *
|
|
14
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
15
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
16
|
+
* GNU Lesser General Public License for more details. *
|
|
17
|
+
* *
|
|
18
|
+
* You should have received a copy of the GNU Lesser General *
|
|
19
|
+
* Public License along with this program. If not, see *
|
|
20
|
+
* <http://www.gnu.org/licenses/>. *
|
|
21
|
+
* *
|
|
22
|
+
* -------------------------------------------------------------------------- */
|
|
1
23
|
import * as React from 'react';
|
|
2
24
|
import { Piece, Square, MoveDescriptor, Position } from 'kokopu';
|
|
3
25
|
import { Colorset, Pieceset, AnnotationColor, SquareMarkerSet, TextMarkerSet, ArrowMarkerSet } from '../types';
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
/*!
|
|
2
|
+
* -------------------------------------------------------------------------- *
|
|
2
3
|
* *
|
|
3
|
-
*
|
|
4
|
-
*
|
|
4
|
+
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
|
+
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
+
* Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
7
|
* *
|
|
6
|
-
*
|
|
8
|
+
* Kokopu-React is free software: you can redistribute it and/or *
|
|
7
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
8
10
|
* as published by the Free Software Foundation, either version 3 of *
|
|
9
11
|
* the License, or (at your option) any later version. *
|
|
10
12
|
* *
|
|
11
|
-
*
|
|
13
|
+
* Kokopu-React is distributed in the hope that it will be useful, *
|
|
12
14
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
15
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
16
|
* GNU Lesser General Public License for more details. *
|
|
@@ -362,7 +364,7 @@ export class ChessboardImpl extends React.Component {
|
|
|
362
364
|
// Promotion move.
|
|
363
365
|
case 'promotion':
|
|
364
366
|
this.setState({
|
|
365
|
-
inhibitedSquare: sq,
|
|
367
|
+
inhibitedSquare: sq, // The moving pawn must not be visible while the promotion drawer is opened.
|
|
366
368
|
promotionDrawer: {
|
|
367
369
|
origin: targetSq,
|
|
368
370
|
buttons: positionStill.variant() === 'antichess' ? ['q', 'r', 'b', 'n', 'k'] : ['q', 'r', 'b', 'n'],
|