kokopu-react 3.0.2 → 3.2.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/.eslintrc.yml +1 -1
- package/CHANGELOG.md +13 -1
- 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 +13 -13
- package/dist/lib/chessboard/Chessboard.d.ts +14 -58
- package/dist/lib/chessboard/Chessboard.js +26 -92
- package/dist/lib/chessboard/Chessboard.js.map +1 -1
- package/dist/lib/chessboard/ChessboardImpl.js.map +1 -1
- package/dist/lib/chessboard/Draggable.js.map +1 -1
- package/dist/lib/chessboard/Motion.js.map +1 -1
- package/dist/lib/chessboard/colorsets.js.map +1 -1
- package/dist/lib/chessboard/piecesets.js.map +1 -1
- package/dist/lib/errorbox/ErrorBox.css +18 -18
- 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.js.map +1 -1
- package/dist/lib/i18n.d.ts +6 -0
- package/dist/lib/i18n.js +7 -0
- package/dist/lib/i18n.js.map +1 -1
- package/dist/lib/icons/AnnotationSymbolShape.css +6 -6
- package/dist/lib/icons/AnnotationSymbolShape.js.map +1 -1
- package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -1
- package/dist/lib/icons/ArrowTip.js.map +1 -1
- package/dist/lib/icons/ChessPieceIcon.js.map +1 -1
- package/dist/lib/icons/SquareMarkerIcon.js.map +1 -1
- package/dist/lib/icons/TextMarkerIcon.js.map +1 -1
- package/dist/lib/icons/arrow.css +1 -1
- package/dist/lib/index.d.ts +5 -1
- package/dist/lib/index.js +3 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/movetext/Movetext.css +27 -40
- package/dist/lib/movetext/Movetext.d.ts +9 -43
- package/dist/lib/movetext/Movetext.js +15 -67
- package/dist/lib/movetext/Movetext.js.map +1 -1
- package/dist/lib/movetext/MovetextImpl.d.ts +7 -28
- package/dist/lib/movetext/MovetextImpl.js +15 -94
- package/dist/lib/movetext/MovetextImpl.js.map +1 -1
- package/dist/lib/movetext/fonts.css +7 -7
- package/dist/lib/movetext/htmlFilter.js.map +1 -1
- package/dist/lib/movetext/moveFormatter.js.map +1 -1
- package/dist/lib/navigationboard/NavigationBoard.d.ts +156 -0
- package/dist/lib/navigationboard/NavigationBoard.js +195 -0
- package/dist/lib/navigationboard/NavigationBoard.js.map +1 -0
- package/dist/lib/navigationboard/NavigationButton.d.ts +54 -0
- package/dist/lib/navigationboard/NavigationButton.js +35 -0
- package/dist/lib/navigationboard/NavigationButton.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 +54 -0
- package/dist/lib/navigationboard/NavigationToolbar.d.ts +34 -0
- package/dist/lib/navigationboard/NavigationToolbar.js +73 -0
- package/dist/lib/navigationboard/NavigationToolbar.js.map +1 -0
- package/dist/lib/navigationboard/iconPaths.d.ts +29 -0
- package/dist/lib/navigationboard/iconPaths.js +91 -0
- package/dist/lib/navigationboard/iconPaths.js.map +1 -0
- package/dist/lib/sanitization.js.map +1 -1
- package/dist/lib/types.js.map +1 -1
- package/dist/lib/util.js.map +1 -1
- package/doc_src/demo/PageChessboardBase.tsx +115 -115
- package/doc_src/demo/PageChessboardInteraction.tsx +303 -303
- package/doc_src/demo/PageChessboardMove.tsx +173 -156
- package/doc_src/demo/PageChessboardSmallScreens.tsx +94 -94
- package/doc_src/demo/PageMovetextBase.tsx +180 -180
- package/doc_src/demo/PageMovetextInteraction.tsx +123 -123
- package/doc_src/demo/PageNavigationBoardBase.tsx +201 -0
- package/doc_src/demo/PageNavigationBoardUncontrolledVsControlled.tsx +114 -0
- package/doc_src/demo/decs.d.ts +4 -4
- package/doc_src/demo/demo.css +12 -12
- package/doc_src/demo/game-3.pgn +10 -0
- package/doc_src/demo/util.ts +1 -1
- package/doc_src/examples/Movetext.md +1 -1
- package/doc_src/examples/NavigationBoard.md +15 -0
- package/doc_src/theming/LogoRenderer.js +13 -13
- package/doc_src/theming/theming.css +5 -5
- package/package.json +95 -95
- package/scripts/doc.styleguide.config.js +133 -123
- package/scripts/doc.tsconfig.json +5 -5
- package/scripts/docker-compose.yml +1 -1
- package/scripts/test-graphic.tsconfig.json +5 -5
- package/scripts/test-graphic.webpack.config.js +57 -57
- package/scripts/test-headless.webpack.config.js +29 -29
- package/src/chessboard/BoardProperties.ts +131 -0
- package/src/chessboard/Chessboard.css +13 -13
- package/src/chessboard/Chessboard.tsx +389 -518
- package/src/chessboard/ChessboardImpl.tsx +557 -557
- package/src/chessboard/Draggable.tsx +185 -185
- package/src/chessboard/Motion.tsx +67 -67
- package/src/chessboard/colorsets.ts +66 -66
- package/src/chessboard/piecesets.ts +84 -84
- package/src/decs.d.ts +2 -2
- package/src/errorbox/ErrorBox.css +18 -18
- package/src/errorbox/ErrorBox.tsx +75 -75
- package/src/errorbox/parsing.tsx +158 -0
- package/src/exception.ts +17 -17
- package/src/i18n.ts +8 -0
- package/src/icons/AnnotationSymbolShape.css +6 -6
- package/src/icons/AnnotationSymbolShape.tsx +31 -31
- package/src/icons/ArrowMarkerIcon.tsx +34 -34
- package/src/icons/ArrowTip.tsx +14 -14
- package/src/icons/ChessPieceIcon.tsx +45 -45
- package/src/icons/SquareMarkerIcon.tsx +20 -20
- package/src/icons/TextMarkerIcon.tsx +29 -29
- package/src/icons/arrow.css +1 -1
- package/src/index.ts +8 -3
- package/src/movetext/Movetext.css +27 -40
- package/src/movetext/Movetext.tsx +163 -228
- package/src/movetext/MovetextImpl.tsx +351 -438
- package/src/movetext/fonts.css +7 -7
- package/src/movetext/htmlFilter.tsx +129 -129
- package/src/movetext/moveFormatter.tsx +37 -37
- package/src/navigationboard/NavigationBoard.tsx +350 -0
- package/src/navigationboard/NavigationButton.ts +72 -0
- package/src/navigationboard/NavigationField.css +36 -0
- package/src/navigationboard/NavigationField.tsx +185 -0
- package/src/navigationboard/NavigationToolbar.css +54 -0
- package/src/navigationboard/NavigationToolbar.tsx +117 -0
- package/src/navigationboard/iconPaths.ts +98 -0
- package/src/sanitization.ts +17 -17
- package/src/types.ts +116 -116
- package/src/util.ts +11 -11
- package/test/01_types.js +167 -167
- package/test/02_chessboard_util.js +114 -114
- package/test/03_error_box_graphic.js +16 -16
- package/test/04_icons_graphic.js +32 -32
- package/test/05_chessboard_graphic.js +60 -58
- package/test/06_chessboard_animation.js +36 -36
- package/test/07_chessboard_interaction.js +101 -101
- package/test/08_chessboard_play_moves.js +62 -62
- package/test/09_chessboard_small_screens.js +42 -21
- package/test/10_movetext_graphic.js +36 -31
- package/test/11_movetext_interaction.js +100 -96
- package/test/12_navigation_board_base.js +151 -0
- package/test/13_navigation_board_graphic.js +68 -0
- package/test/14_navigation_board_autoplay.js +100 -0
- package/test/common/graphic.js +106 -97
- 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_base/controlled/default.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/invalid_node_id.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/overriding_initial_node_id.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_2.png +0 -0
- package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_3.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_2.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_2.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_end.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_specific_id.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default_with_game_index.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_on_null-move.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_2.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_3.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_4.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_0.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_1.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_2.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_3.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_4.png +0 -0
- package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_5.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_1.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_2.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/additional_buttons/multiple_buttons.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/additional_buttons/single_button.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/error/pgn_parsing_error.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/error/wrong_game_type.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/theme/custom_1.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/theme/custom_2.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/theme/large.png +0 -0
- package/test/graphic_references/13_navigation_board_graphic/theme/small.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_acknowledging_is-playing_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_not_acknowledging_is-playing_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_acknowledging_node_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_not_acknowledging_node_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/after_reaching_the_end.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/already_at_the_end.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_is-playing_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_node_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_at_the_end.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_close_to_end.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_is-playing_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_node_changes.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_after_stop.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_before_stop.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_after_stop.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_before_stop.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_close_to_end.png +0 -0
- package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_default.png +0 -0
- package/test/graphic_test_app/03_error_box_graphic/base.tsx +14 -14
- package/test/graphic_test_app/03_error_box_graphic/localization.tsx +1 -1
- package/test/graphic_test_app/04_icons_graphic/chess_piece.tsx +7 -7
- package/test/graphic_test_app/04_icons_graphic/marker.tsx +15 -15
- package/test/graphic_test_app/05_chessboard_graphic/annotations.tsx +7 -7
- package/test/graphic_test_app/05_chessboard_graphic/base.tsx +6 -6
- package/test/graphic_test_app/05_chessboard_graphic/chess_variants.tsx +7 -7
- package/test/graphic_test_app/05_chessboard_graphic/flipped.tsx +5 -5
- package/test/graphic_test_app/05_chessboard_graphic/move.tsx +12 -10
- package/test/graphic_test_app/05_chessboard_graphic/theme.tsx +12 -12
- package/test/graphic_test_app/06_chessboard_animation/base_1.tsx +6 -6
- package/test/graphic_test_app/06_chessboard_animation/base_2.tsx +6 -6
- package/test/graphic_test_app/06_chessboard_animation/base_3.tsx +6 -6
- package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +16 -16
- package/test/graphic_test_app/07_chessboard_interaction/click_squares.tsx +5 -5
- package/test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx +4 -4
- package/test/graphic_test_app/07_chessboard_interaction/error.tsx +2 -2
- package/test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx +5 -5
- package/test/graphic_test_app/08_chessboard_play_moves/base.tsx +8 -8
- package/test/graphic_test_app/08_chessboard_play_moves/promotions.tsx +4 -4
- package/test/graphic_test_app/09_chessboard_small_screens/base.tsx +9 -9
- 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 +4 -4
- package/test/graphic_test_app/10_movetext_graphic/error.tsx +6 -6
- package/test/graphic_test_app/10_movetext_graphic/format_move.tsx +31 -0
- package/test/graphic_test_app/10_movetext_graphic/html.tsx +5 -5
- package/test/graphic_test_app/10_movetext_graphic/options.tsx +10 -9
- package/test/graphic_test_app/11_movetext_interaction/error.tsx +1 -1
- package/test/graphic_test_app/11_movetext_interaction/select_moves.tsx +11 -10
- package/test/graphic_test_app/12_navigation_board_base/controlled.tsx +43 -0
- package/test/graphic_test_app/12_navigation_board_base/uncontrolled.tsx +56 -0
- package/test/graphic_test_app/13_navigation_board_graphic/additional_buttons.tsx +49 -0
- package/test/graphic_test_app/13_navigation_board_graphic/error.tsx +34 -0
- package/test/graphic_test_app/13_navigation_board_graphic/theme.tsx +38 -0
- package/test/graphic_test_app/14_navigation_board_autoplay/controlled.tsx +73 -0
- package/test/graphic_test_app/14_navigation_board_autoplay/uncontrolled.tsx +34 -0
- package/test/graphic_test_app/common/decs.d.ts +2 -2
- package/test/graphic_test_app/common/test_app.css +15 -15
- package/test/graphic_test_app/common/test_app.tsx +48 -48
- package/tsconfig.json +13 -13
|
@@ -0,0 +1,81 @@
|
|
|
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 * as React from 'react';
|
|
24
|
+
import { Game } from 'kokopu';
|
|
25
|
+
import './NavigationField.css';
|
|
26
|
+
interface NavigationFieldProps {
|
|
27
|
+
onFirstPressed?: () => void;
|
|
28
|
+
onPreviousPressed?: () => void;
|
|
29
|
+
onNextPressed?: () => void;
|
|
30
|
+
onLastPressed?: () => void;
|
|
31
|
+
onExitPressed?: () => void;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Invisible field, to capture keyboard events.
|
|
35
|
+
*/
|
|
36
|
+
export declare class NavigationField extends React.Component<NavigationFieldProps> {
|
|
37
|
+
private focusFieldRef;
|
|
38
|
+
render(): React.JSX.Element;
|
|
39
|
+
private handleKeyDown;
|
|
40
|
+
/**
|
|
41
|
+
* Set the focus to the component.
|
|
42
|
+
*/
|
|
43
|
+
focus(): void;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Return the ID of the main variation in the given chess game.
|
|
47
|
+
* If the given selection corresponds already at the main variation, `undefined` is returned.
|
|
48
|
+
*
|
|
49
|
+
* @param game - Considered chess game.
|
|
50
|
+
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
53
|
+
export declare function firstNodeId(game: Game, selection: string): string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Return the ID of the node immediately preceding the given selection in the given chess game.
|
|
56
|
+
* If no such node exists, `undefined` is returned.
|
|
57
|
+
*
|
|
58
|
+
* @param game - Considered chess game.
|
|
59
|
+
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
60
|
+
* @public
|
|
61
|
+
*/
|
|
62
|
+
export declare function previousNodeId(game: Game, selection: string): string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Return the ID of the node immediately following the given selection in the given chess game.
|
|
65
|
+
* If no such node exists, `undefined` is returned.
|
|
66
|
+
*
|
|
67
|
+
* @param game - Considered chess game.
|
|
68
|
+
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
69
|
+
* @public
|
|
70
|
+
*/
|
|
71
|
+
export declare function nextNodeId(game: Game, selection: string): string | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Return the ID of the node at then end of the variation in which lies the given selection in the given chess game.
|
|
74
|
+
* If the selection is already at the end its variation, `undefined` is returned.
|
|
75
|
+
*
|
|
76
|
+
* @param game - Considered chess game.
|
|
77
|
+
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
78
|
+
* @public
|
|
79
|
+
*/
|
|
80
|
+
export declare function lastNodeId(game: Game, selection: string): string | undefined;
|
|
81
|
+
export {};
|
|
@@ -0,0 +1,154 @@
|
|
|
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 * as React from 'react';
|
|
24
|
+
import { Variation } from 'kokopu';
|
|
25
|
+
import './NavigationField.css';
|
|
26
|
+
/**
|
|
27
|
+
* Invisible field, to capture keyboard events.
|
|
28
|
+
*/
|
|
29
|
+
export class NavigationField extends React.Component {
|
|
30
|
+
constructor() {
|
|
31
|
+
super(...arguments);
|
|
32
|
+
this.focusFieldRef = React.createRef();
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
return (React.createElement("div", { className: "kokopu-focusFieldContainer" },
|
|
36
|
+
React.createElement("a", { className: "kokopu-focusField", href: "#", ref: this.focusFieldRef, onKeyDown: evt => this.handleKeyDown(evt) })));
|
|
37
|
+
}
|
|
38
|
+
handleKeyDown(evt) {
|
|
39
|
+
/* eslint-disable no-unused-expressions */
|
|
40
|
+
doHandleKeyDown(evt, 'Home', this.props.onFirstPressed) ||
|
|
41
|
+
doHandleKeyDown(evt, 'ArrowLeft', this.props.onPreviousPressed) ||
|
|
42
|
+
doHandleKeyDown(evt, 'ArrowRight', this.props.onNextPressed) ||
|
|
43
|
+
doHandleKeyDown(evt, 'End', this.props.onLastPressed) ||
|
|
44
|
+
doHandleKeyDown(evt, 'Escape', this.props.onExitPressed);
|
|
45
|
+
/* eslint-enable */
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Set the focus to the component.
|
|
49
|
+
*/
|
|
50
|
+
focus() {
|
|
51
|
+
const target = this.focusFieldRef.current;
|
|
52
|
+
// istanbul ignore else
|
|
53
|
+
if (target) {
|
|
54
|
+
target.focus();
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function doHandleKeyDown(evt, targetKey, targetCallback) {
|
|
59
|
+
// Skip if the pressed key does not match the target key.
|
|
60
|
+
if (evt.key !== targetKey) {
|
|
61
|
+
return false;
|
|
62
|
+
}
|
|
63
|
+
// Otherwise, invoke the callback.
|
|
64
|
+
if (targetCallback) {
|
|
65
|
+
evt.preventDefault();
|
|
66
|
+
targetCallback();
|
|
67
|
+
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Return the ID of the main variation in the given chess game.
|
|
72
|
+
* If the given selection corresponds already at the main variation, `undefined` is returned.
|
|
73
|
+
*
|
|
74
|
+
* @param game - Considered chess game.
|
|
75
|
+
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
export function firstNodeId(game, selection) {
|
|
79
|
+
if (!game.findById(selection)) {
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
return selection === 'start' ? undefined : 'start';
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Return the ID of the node immediately preceding the given selection in the given chess game.
|
|
86
|
+
* If no such node exists, `undefined` is returned.
|
|
87
|
+
*
|
|
88
|
+
* @param game - Considered chess game.
|
|
89
|
+
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
90
|
+
* @public
|
|
91
|
+
*/
|
|
92
|
+
export function previousNodeId(game, selection) {
|
|
93
|
+
let currentNode = game.findById(selection);
|
|
94
|
+
if (!currentNode) {
|
|
95
|
+
return undefined;
|
|
96
|
+
}
|
|
97
|
+
if (currentNode instanceof Variation) {
|
|
98
|
+
currentNode = currentNode.parentNode();
|
|
99
|
+
if (!currentNode) {
|
|
100
|
+
return undefined; // This case corresponds to the first variation being selected initially.
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
while (currentNode) {
|
|
104
|
+
const previousNode = currentNode.previous();
|
|
105
|
+
if (previousNode) {
|
|
106
|
+
return previousNode.id();
|
|
107
|
+
}
|
|
108
|
+
currentNode = currentNode.parentVariation().parentNode();
|
|
109
|
+
}
|
|
110
|
+
return 'start';
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Return the ID of the node immediately following the given selection in the given chess game.
|
|
114
|
+
* If no such node exists, `undefined` is returned.
|
|
115
|
+
*
|
|
116
|
+
* @param game - Considered chess game.
|
|
117
|
+
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
118
|
+
* @public
|
|
119
|
+
*/
|
|
120
|
+
export function nextNodeId(game, selection) {
|
|
121
|
+
const currentNode = game.findById(selection);
|
|
122
|
+
if (!currentNode) {
|
|
123
|
+
return undefined;
|
|
124
|
+
}
|
|
125
|
+
const nextNode = currentNode instanceof Variation ? currentNode.first() : currentNode.next();
|
|
126
|
+
return nextNode ? nextNode.id() : undefined;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Return the ID of the node at then end of the variation in which lies the given selection in the given chess game.
|
|
130
|
+
* If the selection is already at the end its variation, `undefined` is returned.
|
|
131
|
+
*
|
|
132
|
+
* @param game - Considered chess game.
|
|
133
|
+
* @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
136
|
+
export function lastNodeId(game, selection) {
|
|
137
|
+
let currentNode = game.findById(selection);
|
|
138
|
+
if (!currentNode) {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
currentNode = currentNode instanceof Variation ? currentNode.first() : currentNode.next();
|
|
142
|
+
if (!currentNode) { // Ensure that the input node is not already the last one.
|
|
143
|
+
return undefined;
|
|
144
|
+
}
|
|
145
|
+
let currentNodeNotNull = currentNode;
|
|
146
|
+
while (true) {
|
|
147
|
+
const nextNode = currentNodeNotNull.next();
|
|
148
|
+
if (!nextNode) {
|
|
149
|
+
return currentNodeNotNull.id();
|
|
150
|
+
}
|
|
151
|
+
currentNodeNotNull = nextNode;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=NavigationField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationField.js","sourceRoot":"","sources":["../../../src/navigationboard/NavigationField.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;gFAqBgF;AAGhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAQ,SAAS,EAAE,MAAM,QAAQ,CAAC;AAEzC,OAAO,uBAAuB,CAAC;AAY/B;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,KAAK,CAAC,SAA+B;IAA1E;;QAEY,kBAAa,GAAuC,KAAK,CAAC,SAAS,EAAE,CAAC;IA+BlF,CAAC;IA7BG,MAAM;QACF,OAAO,CACH,6BAAK,SAAS,EAAC,4BAA4B;YACvC,2BAAG,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O,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;AAChD,CAAC;AAGD;;;;;;;GAOG;AACH,MAAM,UAAU,UAAU,CAAC,IAAU,EAAE,SAAiB;IACpD,IAAI,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC3C,IAAI,CAAC,WAAW,EAAE,CAAC;QACf,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,WAAW,GAAG,WAAW,YAAY,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,EAAE,CAAC;IAC1F,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,0DAA0D;QAC1E,OAAO,SAAS,CAAC;IACrB,CAAC;IACD,IAAI,kBAAkB,GAAG,WAAW,CAAC;IACrC,OAAO,IAAI,EAAE,CAAC;QACV,MAAM,QAAQ,GAAG,kBAAkB,CAAC,IAAI,EAAE,CAAC;QAC3C,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,OAAO,kBAAkB,CAAC,EAAE,EAAE,CAAC;QACnC,CAAC;QACD,kBAAkB,GAAG,QAAQ,CAAC;IAClC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
|
|
24
|
+
|
|
25
|
+
.kokopu-navigationBoard {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
align-items: center;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.kokopu-navigationToolbar {
|
|
32
|
+
line-height: 0px;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.kokopu-enabledNavigationButton,
|
|
36
|
+
.kokopu-disabledNavigationButton {
|
|
37
|
+
display: inline-block;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.kokopu-enabledNavigationButton {
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.kokopu-enabledNavigationButton:hover {
|
|
45
|
+
opacity: 0.6;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.kokopu-disabledNavigationButton {
|
|
49
|
+
opacity: 0.2;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.kokopu-navigationSpacer {
|
|
53
|
+
display: inline-block;
|
|
54
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 * as React from 'react';
|
|
24
|
+
import { NavigationButtonList } from './NavigationButton';
|
|
25
|
+
import './NavigationToolbar.css';
|
|
26
|
+
interface NavigationToolbarProps {
|
|
27
|
+
squareSize: number;
|
|
28
|
+
buttons: NavigationButtonList;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Toolbar below the navigation board.
|
|
32
|
+
*/
|
|
33
|
+
export declare function NavigationToolbar({ squareSize, buttons }: NavigationToolbarProps): React.JSX.Element;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
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 * as React from 'react';
|
|
24
|
+
import './NavigationToolbar.css';
|
|
25
|
+
/**
|
|
26
|
+
* Toolbar below the navigation board.
|
|
27
|
+
*/
|
|
28
|
+
export function NavigationToolbar({ squareSize, buttons }) {
|
|
29
|
+
const buttonSize = computeButtonSize(squareSize);
|
|
30
|
+
const spacerSize = computeSpacerSize(squareSize);
|
|
31
|
+
const buttonNodes = [];
|
|
32
|
+
let atLeastOneButtonEncountered = false;
|
|
33
|
+
for (let i = 0; i < buttons.length; ++i) {
|
|
34
|
+
const button = buttons[i];
|
|
35
|
+
// Skip the spacers.
|
|
36
|
+
if (button === 'spacer') {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
// Enqueue a spacer if necessary.
|
|
40
|
+
// Remark: consecutive spacers are collapsed into a single one for rendering, and spacers at the begin and end of the button list are not rendered.
|
|
41
|
+
if (atLeastOneButtonEncountered && buttons[i - 1] === 'spacer') {
|
|
42
|
+
buttonNodes.push(React.createElement("div", { key: buttonNodes.length, className: "kokopu-navigationSpacer", style: { width: spacerSize } }));
|
|
43
|
+
}
|
|
44
|
+
atLeastOneButtonEncountered = true;
|
|
45
|
+
// Enqueue the button node.
|
|
46
|
+
buttonNodes.push(React.createElement(NavigationButtonImpl, { key: buttonNodes.length, tooltip: button.tooltip, iconPath: button.iconPath, enabled: button.enabled, onClick: button.onClick, size: buttonSize, spaceOnLeft: i === 0 || buttons[i - 1] === 'spacer', spaceOnRight: i === buttons.length - 1 || buttons[i + 1] === 'spacer' }));
|
|
47
|
+
}
|
|
48
|
+
return React.createElement("div", { className: "kokopu-navigationToolbar", style: { marginTop: Math.round(buttonSize / 4) } }, buttonNodes);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Button for the navigation toolbar.
|
|
52
|
+
*/
|
|
53
|
+
function NavigationButtonImpl({ size, spaceOnLeft, spaceOnRight, iconPath, tooltip, enabled, onClick }) {
|
|
54
|
+
const leftBoundary = spaceOnLeft ? 'A 16 16 0 0 0 16 32' : 'L 1 0 L 1 32 L 16 32';
|
|
55
|
+
const rightBoundary = spaceOnRight ? 'A 16 16 0 0 0 16 0' : 'L 31 32 L 31 0 L 16 0';
|
|
56
|
+
const actuallyEnabled = enabled ?? true;
|
|
57
|
+
return (React.createElement("div", { className: actuallyEnabled ? 'kokopu-enabledNavigationButton' : 'kokopu-disabledNavigationButton', title: tooltip, onClick: actuallyEnabled ? onClick : undefined },
|
|
58
|
+
React.createElement("svg", { viewBox: "0 0 32 32", width: size, height: size },
|
|
59
|
+
React.createElement("path", { d: `M 16 0 ${leftBoundary} ${rightBoundary} Z ${iconPath}`, fill: "currentcolor" }))));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Return the height/width of the buttons assuming the given square size.
|
|
63
|
+
*/
|
|
64
|
+
function computeButtonSize(squareSize) {
|
|
65
|
+
return Math.round((squareSize * 2 + 116) / 7);
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Return the width of the spacer between button groups, assuming the given square size.
|
|
69
|
+
*/
|
|
70
|
+
function computeSpacerSize(squareSize) {
|
|
71
|
+
return Math.round((squareSize * 2 + 116) / 14);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=NavigationToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NavigationToolbar.js","sourceRoot":"","sources":["../../../src/navigationboard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IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;AAClD,CAAC;AAGD;;GAEG;AACH,SAAS,iBAAiB,CAAC,UAAkB;IACzC,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,UAAU,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +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
|
+
* -------------------------------------------------------------------------- */
|
|
23
|
+
export declare const GO_FIRST_ICON_PATH: string;
|
|
24
|
+
export declare const GO_PREVIOUS_ICON_PATH: string;
|
|
25
|
+
export declare const GO_NEXT_ICON_PATH: string;
|
|
26
|
+
export declare const GO_LAST_ICON_PATH: string;
|
|
27
|
+
export declare const PLAY_ICON_PATH = "M 23 16 L 12 23 V 9 Z";
|
|
28
|
+
export declare const STOP_ICON_PATH = "M 11 11 H 21 V 21 H 11 Z";
|
|
29
|
+
export declare const FLIP_ICON_PATH: string;
|
|
@@ -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
|
+
const THICKNESS = 2;
|
|
24
|
+
const CHEVRON_SIZE = 7;
|
|
25
|
+
const ARROW_SIZE = 5;
|
|
26
|
+
const ARROW_LENGTH = 16;
|
|
27
|
+
/**
|
|
28
|
+
* * C
|
|
29
|
+
* / \
|
|
30
|
+
* B * \
|
|
31
|
+
* \ \
|
|
32
|
+
* \ \
|
|
33
|
+
* A * * D
|
|
34
|
+
* / /
|
|
35
|
+
* / /
|
|
36
|
+
* F * /
|
|
37
|
+
* \ /
|
|
38
|
+
* * E
|
|
39
|
+
*
|
|
40
|
+
* (x,y) = middle of [AD]
|
|
41
|
+
*/
|
|
42
|
+
function chevronPath(x, y, direction) {
|
|
43
|
+
const xA = x - direction * THICKNESS * Math.sqrt(2) / 2;
|
|
44
|
+
const xB = x - direction * (CHEVRON_SIZE + THICKNESS / Math.sqrt(2) / 2);
|
|
45
|
+
const xC = x - direction * (CHEVRON_SIZE - THICKNESS / Math.sqrt(2) / 2);
|
|
46
|
+
const xD = x + direction * THICKNESS * Math.sqrt(2) / 2;
|
|
47
|
+
const yB = y - direction * (CHEVRON_SIZE - THICKNESS / Math.sqrt(2) / 2);
|
|
48
|
+
const yC = y - direction * (CHEVRON_SIZE + THICKNESS / Math.sqrt(2) / 2);
|
|
49
|
+
const yE = y + direction * (CHEVRON_SIZE + THICKNESS / Math.sqrt(2) / 2);
|
|
50
|
+
const yF = y + direction * (CHEVRON_SIZE - THICKNESS / Math.sqrt(2) / 2);
|
|
51
|
+
return `M ${xA} ${y} L ${xB} ${yB} L ${xC} ${yC} L ${xD} ${y} L ${xC} ${yE} L ${xB} ${yF} Z`;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* D +---+ E
|
|
55
|
+
* | |
|
|
56
|
+
* | |
|
|
57
|
+
* | |
|
|
58
|
+
* B * | | * G
|
|
59
|
+
* / \ | | / \
|
|
60
|
+
* A * \| |/ * H
|
|
61
|
+
* \ * * /
|
|
62
|
+
* \ C F /
|
|
63
|
+
* \ O /
|
|
64
|
+
* \ * /
|
|
65
|
+
* \ /
|
|
66
|
+
* \ /
|
|
67
|
+
* *
|
|
68
|
+
* (x,y)
|
|
69
|
+
*/
|
|
70
|
+
function arrowPath(x, y, direction) {
|
|
71
|
+
const xA = x - direction * (ARROW_SIZE + THICKNESS / Math.sqrt(2) / 2);
|
|
72
|
+
const xB = x - direction * (ARROW_SIZE - THICKNESS / Math.sqrt(2) / 2);
|
|
73
|
+
const xC = x - direction * THICKNESS / 2;
|
|
74
|
+
const xF = x + direction * THICKNESS / 2;
|
|
75
|
+
const xG = x + direction * (ARROW_SIZE - THICKNESS / Math.sqrt(2) / 2);
|
|
76
|
+
const xH = x + direction * (ARROW_SIZE + THICKNESS / Math.sqrt(2) / 2);
|
|
77
|
+
const y0 = y - direction * THICKNESS * Math.sqrt(2) / 2;
|
|
78
|
+
const yA = y0 - direction * (ARROW_SIZE - THICKNESS / Math.sqrt(2) / 2);
|
|
79
|
+
const yB = y0 - direction * (ARROW_SIZE + THICKNESS / Math.sqrt(2) / 2);
|
|
80
|
+
const yC = yB + (xC - xB);
|
|
81
|
+
const yD = y - direction * ARROW_LENGTH;
|
|
82
|
+
return `M ${x} ${y} L ${xA} ${yA} L ${xB} ${yB} L ${xC} ${yC} V ${yD} H ${xF} V ${yC} L ${xG} ${yB} L ${xH} ${yA} Z`;
|
|
83
|
+
}
|
|
84
|
+
export const GO_FIRST_ICON_PATH = chevronPath(14, 16, -1) + ' ' + chevronPath(10, 16, -1);
|
|
85
|
+
export const GO_PREVIOUS_ICON_PATH = chevronPath(12, 16, -1);
|
|
86
|
+
export const GO_NEXT_ICON_PATH = chevronPath(20, 16, 1);
|
|
87
|
+
export const GO_LAST_ICON_PATH = chevronPath(18, 16, 1) + ' ' + chevronPath(22, 16, 1);
|
|
88
|
+
export const PLAY_ICON_PATH = 'M 23 16 L 12 23 V 9 Z';
|
|
89
|
+
export const STOP_ICON_PATH = 'M 11 11 H 21 V 21 H 11 Z';
|
|
90
|
+
export const FLIP_ICON_PATH = arrowPath(11, 25, 1) + ' ' + arrowPath(21, 7, -1);
|
|
91
|
+
//# sourceMappingURL=iconPaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iconPaths.js","sourceRoot":"","sources":["../../../src/navigationboard/iconPaths.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;gFAqBgF;AAGhF,MAAM,SAAS,GAAG,CAAC,CAAC;AACpB,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,UAAU,GAAG,CAAC,CAAC;AAC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1
|
-
{"version":3,"file":"sanitization.js","sourceRoot":"","sources":["../../src/sanitization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;gFAqBgF;AAMhF,MAAM,UAAU,cAAc,CAAC,KAAa;
|
|
1
|
+
{"version":3,"file":"sanitization.js","sourceRoot":"","sources":["../../src/sanitization.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;gFAqBgF;AAMhF,MAAM,UAAU,cAAc,CAAC,KAAa;IACxC,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACzB,CAAC;AAGD,MAAM,UAAU,eAAe,CAAC,KAAc;IAC1C,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC;AAC1B,CAAC;AAGD,MAAM,UAAU,qBAAqB,CAAI,KAA6B,EAAE,gBAAuC;IAC3G,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACxC,OAAO,EAAE,CAAC;IACd,CAAC;SACI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACjC,MAAM,gBAAgB,EAAE,CAAC;IAC7B,CAAC;SACI,CAAC;QACF,OAAO,KAAK,CAAC;IACjB,CAAC;AACL,CAAC;AAGD,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,gBAAuC;IAClF,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QACvD,MAAM,gBAAgB,EAAE,CAAC;IAC7B,CAAC;IACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAGD,MAAM,UAAU,sBAAsB,CAAC,KAAa,EAAE,GAAW,EAAE,GAAW,EAAE,gBAAuC;IACnH,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe,CAAC,KAAK,EAAE,gBAAgB,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;AAClF,CAAC;AAGD,MAAM,UAAU,gBAAgB,CAAI,KAAoB,EAAE,oBAAmC;IACzF,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,oBAAoB,CAAC,KAAK,CAAC,CAAC;AAC3F,CAAC"}
|
package/dist/lib/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;gFAqBgF;AAGhF,OAAO,EAAsC,cAAc,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAEtG,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAWlC;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAiB;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;gFAqBgF;AAGhF,OAAO,EAAsC,cAAc,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AAEtG,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAWlC;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,QAAiB;IAClD,OAAO,cAAc,CAAC,QAAQ,CAAC,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,KAAK,IAAI,CAAC;AAC9E,CAAC;AA8FD;;GAEG;AACH,MAAM,UAAU,oBAAoB,CA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AAM,CAAC;AAClB,CAAC"}
|
package/dist/lib/util.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;gFAqBgF;AAGhF,MAAM,UAAU,gBAAgB;
|
|
1
|
+
{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;gFAqBgF;AAGhF,MAAM,UAAU,gBAAgB;IAC5B,MAAM,MAAM,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC;IAClC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC;QACrC,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAGD,MAAM,UAAU,eAAe,CAAC,OAAe,EAAE,GAAG,iBAA4B;IAC5E,OAAO,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,WAAW,EAAE,EAAE;QACtD,MAAM,gBAAgB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;QAC7C,OAAO,gBAAgB,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;IAC7G,CAAC,CAAC,CAAC;AACP,CAAC"}
|