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
|
@@ -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 { AnnotationSymbol } from '../types';
|
|
3
25
|
export interface TextMarkerIconProps {
|
|
@@ -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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextMarkerIcon.js","sourceRoot":"","sources":["../../../src/icons/TextMarkerIcon.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"TextMarkerIcon.js","sourceRoot":"","sources":["../../../src/icons/TextMarkerIcon.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;gFAqBgF;AAGhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,eA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|
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. *
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -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
|
export { i18n } from './i18n';
|
|
2
24
|
export * as exception from './exception';
|
|
3
25
|
export { ChessPieceIconType, Colorset, Pieceset, PieceSymbolMapping, AnnotationColor, AnnotationSymbol, SquareMarkerSet, TextMarkerSet, ArrowMarkerSet, isChessPieceIconType, isPieceSymbolMapping, isAnnotationColor, isAnnotationSymbol, flattenSquareMarkers, flattenTextMarkers, flattenArrowMarkers, parseSquareMarkers, parseTextMarkers, parseArrowMarkers } from './types';
|
|
@@ -6,6 +28,9 @@ export { SquareMarkerIcon, SquareMarkerIconProps } from './icons/SquareMarkerIco
|
|
|
6
28
|
export { TextMarkerIcon, TextMarkerIconProps } from './icons/TextMarkerIcon';
|
|
7
29
|
export { ArrowMarkerIcon, ArrowMarkerIconProps } from './icons/ArrowMarkerIcon';
|
|
8
30
|
export { ChessPieceIcon, ChessPieceIconProps } from './icons/ChessPieceIcon';
|
|
9
|
-
export {
|
|
31
|
+
export { SmallScreenLimit } from './chessboard/BoardProperties';
|
|
32
|
+
export { Chessboard, ChessboardProps } from './chessboard/Chessboard';
|
|
10
33
|
export { formatMove, moveFormatter } from './movetext/moveFormatter';
|
|
11
34
|
export { Movetext, MovetextProps, MoveSelectEventOrigin } from './movetext/Movetext';
|
|
35
|
+
export { firstNodeId, previousNodeId, nextNodeId, lastNodeId } from './navigationboard/NavigationField';
|
|
36
|
+
export { NavigationBoard, NavigationBoardProps } from './navigationboard/NavigationBoard';
|
package/dist/lib/index.js
CHANGED
|
@@ -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. *
|
|
@@ -29,4 +31,6 @@ export { ChessPieceIcon } from './icons/ChessPieceIcon';
|
|
|
29
31
|
export { Chessboard } from './chessboard/Chessboard';
|
|
30
32
|
export { formatMove, moveFormatter } from './movetext/moveFormatter';
|
|
31
33
|
export { Movetext } from './movetext/Movetext';
|
|
34
|
+
export { firstNodeId, previousNodeId, nextNodeId, lastNodeId } from './navigationboard/NavigationField';
|
|
35
|
+
export { NavigationBoard } from './navigationboard/NavigationBoard';
|
|
32
36
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;gFAqBgF;AAGhF,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAEzC,OAAO,EACN,oBAAoB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,mBAAmB,EAChJ,kBAAkB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE1E,OAAO,EAAE,QAAQ,EAAiB,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EAAE,gBAAgB,EAAyB,MAAM,0BAA0B,CAAC;AACnF,OAAO,EAAE,cAAc,EAAuB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAwB,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAE,cAAc,EAAuB,MAAM,wBAAwB,CAAC;AAG7E,OAAO,EAAE,UAAU,EAAmB,MAAM,yBAAyB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAwC,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACxG,OAAO,EAAE,eAAe,EAAwB,MAAM,mCAAmC,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. *
|
|
@@ -106,16 +108,3 @@ div.kokopu-subVariation {
|
|
|
106
108
|
text-decoration: underline;
|
|
107
109
|
cursor: pointer;
|
|
108
110
|
}
|
|
109
|
-
|
|
110
|
-
.kokopu-focusFieldContainer {
|
|
111
|
-
position: fixed;
|
|
112
|
-
bottom: 0px;
|
|
113
|
-
right: 0px;
|
|
114
|
-
width: 0px;
|
|
115
|
-
height: 0px;
|
|
116
|
-
overflow: hidden;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.kokopu-focusField {
|
|
120
|
-
position: absolute; /* see #1 */
|
|
121
|
-
}
|
|
@@ -1,7 +1,29 @@
|
|
|
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 { Database, Game } from 'kokopu';
|
|
3
25
|
import { PieceSymbolMapping } from '../types';
|
|
4
|
-
import {
|
|
26
|
+
import { StaticBoardGraphicProps } from '../chessboard/BoardProperties';
|
|
5
27
|
import './Movetext.css';
|
|
6
28
|
/**
|
|
7
29
|
* Origin of a "move-selected" event in {@link Movetext}. See {@link MovetextProps.onMoveSelected} for more details.
|
|
@@ -9,7 +31,7 @@ import './Movetext.css';
|
|
|
9
31
|
export type MoveSelectEventOrigin = 'key-first' | 'key-previous' | 'key-next' | 'key-last' | 'key-exit' | 'click';
|
|
10
32
|
export interface MovetextProps {
|
|
11
33
|
/**
|
|
12
|
-
* Displayed
|
|
34
|
+
* Displayed game. Can be a [kokopu.Game](https://kokopu.yo35.org/docs/current/classes/Game.html) object,
|
|
13
35
|
* a [kokopu.Database](https://kokopu.yo35.org/docs/current/classes/Database.html) object,
|
|
14
36
|
* or a [PGN string](https://en.wikipedia.org/wiki/Portable_Game_Notation).
|
|
15
37
|
*/
|
|
@@ -23,14 +45,8 @@ export interface MovetextProps {
|
|
|
23
45
|
/**
|
|
24
46
|
* Options applicable to the diagrams in the comments. See [Chessboard](#/Components/Chessboard) for more details about each option.
|
|
25
47
|
*/
|
|
26
|
-
diagramOptions: {
|
|
27
|
-
flipped?:
|
|
28
|
-
squareSize?: ChessboardProps['squareSize'];
|
|
29
|
-
coordinateVisible?: ChessboardProps['coordinateVisible'];
|
|
30
|
-
turnVisible?: ChessboardProps['turnVisible'];
|
|
31
|
-
colorset?: ChessboardProps['colorset'];
|
|
32
|
-
pieceset?: ChessboardProps['pieceset'];
|
|
33
|
-
smallScreenLimits?: ChessboardProps['smallScreenLimits'];
|
|
48
|
+
diagramOptions: Partial<StaticBoardGraphicProps> & {
|
|
49
|
+
flipped?: boolean;
|
|
34
50
|
};
|
|
35
51
|
/**
|
|
36
52
|
* Symbols to use for the chess pieces. See {@link moveFormatter}.
|
|
@@ -45,7 +61,7 @@ export interface MovetextProps {
|
|
|
45
61
|
*/
|
|
46
62
|
headerVisible: boolean;
|
|
47
63
|
/**
|
|
48
|
-
* ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
64
|
+
* ID of the selected move (or `'start'`/`'end'` for the beginning/end of the main variation).
|
|
49
65
|
* Use [kokopu.Node#id](https://kokopu.yo35.org/docs/current/classes/Node.html#id) to get the ID of a game move.
|
|
50
66
|
*/
|
|
51
67
|
selection?: string;
|
|
@@ -92,47 +108,19 @@ export declare class Movetext extends React.Component<MovetextProps> {
|
|
|
92
108
|
*/
|
|
93
109
|
focus(): void;
|
|
94
110
|
/**
|
|
95
|
-
*
|
|
96
|
-
* If the given selection corresponds already at the main variation, `undefined` is returned.
|
|
97
|
-
*
|
|
98
|
-
* This corresponds to the operation performed when the user presses key "home" on a `Movetext` component.
|
|
99
|
-
*
|
|
100
|
-
* @param game - Considered chess game.
|
|
101
|
-
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
102
|
-
* @public
|
|
111
|
+
* @deprecated
|
|
103
112
|
*/
|
|
104
113
|
static firstNodeId(game: Game, selection: string): string | undefined;
|
|
105
114
|
/**
|
|
106
|
-
*
|
|
107
|
-
* If no such node exists, `undefined` is returned.
|
|
108
|
-
*
|
|
109
|
-
* This corresponds to the operation performed when the user presses key "arrow left" on a `Movetext` component.
|
|
110
|
-
*
|
|
111
|
-
* @param game - Considered chess game.
|
|
112
|
-
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
113
|
-
* @public
|
|
115
|
+
* @deprecated
|
|
114
116
|
*/
|
|
115
117
|
static previousNodeId(game: Game, selection: string): string | undefined;
|
|
116
118
|
/**
|
|
117
|
-
*
|
|
118
|
-
* If no such node exists, `undefined` is returned.
|
|
119
|
-
*
|
|
120
|
-
* This corresponds to the operation performed when the user presses key "arrow right" on a `Movetext` component.
|
|
121
|
-
*
|
|
122
|
-
* @param game - Considered chess game.
|
|
123
|
-
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
124
|
-
* @public
|
|
119
|
+
* @deprecated
|
|
125
120
|
*/
|
|
126
121
|
static nextNodeId(game: Game, selection: string): string | undefined;
|
|
127
122
|
/**
|
|
128
|
-
*
|
|
129
|
-
* If the selection is already at the end its variation, `undefined` is returned.
|
|
130
|
-
*
|
|
131
|
-
* This corresponds to the operation performed when the user presses key "end" on a `Movetext` component.
|
|
132
|
-
*
|
|
133
|
-
* @param game - Considered chess game.
|
|
134
|
-
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
135
|
-
* @public
|
|
123
|
+
* @deprecated
|
|
136
124
|
*/
|
|
137
125
|
static lastNodeId(game: Game, selection: string): string | undefined;
|
|
138
126
|
}
|
|
@@ -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,13 +21,13 @@
|
|
|
19
21
|
* *
|
|
20
22
|
* -------------------------------------------------------------------------- */
|
|
21
23
|
import * as React from 'react';
|
|
22
|
-
import {
|
|
24
|
+
import { Game } from 'kokopu';
|
|
23
25
|
import { IllegalArgument } from '../exception';
|
|
24
|
-
import { i18n } from '../i18n';
|
|
25
26
|
import { sanitizeString, sanitizeBoolean, sanitizeOptional } from '../sanitization';
|
|
26
|
-
import {
|
|
27
|
+
import { parseGame } from '../errorbox/parsing';
|
|
28
|
+
import { firstNodeId as firstNodeIdImpl, previousNodeId as previousNodeIdImpl, nextNodeId as nextNodeIdImpl, lastNodeId as lastNodeIdImpl } from '../navigationboard/NavigationField';
|
|
27
29
|
import { moveFormatter } from './moveFormatter';
|
|
28
|
-
import { MovetextImpl
|
|
30
|
+
import { MovetextImpl } from './MovetextImpl';
|
|
29
31
|
import './Movetext.css';
|
|
30
32
|
/**
|
|
31
33
|
* Display a chess game, i.e. the headers (name of the players, event, etc.), the moves, and all the related annotations if any (comments, variations, NAGs...).
|
|
@@ -37,9 +39,9 @@ export class Movetext extends React.Component {
|
|
|
37
39
|
}
|
|
38
40
|
render() {
|
|
39
41
|
// Validate the game and game-index attributes.
|
|
40
|
-
const info = parseGame(this.props.game, this.props.gameIndex);
|
|
42
|
+
const info = parseGame(this.props.game, this.props.gameIndex, 'Movetext');
|
|
41
43
|
if (info.error) {
|
|
42
|
-
return
|
|
44
|
+
return info.errorBox;
|
|
43
45
|
}
|
|
44
46
|
// Validate the appearance attributes.
|
|
45
47
|
if (typeof this.props.diagramOptions !== 'object' || this.props.diagramOptions === null) {
|
|
@@ -70,59 +72,36 @@ export class Movetext extends React.Component {
|
|
|
70
72
|
*/
|
|
71
73
|
focus() {
|
|
72
74
|
const movetextImpl = this.implRef.current;
|
|
75
|
+
// istanbul ignore else
|
|
73
76
|
if (movetextImpl) {
|
|
74
77
|
movetextImpl.focus();
|
|
75
78
|
}
|
|
76
79
|
}
|
|
77
80
|
/**
|
|
78
|
-
*
|
|
79
|
-
* If the given selection corresponds already at the main variation, `undefined` is returned.
|
|
80
|
-
*
|
|
81
|
-
* This corresponds to the operation performed when the user presses key "home" on a `Movetext` component.
|
|
82
|
-
*
|
|
83
|
-
* @param game - Considered chess game.
|
|
84
|
-
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
85
|
-
* @public
|
|
81
|
+
* @deprecated
|
|
86
82
|
*/
|
|
83
|
+
// istanbul ignore next
|
|
87
84
|
static firstNodeId(game, selection) {
|
|
88
85
|
return firstNodeIdImpl(game, selection);
|
|
89
86
|
}
|
|
90
87
|
/**
|
|
91
|
-
*
|
|
92
|
-
* If no such node exists, `undefined` is returned.
|
|
93
|
-
*
|
|
94
|
-
* This corresponds to the operation performed when the user presses key "arrow left" on a `Movetext` component.
|
|
95
|
-
*
|
|
96
|
-
* @param game - Considered chess game.
|
|
97
|
-
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
98
|
-
* @public
|
|
88
|
+
* @deprecated
|
|
99
89
|
*/
|
|
90
|
+
// istanbul ignore next
|
|
100
91
|
static previousNodeId(game, selection) {
|
|
101
92
|
return previousNodeIdImpl(game, selection);
|
|
102
93
|
}
|
|
103
94
|
/**
|
|
104
|
-
*
|
|
105
|
-
* If no such node exists, `undefined` is returned.
|
|
106
|
-
*
|
|
107
|
-
* This corresponds to the operation performed when the user presses key "arrow right" on a `Movetext` component.
|
|
108
|
-
*
|
|
109
|
-
* @param game - Considered chess game.
|
|
110
|
-
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
111
|
-
* @public
|
|
95
|
+
* @deprecated
|
|
112
96
|
*/
|
|
97
|
+
// istanbul ignore next
|
|
113
98
|
static nextNodeId(game, selection) {
|
|
114
99
|
return nextNodeIdImpl(game, selection);
|
|
115
100
|
}
|
|
116
101
|
/**
|
|
117
|
-
*
|
|
118
|
-
* If the selection is already at the end its variation, `undefined` is returned.
|
|
119
|
-
*
|
|
120
|
-
* This corresponds to the operation performed when the user presses key "end" on a `Movetext` component.
|
|
121
|
-
*
|
|
122
|
-
* @param game - Considered chess game.
|
|
123
|
-
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
124
|
-
* @public
|
|
102
|
+
* @deprecated
|
|
125
103
|
*/
|
|
104
|
+
// istanbul ignore next
|
|
126
105
|
static lastNodeId(game, selection) {
|
|
127
106
|
return lastNodeIdImpl(game, selection);
|
|
128
107
|
}
|
|
@@ -135,33 +114,4 @@ Movetext.defaultProps = {
|
|
|
135
114
|
diagramVisible: true,
|
|
136
115
|
headerVisible: true,
|
|
137
116
|
};
|
|
138
|
-
/**
|
|
139
|
-
* Try to interpret the given object as a chess game.
|
|
140
|
-
*/
|
|
141
|
-
function parseGame(game, gameIndex) {
|
|
142
|
-
if (game instanceof Game) {
|
|
143
|
-
return { error: false, game: game };
|
|
144
|
-
}
|
|
145
|
-
else if (game instanceof Database || typeof game === 'string') {
|
|
146
|
-
if (!Number.isInteger(gameIndex) || gameIndex < 0) {
|
|
147
|
-
throw new IllegalArgument('Movetext', 'gameIndex');
|
|
148
|
-
}
|
|
149
|
-
try {
|
|
150
|
-
const result = game instanceof Database ? game.game(gameIndex) : pgnRead(game, gameIndex);
|
|
151
|
-
return { error: false, game: result };
|
|
152
|
-
}
|
|
153
|
-
catch (e) {
|
|
154
|
-
// istanbul ignore else
|
|
155
|
-
if (e instanceof kokopuException.InvalidPGN) {
|
|
156
|
-
return { error: true, pgnException: e };
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
throw e;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
else {
|
|
164
|
-
throw new IllegalArgument('Movetext', 'game');
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
117
|
//# sourceMappingURL=Movetext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Movetext.js","sourceRoot":"","sources":["../../../src/movetext/Movetext.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"Movetext.js","sourceRoot":"","sources":["../../../src/movetext/Movetext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;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AM,CAAC,WAAW,CAAC,IAAU,EAAE,SAAiB;QAC/C,OAAO,eAAe,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,uBAAuB;IACvB,MAAM,CAAC,cAAc,CAAC,IAAU,EAAE,SAAiB;QAClD,OAAO,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,uBAAuB;IACvB,MAAM,CAAC,UAAU,CAAC,IAAU,EAAE,SAAiB;QAC9C,OAAO,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,uBAAuB;IACvB,MAAM,CAAC,UAAU,CAAC,IAAU,EAAE,SAAiB;QAC9C,OAAO,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;;AA9FM,qBAAY,GAAG;IACrB,IAAI,EAAE,IAAI,IAAI,EAAE;IAChB,SAAS,EAAE,CAAC;IACZ,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,QAAQ;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;CACnB,AAPkB,CAOjB"}
|
|
@@ -1,17 +1,33 @@
|
|
|
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 { Game } from 'kokopu';
|
|
3
|
-
import {
|
|
25
|
+
import { StaticBoardGraphicProps } from '../chessboard/BoardProperties';
|
|
4
26
|
import './Movetext.css';
|
|
5
27
|
interface MovetextImplProps {
|
|
6
28
|
game: Game;
|
|
7
|
-
diagramOptions: {
|
|
8
|
-
flipped?:
|
|
9
|
-
squareSize?: ChessboardProps['squareSize'];
|
|
10
|
-
coordinateVisible?: ChessboardProps['coordinateVisible'];
|
|
11
|
-
turnVisible?: ChessboardProps['turnVisible'];
|
|
12
|
-
colorset?: ChessboardProps['colorset'];
|
|
13
|
-
pieceset?: ChessboardProps['pieceset'];
|
|
14
|
-
smallScreenLimits?: ChessboardProps['smallScreenLimits'];
|
|
29
|
+
diagramOptions: Partial<StaticBoardGraphicProps> & {
|
|
30
|
+
flipped?: boolean;
|
|
15
31
|
};
|
|
16
32
|
moveFormatter: (notation: string) => React.ReactNode;
|
|
17
33
|
diagramVisible: boolean;
|
|
@@ -26,7 +42,7 @@ interface MovetextImplProps {
|
|
|
26
42
|
* This implementation assumes that all the parameter sanitization has been performed beforehand.
|
|
27
43
|
*/
|
|
28
44
|
export declare class MovetextImpl extends React.Component<MovetextImplProps> {
|
|
29
|
-
private
|
|
45
|
+
private navigationFieldRef;
|
|
30
46
|
render(): React.JSX.Element;
|
|
31
47
|
private renderHeaders;
|
|
32
48
|
/**
|
|
@@ -45,7 +61,7 @@ export declare class MovetextImpl extends React.Component<MovetextImplProps> {
|
|
|
45
61
|
* Header containing the annotator information.
|
|
46
62
|
*/
|
|
47
63
|
private renderAnnotatorHeader;
|
|
48
|
-
private
|
|
64
|
+
private renderNavigationField;
|
|
49
65
|
private renderBody;
|
|
50
66
|
/**
|
|
51
67
|
* Render the given variation and its sub-variations, recursively.
|
|
@@ -60,7 +76,8 @@ export declare class MovetextImpl extends React.Component<MovetextImplProps> {
|
|
|
60
76
|
*/
|
|
61
77
|
private renderComment;
|
|
62
78
|
private extractComment;
|
|
63
|
-
private
|
|
79
|
+
private handleNavigationPressed;
|
|
80
|
+
private handleExitPressed;
|
|
64
81
|
private fireMoveSelected;
|
|
65
82
|
private handleNodeClicked;
|
|
66
83
|
/**
|
|
@@ -68,20 +85,4 @@ export declare class MovetextImpl extends React.Component<MovetextImplProps> {
|
|
|
68
85
|
*/
|
|
69
86
|
focus(): void;
|
|
70
87
|
}
|
|
71
|
-
/**
|
|
72
|
-
* See {@link Movetext.firstNodeId}.
|
|
73
|
-
*/
|
|
74
|
-
export declare function firstNodeIdImpl(game: Game, selection: string): string | undefined;
|
|
75
|
-
/**
|
|
76
|
-
* See {@link Movetext.previousNodeId}.
|
|
77
|
-
*/
|
|
78
|
-
export declare function previousNodeIdImpl(game: Game, selection: string): string | undefined;
|
|
79
|
-
/**
|
|
80
|
-
* See {@link Movetext.nextNodeId}.
|
|
81
|
-
*/
|
|
82
|
-
export declare function nextNodeIdImpl(game: Game, selection: string): string | undefined;
|
|
83
|
-
/**
|
|
84
|
-
* See {@link Movetext.lastNodeId}.
|
|
85
|
-
*/
|
|
86
|
-
export declare function lastNodeIdImpl(game: Game, selection: string): string | undefined;
|
|
87
88
|
export {};
|