kokopu-react 1.11.1 → 2.0.1
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 +83 -0
- package/.nycrc.yml +0 -1
- package/CHANGELOG.md +178 -0
- package/CREDITS.md +18 -0
- package/README.md +1 -1
- package/{src/css/chessboard.css → dist/lib/chessboard/Chessboard.css} +2 -2
- package/dist/lib/chessboard/Chessboard.d.ts +171 -0
- package/dist/lib/chessboard/Chessboard.js +366 -0
- package/dist/lib/chessboard/Chessboard.js.map +1 -0
- package/dist/lib/chessboard/ChessboardImpl.d.ts +119 -0
- package/dist/lib/chessboard/ChessboardImpl.js +471 -0
- package/dist/lib/chessboard/ChessboardImpl.js.map +1 -0
- package/dist/lib/chessboard/Draggable.d.ts +62 -0
- package/dist/lib/chessboard/Draggable.js +157 -0
- package/dist/lib/chessboard/Draggable.js.map +1 -0
- package/dist/lib/chessboard/Motion.d.ts +28 -0
- package/dist/lib/chessboard/Motion.js +74 -0
- package/dist/lib/chessboard/Motion.js.map +1 -0
- package/dist/lib/chessboard/colorsets.d.ts +5 -0
- package/dist/lib/{impl → chessboard}/colorsets.js +43 -47
- package/dist/lib/chessboard/colorsets.js.map +1 -0
- package/dist/lib/chessboard/piecesets.d.ts +5 -0
- package/dist/lib/chessboard/piecesets.js +214 -0
- package/dist/lib/chessboard/piecesets.js.map +1 -0
- package/dist/lib/{css/error_box.css → errorbox/ErrorBox.css} +2 -2
- package/dist/lib/errorbox/ErrorBox.d.ts +28 -0
- package/dist/lib/errorbox/ErrorBox.js +84 -0
- package/dist/lib/errorbox/ErrorBox.js.map +1 -0
- package/dist/lib/exception.d.ts +18 -0
- package/dist/lib/exception.js +40 -0
- package/dist/lib/exception.js.map +1 -0
- package/dist/lib/i18n.d.ts +18 -0
- package/dist/lib/i18n.js +20 -33
- package/dist/lib/i18n.js.map +1 -0
- package/{src/css/symbol.css → dist/lib/icons/AnnotationSymbolShape.css} +2 -2
- package/dist/lib/icons/AnnotationSymbolShape.d.ts +30 -0
- package/dist/lib/{impl/ArrowTip.js → icons/AnnotationSymbolShape.js} +21 -35
- package/dist/lib/icons/AnnotationSymbolShape.js.map +1 -0
- package/dist/lib/icons/ArrowMarkerIcon.d.ts +20 -0
- package/dist/lib/icons/ArrowMarkerIcon.js +54 -0
- package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -0
- package/dist/lib/icons/ArrowTip.d.ts +16 -0
- package/dist/lib/icons/ArrowTip.js +29 -0
- package/dist/lib/icons/ArrowTip.js.map +1 -0
- package/dist/lib/icons/SquareMarkerIcon.d.ts +18 -0
- package/{src/i18n.js → dist/lib/icons/SquareMarkerIcon.js} +24 -23
- package/dist/lib/icons/SquareMarkerIcon.js.map +1 -0
- package/dist/lib/icons/TextMarkerIcon.d.ts +23 -0
- package/dist/lib/icons/TextMarkerIcon.js +45 -0
- package/dist/lib/icons/TextMarkerIcon.js.map +1 -0
- package/{src/css → dist/lib/icons}/arrow.css +2 -2
- package/dist/lib/index.d.ts +10 -0
- package/dist/lib/index.js +31 -105
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/{css/movetext.css → movetext/Movetext.css} +2 -2
- package/dist/lib/movetext/Movetext.d.ts +136 -0
- package/dist/lib/movetext/Movetext.js +168 -0
- package/dist/lib/movetext/Movetext.js.map +1 -0
- package/dist/lib/movetext/MovetextImpl.d.ts +85 -0
- package/dist/lib/movetext/MovetextImpl.js +411 -0
- package/dist/lib/movetext/MovetextImpl.js.map +1 -0
- package/dist/lib/{css → movetext}/fonts.css +4 -4
- package/dist/lib/movetext/htmlFilter.d.ts +7 -0
- package/dist/lib/movetext/htmlFilter.js +169 -0
- package/dist/lib/movetext/htmlFilter.js.map +1 -0
- package/dist/lib/movetext/moveFormatter.d.ts +20 -0
- package/dist/lib/movetext/moveFormatter.js +93 -0
- package/dist/lib/movetext/moveFormatter.js.map +1 -0
- package/dist/lib/sanitization.d.ts +6 -0
- package/dist/lib/sanitization.js +39 -0
- package/dist/lib/sanitization.js.map +1 -0
- package/dist/lib/types.d.ts +151 -0
- package/dist/lib/types.js +162 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/util.d.ts +2 -0
- package/dist/lib/util.js +36 -0
- package/dist/lib/util.js.map +1 -0
- package/doc_src/demo/{PageChessboardBase.js → PageChessboardBase.tsx} +30 -24
- package/doc_src/demo/{PageChessboardInteraction.js → PageChessboardInteraction.tsx} +95 -66
- package/doc_src/demo/{PageChessboardMove.js → PageChessboardMove.tsx} +66 -54
- package/doc_src/demo/{PageChessboardSmallScreens.js → PageChessboardSmallScreens.tsx} +23 -14
- package/doc_src/demo/{PageMovetextBase.js → PageMovetextBase.tsx} +62 -49
- package/doc_src/demo/{PageMovetextInteraction.js → PageMovetextInteraction.tsx} +58 -43
- package/doc_src/demo/decs.d.ts +31 -0
- package/doc_src/demo/demo.css +2 -2
- package/doc_src/demo/{util.js → util.ts} +3 -3
- package/doc_src/migrate_to_2.md +26 -0
- package/doc_src/theming/LogoRenderer.js +5 -5
- package/doc_src/theming/theming.css +8 -2
- package/package.json +45 -32
- package/scripts/doc.styleguide.config.js +192 -0
- package/scripts/doc.tsconfig.json +7 -0
- package/scripts/docker-compose.yml +1 -1
- package/scripts/test-graphic.tsconfig.json +7 -0
- package/scripts/test-graphic.webpack.config.js +33 -17
- package/scripts/test-headless.webpack.config.js +6 -10
- package/{dist/lib/css/chessboard.css → src/chessboard/Chessboard.css} +2 -2
- package/src/chessboard/Chessboard.tsx +575 -0
- package/src/chessboard/ChessboardImpl.tsx +632 -0
- package/src/chessboard/Draggable.tsx +252 -0
- package/src/{impl/Motion.js → chessboard/Motion.tsx} +37 -27
- package/src/chessboard/colorsets.ts +134 -0
- package/src/chessboard/piecesets.ts +229 -0
- package/src/decs.d.ts +26 -0
- package/src/{css/error_box.css → errorbox/ErrorBox.css} +2 -2
- package/src/errorbox/ErrorBox.tsx +129 -0
- package/src/exception.ts +51 -0
- package/src/i18n.ts +43 -0
- package/{dist/lib/css/symbol.css → src/icons/AnnotationSymbolShape.css} +2 -2
- package/src/{impl/TextSymbol.js → icons/AnnotationSymbolShape.tsx} +32 -30
- package/src/{ArrowMarkerIcon.js → icons/ArrowMarkerIcon.tsx} +39 -36
- package/src/{impl/ArrowTip.js → icons/ArrowTip.tsx} +20 -20
- package/src/{SquareMarkerIcon.js → icons/SquareMarkerIcon.tsx} +35 -28
- package/src/{TextMarkerIcon.js → icons/TextMarkerIcon.tsx} +40 -32
- package/{dist/lib/css → src/icons}/arrow.css +2 -2
- package/src/index.ts +38 -0
- package/src/{css/movetext.css → movetext/Movetext.css} +2 -2
- package/src/movetext/Movetext.tsx +278 -0
- package/src/movetext/MovetextImpl.tsx +493 -0
- package/src/{css → movetext}/fonts.css +4 -4
- package/src/movetext/htmlFilter.tsx +188 -0
- package/src/{formatmove.js → movetext/moveFormatter.tsx} +39 -26
- package/src/sanitization.ts +51 -0
- package/src/types.ts +311 -0
- package/src/util.ts +39 -0
- package/test/.eslintrc.yml +3 -3
- package/test/{1_markers.js → 01_types.js} +89 -4
- package/test/{2_chessboard_util.js → 02_chessboard_util.js} +16 -7
- package/test/{3_marker_icons_graphic.js → 03_error_box_graphic.js} +20 -14
- package/test/04_marker_icons_graphic.js +49 -0
- package/test/05_chessboard_graphic.js +92 -0
- package/test/06_chessboard_animation.js +71 -0
- package/test/07_chessboard_interaction.js +130 -0
- package/test/08_chessboard_play_moves.js +98 -0
- package/test/{7_movetext_graphic.js → 09_movetext_graphic.js} +32 -16
- package/test/{8_movetext_interaction.js → 10_movetext_interaction.js} +18 -23
- package/test/common/graphic.js +67 -33
- 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_marker_icons_graphic/base/colorized_arrow.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/colorized_symbol.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/colorized_text.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/default_arrow.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/default_text.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_arrow_size.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_square_size.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_symbol.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/invalid_text_size.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/wrapped_arrow.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/wrapped_symbol.png +0 -0
- package/test/graphic_references/04_marker_icons_graphic/base/wrapped_text.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/flipped/parsing_error.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/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/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/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/09_movetext_graphic/error/wrong_game_index_type.png +0 -0
- package/test/graphic_references/09_movetext_graphic/error/wrong_game_type.png +0 -0
- package/test/graphic_references/09_movetext_graphic/options/wrong_diagram_options_1.png +0 -0
- package/test/graphic_references/09_movetext_graphic/options/wrong_diagram_options_2.png +0 -0
- package/test/graphic_references/10_movetext_interaction/error/wrong_interaction_mode.png +0 -0
- package/test/graphic_test_app/.eslintrc.yml +3 -0
- package/test/graphic_test_app/03_error_box_graphic/base.tsx +46 -0
- package/{scripts/clean-graphic-output.js → test/graphic_test_app/03_error_box_graphic/localization.tsx} +10 -7
- package/{graphic_test_src/01_marker_icons.js → test/graphic_test_app/04_marker_icons_graphic/base.tsx} +15 -7
- package/{graphic_test_src/04_chessboard_annotations.js → test/graphic_test_app/05_chessboard_graphic/annotations.tsx} +23 -14
- package/{graphic_test_src/02_chessboard_simple.js → test/graphic_test_app/05_chessboard_graphic/base.tsx} +6 -6
- package/test/graphic_test_app/05_chessboard_graphic/chess_variants.tsx +35 -0
- package/{graphic_test_src/03_chessboard_flipped.js → test/graphic_test_app/05_chessboard_graphic/flipped.tsx} +5 -5
- package/{graphic_test_src/05_chessboard_move.js → test/graphic_test_app/05_chessboard_graphic/move.tsx} +9 -8
- package/{graphic_test_src/07_chessboard_theme.js → test/graphic_test_app/05_chessboard_graphic/theme.tsx} +14 -11
- package/{graphic_test_src/06a_chessboard_animated_move.js → test/graphic_test_app/06_chessboard_animation/base_1.tsx} +5 -5
- package/{graphic_test_src/06b_chessboard_animated_move.js → test/graphic_test_app/06_chessboard_animation/base_2.tsx} +5 -5
- package/{graphic_test_src/06c_chessboard_animated_move.js → test/graphic_test_app/06_chessboard_animation/base_3.tsx} +5 -5
- package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +49 -0
- package/{graphic_test_src/08_chessboard_click_squares.js → test/graphic_test_app/07_chessboard_interaction/click_squares.tsx} +7 -6
- package/{graphic_test_src/10_chessboard_edit_arrows.js → test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx} +7 -7
- package/test/graphic_test_app/07_chessboard_interaction/error.tsx +30 -0
- package/{graphic_test_src/09_chessboard_move_pieces.js → test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx} +7 -6
- package/{graphic_test_src/11_chessboard_play_moves.js → test/graphic_test_app/08_chessboard_play_moves/base.tsx} +6 -6
- package/{graphic_test_src/12_chessboard_play_promotions.js → test/graphic_test_app/08_chessboard_play_moves/promotions.tsx} +6 -6
- package/{graphic_test_src/13_movetext_simple.js → test/graphic_test_app/09_movetext_graphic/base.tsx} +8 -8
- package/{graphic_test_src/14_movetext_error.js → test/graphic_test_app/09_movetext_graphic/error.tsx} +10 -9
- package/{graphic_test_src/15_movetext_html.js → test/graphic_test_app/09_movetext_graphic/html.tsx} +7 -7
- package/{graphic_test_src/16_movetext_options.js → test/graphic_test_app/09_movetext_graphic/options.tsx} +9 -6
- package/test/graphic_test_app/10_movetext_interaction/error.tsx +31 -0
- package/{graphic_test_src/17_movetext_interaction.js → test/graphic_test_app/10_movetext_interaction/select_moves.tsx} +7 -7
- package/test/graphic_test_app/common/decs.d.ts +26 -0
- package/{graphic_test_src → test/graphic_test_app}/common/games.pgn +1 -1
- package/{graphic_test_src → test/graphic_test_app}/common/test_app.css +11 -2
- package/{graphic_test_src/common/test_app.js → test/graphic_test_app/common/test_app.tsx} +62 -14
- package/tsconfig.json +15 -0
- package/.babelrc +0 -3
- package/dist/lib/ArrowMarkerIcon.js +0 -85
- package/dist/lib/Chessboard.js +0 -1276
- package/dist/lib/ErrorBox.js +0 -125
- package/dist/lib/Movetext.js +0 -805
- package/dist/lib/SquareMarkerIcon.js +0 -69
- package/dist/lib/TextMarkerIcon.js +0 -74
- package/dist/lib/formatmove.js +0 -107
- package/dist/lib/impl/DraggableHandle.js +0 -277
- package/dist/lib/impl/HtmlSanitizer.js +0 -145
- package/dist/lib/impl/Motion.js +0 -109
- package/dist/lib/impl/TextSymbol.js +0 -89
- package/dist/lib/impl/piecesets.js +0 -219
- package/dist/lib/impl/util.js +0 -71
- package/dist/lib/markers.js +0 -144
- package/doc_src/.eslintrc.yml +0 -2
- package/src/Chessboard.js +0 -1034
- package/src/ErrorBox.js +0 -132
- package/src/Movetext.js +0 -671
- package/src/impl/DraggableHandle.js +0 -235
- package/src/impl/HtmlSanitizer.js +0 -126
- package/src/impl/colorsets.js +0 -119
- package/src/impl/piecesets.js +0 -218
- package/src/impl/util.js +0 -68
- package/src/index.js +0 -31
- package/src/markers.js +0 -115
- package/test/4_chessboard_graphic.js +0 -49
- package/test/5_chessboard_interaction.js +0 -135
- package/test/6_chessboard_play_moves.js +0 -107
- package/test/references/01_marker_icons/10.png +0 -0
- package/test/references/01_marker_icons/3.png +0 -0
- package/test/references/01_marker_icons/4.png +0 -0
- package/test/references/01_marker_icons/5.png +0 -0
- package/test/references/01_marker_icons/6.png +0 -0
- package/test/references/01_marker_icons/7.png +0 -0
- package/test/references/01_marker_icons/8.png +0 -0
- package/test/references/01_marker_icons/9.png +0 -0
- package/test/references/02_chessboard_simple/5.png +0 -0
- package/test/references/05_chessboard_move/8.png +0 -0
- package/test/references/11_chessboard_play_moves/wrong_color.png +0 -0
- package/test/references/14_movetext_error/4.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-bb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-bk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-bn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-bp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-bq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-br.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-bx.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-wb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-wk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-wn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-wp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-wq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-wr.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/cburnett-wx.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-bb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-bk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-bn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-bp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-bq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-br.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-bx.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-wb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-wk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-wn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-wp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-wq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-wr.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/celtic-wx.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-bb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-bk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-bn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-bp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-bq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-br.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-spatial-bx.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-spatial-wx.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-wb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-wk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-wn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-wp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-wq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/eyes-wr.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-bb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-bk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-bn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-bp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-bq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-br.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-bx.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-wb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-wk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-wn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-wp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-wq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-wr.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/fantasy-wx.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-bb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-bk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-bn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-bp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-bq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-br.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-bx.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-wb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-wk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-wn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-wp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-wq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-wr.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/skulls-wx.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-bb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-bk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-bn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-bp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-bq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-br.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-wb.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-wk.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-wn.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-wp.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-wq.png +0 -0
- /package/dist/lib/{sprites → chessboard/sprites}/spatial-wr.png +0 -0
- /package/dist/lib/{fonts → movetext/fonts}/chessalpha.woff +0 -0
- /package/dist/lib/{fonts → movetext/fonts}/chessalpha.woff2 +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-bb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-bk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-bn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-bp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-bq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-br.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-bx.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-wb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-wk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-wn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-wp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-wq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-wr.png +0 -0
- /package/src/{sprites → chessboard/sprites}/cburnett-wx.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-bb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-bk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-bn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-bp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-bq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-br.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-bx.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-wb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-wk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-wn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-wp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-wq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-wr.png +0 -0
- /package/src/{sprites → chessboard/sprites}/celtic-wx.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-bb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-bk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-bn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-bp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-bq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-br.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-spatial-bx.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-spatial-wx.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-wb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-wk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-wn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-wp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-wq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/eyes-wr.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-bb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-bk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-bn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-bp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-bq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-br.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-bx.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-wb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-wk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-wn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-wp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-wq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-wr.png +0 -0
- /package/src/{sprites → chessboard/sprites}/fantasy-wx.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-bb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-bk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-bn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-bp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-bq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-br.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-bx.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-wb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-wk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-wn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-wp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-wq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-wr.png +0 -0
- /package/src/{sprites → chessboard/sprites}/skulls-wx.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-bb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-bk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-bn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-bp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-bq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-br.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-wb.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-wk.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-wn.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-wp.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-wq.png +0 -0
- /package/src/{sprites → chessboard/sprites}/spatial-wr.png +0 -0
- /package/src/{fonts → movetext/fonts}/chessalpha.woff +0 -0
- /package/src/{fonts → movetext/fonts}/chessalpha.woff2 +0 -0
- /package/test/{references/01_marker_icons/1.png → graphic_references/04_marker_icons_graphic/base/colorized_square.png} +0 -0
- /package/test/{references/01_marker_icons/0.png → graphic_references/04_marker_icons_graphic/base/default_square.png} +0 -0
- /package/test/{references/01_marker_icons/2.png → graphic_references/04_marker_icons_graphic/base/wrapped_square.png} +0 -0
- /package/test/{references/04_chessboard_annotations/4.png → graphic_references/05_chessboard_graphic/annotations/overlap.png} +0 -0
- /package/test/{references/04_chessboard_annotations/5.png → graphic_references/05_chessboard_graphic/annotations/overlap_and_flip.png} +0 -0
- /package/test/{references/04_chessboard_annotations/0.png → graphic_references/05_chessboard_graphic/annotations/with_coordinates.png} +0 -0
- /package/test/{references/04_chessboard_annotations/1.png → graphic_references/05_chessboard_graphic/annotations/with_coordinates_and_flip.png} +0 -0
- /package/test/{references/04_chessboard_annotations/2.png → graphic_references/05_chessboard_graphic/annotations/without_coordinates.png} +0 -0
- /package/test/{references/04_chessboard_annotations/3.png → graphic_references/05_chessboard_graphic/annotations/without_coordinates_and_flip.png} +0 -0
- /package/test/{references/02_chessboard_simple/0.png → graphic_references/05_chessboard_graphic/base/default.png} +0 -0
- /package/test/{references/02_chessboard_simple/1.png → graphic_references/05_chessboard_graphic/base/empty.png} +0 -0
- /package/test/{references/02_chessboard_simple/3.png → graphic_references/05_chessboard_graphic/base/from_fen.png} +0 -0
- /package/test/{references/02_chessboard_simple/4.png → graphic_references/05_chessboard_graphic/base/from_kokopu_object.png} +0 -0
- /package/test/{references/02_chessboard_simple/2.png → graphic_references/05_chessboard_graphic/base/parsing_error.png} +0 -0
- /package/test/{references/03_chessboard_flipped/2.png → graphic_references/05_chessboard_graphic/chess_variants/variant_without_std_initial_position.png} +0 -0
- /package/test/{references/03_chessboard_flipped/0.png → graphic_references/05_chessboard_graphic/flipped/default.png} +0 -0
- /package/test/{references/03_chessboard_flipped/1.png → graphic_references/05_chessboard_graphic/flipped/empty.png} +0 -0
- /package/test/{references/03_chessboard_flipped/3.png → graphic_references/05_chessboard_graphic/flipped/from_fen.png} +0 -0
- /package/test/{references/03_chessboard_flipped/4.png → graphic_references/05_chessboard_graphic/flipped/from_kokopu_object.png} +0 -0
- /package/test/{references/05_chessboard_move/4.png → graphic_references/05_chessboard_graphic/move/capture.png} +0 -0
- /package/test/{references/05_chessboard_move/5.png → graphic_references/05_chessboard_graphic/move/castling_move.png} +0 -0
- /package/test/{references/05_chessboard_move/0.png → graphic_references/05_chessboard_graphic/move/default.png} +0 -0
- /package/test/{references/05_chessboard_move/6.png → graphic_references/05_chessboard_graphic/move/en-passant.png} +0 -0
- /package/test/{references/05_chessboard_move/1.png → graphic_references/05_chessboard_graphic/move/no_move_arrow.png} +0 -0
- /package/test/{references/05_chessboard_move/2.png → graphic_references/05_chessboard_graphic/move/parsing_error.png} +0 -0
- /package/test/{references/05_chessboard_move/7.png → graphic_references/05_chessboard_graphic/move/promotion.png} +0 -0
- /package/test/{references/05_chessboard_move/3.png → graphic_references/05_chessboard_graphic/move/with_forced_move_arrow_and_flip.png} +0 -0
- /package/test/{references/07_chessboard_theme/3.png → graphic_references/05_chessboard_graphic/theme/custom_1.png} +0 -0
- /package/test/{references/07_chessboard_theme/4.png → graphic_references/05_chessboard_graphic/theme/custom_2.png} +0 -0
- /package/test/{references/07_chessboard_theme/5.png → graphic_references/05_chessboard_graphic/theme/custom_3.png} +0 -0
- /package/test/{references/07_chessboard_theme/6.png → graphic_references/05_chessboard_graphic/theme/custom_4.png} +0 -0
- /package/test/{references/07_chessboard_theme/7.png → graphic_references/05_chessboard_graphic/theme/custom_5.png} +0 -0
- /package/test/{references/07_chessboard_theme/8.png → graphic_references/05_chessboard_graphic/theme/custom_6.png} +0 -0
- /package/test/{references/07_chessboard_theme/0.png → graphic_references/05_chessboard_graphic/theme/default.png} +0 -0
- /package/test/{references/07_chessboard_theme/1.png → graphic_references/05_chessboard_graphic/theme/large.png} +0 -0
- /package/test/{references/07_chessboard_theme/2.png → graphic_references/05_chessboard_graphic/theme/small.png} +0 -0
- /package/test/{references/06a_chessboard_animated_move/2.png → graphic_references/06_chessboard_animation/base_1/capture.png} +0 -0
- /package/test/{references/06a_chessboard_animated_move/3.png → graphic_references/06_chessboard_animation/base_1/castling_move.png} +0 -0
- /package/test/{references/06a_chessboard_animated_move/4.png → graphic_references/06_chessboard_animation/base_1/en-passant.png} +0 -0
- /package/test/{references/06a_chessboard_animated_move/0.png → graphic_references/06_chessboard_animation/base_1/move_1.png} +0 -0
- /package/test/{references/06a_chessboard_animated_move/1.png → graphic_references/06_chessboard_animation/base_1/move_2.png} +0 -0
- /package/test/{references/06a_chessboard_animated_move/5.png → graphic_references/06_chessboard_animation/base_1/promotion.png} +0 -0
- /package/test/{references/06b_chessboard_animated_move/2.png → graphic_references/06_chessboard_animation/base_2/capture.png} +0 -0
- /package/test/{references/06b_chessboard_animated_move/3.png → graphic_references/06_chessboard_animation/base_2/castling_move.png} +0 -0
- /package/test/{references/06b_chessboard_animated_move/4.png → graphic_references/06_chessboard_animation/base_2/en-passant.png} +0 -0
- /package/test/{references/06b_chessboard_animated_move/0.png → graphic_references/06_chessboard_animation/base_2/move_1.png} +0 -0
- /package/test/{references/06b_chessboard_animated_move/1.png → graphic_references/06_chessboard_animation/base_2/move_2.png} +0 -0
- /package/test/{references/06b_chessboard_animated_move/5.png → graphic_references/06_chessboard_animation/base_2/promotion.png} +0 -0
- /package/test/{references/06c_chessboard_animated_move/2.png → graphic_references/06_chessboard_animation/base_3/capture.png} +0 -0
- /package/test/{references/06c_chessboard_animated_move/3.png → graphic_references/06_chessboard_animation/base_3/castling_move.png} +0 -0
- /package/test/{references/06c_chessboard_animated_move/4.png → graphic_references/06_chessboard_animation/base_3/en-passant.png} +0 -0
- /package/test/{references/06c_chessboard_animated_move/0.png → graphic_references/06_chessboard_animation/base_3/move_1.png} +0 -0
- /package/test/{references/06c_chessboard_animated_move/1.png → graphic_references/06_chessboard_animation/base_3/move_2.png} +0 -0
- /package/test/{references/06c_chessboard_animated_move/5.png → graphic_references/06_chessboard_animation/base_3/promotion.png} +0 -0
- /package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/base_1.png +0 -0
- /package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/base_2.png +0 -0
- /package/test/{references/10_chessboard_edit_arrows/null_vector.png → graphic_references/07_chessboard_interaction/edit_arrows/from_==_to.png} +0 -0
- /package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/out_of_board.png +0 -0
- /package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/over_arrow_marker.png +0 -0
- /package/test/{references/10_chessboard_edit_arrows → graphic_references/07_chessboard_interaction/edit_arrows}/over_square_marker.png +0 -0
- /package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/after_move.png +0 -0
- /package/test/{references/09_chessboard_move_pieces/null_vector.png → graphic_references/07_chessboard_interaction/move_pieces/from_==_to.png} +0 -0
- /package/test/{references/09_chessboard_move_pieces/empty_square.png → graphic_references/07_chessboard_interaction/move_pieces/move_empty_square.png} +0 -0
- /package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/out_of_board.png +0 -0
- /package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_arrow_marker.png +0 -0
- /package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_empty.png +0 -0
- /package/test/{references/09_chessboard_move_pieces/over_non_empty_1.png → graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_1.png} +0 -0
- /package/test/{references/09_chessboard_move_pieces/over_non_empty_2.png → graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_2.png} +0 -0
- /package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_square_marker.png +0 -0
- /package/test/{references/09_chessboard_move_pieces → graphic_references/07_chessboard_interaction/move_pieces}/over_text_marker.png +0 -0
- /package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/castling_move.png +0 -0
- /package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/chess960_ambiguous_king_move.png +0 -0
- /package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/chess960_castling_move_1.png +0 -0
- /package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/chess960_castling_move_2.png +0 -0
- /package/test/{references/11_chessboard_play_moves/chess960_non_kxr_castling.png → graphic_references/08_chessboard_play_moves/base/chess960_non-kxr_castling.png} +0 -0
- /package/test/{references/11_chessboard_play_moves/null_vector.png → graphic_references/08_chessboard_play_moves/base/from_==_to.png} +0 -0
- /package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/illegal_move.png +0 -0
- /package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/illegal_position.png +0 -0
- /package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/out_of_board.png +0 -0
- /package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/regular_move_1.png +0 -0
- /package/test/{references/11_chessboard_play_moves → graphic_references/08_chessboard_play_moves/base}/regular_move_2.png +0 -0
- /package/test/{references/10_chessboard_edit_arrows/edit_color_not_set.png → graphic_references/08_chessboard_play_moves/base/wrong_color_moved.png} +0 -0
- /package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/antichess_promotion.png +0 -0
- /package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/cancel_promotion.png +0 -0
- /package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/regular_promotion_1.png +0 -0
- /package/test/{references/12_chessboard_play_promotions → graphic_references/08_chessboard_play_moves/promotions}/regular_promotion_2.png +0 -0
- /package/test/{references/13_movetext_simple/0.png → graphic_references/09_movetext_graphic/base/game_1.png} +0 -0
- /package/test/{references/13_movetext_simple/1.png → graphic_references/09_movetext_graphic/base/game_2.png} +0 -0
- /package/test/{references/13_movetext_simple/2.png → graphic_references/09_movetext_graphic/base/game_3.png} +0 -0
- /package/test/{references/13_movetext_simple/3.png → graphic_references/09_movetext_graphic/base/game_4.png} +0 -0
- /package/test/{references/14_movetext_error/2.png → graphic_references/09_movetext_graphic/error/pgn_parsing_error_1.png} +0 -0
- /package/test/{references/14_movetext_error/3.png → graphic_references/09_movetext_graphic/error/pgn_parsing_error_2.png} +0 -0
- /package/test/{references/14_movetext_error/0.png → graphic_references/09_movetext_graphic/error/wrong_game_index_1.png} +0 -0
- /package/test/{references/14_movetext_error/1.png → graphic_references/09_movetext_graphic/error/wrong_game_index_2.png} +0 -0
- /package/test/{references/15_movetext_html/2.png → graphic_references/09_movetext_graphic/html/filtered_tags_and_attributes.png} +0 -0
- /package/test/{references/15_movetext_html/1.png → graphic_references/09_movetext_graphic/html/html_in_comments.png} +0 -0
- /package/test/{references/15_movetext_html/0.png → graphic_references/09_movetext_graphic/html/html_in_headers.png} +0 -0
- /package/test/{references/16_movetext_options/1.png → graphic_references/09_movetext_graphic/options/custom_piece_symbols.png} +0 -0
- /package/test/{references/16_movetext_options/2.png → graphic_references/09_movetext_graphic/options/figurine_piece_symbols_and_diagram_options.png} +0 -0
- /package/test/{references/16_movetext_options/3.png → graphic_references/09_movetext_graphic/options/hidden_diagrams.png} +0 -0
- /package/test/{references/16_movetext_options/0.png → graphic_references/09_movetext_graphic/options/localized_piece_symbols.png} +0 -0
- /package/test/{references/17_movetext_interaction/0.png → graphic_references/10_movetext_interaction/select_moves/click_on_disabled.png} +0 -0
- /package/test/{references/17_movetext_interaction/1.png → graphic_references/10_movetext_interaction/select_moves/click_on_unselected.png} +0 -0
- /package/test/{references/17_movetext_interaction/2.png → graphic_references/10_movetext_interaction/select_moves/click_on_with_variations.png} +0 -0
- /package/{graphic_test_src → test/graphic_test_app}/common/dummy.pgn +0 -0
- /package/{graphic_test_src → test/graphic_test_app}/common/heartbeat.txt +0 -0
- /package/{graphic_test_src → test/graphic_test_app}/common/smiley.png +0 -0
package/src/Movetext.js
DELETED
|
@@ -1,671 +0,0 @@
|
|
|
1
|
-
/******************************************************************************
|
|
2
|
-
* *
|
|
3
|
-
* This file is part of Kokopu-React, a JavaScript chess library. *
|
|
4
|
-
* Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
|
|
5
|
-
* *
|
|
6
|
-
* This program is free software: you can redistribute it and/or *
|
|
7
|
-
* modify it under the terms of the GNU Lesser General Public License *
|
|
8
|
-
* as published by the Free Software Foundation, either version 3 of *
|
|
9
|
-
* the License, or (at your option) any later version. *
|
|
10
|
-
* *
|
|
11
|
-
* This program is distributed in the hope that it will be useful, *
|
|
12
|
-
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
13
|
-
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
14
|
-
* GNU Lesser General Public License for more details. *
|
|
15
|
-
* *
|
|
16
|
-
* You should have received a copy of the GNU Lesser General *
|
|
17
|
-
* Public License along with this program. If not, see *
|
|
18
|
-
* <http://www.gnu.org/licenses/>. *
|
|
19
|
-
* *
|
|
20
|
-
******************************************************************************/
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
import PropTypes from 'prop-types';
|
|
24
|
-
import React from 'react';
|
|
25
|
-
import { exception, Database, Game, nagSymbol, pgnRead } from 'kokopu';
|
|
26
|
-
|
|
27
|
-
import HtmlSanitizer from './impl/HtmlSanitizer';
|
|
28
|
-
import { fillPlaceholder } from './impl/util';
|
|
29
|
-
import Chessboard from './Chessboard';
|
|
30
|
-
import ErrorBox from './ErrorBox';
|
|
31
|
-
import { moveFormatter } from './formatmove';
|
|
32
|
-
import i18n from './i18n';
|
|
33
|
-
|
|
34
|
-
import './css/movetext.css';
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Display a chess game, i.e. the headers (name of the players, event, etc.), the moves, and all the related annotations if any (comments, variations, NAGs...).
|
|
39
|
-
*/
|
|
40
|
-
export default class Movetext extends React.Component {
|
|
41
|
-
|
|
42
|
-
constructor(props) {
|
|
43
|
-
super(props);
|
|
44
|
-
this.focusFieldRef = React.createRef();
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
render() {
|
|
48
|
-
let info = parseGame(this.props.game, this.props.gameIndex);
|
|
49
|
-
if (info.error) {
|
|
50
|
-
return <ErrorBox title={i18n.INVALID_PGN_ERROR_TITLE} message={info.message} text={info.text} errorIndex={info.errorIndex} lineNumber={info.lineNumber} />;
|
|
51
|
-
}
|
|
52
|
-
return (
|
|
53
|
-
<div className="kokopu-movetext">
|
|
54
|
-
{this.renderHeaders(info.game)}
|
|
55
|
-
{this.renderBody(info.game)}
|
|
56
|
-
{this.renderFocusField(info.game)}
|
|
57
|
-
</div>
|
|
58
|
-
);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
renderHeaders(game) {
|
|
62
|
-
if (!this.props.headerVisible) {
|
|
63
|
-
return undefined;
|
|
64
|
-
}
|
|
65
|
-
let headers = [];
|
|
66
|
-
headers.push(this.renderPlayerHeaders(game, 'w'));
|
|
67
|
-
headers.push(this.renderPlayerHeaders(game, 'b'));
|
|
68
|
-
headers.push(this.renderEventRoundHeaders(game));
|
|
69
|
-
headers.push(this.renderDateSiteHeaders(game));
|
|
70
|
-
headers.push(this.renderAnnotatorHeader(game));
|
|
71
|
-
return headers.some(element => element !== undefined) ? <div className="kokopu-headers">{headers}</div> : undefined;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Header containing the player-related information (name, rating, title) corresponding to the given color.
|
|
76
|
-
*/
|
|
77
|
-
renderPlayerHeaders(game, color) {
|
|
78
|
-
let playerName = game.playerName(color);
|
|
79
|
-
if (playerName === undefined) {
|
|
80
|
-
return undefined;
|
|
81
|
-
}
|
|
82
|
-
let title = game.playerTitle(color);
|
|
83
|
-
let rating = game.playerElo(color);
|
|
84
|
-
|
|
85
|
-
let classNames = [ 'kokopu-headerGroup-player', color === 'w' ? 'kokopu-headerGroup-whitePlayer' : 'kokopu-headerGroup-blackPlayer' ];
|
|
86
|
-
let colorTag = <span className="kokopu-colorTag"></span>;
|
|
87
|
-
let playerNameElement = <span className="kokopu-header-playerName">{sanitizeHtml(playerName)}</span>;
|
|
88
|
-
let titleElement = title === undefined ? undefined : <span className="kokopu-header-playerTitle">{sanitizeHtml(title)}</span>;
|
|
89
|
-
let ratingElement = rating === undefined ? undefined : <span className="kokopu-header-playerRating">{rating}</span>;
|
|
90
|
-
let separator = title === undefined || rating === undefined ? undefined : '\u00a0'; // \u00a0 ==
|
|
91
|
-
let titleRatingGroup = title === undefined && rating === undefined ? undefined : <span className="kokopu-headerGroup-titleRating">{titleElement}{separator}{ratingElement}</span>;
|
|
92
|
-
return <div className={classNames.join(' ')} key={'player-' + color}>{colorTag}{playerNameElement}{titleRatingGroup}</div>;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Header containing the event-related information: event + round.
|
|
97
|
-
*/
|
|
98
|
-
renderEventRoundHeaders(game) {
|
|
99
|
-
let evt = game.event();
|
|
100
|
-
if (evt === undefined) {
|
|
101
|
-
return undefined;
|
|
102
|
-
}
|
|
103
|
-
let fullRound = game.fullRound();
|
|
104
|
-
let roundElement = fullRound === undefined ? undefined : <span className="kokopu-header-round">{fullRound}</span>;
|
|
105
|
-
let evtElement = <span className="kokopu-header-event">{sanitizeHtml(evt)}</span>;
|
|
106
|
-
return <div className="kokopu-headerGroup-eventRound" key="event-round">{evtElement}{roundElement}</div>;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Header containing the date/place information.
|
|
111
|
-
*/
|
|
112
|
-
renderDateSiteHeaders(game) {
|
|
113
|
-
let date = game.date();
|
|
114
|
-
let site = game.site();
|
|
115
|
-
if(date === undefined && site === undefined) {
|
|
116
|
-
return undefined;
|
|
117
|
-
}
|
|
118
|
-
let dateElement = date === undefined ? undefined : <span className="kokopu-header-date">{capitalizeFirstWord(game.dateAsString())}</span>;
|
|
119
|
-
let siteElement = site === undefined ? undefined : <span className="kokopu-header-site">{sanitizeHtml(site)}</span>;
|
|
120
|
-
let separator = date === undefined || site === undefined ? undefined : '\u00a0\u2013\u00a0'; // \u00a0 == \u2013 == –
|
|
121
|
-
return <div className="kokopu-headerGroup-dateSite" key="date-site">{dateElement}{separator}{siteElement}</div>;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Header containing the annotator information.
|
|
126
|
-
*/
|
|
127
|
-
renderAnnotatorHeader(game) {
|
|
128
|
-
let annotator = game.annotator();
|
|
129
|
-
if (annotator === undefined) {
|
|
130
|
-
return undefined;
|
|
131
|
-
}
|
|
132
|
-
annotator = fillPlaceholder(i18n.ANNOTATED_BY, annotator);
|
|
133
|
-
return <div className="kokopu-header-annotator" key="annotator">{sanitizeHtml(annotator)}</div>;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
renderFocusField(game) {
|
|
137
|
-
if (this.props.interactionMode !== 'selectMove') {
|
|
138
|
-
return undefined;
|
|
139
|
-
}
|
|
140
|
-
return (
|
|
141
|
-
<div className="kokopu-focusFieldContainer">
|
|
142
|
-
<a className="kokopu-focusField" href="#" ref={this.focusFieldRef} onKeyDown={evt => this.handleKeyDownInFocusField(evt, game)}></a>
|
|
143
|
-
</div>
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
renderBody(game) {
|
|
148
|
-
let notationTextBuilder = moveFormatter(this.props.pieceSymbols);
|
|
149
|
-
return this.renderVariation(notationTextBuilder, game.mainVariation(), 'main-variation', true, game.result());
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Render the given variation and its sub-variations, recursively.
|
|
154
|
-
*/
|
|
155
|
-
renderVariation(notationTextBuilder, variation, variationKey, isMainVariation, gameResult) {
|
|
156
|
-
|
|
157
|
-
let moveGroups = []; // ... and also long comments and long sub-variations
|
|
158
|
-
let currentMoveGroupElements = [];
|
|
159
|
-
|
|
160
|
-
// Close the current move group, if any.
|
|
161
|
-
function closeMoveGroup() {
|
|
162
|
-
if (!variation.isLongVariation() || currentMoveGroupElements.length === 0) {
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
moveGroups.push(<div className="kokopu-moveGroup" key={'group-' + moveGroups.length}>{currentMoveGroupElements}</div>);
|
|
166
|
-
currentMoveGroupElements = [];
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// Write the initial comment, if any.
|
|
170
|
-
let variationComment = this.extractComment(variation);
|
|
171
|
-
if (variationComment !== undefined) {
|
|
172
|
-
if (variation.isLongComment()) {
|
|
173
|
-
moveGroups.push(this.renderComment(variation, variationComment, true));
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
currentMoveGroupElements.push(this.renderComment(variation, variationComment, true));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
// Visit all the PGN nodes (one node per move) within the variation.
|
|
181
|
-
let forcePrintMoveNumber = true;
|
|
182
|
-
let node = variation.first();
|
|
183
|
-
while (node !== undefined) {
|
|
184
|
-
|
|
185
|
-
// Write the move, including directly related information (i.e. move number + NAGs).
|
|
186
|
-
currentMoveGroupElements.push(this.renderMove(notationTextBuilder, node, forcePrintMoveNumber));
|
|
187
|
-
|
|
188
|
-
// Write the comment (if any).
|
|
189
|
-
let nodeComment = this.extractComment(node);
|
|
190
|
-
if (nodeComment !== undefined) {
|
|
191
|
-
if (node.isLongComment()) {
|
|
192
|
-
closeMoveGroup();
|
|
193
|
-
moveGroups.push(this.renderComment(node, nodeComment, false));
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
currentMoveGroupElements.push(this.renderComment(node, nodeComment, false));
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
// Write the sub-variations.
|
|
201
|
-
let hasNonEmptySubVariations = false;
|
|
202
|
-
for (let [index, subVariation] of node.variations().entries()) {
|
|
203
|
-
let subVariationElement = this.renderVariation(notationTextBuilder, subVariation, node.fullMoveNumber() + node.moveColor() + '-variation-' + index, false);
|
|
204
|
-
if (subVariationElement) {
|
|
205
|
-
if (subVariation.isLongVariation()) {
|
|
206
|
-
closeMoveGroup();
|
|
207
|
-
moveGroups.push(subVariationElement);
|
|
208
|
-
}
|
|
209
|
-
else {
|
|
210
|
-
currentMoveGroupElements.push(subVariationElement);
|
|
211
|
-
}
|
|
212
|
-
hasNonEmptySubVariations = true;
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Back to the current variation, go to the next move.
|
|
217
|
-
forcePrintMoveNumber = (nodeComment !== undefined || hasNonEmptySubVariations);
|
|
218
|
-
node = node.next();
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
// Append the game result at the end of the main variation.
|
|
222
|
-
if (isMainVariation && gameResult !== '*') {
|
|
223
|
-
currentMoveGroupElements.push(<span className="kokopu-gameResult" key="gameResult">{formatResult(gameResult)}</span>);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// Close the last move group, and return the result.
|
|
227
|
-
closeMoveGroup();
|
|
228
|
-
let elements = variation.isLongVariation() ? moveGroups : currentMoveGroupElements;
|
|
229
|
-
if (elements.length === 0) {
|
|
230
|
-
return undefined;
|
|
231
|
-
}
|
|
232
|
-
if (isMainVariation) {
|
|
233
|
-
return <div className="kokopu-variation kokopu-mainVariation" key={variationKey}>{elements}</div>;
|
|
234
|
-
}
|
|
235
|
-
else if (variation.isLongVariation()) {
|
|
236
|
-
return <div className="kokopu-variation kokopu-subVariation" key={variationKey}>{elements}</div>;
|
|
237
|
-
}
|
|
238
|
-
else {
|
|
239
|
-
return <span className="kokopu-variation kokopu-subVariation" key={variationKey}>{elements}</span>;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Render the given move, move number, and NAG (if any).
|
|
245
|
-
*/
|
|
246
|
-
renderMove(notationTextBuilder, node, forcePrintMoveNumber) {
|
|
247
|
-
|
|
248
|
-
// Move number
|
|
249
|
-
let moveNumber = undefined;
|
|
250
|
-
if (forcePrintMoveNumber || node.moveColor() === 'w') {
|
|
251
|
-
let moveNumberText = node.fullMoveNumber() + (node.moveColor() === 'w' ? '.' : '\u2026');
|
|
252
|
-
moveNumber = <span className="kokopu-moveNumber">{moveNumberText}</span>;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
// SAN notation.
|
|
256
|
-
let notationText = notationTextBuilder(node.notation());
|
|
257
|
-
|
|
258
|
-
// NAGs
|
|
259
|
-
let nagElements = node.nags().map(nag => <span className="kokopu-nag" key={nag}>{nagSymbol(nag)}</span>);
|
|
260
|
-
|
|
261
|
-
// Class
|
|
262
|
-
let nodeId = node.id();
|
|
263
|
-
let moveClassNames = [ 'kokopu-move' ];
|
|
264
|
-
let onClick = undefined;
|
|
265
|
-
if (this.props.selection && this.props.selection === nodeId) {
|
|
266
|
-
moveClassNames.push('kokopu-selectedMove');
|
|
267
|
-
}
|
|
268
|
-
if (this.props.interactionMode === 'selectMove') {
|
|
269
|
-
moveClassNames.push('kokopu-clickableMove');
|
|
270
|
-
onClick = () => this.handleNodeClicked(nodeId);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
return (
|
|
274
|
-
<span className={moveClassNames.join(' ')} key={node.fullMoveNumber() + node.moveColor()}>
|
|
275
|
-
<span className="kokopu-moveContent" onClick={onClick}>
|
|
276
|
-
{moveNumber}
|
|
277
|
-
<span className="kokopu-moveNotation">{notationText}</span>
|
|
278
|
-
{nagElements.length === 0 ? undefined : nagElements}
|
|
279
|
-
</span>
|
|
280
|
-
</span>
|
|
281
|
-
);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
/**
|
|
285
|
-
* Render the given text comment with its diagrams, if any.
|
|
286
|
-
*/
|
|
287
|
-
renderComment(node, comment, isVariation) {
|
|
288
|
-
let content;
|
|
289
|
-
let sanitizer = createSanitizer(true);
|
|
290
|
-
if (this.props.diagramVisible && comment.includes('[#]')) {
|
|
291
|
-
content = [];
|
|
292
|
-
let isFirstPart = true;
|
|
293
|
-
for (let [index, part] of comment.split('[#]').entries()) {
|
|
294
|
-
if (!isFirstPart) {
|
|
295
|
-
let position = isVariation ? node.initialPosition() : node.position();
|
|
296
|
-
let diagram = <Chessboard position={position} squareMarkers={node.tag('csl')} arrowMarkers={node.tag('cal')} textMarkers={node.tag('ctl')}
|
|
297
|
-
flipped={this.props.diagramOptions.flipped}
|
|
298
|
-
squareSize={this.props.diagramOptions.squareSize}
|
|
299
|
-
coordinateVisible={this.props.diagramOptions.coordinateVisible}
|
|
300
|
-
smallScreenLimits={this.props.diagramOptions.smallScreenLimits}
|
|
301
|
-
colorset={this.props.diagramOptions.colorset}
|
|
302
|
-
pieceset={this.props.diagramOptions.pieceset}
|
|
303
|
-
/>;
|
|
304
|
-
content.push(<div className="kokopu-diagram" key={'diagram-' + index}>{diagram}</div>);
|
|
305
|
-
}
|
|
306
|
-
isFirstPart = false;
|
|
307
|
-
part = part.trim();
|
|
308
|
-
if (part.length !== 0) {
|
|
309
|
-
content.push(sanitizeHtml(part, sanitizer));
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
content = sanitizeHtml(comment, sanitizer);
|
|
315
|
-
}
|
|
316
|
-
let key = isVariation ? 'initial-comment' : node.fullMoveNumber() + node.moveColor() + '-comment';
|
|
317
|
-
return node.isLongComment() ? <div className="kokopu-comment" key={key}>{content}</div> : <span className="kokopu-comment" key={key}>{content}</span>;
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
extractComment(node) {
|
|
321
|
-
let comment = node.comment();
|
|
322
|
-
if (comment) {
|
|
323
|
-
|
|
324
|
-
// Remove the diagrams if necessary.
|
|
325
|
-
if (!this.props.diagramVisible) {
|
|
326
|
-
comment = comment.replace(/\[#\]/g, ' ');
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
// Trim and sanitize the space characters.
|
|
330
|
-
comment = comment.replace(/\s+/g, ' ').trim();
|
|
331
|
-
}
|
|
332
|
-
return comment ? comment : undefined;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
handleKeyDownInFocusField(evt, game) {
|
|
336
|
-
if (evt.key !== 'Home' && evt.key !== 'ArrowLeft' && evt.key !== 'ArrowRight' && evt.key !== 'End') {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
evt.preventDefault();
|
|
340
|
-
if (!this.props.selection) {
|
|
341
|
-
return;
|
|
342
|
-
}
|
|
343
|
-
let nodeId = undefined;
|
|
344
|
-
let evtOrigin = '';
|
|
345
|
-
if (evt.key === 'Home') {
|
|
346
|
-
nodeId = Movetext.firstNodeId(game, this.props.selection);
|
|
347
|
-
evtOrigin = 'key-first';
|
|
348
|
-
}
|
|
349
|
-
else if (evt.key === 'ArrowLeft') {
|
|
350
|
-
nodeId = Movetext.previousNodeId(game, this.props.selection);
|
|
351
|
-
evtOrigin = 'key-previous';
|
|
352
|
-
}
|
|
353
|
-
else if (evt.key === 'ArrowRight') {
|
|
354
|
-
nodeId = Movetext.nextNodeId(game, this.props.selection);
|
|
355
|
-
evtOrigin = 'key-next';
|
|
356
|
-
}
|
|
357
|
-
else { // evt.key === 'End'
|
|
358
|
-
nodeId = Movetext.lastNodeId(game, this.props.selection);
|
|
359
|
-
evtOrigin = 'key-last';
|
|
360
|
-
}
|
|
361
|
-
if (nodeId && this.props.onMoveSelected) {
|
|
362
|
-
this.props.onMoveSelected(nodeId, evtOrigin);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
handleNodeClicked(nodeId) {
|
|
367
|
-
this.focus();
|
|
368
|
-
if (this.props.onMoveSelected) {
|
|
369
|
-
this.props.onMoveSelected(nodeId === this.props.selection ? undefined : nodeId, 'click');
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
|
|
373
|
-
/**
|
|
374
|
-
* Set the focus to the current component.
|
|
375
|
-
*
|
|
376
|
-
* @public
|
|
377
|
-
*/
|
|
378
|
-
focus() {
|
|
379
|
-
this.focusFieldRef.current.focus();
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Return the ID of the main variation in the given chess game.
|
|
384
|
-
* If the given selection corresponds already at the main variation, `undefined` is returned.
|
|
385
|
-
*
|
|
386
|
-
* This corresponds to the operation performed when the user presses key "home" on a `Movetext` component.
|
|
387
|
-
*
|
|
388
|
-
* @param {kokopu.Game} game Considered chess game.
|
|
389
|
-
* @param {string} selection ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
390
|
-
* @returns {string?}
|
|
391
|
-
* @public
|
|
392
|
-
*/
|
|
393
|
-
static firstNodeId(game, selection) {
|
|
394
|
-
if (!game.findById(selection)) {
|
|
395
|
-
return undefined;
|
|
396
|
-
}
|
|
397
|
-
return selection === 'start' ? undefined : 'start';
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
/**
|
|
401
|
-
* Return the ID of the node immediately preceding the given selection in the given chess game.
|
|
402
|
-
* If no such node exists, `undefined` is returned.
|
|
403
|
-
*
|
|
404
|
-
* This corresponds to the operation performed when the user presses key "arrow left" on a `Movetext` component.
|
|
405
|
-
*
|
|
406
|
-
* @param {kokopu.Game} game Considered chess game.
|
|
407
|
-
* @param {string} selection ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
408
|
-
* @returns {string?}
|
|
409
|
-
* @public
|
|
410
|
-
*/
|
|
411
|
-
static previousNodeId(game, selection) {
|
|
412
|
-
let currentNode = game.findById(selection);
|
|
413
|
-
if (!currentNode) {
|
|
414
|
-
return undefined;
|
|
415
|
-
}
|
|
416
|
-
if (selection === 'start') {
|
|
417
|
-
return undefined;
|
|
418
|
-
}
|
|
419
|
-
else if (selection.endsWith('start')) {
|
|
420
|
-
currentNode = currentNode.parentNode(); // `.parentNode()` returns always non-null ref here
|
|
421
|
-
}
|
|
422
|
-
while (currentNode) {
|
|
423
|
-
let previousNode = currentNode.previous();
|
|
424
|
-
if (previousNode) {
|
|
425
|
-
return previousNode.id();
|
|
426
|
-
}
|
|
427
|
-
currentNode = currentNode.parentVariation().parentNode();
|
|
428
|
-
}
|
|
429
|
-
return 'start';
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
/**
|
|
433
|
-
* Return the ID of the node immediately following the given selection in the given chess game.
|
|
434
|
-
* If no such node exists, `undefined` is returned.
|
|
435
|
-
*
|
|
436
|
-
* This corresponds to the operation performed when the user presses key "arrow right" on a `Movetext` component.
|
|
437
|
-
*
|
|
438
|
-
* @param {kokopu.Game} game Considered chess game.
|
|
439
|
-
* @param {string} selection ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
440
|
-
* @returns {string?}
|
|
441
|
-
* @public
|
|
442
|
-
*/
|
|
443
|
-
static nextNodeId(game, selection) {
|
|
444
|
-
let currentNode = game.findById(selection);
|
|
445
|
-
if (!currentNode) {
|
|
446
|
-
return undefined;
|
|
447
|
-
}
|
|
448
|
-
let nextNode = selection.endsWith('start') ? currentNode.first() : currentNode.next();
|
|
449
|
-
return nextNode ? nextNode.id() : undefined;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
/**
|
|
453
|
-
* Return the ID of the node at then end of the variation in which lies the given selection in the given chess game.
|
|
454
|
-
* If the selection is already at the end its variation, `undefined` is returned.
|
|
455
|
-
*
|
|
456
|
-
* This corresponds to the operation performed when the user presses key "end" on a `Movetext` component.
|
|
457
|
-
*
|
|
458
|
-
* @param {kokopu.Game} game Considered chess game.
|
|
459
|
-
* @param {string} selection ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
460
|
-
* @returns {string?}
|
|
461
|
-
* @public
|
|
462
|
-
*/
|
|
463
|
-
static lastNodeId(game, selection) {
|
|
464
|
-
let currentNode = game.findById(selection);
|
|
465
|
-
if (!currentNode) {
|
|
466
|
-
return undefined;
|
|
467
|
-
}
|
|
468
|
-
currentNode = selection.endsWith('start') ? currentNode.first() : currentNode.next();
|
|
469
|
-
if (!currentNode) { // Ensure that the input node is not already the last one.
|
|
470
|
-
return undefined;
|
|
471
|
-
}
|
|
472
|
-
while (true) {
|
|
473
|
-
let nextNode = currentNode.next();
|
|
474
|
-
if (!nextNode) {
|
|
475
|
-
return currentNode.id();
|
|
476
|
-
}
|
|
477
|
-
currentNode = nextNode;
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
Movetext.propTypes = {
|
|
484
|
-
|
|
485
|
-
/**
|
|
486
|
-
* Displayed position. Can be a [kokopu.Game](https://kokopu.yo35.org/docs/current/classes/Game.html) object,
|
|
487
|
-
* a [kokopu.Database](https://kokopu.yo35.org/docs/current/classes/Database.html) object,
|
|
488
|
-
* or a [PGN string](https://en.wikipedia.org/wiki/Portable_Game_Notation).
|
|
489
|
-
*/
|
|
490
|
-
game: PropTypes.oneOfType([
|
|
491
|
-
PropTypes.instanceOf(Game),
|
|
492
|
-
PropTypes.instanceOf(Database),
|
|
493
|
-
PropTypes.string
|
|
494
|
-
]),
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* Index of the game to display (only if attribute `game` is a [kokopu.Database](https://kokopu.yo35.org/docs/current/classes/Database.html)
|
|
498
|
-
* or a [PGN string](https://en.wikipedia.org/wiki/Portable_Game_Notation)): `0` for the first game of the database/PGN, `1` for the second one, etc.
|
|
499
|
-
* If omitted, the first game of the database/PGN is displayed.
|
|
500
|
-
*/
|
|
501
|
-
gameIndex: PropTypes.number,
|
|
502
|
-
|
|
503
|
-
/**
|
|
504
|
-
* Options applicable to the diagrams in the comments. See [Chessboard](#/Components/Chessboard) for more details about each option.
|
|
505
|
-
*/
|
|
506
|
-
diagramOptions: PropTypes.shape({
|
|
507
|
-
flipped: Chessboard.propTypes.flipped,
|
|
508
|
-
squareSize: Chessboard.propTypes.squareSize,
|
|
509
|
-
coordinateVisible: Chessboard.propTypes.coordinateVisible,
|
|
510
|
-
smallScreenLimits: Chessboard.propTypes.smallScreenLimits,
|
|
511
|
-
colorset: Chessboard.propTypes.colorset,
|
|
512
|
-
pieceset: Chessboard.propTypes.pieceset,
|
|
513
|
-
}),
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* Symbols to use for the chess pieces. Can be:
|
|
517
|
-
* - `'native'`: use the first letter of the piece names (in English),
|
|
518
|
-
* - `'localized'`: use the symbols defined by `i18n.PIECE_SYMBOLS`,
|
|
519
|
-
* - `'figurines'`: use the figurines,
|
|
520
|
-
* - or an object defining 6 string-valued properties named `K`, `Q`, `R`, `B`, `N` and `P`.
|
|
521
|
-
*/
|
|
522
|
-
pieceSymbols: PropTypes.oneOfType([
|
|
523
|
-
PropTypes.oneOf([ 'native', 'localized', 'figurines' ]),
|
|
524
|
-
PropTypes.shape({
|
|
525
|
-
K: PropTypes.string.isRequired,
|
|
526
|
-
Q: PropTypes.string.isRequired,
|
|
527
|
-
R: PropTypes.string.isRequired,
|
|
528
|
-
B: PropTypes.string.isRequired,
|
|
529
|
-
N: PropTypes.string.isRequired,
|
|
530
|
-
P: PropTypes.string.isRequired
|
|
531
|
-
})
|
|
532
|
-
]),
|
|
533
|
-
|
|
534
|
-
/**
|
|
535
|
-
* Whether the diagrams within the comments (if any) are displayed or not.
|
|
536
|
-
*/
|
|
537
|
-
diagramVisible: PropTypes.bool,
|
|
538
|
-
|
|
539
|
-
/**
|
|
540
|
-
* Whether the game headers (if any) are displayed or not.
|
|
541
|
-
*/
|
|
542
|
-
headerVisible: PropTypes.bool,
|
|
543
|
-
|
|
544
|
-
/**
|
|
545
|
-
* ID of the selected move (or `'start'` for the beginning of the main variation).
|
|
546
|
-
* Use [kokopu.Node#id](https://kokopu.yo35.org/docs/current/classes/Node.html#id) to get the ID of a game move.
|
|
547
|
-
*/
|
|
548
|
-
selection: PropTypes.string,
|
|
549
|
-
|
|
550
|
-
/**
|
|
551
|
-
* Type of action allowed with the mouse/keys on the component. If undefined, then the user cannot interact with the component.
|
|
552
|
-
*
|
|
553
|
-
* - `'selectMove'` allows the user to select a move.
|
|
554
|
-
*/
|
|
555
|
-
interactionMode: PropTypes.oneOf([ 'selectMove' ]),
|
|
556
|
-
|
|
557
|
-
/**
|
|
558
|
-
* Callback invoked when the user selects a move (only if `interactionMode` is set to `'selectMove'`).
|
|
559
|
-
*
|
|
560
|
-
* @param {string?} nodeId ID of the selected move (as returned by [kokopu.Node#id](https://kokopu.yo35.org/docs/current/classes/Node.html#id)),
|
|
561
|
-
* `'start'` for the beginning of the main variation, or `undefined` if the user unselects the previously selected move.
|
|
562
|
-
* @param {string} evtOrigin Origin of the event. Can be:
|
|
563
|
-
* - `'key-first'`: the event has been triggered by the "go-to-first-move" key (aka. the home key),
|
|
564
|
-
* - `'key-previous'`: the event has been triggered by the "go-to-previous-move" key (aka. the arrow left key),
|
|
565
|
-
* - `'key-next'`: the event has been triggered by the "go-to-next-move" key (aka. the arrow right key),
|
|
566
|
-
* - `'key-last'`: the event has been triggered by the "go-to-last-move" key (aka. the end key),
|
|
567
|
-
* - `'click'`: the event has been triggered by a mouse click on a move.
|
|
568
|
-
*/
|
|
569
|
-
onMoveSelected: PropTypes.func,
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
Movetext.defaultProps = {
|
|
574
|
-
game: new Game(),
|
|
575
|
-
gameIndex: 0,
|
|
576
|
-
diagramOptions: {},
|
|
577
|
-
pieceSymbols: 'native',
|
|
578
|
-
diagramVisible: true,
|
|
579
|
-
headerVisible: true,
|
|
580
|
-
};
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
/**
|
|
584
|
-
* Example: `'hello world'` is turned into `'Hello world'`.
|
|
585
|
-
*/
|
|
586
|
-
function capitalizeFirstWord(text) {
|
|
587
|
-
return text.length===0 ? '' : text.charAt(0).toUpperCase() + text.slice(1);
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
function formatResult(result) {
|
|
592
|
-
switch (result) {
|
|
593
|
-
case '1/2-1/2': return '\u00bd\u2013\u00bd';
|
|
594
|
-
case '1-0': return '1\u20130';
|
|
595
|
-
case '0-1': return '0\u20131';
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
function createSanitizer(withBlockTags) {
|
|
601
|
-
let allowedTags = [
|
|
602
|
-
'span', // general purpose
|
|
603
|
-
'a', // links
|
|
604
|
-
'b', 'strong', 'i', 'em', // bold, italic
|
|
605
|
-
'del', 'ins', 's', 'u', // underline, strikethrough
|
|
606
|
-
'sub', 'sup', // subscript, superscript
|
|
607
|
-
'abbr', // acronym (typically associated to a title=".." tooltip)
|
|
608
|
-
'q', 'cite', // quotation and title of a work
|
|
609
|
-
'mark', // highlighted text
|
|
610
|
-
'small', // smaller text
|
|
611
|
-
];
|
|
612
|
-
let allowedAttributes = {
|
|
613
|
-
'*': [ 'class', 'id', 'title' ],
|
|
614
|
-
'a': [ 'href', 'target' ],
|
|
615
|
-
};
|
|
616
|
-
if (withBlockTags) {
|
|
617
|
-
allowedTags = allowedTags.concat([
|
|
618
|
-
'div', // general purpose
|
|
619
|
-
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', // headings
|
|
620
|
-
'p', 'br', // paragraph and line break
|
|
621
|
-
'blockquote', // long quotation
|
|
622
|
-
'img', // image
|
|
623
|
-
'pre', // preformatted text
|
|
624
|
-
'ul', 'ol', 'li', // lists
|
|
625
|
-
]);
|
|
626
|
-
Object.assign(allowedAttributes, {
|
|
627
|
-
'img': [ 'alt', 'src', 'height', 'width' ],
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
return new HtmlSanitizer({ allowedTags: allowedTags, allowedAttributes: allowedAttributes });
|
|
631
|
-
}
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
function sanitizeHtml(text, sanitizer) {
|
|
635
|
-
if (!sanitizer) {
|
|
636
|
-
sanitizer = createSanitizer(false);
|
|
637
|
-
}
|
|
638
|
-
let result = sanitizer.parse(text);
|
|
639
|
-
return result ?? text;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* Try to interpret the given object as a chess game.
|
|
645
|
-
*/
|
|
646
|
-
function parseGame(game, gameIndex) {
|
|
647
|
-
if (game instanceof Game) {
|
|
648
|
-
return { error: false, game: game };
|
|
649
|
-
}
|
|
650
|
-
else if (game instanceof Database || typeof game === 'string') {
|
|
651
|
-
if (!Number.isInteger(gameIndex) || gameIndex < 0) {
|
|
652
|
-
return { error: true, message: i18n.INVALID_GAME_INDEX_ATTRIBUTE_ERROR_MESSAGE };
|
|
653
|
-
}
|
|
654
|
-
try {
|
|
655
|
-
const result = game instanceof Database ? game.game(gameIndex) : pgnRead(game, gameIndex);
|
|
656
|
-
return { error: false, game: result };
|
|
657
|
-
}
|
|
658
|
-
catch (e) {
|
|
659
|
-
// istanbul ignore else
|
|
660
|
-
if (e instanceof exception.InvalidPGN) {
|
|
661
|
-
return { error: true, message: e.message, text: e.pgn, errorIndex: e.index, lineNumber: e.lineNumber };
|
|
662
|
-
}
|
|
663
|
-
else {
|
|
664
|
-
throw e;
|
|
665
|
-
}
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
else {
|
|
669
|
-
return { error: true, message: i18n.INVALID_GAME_ATTRIBUTE_ERROR_MESSAGE };
|
|
670
|
-
}
|
|
671
|
-
}
|