kokopu-react 3.3.0 → 3.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/lib/chessboard/BoardProperties.d.ts +1 -1
- package/dist/lib/chessboard/BoardProperties.js +1 -1
- package/dist/lib/chessboard/Chessboard.css +1 -1
- package/dist/lib/chessboard/Chessboard.d.ts +3 -3
- package/dist/lib/chessboard/Chessboard.js +4 -3
- package/dist/lib/chessboard/Chessboard.js.map +1 -1
- package/dist/lib/chessboard/ChessboardImpl.d.ts +1 -1
- package/dist/lib/chessboard/ChessboardImpl.js +2 -2
- package/dist/lib/chessboard/ChessboardImpl.js.map +1 -1
- package/dist/lib/chessboard/Draggable.d.ts +1 -1
- package/dist/lib/chessboard/Draggable.js +1 -1
- package/dist/lib/chessboard/Draggable.js.map +1 -1
- package/dist/lib/chessboard/Motion.d.ts +1 -1
- package/dist/lib/chessboard/Motion.js +2 -2
- package/dist/lib/chessboard/Motion.js.map +1 -1
- package/dist/lib/chessboard/colorsets.d.ts +1 -1
- package/dist/lib/chessboard/colorsets.js +1 -1
- package/dist/lib/chessboard/piecesets.d.ts +1 -1
- package/dist/lib/chessboard/piecesets.js +1 -1
- package/dist/lib/errorbox/ErrorBox.css +1 -1
- package/dist/lib/errorbox/ErrorBox.d.ts +1 -1
- package/dist/lib/errorbox/ErrorBox.js +1 -1
- package/dist/lib/errorbox/parsing.d.ts +5 -4
- package/dist/lib/errorbox/parsing.js +1 -1
- package/dist/lib/exception.d.ts +1 -1
- package/dist/lib/exception.js +1 -1
- package/dist/lib/i18n.d.ts +1 -1
- package/dist/lib/i18n.js +3 -3
- package/dist/lib/i18n.js.map +1 -1
- package/dist/lib/icons/AnnotationSymbolShape.css +1 -1
- package/dist/lib/icons/AnnotationSymbolShape.d.ts +1 -1
- package/dist/lib/icons/AnnotationSymbolShape.js +1 -1
- package/dist/lib/icons/ArrowMarkerIcon.d.ts +1 -1
- package/dist/lib/icons/ArrowMarkerIcon.js +1 -1
- package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -1
- package/dist/lib/icons/ArrowTip.d.ts +1 -1
- package/dist/lib/icons/ArrowTip.js +1 -1
- package/dist/lib/icons/ChessPieceIcon.d.ts +2 -5
- package/dist/lib/icons/ChessPieceIcon.js +2 -6
- package/dist/lib/icons/ChessPieceIcon.js.map +1 -1
- package/dist/lib/icons/SquareMarkerIcon.d.ts +2 -5
- package/dist/lib/icons/SquareMarkerIcon.js +2 -6
- package/dist/lib/icons/SquareMarkerIcon.js.map +1 -1
- package/dist/lib/icons/TextMarkerIcon.d.ts +2 -5
- package/dist/lib/icons/TextMarkerIcon.js +2 -6
- package/dist/lib/icons/TextMarkerIcon.js.map +1 -1
- package/dist/lib/icons/arrow.css +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/movetext/Movetext.css +1 -1
- package/dist/lib/movetext/Movetext.d.ts +1 -1
- package/dist/lib/movetext/Movetext.js +1 -1
- package/dist/lib/movetext/Movetext.js.map +1 -1
- package/dist/lib/movetext/MovetextImpl.d.ts +1 -1
- package/dist/lib/movetext/MovetextImpl.js +5 -4
- package/dist/lib/movetext/MovetextImpl.js.map +1 -1
- package/dist/lib/movetext/fonts.css +1 -1
- package/dist/lib/movetext/htmlFilter.d.ts +1 -1
- package/dist/lib/movetext/htmlFilter.js +2 -2
- package/dist/lib/movetext/htmlFilter.js.map +1 -1
- package/dist/lib/movetext/moveFormatter.d.ts +1 -1
- package/dist/lib/movetext/moveFormatter.js +1 -1
- package/dist/lib/navigationboard/NavigationBoard.d.ts +2 -2
- package/dist/lib/navigationboard/NavigationBoard.js +3 -3
- package/dist/lib/navigationboard/NavigationBoard.js.map +1 -1
- package/dist/lib/navigationboard/NavigationButton.d.ts +1 -1
- package/dist/lib/navigationboard/NavigationButton.js +1 -1
- package/dist/lib/navigationboard/NavigationField.css +1 -1
- package/dist/lib/navigationboard/NavigationField.d.ts +1 -1
- package/dist/lib/navigationboard/NavigationField.js +2 -2
- package/dist/lib/navigationboard/NavigationField.js.map +1 -1
- package/dist/lib/navigationboard/NavigationToolbar.css +1 -1
- package/dist/lib/navigationboard/NavigationToolbar.d.ts +1 -1
- package/dist/lib/navigationboard/NavigationToolbar.js +1 -1
- package/dist/lib/navigationboard/NavigationToolbar.js.map +1 -1
- package/dist/lib/navigationboard/iconPaths.d.ts +1 -1
- package/dist/lib/navigationboard/iconPaths.js +1 -1
- package/dist/lib/sanitization.d.ts +1 -1
- package/dist/lib/sanitization.js +1 -1
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/types.js +1 -1
- package/dist/lib/util.d.ts +1 -1
- package/dist/lib/util.js +3 -3
- package/dist/lib/util.js.map +1 -1
- package/doc_src/demo/NavigationBoardWithMoveText.txt +19 -0
- package/doc_src/demo/PageChessboardBase.tsx +58 -52
- package/doc_src/demo/PageChessboardInteraction.tsx +79 -64
- package/doc_src/demo/PageChessboardMove.tsx +36 -31
- package/doc_src/demo/PageChessboardSmallScreens.tsx +4 -4
- package/doc_src/demo/PageMovetextBase.tsx +92 -82
- package/doc_src/demo/PageMovetextInteraction.tsx +28 -28
- package/doc_src/demo/PageNavigationBoardBase.tsx +64 -56
- package/doc_src/demo/PageNavigationBoardUncontrolledVsControlled.tsx +26 -20
- package/doc_src/demo/PageSynchroNavigationBoardMovetext.tsx +115 -0
- package/doc_src/demo/decs.d.ts +6 -1
- package/doc_src/demo/demo.css +1 -1
- package/doc_src/demo/util.ts +1 -1
- package/doc_src/theming/LogoRenderer.js +9 -10
- package/doc_src/theming/theming.css +1 -1
- package/package.json +32 -30
- package/scripts/doc.styleguide.config.js +3 -2
- package/scripts/docker-compose.yml +1 -3
- package/scripts/test-graphic.webpack.config.js +1 -1
- package/scripts/test-headless.webpack.config.js +1 -1
- package/src/chessboard/BoardProperties.ts +14 -14
- package/src/chessboard/Chessboard.css +1 -1
- package/src/chessboard/Chessboard.tsx +44 -40
- package/src/chessboard/ChessboardImpl.tsx +57 -40
- package/src/chessboard/Draggable.tsx +17 -17
- package/src/chessboard/Motion.tsx +5 -5
- package/src/chessboard/colorsets.ts +1 -1
- package/src/chessboard/piecesets.ts +1 -1
- package/src/decs.d.ts +1 -1
- package/src/errorbox/ErrorBox.css +1 -1
- package/src/errorbox/ErrorBox.tsx +6 -6
- package/src/errorbox/parsing.tsx +7 -7
- package/src/exception.ts +1 -1
- package/src/i18n.ts +3 -3
- package/src/icons/AnnotationSymbolShape.css +1 -1
- package/src/icons/AnnotationSymbolShape.tsx +6 -6
- package/src/icons/ArrowMarkerIcon.tsx +9 -5
- package/src/icons/ArrowTip.tsx +3 -3
- package/src/icons/ChessPieceIcon.tsx +5 -12
- package/src/icons/SquareMarkerIcon.tsx +4 -11
- package/src/icons/TextMarkerIcon.tsx +5 -12
- package/src/icons/arrow.css +1 -1
- package/src/index.ts +1 -1
- package/src/movetext/Movetext.css +1 -1
- package/src/movetext/Movetext.tsx +13 -12
- package/src/movetext/MovetextImpl.tsx +36 -30
- package/src/movetext/fonts.css +1 -1
- package/src/movetext/htmlFilter.tsx +5 -5
- package/src/movetext/moveFormatter.tsx +1 -1
- package/src/navigationboard/NavigationBoard.tsx +57 -52
- package/src/navigationboard/NavigationButton.ts +5 -5
- package/src/navigationboard/NavigationField.css +1 -1
- package/src/navigationboard/NavigationField.tsx +8 -8
- package/src/navigationboard/NavigationToolbar.css +1 -1
- package/src/navigationboard/NavigationToolbar.tsx +18 -14
- package/src/navigationboard/iconPaths.ts +1 -1
- package/src/sanitization.ts +1 -1
- package/src/types.ts +27 -27
- package/src/util.ts +3 -3
- package/test/01_types.js +84 -62
- package/test/02_chessboard_util.js +3 -1
- package/test/03_error_box_graphic.js +2 -2
- package/test/04_icons_graphic.js +1 -1
- package/test/05_chessboard_graphic.js +1 -1
- package/test/06_chessboard_animation.js +1 -1
- package/test/07_chessboard_interaction.js +2 -3
- package/test/08_chessboard_play_moves.js +1 -1
- package/test/09_chessboard_small_screens.js +1 -1
- package/test/10_movetext_graphic.js +1 -1
- package/test/11_movetext_interaction.js +1 -1
- package/test/12_navigation_board_base.js +1 -1
- package/test/13_navigation_board_graphic.js +4 -4
- package/test/14_navigation_board_autoplay.js +1 -1
- package/test/common/graphic.js +12 -12
- package/test/graphic_references/03_error_box_graphic/base/cut_beginning_of_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/cut_end_of_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/cut_on_line_breaks.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/error_index_not_integer.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/full.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/minimal.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/missing_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/missing_error_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/negative_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/single_character_text.png +0 -0
- package/test/graphic_references/03_error_box_graphic/base/too_large_error_index.png +0 -0
- package/test/graphic_references/03_error_box_graphic/localization/default.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/customized_pieceset.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/invalid_multiple_pieces.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/invalid_pieceset.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/invalid_single_piece.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/invalid_size.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/multiple_pieces.png +0 -0
- package/test/graphic_references/04_icons_graphic/chess_piece/single_piece.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/colorized_arrow.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/colorized_square.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/colorized_symbol.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/colorized_text.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/default_arrow.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/default_square.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/default_text.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/invalid_arrow_size.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/invalid_square_size.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/invalid_symbol.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/invalid_text_size.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/wrapped_arrow.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/wrapped_square.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/wrapped_symbol.png +0 -0
- package/test/graphic_references/04_icons_graphic/marker/wrapped_text.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/overlap.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/overlap_and_flip.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates_and_flip.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates_and_flip.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/default.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/empty.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/from_fen.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/from_kokopu_object.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/parsing_error.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/base/wrong_position_type.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960_with_move.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant_with_fen.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/special_code.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_with_std_initial_position.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_without_std_initial_position.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/default.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/empty.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/from_fen.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/from_kokopu_object.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/flipped/parsing_error.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/capture.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/castling_move.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/default.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/en-passant.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/illegal_null-move.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/no_move_arrow.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/null-move.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/parsing_error.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/promotion.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/with_forced_move_arrow_and_flip.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/wrong_move_arrow_color_type.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/move/wrong_move_type.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_1.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_2.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_3.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_4.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_5.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/custom_6.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/default.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/large.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/small.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_colorset.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_pieceset.png +0 -0
- package/test/graphic_references/05_chessboard_graphic/theme/wrong_square_size_type.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/capture.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/castling_move.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/en-passant.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/move_1.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/move_2.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_1/promotion.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/capture.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/castling_move.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/en-passant.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/move_1.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/move_2.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_2/promotion.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/capture.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/castling_move.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/en-passant.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/move_1.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/move_2.png +0 -0
- package/test/graphic_references/06_chessboard_animation/base_3/promotion.png +0 -0
- package/test/graphic_references/06_chessboard_animation/on_redraw/final_state.png +0 -0
- package/test/graphic_references/06_chessboard_animation/on_redraw/initial_state.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_1.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_2.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/from_==_to.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/out_of_board.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_arrow_marker.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_square_marker.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/error/edit_color_not_set.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/error/wrong_interaction_mode.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/after_move.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/from_==_to.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/move_empty_square.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/out_of_board.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_arrow_marker.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_empty.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_1.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_2.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_square_marker.png +0 -0
- package/test/graphic_references/07_chessboard_interaction/move_pieces/over_text_marker.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/castling_move.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/chess960_ambiguous_king_move.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_1.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_2.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/chess960_non-kxr_castling.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/from_==_to.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/illegal_move.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/illegal_position.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/out_of_board.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/regular_move_1.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/regular_move_2.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/base/wrong_color_moved.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/promotions/antichess_promotion.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/promotions/cancel_promotion.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_1.png +0 -0
- package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_2.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/default.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/invalid_limits.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_690.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_700.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_710.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_720.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_730.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_740.png +0 -0
- package/test/graphic_references/09_chessboard_small_screens/base/width_750.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/base/game_1.png +0 -0
- package/test/graphic_references/10_movetext_graphic/base/game_2.png +0 -0
- package/test/graphic_references/10_movetext_graphic/base/game_3.png +0 -0
- package/test/graphic_references/10_movetext_graphic/base/game_4.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_1.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_2.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_1.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_2.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_type.png +0 -0
- package/test/graphic_references/10_movetext_graphic/error/wrong_game_type.png +0 -0
- package/test/graphic_references/10_movetext_graphic/format_move/format_text.png +0 -0
- package/test/graphic_references/10_movetext_graphic/html/filtered_tags_and_attributes.png +0 -0
- package/test/graphic_references/10_movetext_graphic/html/html_in_comments.png +0 -0
- package/test/graphic_references/10_movetext_graphic/html/html_in_headers.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/custom_piece_symbols.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/figurine_piece_symbols_and_diagram_options.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/hidden_diagrams.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/localized_piece_symbols.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/other_diagram_options.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_1.png +0 -0
- package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_2.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/error/wrong_interaction_mode.png +0 -0
- package/test/graphic_references/11_movetext_interaction/select_moves/click_on_disabled.png +0 -0
- package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected.png +0 -0
- package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected_without_callback.png +0 -0
- package/test/graphic_references/11_movetext_interaction/select_moves/click_on_with_variations.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 +19 -7
- package/test/graphic_test_app/03_error_box_graphic/localization.tsx +1 -1
- package/test/graphic_test_app/04_icons_graphic/chess_piece.tsx +13 -4
- package/test/graphic_test_app/04_icons_graphic/marker.tsx +15 -5
- package/test/graphic_test_app/05_chessboard_graphic/annotations.tsx +8 -4
- package/test/graphic_test_app/05_chessboard_graphic/base.tsx +2 -2
- package/test/graphic_test_app/05_chessboard_graphic/chess_variants.tsx +1 -1
- package/test/graphic_test_app/05_chessboard_graphic/flipped.tsx +1 -1
- package/test/graphic_test_app/05_chessboard_graphic/move.tsx +10 -3
- package/test/graphic_test_app/05_chessboard_graphic/theme.tsx +2 -2
- package/test/graphic_test_app/06_chessboard_animation/base_1.tsx +1 -1
- package/test/graphic_test_app/06_chessboard_animation/base_2.tsx +1 -1
- package/test/graphic_test_app/06_chessboard_animation/base_3.tsx +1 -1
- package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +9 -7
- package/test/graphic_test_app/07_chessboard_interaction/click_squares.tsx +5 -3
- package/test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx +5 -3
- package/test/graphic_test_app/07_chessboard_interaction/error.tsx +4 -2
- package/test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx +5 -3
- package/test/graphic_test_app/08_chessboard_play_moves/base.tsx +13 -7
- package/test/graphic_test_app/08_chessboard_play_moves/promotions.tsx +13 -4
- package/test/graphic_test_app/09_chessboard_small_screens/base.tsx +4 -2
- package/test/graphic_test_app/09_chessboard_small_screens/top_bottom_components.tsx +9 -7
- package/test/graphic_test_app/10_movetext_graphic/base.tsx +1 -1
- package/test/graphic_test_app/10_movetext_graphic/error.tsx +2 -2
- package/test/graphic_test_app/10_movetext_graphic/format_move.tsx +1 -1
- package/test/graphic_test_app/10_movetext_graphic/html.tsx +1 -1
- package/test/graphic_test_app/10_movetext_graphic/options.tsx +17 -7
- package/test/graphic_test_app/11_movetext_interaction/error.tsx +5 -2
- package/test/graphic_test_app/11_movetext_interaction/select_moves.tsx +1 -1
- package/test/graphic_test_app/12_navigation_board_base/controlled.tsx +1 -1
- package/test/graphic_test_app/12_navigation_board_base/uncontrolled.tsx +1 -1
- package/test/graphic_test_app/13_navigation_board_graphic/additional_buttons.tsx +24 -17
- package/test/graphic_test_app/13_navigation_board_graphic/error.tsx +2 -2
- package/test/graphic_test_app/13_navigation_board_graphic/theme.tsx +1 -1
- package/test/graphic_test_app/14_navigation_board_autoplay/controlled.tsx +35 -19
- package/test/graphic_test_app/14_navigation_board_autoplay/uncontrolled.tsx +1 -1
- package/test/graphic_test_app/common/decs.d.ts +1 -1
- package/test/graphic_test_app/common/test_app.css +1 -1
- package/test/graphic_test_app/common/test_app.tsx +5 -5
- package/.eslintrc.yml +0 -83
- package/test/.eslintrc.yml +0 -8
- package/test/graphic_test_app/.eslintrc.yml +0 -3
- /package/doc_src/demo/{game-3.pgn → game-short.pgn} +0 -0
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -30,8 +30,8 @@ import './NavigationToolbar.css';
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
interface NavigationToolbarProps {
|
|
33
|
-
squareSize: number
|
|
34
|
-
buttons: NavigationBar
|
|
33
|
+
squareSize: number,
|
|
34
|
+
buttons: NavigationBar,
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
|
|
@@ -62,13 +62,15 @@ export function NavigationToolbar({ squareSize, buttons }: NavigationToolbarProp
|
|
|
62
62
|
atLeastOneButtonEncountered = true;
|
|
63
63
|
|
|
64
64
|
// Enqueue the button node.
|
|
65
|
-
buttonNodes.push(
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
buttonNodes.push(
|
|
66
|
+
<NavigationButtonImpl
|
|
67
|
+
key={buttonNodes.length}
|
|
68
|
+
tooltip={button.tooltip} iconPath={button.iconPath} enabled={button.enabled} onClick={button.onClick}
|
|
69
|
+
size={buttonSize}
|
|
70
|
+
spaceOnLeft={i === 0 || buttons[i - 1] === 'spacer'}
|
|
71
|
+
spaceOnRight={i === buttons.length - 1 || buttons[i + 1] === 'spacer'}
|
|
72
|
+
/>,
|
|
73
|
+
);
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
return <div className="kokopu-navigationToolbar" style={{ marginTop: computeMarginTop(squareSize) }}>{buttonNodes}</div>;
|
|
@@ -76,9 +78,9 @@ export function NavigationToolbar({ squareSize, buttons }: NavigationToolbarProp
|
|
|
76
78
|
|
|
77
79
|
|
|
78
80
|
interface NavigationButtonImplProps extends NavigationButton {
|
|
79
|
-
size: number
|
|
80
|
-
spaceOnLeft: boolean
|
|
81
|
-
spaceOnRight: boolean
|
|
81
|
+
size: number,
|
|
82
|
+
spaceOnLeft: boolean,
|
|
83
|
+
spaceOnRight: boolean,
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
|
|
@@ -90,7 +92,9 @@ function NavigationButtonImpl({ size, spaceOnLeft, spaceOnRight, iconPath, toolt
|
|
|
90
92
|
const rightBoundary = spaceOnRight ? 'A 16 16 0 0 0 16 0' : 'L 31 32 L 31 0 L 16 0';
|
|
91
93
|
const actuallyEnabled = enabled ?? true;
|
|
92
94
|
return (
|
|
93
|
-
<div
|
|
95
|
+
<div
|
|
96
|
+
className={actuallyEnabled ? 'kokopu-enabledNavigationButton' : 'kokopu-disabledNavigationButton'}
|
|
97
|
+
title={tooltip}
|
|
94
98
|
onClick={actuallyEnabled ? onClick : undefined}
|
|
95
99
|
>
|
|
96
100
|
<svg viewBox="0 0 32 32" width={size} height={size}>
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
package/src/sanitization.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
package/src/types.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -62,22 +62,22 @@ export function isChessPieceIconType(iconType: unknown): iconType is ChessPieceI
|
|
|
62
62
|
export type Colorset = {
|
|
63
63
|
|
|
64
64
|
/** Color of the black squares. */
|
|
65
|
-
b: string
|
|
65
|
+
b: string,
|
|
66
66
|
|
|
67
67
|
/** Color of the white squares. */
|
|
68
|
-
w: string
|
|
68
|
+
w: string,
|
|
69
69
|
|
|
70
70
|
/** Color of the blue markers. */
|
|
71
|
-
cb: string
|
|
71
|
+
cb: string,
|
|
72
72
|
|
|
73
73
|
/** Color of the green markers. */
|
|
74
|
-
cg: string
|
|
74
|
+
cg: string,
|
|
75
75
|
|
|
76
76
|
/** Color of the red markers. */
|
|
77
|
-
cr: string
|
|
77
|
+
cr: string,
|
|
78
78
|
|
|
79
79
|
/** Color of the yellow markers. */
|
|
80
|
-
cy: string
|
|
80
|
+
cy: string,
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
|
|
@@ -89,46 +89,46 @@ export type Colorset = {
|
|
|
89
89
|
export type Pieceset = {
|
|
90
90
|
|
|
91
91
|
/** Image for the black bishops. */
|
|
92
|
-
bb: string
|
|
92
|
+
bb: string,
|
|
93
93
|
|
|
94
94
|
/** Image for the black kings. */
|
|
95
|
-
bk: string
|
|
95
|
+
bk: string,
|
|
96
96
|
|
|
97
97
|
/** Image for the black knights. */
|
|
98
|
-
bn: string
|
|
98
|
+
bn: string,
|
|
99
99
|
|
|
100
100
|
/** Image for the black pawns. */
|
|
101
|
-
bp: string
|
|
101
|
+
bp: string,
|
|
102
102
|
|
|
103
103
|
/** Image for the black queens. */
|
|
104
|
-
bq: string
|
|
104
|
+
bq: string,
|
|
105
105
|
|
|
106
106
|
/** Image for the black rooks. */
|
|
107
|
-
br: string
|
|
107
|
+
br: string,
|
|
108
108
|
|
|
109
109
|
/** Image for the black turn flags. */
|
|
110
|
-
bx: string
|
|
110
|
+
bx: string,
|
|
111
111
|
|
|
112
112
|
/** Image for the white bishops. */
|
|
113
|
-
wb: string
|
|
113
|
+
wb: string,
|
|
114
114
|
|
|
115
115
|
/** Image for the white kings. */
|
|
116
|
-
wk: string
|
|
116
|
+
wk: string,
|
|
117
117
|
|
|
118
118
|
/** Image for the white knights. */
|
|
119
|
-
wn: string
|
|
119
|
+
wn: string,
|
|
120
120
|
|
|
121
121
|
/** Image for the white pawns. */
|
|
122
|
-
wp: string
|
|
122
|
+
wp: string,
|
|
123
123
|
|
|
124
124
|
/** Image for the white queens. */
|
|
125
|
-
wq: string
|
|
125
|
+
wq: string,
|
|
126
126
|
|
|
127
127
|
/** Image for the white rooks. */
|
|
128
|
-
wr: string
|
|
128
|
+
wr: string,
|
|
129
129
|
|
|
130
130
|
/** Image for the white turn flags. */
|
|
131
|
-
wx: string
|
|
131
|
+
wx: string,
|
|
132
132
|
};
|
|
133
133
|
|
|
134
134
|
|
|
@@ -136,12 +136,12 @@ export type Pieceset = {
|
|
|
136
136
|
* Set of aliases for chess pieces symbols.
|
|
137
137
|
*/
|
|
138
138
|
export type PieceSymbolMapping = {
|
|
139
|
-
K: string
|
|
140
|
-
Q: string
|
|
141
|
-
R: string
|
|
142
|
-
B: string
|
|
143
|
-
N: string
|
|
144
|
-
P: string
|
|
139
|
+
K: string,
|
|
140
|
+
Q: string,
|
|
141
|
+
R: string,
|
|
142
|
+
B: string,
|
|
143
|
+
N: string,
|
|
144
|
+
P: string,
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
|
package/src/util.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -26,8 +26,8 @@ export function generateRandomId() {
|
|
|
26
26
|
const buffer = new Uint32Array(8);
|
|
27
27
|
crypto.getRandomValues(buffer);
|
|
28
28
|
let result = '';
|
|
29
|
-
for (
|
|
30
|
-
result +=
|
|
29
|
+
for (const c of buffer) {
|
|
30
|
+
result += c.toString(16);
|
|
31
31
|
}
|
|
32
32
|
return result;
|
|
33
33
|
}
|
package/test/01_types.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -35,7 +35,7 @@ describe('Is piece symbol mapping', () => {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
itIsPieceSymbolMapping('French localization', { K: 'R', Q: 'D', R: 'T', B: 'F', N: 'C', P: 'P' }
|
|
38
|
+
itIsPieceSymbolMapping('French localization', { K: 'R', Q: 'D', R: 'T', B: 'F', N: 'C', P: 'P' }, true);
|
|
39
39
|
itIsPieceSymbolMapping('Additional fields', { K: 'Ki_', Q: 'Qu_', R: 'Rk_', B: 'Bi_', N: 'Kn_', P: 'Pw_', Z: 'whatever', val: 42 }, true);
|
|
40
40
|
itIsPieceSymbolMapping('Missing fields', { K: 'Ki_', Q: 'Qu_', R: 'Rk_', B: 'Bi_', N: 'Kn_' }, false);
|
|
41
41
|
itIsPieceSymbolMapping('Non-string valued fields', { K: 42, Q: 'Qu_', R: 'Rk_', B: 'Bi_', N: 'Kn_', P: 'Pw_' }, false);
|
|
@@ -125,46 +125,60 @@ describe('Parse square markers', () => {
|
|
|
125
125
|
describe('Flatten text markers', () => {
|
|
126
126
|
|
|
127
127
|
it('RAe4', () => { test.value(flattenTextMarkers({ e4: { symbol: 'A', color: 'r' } })).is('RAe4'); });
|
|
128
|
-
it('Gzd3,Y1h8', () => {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
128
|
+
it('Gzd3,Y1h8', () => {
|
|
129
|
+
test.value(flattenTextMarkers({
|
|
130
|
+
h8: { symbol: '1', color: 'y' },
|
|
131
|
+
d3: { symbol: 'z', color: 'g' },
|
|
132
|
+
})).is('Gzd3,Y1h8');
|
|
133
|
+
});
|
|
134
|
+
it('G2a1,YMc5,RLd2,Rxh7,Bwh8', () => {
|
|
135
|
+
test.value(flattenTextMarkers({
|
|
136
|
+
c5: { symbol: 'M', color: 'y' },
|
|
137
|
+
h8: { symbol: 'w', color: 'b' },
|
|
138
|
+
a1: { symbol: '2', color: 'g' },
|
|
139
|
+
h7: { symbol: 'x', color: 'r' },
|
|
140
|
+
d2: { symbol: 'L', color: 'r' },
|
|
141
|
+
})).is('G2a1,YMc5,RLd2,Rxh7,Bwh8');
|
|
142
|
+
});
|
|
143
|
+
it('Multi-character symbols', () => {
|
|
144
|
+
test.value(flattenTextMarkers({
|
|
145
|
+
a1: { symbol: 'A', color: 'y' },
|
|
146
|
+
a7: { symbol: 'plus', color: 'g' },
|
|
147
|
+
b3: { symbol: 'times', color: 'r' },
|
|
148
|
+
g5: { symbol: 'dot', color: 'y' },
|
|
149
|
+
h3: { symbol: 'circle', color: 'g' },
|
|
150
|
+
})).is('YAa1,G(plus)a7,R(times)b3,Y(dot)g5,G(circle)h3');
|
|
151
|
+
});
|
|
146
152
|
it('<empty>', () => { test.value(flattenTextMarkers({})).is(''); });
|
|
147
153
|
|
|
148
|
-
it('Wrong square', () => {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
154
|
+
it('Wrong square', () => {
|
|
155
|
+
test.value(flattenTextMarkers({
|
|
156
|
+
e1: { symbol: 'H', color: 'r' },
|
|
157
|
+
j5: { symbol: 'A', color: 'g' },
|
|
158
|
+
})).is('RHe1');
|
|
159
|
+
});
|
|
160
|
+
it('Wrong color', () => {
|
|
161
|
+
test.value(flattenTextMarkers({
|
|
162
|
+
a2: { symbol: '0', color: 'g' },
|
|
163
|
+
b5: { symbol: 'A', color: 'R' },
|
|
164
|
+
h8: { symbol: 'A' },
|
|
165
|
+
})).is('G0a2');
|
|
166
|
+
});
|
|
167
|
+
it('Wrong symbol', () => {
|
|
168
|
+
test.value(flattenTextMarkers({
|
|
169
|
+
a2: { symbol: '0', color: 'g' },
|
|
170
|
+
b5: { symbol: '', color: 'r' },
|
|
171
|
+
h8: { color: 'g' },
|
|
172
|
+
d8: { symbol: '-', color: 'r' },
|
|
173
|
+
c1: { symbol: 'abcd', color: 'r' },
|
|
174
|
+
})).is('G0a2');
|
|
175
|
+
});
|
|
176
|
+
it('Wrong multi-character symbol', () => {
|
|
177
|
+
test.value(flattenTextMarkers({
|
|
178
|
+
a2: { symbol: '0', color: 'g' },
|
|
179
|
+
b5: { symbol: 'whatever', color: 'r' },
|
|
180
|
+
})).is('G0a2');
|
|
181
|
+
});
|
|
168
182
|
|
|
169
183
|
it('Wrong type (not an object)', () => { test.exception(() => flattenTextMarkers('whatever')).isInstanceOf(exception.IllegalArgument); });
|
|
170
184
|
it('Wrong type (null)', () => { test.exception(() => flattenTextMarkers(null)).isInstanceOf(exception.IllegalArgument); });
|
|
@@ -175,24 +189,30 @@ describe('Flatten text markers', () => {
|
|
|
175
189
|
describe('Parse text markers', () => {
|
|
176
190
|
|
|
177
191
|
it('RAe4', () => { test.value(parseTextMarkers('RAe4')).is({ e4: { symbol: 'A', color: 'r' } }); });
|
|
178
|
-
it('Gzd3,Y1h8', () => {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
it('Gzd3,Y1h8', () => {
|
|
193
|
+
test.value(parseTextMarkers('Gzd3,Y1h8')).is({
|
|
194
|
+
h8: { symbol: '1', color: 'y' },
|
|
195
|
+
d3: { symbol: 'z', color: 'g' },
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
it('G2a1,YMc5,RLd2,Rxh7,Bwh8', () => {
|
|
199
|
+
test.value(parseTextMarkers(' G2a1, Rxh7 ,YMc5 ,RLd2,Bwh8 ')).is({
|
|
200
|
+
c5: { symbol: 'M', color: 'y' },
|
|
201
|
+
h8: { symbol: 'w', color: 'b' },
|
|
202
|
+
a1: { symbol: '2', color: 'g' },
|
|
203
|
+
h7: { symbol: 'x', color: 'r' },
|
|
204
|
+
d2: { symbol: 'L', color: 'r' },
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
it('Multi-character symbols', () => {
|
|
208
|
+
test.value(parseTextMarkers('YAa1,G(plus)a7, R(times)b3 ,Y(dot)g5,G(circle)h3')).is({
|
|
209
|
+
a1: { symbol: 'A', color: 'y' },
|
|
210
|
+
a7: { symbol: 'plus', color: 'g' },
|
|
211
|
+
b3: { symbol: 'times', color: 'r' },
|
|
212
|
+
g5: { symbol: 'dot', color: 'y' },
|
|
213
|
+
h3: { symbol: 'circle', color: 'g' },
|
|
214
|
+
});
|
|
215
|
+
});
|
|
196
216
|
it('<empty>', () => { test.value(parseTextMarkers('')).is({}); });
|
|
197
217
|
it('<blank>', () => { test.value(parseTextMarkers(' ')).is({}); });
|
|
198
218
|
|
|
@@ -213,8 +233,9 @@ describe('Flatten arrow markers', () => {
|
|
|
213
233
|
|
|
214
234
|
it('Re4d6', () => { test.value(flattenArrowMarkers({ e4d6: 'r' })).is('Re4d6'); });
|
|
215
235
|
it('Gd3b4,Yh8h7', () => { test.value(flattenArrowMarkers({ h8h7: 'y', d3b4: 'g' })).is('Gd3b4,Yh8h7'); });
|
|
216
|
-
it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5', () => {
|
|
217
|
-
.is('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5');
|
|
236
|
+
it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5', () => {
|
|
237
|
+
test.value(flattenArrowMarkers({ c5a1: 'y', h8c5: 'b', a1h8: 'g', h7h8: 'r', d2d2: 'r' })).is('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5');
|
|
238
|
+
});
|
|
218
239
|
it('<empty>', () => { test.value(flattenArrowMarkers({})).is(''); });
|
|
219
240
|
|
|
220
241
|
it('Wrong vector', () => { test.value(flattenArrowMarkers({ e1c2: 'r', a1b9: 'g', c0d2: 'r', i3d4: 'r', f2k3: 'g', whatever: 'y' })).is('Re1c2'); });
|
|
@@ -230,8 +251,9 @@ describe('Parse arrow markers', () => {
|
|
|
230
251
|
|
|
231
252
|
it('Re4d6', () => { test.value(parseArrowMarkers('Re4d6')).is({ e4d6: 'r' }); });
|
|
232
253
|
it('Gd3b4,Yh8h7', () => { test.value(parseArrowMarkers('Gd3b4,Yh8h7')).is({ h8h7: 'y', d3b4: 'g' }); });
|
|
233
|
-
it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5', () => {
|
|
234
|
-
.is({ c5a1: 'y', h8c5: 'b', a1h8: 'g', h7h8: 'r', d2d2: 'r' });
|
|
254
|
+
it('Ga1h8,Yc5a1,Rd2d2,Rh7h8,Bh8c5', () => {
|
|
255
|
+
test.value(parseArrowMarkers(' Bh8c5,Ga1h8 , Yc5a1 , Rd2d2,Rh7h8 ')).is({ c5a1: 'y', h8c5: 'b', a1h8: 'g', h7h8: 'r', d2d2: 'r' });
|
|
256
|
+
});
|
|
235
257
|
it('<empty>', () => { test.value(parseArrowMarkers('')).is({}); });
|
|
236
258
|
it('<blank>', () => { test.value(parseArrowMarkers(' ')).is({}); });
|
|
237
259
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -211,6 +211,8 @@ describe('Adapt square-size with small-screen limits', () => {
|
|
|
211
211
|
delete global.window;
|
|
212
212
|
});
|
|
213
213
|
|
|
214
|
+
/* global window */
|
|
215
|
+
|
|
214
216
|
it('Window-limited', () => {
|
|
215
217
|
window.innerWidth = 640;
|
|
216
218
|
testAdaptSquareSize(32, 9999, 9999, true, true, limits);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -42,7 +42,7 @@ describeWithBrowser('Error box graphic', browserContext => {
|
|
|
42
42
|
]);
|
|
43
43
|
|
|
44
44
|
itChecksScreenshots(browserContext, '03_error_box_graphic/localization', [
|
|
45
|
-
'default'
|
|
45
|
+
'default',
|
|
46
46
|
]);
|
|
47
47
|
|
|
48
48
|
});
|
package/test/04_icons_graphic.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -31,8 +31,7 @@ describeWithBrowser('Chessboard interaction', browserContext => {
|
|
|
31
31
|
itCustom(browserContext, '07_chessboard_interaction/click_squares', itemIndex, label, async element => {
|
|
32
32
|
const actions = browserContext.driver.actions({ async: true });
|
|
33
33
|
const area = await element.getRect();
|
|
34
|
-
for (
|
|
35
|
-
const target = targets[i];
|
|
34
|
+
for (const target of targets) {
|
|
36
35
|
await actions.move({ x: area.x + target.x, y: area.y + target.y }).click().perform();
|
|
37
36
|
await compareSandbox(browserContext, target.expectedText);
|
|
38
37
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|
|
@@ -50,10 +50,10 @@ describeWithBrowser('Navigation board graphic', browserContext => {
|
|
|
50
50
|
function itCheckClickButton(itemIndex, label, buttons) {
|
|
51
51
|
itCustom(browserContext, '13_navigation_board_graphic/additional_buttons', itemIndex, label, async element => {
|
|
52
52
|
await setSandbox(browserContext, '');
|
|
53
|
-
for (
|
|
54
|
-
const buttonElement = await element.findElement(By.xpath(`.//div[@title='${
|
|
53
|
+
for (const button of buttons) {
|
|
54
|
+
const buttonElement = await element.findElement(By.xpath(`.//div[@title='${button.title}']`));
|
|
55
55
|
await buttonElement.click();
|
|
56
|
-
await compareSandbox(browserContext,
|
|
56
|
+
await compareSandbox(browserContext, button.expectedSandbox ?? '');
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
59
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* *
|
|
4
4
|
* Kokopu-React - A React-based library of chess-related components. *
|
|
5
5
|
* <https://www.npmjs.com/package/kokopu-react> *
|
|
6
|
-
* Copyright (C) 2021-
|
|
6
|
+
* Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
7
7
|
* *
|
|
8
8
|
* Kokopu-React is free software: you can redistribute it and/or *
|
|
9
9
|
* modify it under the terms of the GNU Lesser General Public License *
|