kokopu-react 3.3.0 → 3.3.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.
Files changed (337) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/lib/chessboard/Chessboard.js +3 -2
  3. package/dist/lib/chessboard/Chessboard.js.map +1 -1
  4. package/dist/lib/chessboard/ChessboardImpl.js +1 -1
  5. package/dist/lib/chessboard/ChessboardImpl.js.map +1 -1
  6. package/dist/lib/chessboard/Motion.js +1 -1
  7. package/dist/lib/chessboard/Motion.js.map +1 -1
  8. package/dist/lib/i18n.js +2 -2
  9. package/dist/lib/i18n.js.map +1 -1
  10. package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -1
  11. package/dist/lib/icons/ChessPieceIcon.d.ts +1 -4
  12. package/dist/lib/icons/ChessPieceIcon.js +1 -5
  13. package/dist/lib/icons/ChessPieceIcon.js.map +1 -1
  14. package/dist/lib/icons/SquareMarkerIcon.d.ts +1 -4
  15. package/dist/lib/icons/SquareMarkerIcon.js +1 -5
  16. package/dist/lib/icons/SquareMarkerIcon.js.map +1 -1
  17. package/dist/lib/icons/TextMarkerIcon.d.ts +1 -4
  18. package/dist/lib/icons/TextMarkerIcon.js +1 -5
  19. package/dist/lib/icons/TextMarkerIcon.js.map +1 -1
  20. package/dist/lib/movetext/Movetext.js.map +1 -1
  21. package/dist/lib/movetext/MovetextImpl.js +4 -3
  22. package/dist/lib/movetext/MovetextImpl.js.map +1 -1
  23. package/dist/lib/movetext/htmlFilter.js +1 -1
  24. package/dist/lib/movetext/htmlFilter.js.map +1 -1
  25. package/dist/lib/navigationboard/NavigationBoard.d.ts +1 -1
  26. package/dist/lib/navigationboard/NavigationBoard.js +2 -2
  27. package/dist/lib/navigationboard/NavigationBoard.js.map +1 -1
  28. package/dist/lib/navigationboard/NavigationField.js +1 -1
  29. package/dist/lib/navigationboard/NavigationField.js.map +1 -1
  30. package/dist/lib/navigationboard/NavigationToolbar.js.map +1 -1
  31. package/dist/lib/util.js +2 -2
  32. package/dist/lib/util.js.map +1 -1
  33. package/doc_src/demo/PageChessboardBase.tsx +57 -51
  34. package/doc_src/demo/PageChessboardInteraction.tsx +78 -63
  35. package/doc_src/demo/PageChessboardMove.tsx +35 -30
  36. package/doc_src/demo/PageChessboardSmallScreens.tsx +3 -3
  37. package/doc_src/demo/PageMovetextBase.tsx +91 -81
  38. package/doc_src/demo/PageMovetextInteraction.tsx +23 -21
  39. package/doc_src/demo/PageNavigationBoardBase.tsx +62 -54
  40. package/doc_src/demo/PageNavigationBoardUncontrolledVsControlled.tsx +24 -18
  41. package/doc_src/theming/LogoRenderer.js +8 -9
  42. package/package.json +30 -28
  43. package/scripts/docker-compose.yml +1 -3
  44. package/src/chessboard/BoardProperties.ts +13 -13
  45. package/src/chessboard/Chessboard.tsx +43 -39
  46. package/src/chessboard/ChessboardImpl.tsx +58 -41
  47. package/src/chessboard/Draggable.tsx +15 -15
  48. package/src/chessboard/Motion.tsx +4 -4
  49. package/src/errorbox/ErrorBox.tsx +5 -5
  50. package/src/errorbox/parsing.tsx +6 -6
  51. package/src/i18n.ts +2 -2
  52. package/src/icons/AnnotationSymbolShape.tsx +5 -5
  53. package/src/icons/ArrowMarkerIcon.tsx +8 -4
  54. package/src/icons/ArrowTip.tsx +2 -2
  55. package/src/icons/ChessPieceIcon.tsx +4 -11
  56. package/src/icons/SquareMarkerIcon.tsx +3 -10
  57. package/src/icons/TextMarkerIcon.tsx +4 -11
  58. package/src/movetext/Movetext.tsx +11 -10
  59. package/src/movetext/MovetextImpl.tsx +34 -28
  60. package/src/movetext/htmlFilter.tsx +4 -4
  61. package/src/navigationboard/NavigationBoard.tsx +55 -50
  62. package/src/navigationboard/NavigationButton.ts +4 -4
  63. package/src/navigationboard/NavigationField.tsx +6 -6
  64. package/src/navigationboard/NavigationToolbar.tsx +17 -13
  65. package/src/types.ts +26 -26
  66. package/src/util.ts +2 -2
  67. package/test/01_types.js +83 -61
  68. package/test/02_chessboard_util.js +2 -0
  69. package/test/03_error_box_graphic.js +1 -1
  70. package/test/07_chessboard_interaction.js +1 -2
  71. package/test/13_navigation_board_graphic.js +3 -3
  72. package/test/common/graphic.js +11 -11
  73. package/test/graphic_references/03_error_box_graphic/base/cut_beginning_of_text.png +0 -0
  74. package/test/graphic_references/03_error_box_graphic/base/cut_end_of_text.png +0 -0
  75. package/test/graphic_references/03_error_box_graphic/base/cut_on_line_breaks.png +0 -0
  76. package/test/graphic_references/03_error_box_graphic/base/error_index_not_integer.png +0 -0
  77. package/test/graphic_references/03_error_box_graphic/base/full.png +0 -0
  78. package/test/graphic_references/03_error_box_graphic/base/minimal.png +0 -0
  79. package/test/graphic_references/03_error_box_graphic/base/missing_error_index.png +0 -0
  80. package/test/graphic_references/03_error_box_graphic/base/missing_error_text.png +0 -0
  81. package/test/graphic_references/03_error_box_graphic/base/negative_error_index.png +0 -0
  82. package/test/graphic_references/03_error_box_graphic/base/single_character_text.png +0 -0
  83. package/test/graphic_references/03_error_box_graphic/base/too_large_error_index.png +0 -0
  84. package/test/graphic_references/03_error_box_graphic/localization/default.png +0 -0
  85. package/test/graphic_references/04_icons_graphic/chess_piece/customized_pieceset.png +0 -0
  86. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_multiple_pieces.png +0 -0
  87. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_pieceset.png +0 -0
  88. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_single_piece.png +0 -0
  89. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_size.png +0 -0
  90. package/test/graphic_references/04_icons_graphic/chess_piece/multiple_pieces.png +0 -0
  91. package/test/graphic_references/04_icons_graphic/chess_piece/single_piece.png +0 -0
  92. package/test/graphic_references/04_icons_graphic/marker/colorized_arrow.png +0 -0
  93. package/test/graphic_references/04_icons_graphic/marker/colorized_square.png +0 -0
  94. package/test/graphic_references/04_icons_graphic/marker/colorized_symbol.png +0 -0
  95. package/test/graphic_references/04_icons_graphic/marker/colorized_text.png +0 -0
  96. package/test/graphic_references/04_icons_graphic/marker/default_arrow.png +0 -0
  97. package/test/graphic_references/04_icons_graphic/marker/default_square.png +0 -0
  98. package/test/graphic_references/04_icons_graphic/marker/default_text.png +0 -0
  99. package/test/graphic_references/04_icons_graphic/marker/invalid_arrow_size.png +0 -0
  100. package/test/graphic_references/04_icons_graphic/marker/invalid_square_size.png +0 -0
  101. package/test/graphic_references/04_icons_graphic/marker/invalid_symbol.png +0 -0
  102. package/test/graphic_references/04_icons_graphic/marker/invalid_text_size.png +0 -0
  103. package/test/graphic_references/04_icons_graphic/marker/wrapped_arrow.png +0 -0
  104. package/test/graphic_references/04_icons_graphic/marker/wrapped_square.png +0 -0
  105. package/test/graphic_references/04_icons_graphic/marker/wrapped_symbol.png +0 -0
  106. package/test/graphic_references/04_icons_graphic/marker/wrapped_text.png +0 -0
  107. package/test/graphic_references/05_chessboard_graphic/annotations/overlap.png +0 -0
  108. package/test/graphic_references/05_chessboard_graphic/annotations/overlap_and_flip.png +0 -0
  109. package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates.png +0 -0
  110. package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates_and_flip.png +0 -0
  111. package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates.png +0 -0
  112. package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates_and_flip.png +0 -0
  113. package/test/graphic_references/05_chessboard_graphic/base/default.png +0 -0
  114. package/test/graphic_references/05_chessboard_graphic/base/empty.png +0 -0
  115. package/test/graphic_references/05_chessboard_graphic/base/from_fen.png +0 -0
  116. package/test/graphic_references/05_chessboard_graphic/base/from_kokopu_object.png +0 -0
  117. package/test/graphic_references/05_chessboard_graphic/base/parsing_error.png +0 -0
  118. package/test/graphic_references/05_chessboard_graphic/base/wrong_position_type.png +0 -0
  119. package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960.png +0 -0
  120. package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960_with_move.png +0 -0
  121. package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant.png +0 -0
  122. package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant_with_fen.png +0 -0
  123. package/test/graphic_references/05_chessboard_graphic/chess_variants/special_code.png +0 -0
  124. package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_with_std_initial_position.png +0 -0
  125. package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_without_std_initial_position.png +0 -0
  126. package/test/graphic_references/05_chessboard_graphic/flipped/default.png +0 -0
  127. package/test/graphic_references/05_chessboard_graphic/flipped/empty.png +0 -0
  128. package/test/graphic_references/05_chessboard_graphic/flipped/from_fen.png +0 -0
  129. package/test/graphic_references/05_chessboard_graphic/flipped/from_kokopu_object.png +0 -0
  130. package/test/graphic_references/05_chessboard_graphic/flipped/parsing_error.png +0 -0
  131. package/test/graphic_references/05_chessboard_graphic/move/capture.png +0 -0
  132. package/test/graphic_references/05_chessboard_graphic/move/castling_move.png +0 -0
  133. package/test/graphic_references/05_chessboard_graphic/move/default.png +0 -0
  134. package/test/graphic_references/05_chessboard_graphic/move/en-passant.png +0 -0
  135. package/test/graphic_references/05_chessboard_graphic/move/illegal_null-move.png +0 -0
  136. package/test/graphic_references/05_chessboard_graphic/move/no_move_arrow.png +0 -0
  137. package/test/graphic_references/05_chessboard_graphic/move/null-move.png +0 -0
  138. package/test/graphic_references/05_chessboard_graphic/move/parsing_error.png +0 -0
  139. package/test/graphic_references/05_chessboard_graphic/move/promotion.png +0 -0
  140. package/test/graphic_references/05_chessboard_graphic/move/with_forced_move_arrow_and_flip.png +0 -0
  141. package/test/graphic_references/05_chessboard_graphic/move/wrong_move_arrow_color_type.png +0 -0
  142. package/test/graphic_references/05_chessboard_graphic/move/wrong_move_type.png +0 -0
  143. package/test/graphic_references/05_chessboard_graphic/theme/custom_1.png +0 -0
  144. package/test/graphic_references/05_chessboard_graphic/theme/custom_2.png +0 -0
  145. package/test/graphic_references/05_chessboard_graphic/theme/custom_3.png +0 -0
  146. package/test/graphic_references/05_chessboard_graphic/theme/custom_4.png +0 -0
  147. package/test/graphic_references/05_chessboard_graphic/theme/custom_5.png +0 -0
  148. package/test/graphic_references/05_chessboard_graphic/theme/custom_6.png +0 -0
  149. package/test/graphic_references/05_chessboard_graphic/theme/default.png +0 -0
  150. package/test/graphic_references/05_chessboard_graphic/theme/large.png +0 -0
  151. package/test/graphic_references/05_chessboard_graphic/theme/small.png +0 -0
  152. package/test/graphic_references/05_chessboard_graphic/theme/wrong_colorset.png +0 -0
  153. package/test/graphic_references/05_chessboard_graphic/theme/wrong_pieceset.png +0 -0
  154. package/test/graphic_references/05_chessboard_graphic/theme/wrong_square_size_type.png +0 -0
  155. package/test/graphic_references/06_chessboard_animation/base_1/capture.png +0 -0
  156. package/test/graphic_references/06_chessboard_animation/base_1/castling_move.png +0 -0
  157. package/test/graphic_references/06_chessboard_animation/base_1/en-passant.png +0 -0
  158. package/test/graphic_references/06_chessboard_animation/base_1/move_1.png +0 -0
  159. package/test/graphic_references/06_chessboard_animation/base_1/move_2.png +0 -0
  160. package/test/graphic_references/06_chessboard_animation/base_1/promotion.png +0 -0
  161. package/test/graphic_references/06_chessboard_animation/base_2/capture.png +0 -0
  162. package/test/graphic_references/06_chessboard_animation/base_2/castling_move.png +0 -0
  163. package/test/graphic_references/06_chessboard_animation/base_2/en-passant.png +0 -0
  164. package/test/graphic_references/06_chessboard_animation/base_2/move_1.png +0 -0
  165. package/test/graphic_references/06_chessboard_animation/base_2/move_2.png +0 -0
  166. package/test/graphic_references/06_chessboard_animation/base_2/promotion.png +0 -0
  167. package/test/graphic_references/06_chessboard_animation/base_3/capture.png +0 -0
  168. package/test/graphic_references/06_chessboard_animation/base_3/castling_move.png +0 -0
  169. package/test/graphic_references/06_chessboard_animation/base_3/en-passant.png +0 -0
  170. package/test/graphic_references/06_chessboard_animation/base_3/move_1.png +0 -0
  171. package/test/graphic_references/06_chessboard_animation/base_3/move_2.png +0 -0
  172. package/test/graphic_references/06_chessboard_animation/base_3/promotion.png +0 -0
  173. package/test/graphic_references/06_chessboard_animation/on_redraw/final_state.png +0 -0
  174. package/test/graphic_references/06_chessboard_animation/on_redraw/initial_state.png +0 -0
  175. package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_1.png +0 -0
  176. package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_2.png +0 -0
  177. package/test/graphic_references/07_chessboard_interaction/edit_arrows/from_==_to.png +0 -0
  178. package/test/graphic_references/07_chessboard_interaction/edit_arrows/out_of_board.png +0 -0
  179. package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_arrow_marker.png +0 -0
  180. package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_square_marker.png +0 -0
  181. package/test/graphic_references/07_chessboard_interaction/error/edit_color_not_set.png +0 -0
  182. package/test/graphic_references/07_chessboard_interaction/error/wrong_interaction_mode.png +0 -0
  183. package/test/graphic_references/07_chessboard_interaction/move_pieces/after_move.png +0 -0
  184. package/test/graphic_references/07_chessboard_interaction/move_pieces/from_==_to.png +0 -0
  185. package/test/graphic_references/07_chessboard_interaction/move_pieces/move_empty_square.png +0 -0
  186. package/test/graphic_references/07_chessboard_interaction/move_pieces/out_of_board.png +0 -0
  187. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_arrow_marker.png +0 -0
  188. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_empty.png +0 -0
  189. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_1.png +0 -0
  190. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_2.png +0 -0
  191. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_square_marker.png +0 -0
  192. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_text_marker.png +0 -0
  193. package/test/graphic_references/08_chessboard_play_moves/base/castling_move.png +0 -0
  194. package/test/graphic_references/08_chessboard_play_moves/base/chess960_ambiguous_king_move.png +0 -0
  195. package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_1.png +0 -0
  196. package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_2.png +0 -0
  197. package/test/graphic_references/08_chessboard_play_moves/base/chess960_non-kxr_castling.png +0 -0
  198. package/test/graphic_references/08_chessboard_play_moves/base/from_==_to.png +0 -0
  199. package/test/graphic_references/08_chessboard_play_moves/base/illegal_move.png +0 -0
  200. package/test/graphic_references/08_chessboard_play_moves/base/illegal_position.png +0 -0
  201. package/test/graphic_references/08_chessboard_play_moves/base/out_of_board.png +0 -0
  202. package/test/graphic_references/08_chessboard_play_moves/base/regular_move_1.png +0 -0
  203. package/test/graphic_references/08_chessboard_play_moves/base/regular_move_2.png +0 -0
  204. package/test/graphic_references/08_chessboard_play_moves/base/wrong_color_moved.png +0 -0
  205. package/test/graphic_references/08_chessboard_play_moves/promotions/antichess_promotion.png +0 -0
  206. package/test/graphic_references/08_chessboard_play_moves/promotions/cancel_promotion.png +0 -0
  207. package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_1.png +0 -0
  208. package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_2.png +0 -0
  209. package/test/graphic_references/09_chessboard_small_screens/base/default.png +0 -0
  210. package/test/graphic_references/09_chessboard_small_screens/base/invalid_limits.png +0 -0
  211. package/test/graphic_references/09_chessboard_small_screens/base/width_690.png +0 -0
  212. package/test/graphic_references/09_chessboard_small_screens/base/width_700.png +0 -0
  213. package/test/graphic_references/09_chessboard_small_screens/base/width_710.png +0 -0
  214. package/test/graphic_references/09_chessboard_small_screens/base/width_720.png +0 -0
  215. package/test/graphic_references/09_chessboard_small_screens/base/width_730.png +0 -0
  216. package/test/graphic_references/09_chessboard_small_screens/base/width_740.png +0 -0
  217. package/test/graphic_references/09_chessboard_small_screens/base/width_750.png +0 -0
  218. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_bottom_component.png +0 -0
  219. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_top_component.png +0 -0
  220. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_bottom_component.png +0 -0
  221. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_top_component.png +0 -0
  222. package/test/graphic_references/10_movetext_graphic/base/game_1.png +0 -0
  223. package/test/graphic_references/10_movetext_graphic/base/game_2.png +0 -0
  224. package/test/graphic_references/10_movetext_graphic/base/game_3.png +0 -0
  225. package/test/graphic_references/10_movetext_graphic/base/game_4.png +0 -0
  226. package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_1.png +0 -0
  227. package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_2.png +0 -0
  228. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_1.png +0 -0
  229. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_2.png +0 -0
  230. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_type.png +0 -0
  231. package/test/graphic_references/10_movetext_graphic/error/wrong_game_type.png +0 -0
  232. package/test/graphic_references/10_movetext_graphic/format_move/format_text.png +0 -0
  233. package/test/graphic_references/10_movetext_graphic/html/filtered_tags_and_attributes.png +0 -0
  234. package/test/graphic_references/10_movetext_graphic/html/html_in_comments.png +0 -0
  235. package/test/graphic_references/10_movetext_graphic/html/html_in_headers.png +0 -0
  236. package/test/graphic_references/10_movetext_graphic/options/custom_piece_symbols.png +0 -0
  237. package/test/graphic_references/10_movetext_graphic/options/figurine_piece_symbols_and_diagram_options.png +0 -0
  238. package/test/graphic_references/10_movetext_graphic/options/hidden_diagrams.png +0 -0
  239. package/test/graphic_references/10_movetext_graphic/options/localized_piece_symbols.png +0 -0
  240. package/test/graphic_references/10_movetext_graphic/options/other_diagram_options.png +0 -0
  241. package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_1.png +0 -0
  242. package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_2.png +0 -0
  243. package/test/graphic_references/10_movetext_graphic/options/wrong_piece_symbol_value.png +0 -0
  244. package/test/graphic_references/11_movetext_interaction/error/wrong_interaction_mode.png +0 -0
  245. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_disabled.png +0 -0
  246. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected.png +0 -0
  247. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected_without_callback.png +0 -0
  248. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_with_variations.png +0 -0
  249. package/test/graphic_references/12_navigation_board_base/controlled/default.png +0 -0
  250. package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_0.png +0 -0
  251. package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_1.png +0 -0
  252. package/test/graphic_references/12_navigation_board_base/controlled/invalid_node_id.png +0 -0
  253. package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_0.png +0 -0
  254. package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_1.png +0 -0
  255. package/test/graphic_references/12_navigation_board_base/controlled/overriding_initial_node_id.png +0 -0
  256. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_0.png +0 -0
  257. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_1.png +0 -0
  258. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_2.png +0 -0
  259. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_3.png +0 -0
  260. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_0.png +0 -0
  261. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_1.png +0 -0
  262. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_2.png +0 -0
  263. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_0.png +0 -0
  264. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_1.png +0 -0
  265. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_2.png +0 -0
  266. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_end.png +0 -0
  267. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_specific_id.png +0 -0
  268. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default.png +0 -0
  269. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default_with_game_index.png +0 -0
  270. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_on_null-move.png +0 -0
  271. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_0.png +0 -0
  272. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_1.png +0 -0
  273. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_2.png +0 -0
  274. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_3.png +0 -0
  275. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_4.png +0 -0
  276. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_0.png +0 -0
  277. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_1.png +0 -0
  278. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_0.png +0 -0
  279. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_1.png +0 -0
  280. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_2.png +0 -0
  281. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_3.png +0 -0
  282. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_4.png +0 -0
  283. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_5.png +0 -0
  284. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_1.png +0 -0
  285. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_2.png +0 -0
  286. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/multiple_buttons.png +0 -0
  287. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/single_button.png +0 -0
  288. package/test/graphic_references/13_navigation_board_graphic/error/pgn_parsing_error.png +0 -0
  289. package/test/graphic_references/13_navigation_board_graphic/error/wrong_game_type.png +0 -0
  290. package/test/graphic_references/13_navigation_board_graphic/theme/custom_1.png +0 -0
  291. package/test/graphic_references/13_navigation_board_graphic/theme/custom_2.png +0 -0
  292. package/test/graphic_references/13_navigation_board_graphic/theme/large.png +0 -0
  293. package/test/graphic_references/13_navigation_board_graphic/theme/small.png +0 -0
  294. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_acknowledging_is-playing_changes.png +0 -0
  295. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_not_acknowledging_is-playing_changes.png +0 -0
  296. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_acknowledging_node_changes.png +0 -0
  297. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_not_acknowledging_node_changes.png +0 -0
  298. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_reaching_the_end.png +0 -0
  299. package/test/graphic_references/14_navigation_board_autoplay/controlled/already_at_the_end.png +0 -0
  300. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_is-playing_changes.png +0 -0
  301. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_node_changes.png +0 -0
  302. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_at_the_end.png +0 -0
  303. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_close_to_end.png +0 -0
  304. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_is-playing_changes.png +0 -0
  305. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_node_changes.png +0 -0
  306. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_after_stop.png +0 -0
  307. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_before_stop.png +0 -0
  308. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_after_stop.png +0 -0
  309. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_before_stop.png +0 -0
  310. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_close_to_end.png +0 -0
  311. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_default.png +0 -0
  312. package/test/graphic_test_app/03_error_box_graphic/base.tsx +18 -6
  313. package/test/graphic_test_app/04_icons_graphic/chess_piece.tsx +12 -3
  314. package/test/graphic_test_app/04_icons_graphic/marker.tsx +14 -4
  315. package/test/graphic_test_app/05_chessboard_graphic/annotations.tsx +7 -3
  316. package/test/graphic_test_app/05_chessboard_graphic/base.tsx +1 -1
  317. package/test/graphic_test_app/05_chessboard_graphic/move.tsx +9 -2
  318. package/test/graphic_test_app/05_chessboard_graphic/theme.tsx +1 -1
  319. package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +8 -6
  320. package/test/graphic_test_app/07_chessboard_interaction/click_squares.tsx +4 -2
  321. package/test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx +4 -2
  322. package/test/graphic_test_app/07_chessboard_interaction/error.tsx +3 -1
  323. package/test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx +4 -2
  324. package/test/graphic_test_app/08_chessboard_play_moves/base.tsx +12 -6
  325. package/test/graphic_test_app/08_chessboard_play_moves/promotions.tsx +12 -3
  326. package/test/graphic_test_app/09_chessboard_small_screens/base.tsx +3 -1
  327. package/test/graphic_test_app/09_chessboard_small_screens/top_bottom_components.tsx +8 -6
  328. package/test/graphic_test_app/10_movetext_graphic/error.tsx +1 -1
  329. package/test/graphic_test_app/10_movetext_graphic/options.tsx +16 -6
  330. package/test/graphic_test_app/11_movetext_interaction/error.tsx +4 -1
  331. package/test/graphic_test_app/13_navigation_board_graphic/additional_buttons.tsx +23 -16
  332. package/test/graphic_test_app/13_navigation_board_graphic/error.tsx +1 -1
  333. package/test/graphic_test_app/14_navigation_board_autoplay/controlled.tsx +34 -18
  334. package/test/graphic_test_app/common/test_app.tsx +4 -4
  335. package/.eslintrc.yml +0 -83
  336. package/test/.eslintrc.yml +0 -8
  337. package/test/graphic_test_app/.eslintrc.yml +0 -3
@@ -48,19 +48,19 @@ import invalidGame from './game-invalid.pgn';
48
48
 
49
49
 
50
50
  interface PageState {
51
- pgn: string;
52
- headerVisible: boolean;
53
- diagramVisible: boolean;
54
- pieceSymbols: 'native' | 'figurines' | 'custom';
55
- customSymbols: PieceSymbolMapping;
51
+ pgn: string,
52
+ headerVisible: boolean,
53
+ diagramVisible: boolean,
54
+ pieceSymbols: 'native' | 'figurines' | 'custom',
55
+ customSymbols: PieceSymbolMapping,
56
56
  diagramOptions: {
57
- flipped: boolean;
58
- squareSize: number;
59
- coordinateVisible: boolean;
60
- turnVisible: boolean;
61
- colorset: string;
62
- pieceset: string;
63
- };
57
+ flipped: boolean,
58
+ squareSize: number,
59
+ coordinateVisible: boolean,
60
+ turnVisible: boolean,
61
+ colorset: string,
62
+ pieceset: string,
63
+ },
64
64
  }
65
65
 
66
66
 
@@ -73,7 +73,7 @@ export default class Page extends React.Component<object, PageState> {
73
73
  headerVisible: true,
74
74
  diagramVisible: true,
75
75
  pieceSymbols: 'figurines',
76
- customSymbols: { K:'R', Q:'D', R:'T', B:'F', N:'C', P:'P' },
76
+ customSymbols: { K: 'R', Q: 'D', R: 'T', B: 'F', N: 'C', P: 'P' },
77
77
  diagramOptions: {
78
78
  flipped: false,
79
79
  squareSize: 32,
@@ -97,66 +97,74 @@ export default class Page extends React.Component<object, PageState> {
97
97
 
98
98
  private renderControls() {
99
99
  const opts = this.state.diagramOptions;
100
- return (<>
101
- <Stack direction="row" spacing={2} alignItems="center">
102
- <ButtonGroup color="primary" size="small">
103
- <Button onClick={() => this.setState({ pgn: game1 })}>Game 1</Button>
104
- <Button onClick={() => this.setState({ pgn: game2 })}>Game 2</Button>
105
- <Button onClick={() => this.setState({ pgn: invalidGame })}>Invalid game</Button>
106
- </ButtonGroup>
107
- <FormControlLabel label="Show headers"
108
- control={<Switch checked={this.state.headerVisible} onChange={() => this.setState({ headerVisible: !this.state.headerVisible })} color="primary" />}
109
- />
110
- <FormControlLabel label="Show diagrams"
111
- control={<Switch checked={this.state.diagramVisible} onChange={() => this.setState({ diagramVisible: !this.state.diagramVisible })} color="primary" />}
112
- />
113
- </Stack>
114
- <Stack direction="row" spacing={2} alignItems="center">
115
- <FormControl variant="standard">
116
- <InputLabel id="piecesymbols-label">Piece symbols</InputLabel>
117
- <Select labelId="piecesymbols-label" sx={{ width: '8em' }} value={this.state.pieceSymbols}
118
- onChange={evt => this.setState({ pieceSymbols: evt.target.value as PageState['pieceSymbols'] })}
119
- >
120
- <MenuItem value="native">Native</MenuItem>
121
- <MenuItem value="figurines">Figurines</MenuItem>
122
- <MenuItem value="custom">Custom</MenuItem>
123
- </Select>
124
- </FormControl>
125
- {this.renderCustomSymbolSelector()}
126
- </Stack>
127
- <Stack direction="row" spacing={2} alignItems="center">
128
- <FormControlLabel label="Flip diagram(s)"
129
- control={<Switch checked={opts.flipped} onChange={() => this.setDiagramOption({ flipped: !opts.flipped })} color="primary" />}
130
- />
131
- <FormControlLabel label="Show coordinates in diagram(s)"
132
- control={<Switch checked={opts.coordinateVisible} onChange={() => this.setDiagramOption({ coordinateVisible: !opts.coordinateVisible })} color="primary" />}
133
- />
134
- <FormControlLabel label="Show turn in diagram(s)"
135
- control={<Switch checked={opts.turnVisible} onChange={() => this.setDiagramOption({ turnVisible: !opts.turnVisible })} color="primary" />}
136
- />
137
- </Stack>
138
- <Stack direction="row" spacing={2} alignItems="center">
139
- <FormControl variant="standard">
140
- <InputLabel id="colorset-label">Colorset</InputLabel>
141
- <Select labelId="colorset-label" sx={{ width: '8em' }} value={opts.colorset} onChange={evt => this.setDiagramOption({ colorset: evt.target.value })}>
142
- {Object.keys(Chessboard.colorsets()).sort().map(colorset => <MenuItem key={colorset} value={colorset}>{colorset}</MenuItem>)}
143
- </Select>
144
- </FormControl>
145
- <FormControl variant="standard">
146
- <InputLabel id="pieceset-label">Pieceset</InputLabel>
147
- <Select labelId="pieceset-label" sx={{ width: '8em' }} value={opts.pieceset} onChange={evt => this.setDiagramOption({ pieceset: evt.target.value })}>
148
- {Object.keys(Chessboard.piecesets()).sort().map(pieceset => <MenuItem key={pieceset} value={pieceset}>{pieceset}</MenuItem>)}
149
- </Select>
150
- </FormControl>
151
- </Stack>
152
- <Box>
153
- <Typography gutterBottom>Diagram square size</Typography>
154
- <Slider
155
- value={opts.squareSize} onChange={(_, newValue) => this.setDiagramOption({ squareSize: newValue as number })}
156
- min={Chessboard.minSquareSize()} max={Chessboard.maxSquareSize()} step={1} valueLabelDisplay="on" color="primary"
157
- />
158
- </Box>
159
- </>);
100
+ return (
101
+ <>
102
+ <Stack direction="row" spacing={2} alignItems="center">
103
+ <ButtonGroup color="primary" size="small">
104
+ <Button onClick={() => this.setState({ pgn: game1 })}>Game 1</Button>
105
+ <Button onClick={() => this.setState({ pgn: game2 })}>Game 2</Button>
106
+ <Button onClick={() => this.setState({ pgn: invalidGame })}>Invalid game</Button>
107
+ </ButtonGroup>
108
+ <FormControlLabel
109
+ label="Show headers"
110
+ control={<Switch checked={this.state.headerVisible} onChange={() => this.setState({ headerVisible: !this.state.headerVisible })} color="primary" />}
111
+ />
112
+ <FormControlLabel
113
+ label="Show diagrams"
114
+ control={<Switch checked={this.state.diagramVisible} onChange={() => this.setState({ diagramVisible: !this.state.diagramVisible })} color="primary" />}
115
+ />
116
+ </Stack>
117
+ <Stack direction="row" spacing={2} alignItems="center">
118
+ <FormControl variant="standard">
119
+ <InputLabel id="piecesymbols-label">Piece symbols</InputLabel>
120
+ <Select
121
+ labelId="piecesymbols-label" sx={{ width: '8em' }} value={this.state.pieceSymbols}
122
+ onChange={evt => this.setState({ pieceSymbols: evt.target.value as PageState['pieceSymbols'] })}
123
+ >
124
+ <MenuItem value="native">Native</MenuItem>
125
+ <MenuItem value="figurines">Figurines</MenuItem>
126
+ <MenuItem value="custom">Custom</MenuItem>
127
+ </Select>
128
+ </FormControl>
129
+ {this.renderCustomSymbolSelector()}
130
+ </Stack>
131
+ <Stack direction="row" spacing={2} alignItems="center">
132
+ <FormControlLabel
133
+ label="Flip diagram(s)"
134
+ control={<Switch checked={opts.flipped} onChange={() => this.setDiagramOption({ flipped: !opts.flipped })} color="primary" />}
135
+ />
136
+ <FormControlLabel
137
+ label="Show coordinates in diagram(s)"
138
+ control={<Switch checked={opts.coordinateVisible} onChange={() => this.setDiagramOption({ coordinateVisible: !opts.coordinateVisible })} color="primary" />}
139
+ />
140
+ <FormControlLabel
141
+ label="Show turn in diagram(s)"
142
+ control={<Switch checked={opts.turnVisible} onChange={() => this.setDiagramOption({ turnVisible: !opts.turnVisible })} color="primary" />}
143
+ />
144
+ </Stack>
145
+ <Stack direction="row" spacing={2} alignItems="center">
146
+ <FormControl variant="standard">
147
+ <InputLabel id="colorset-label">Colorset</InputLabel>
148
+ <Select labelId="colorset-label" sx={{ width: '8em' }} value={opts.colorset} onChange={evt => this.setDiagramOption({ colorset: evt.target.value })}>
149
+ {Object.keys(Chessboard.colorsets()).sort().map(colorset => <MenuItem key={colorset} value={colorset}>{colorset}</MenuItem>)}
150
+ </Select>
151
+ </FormControl>
152
+ <FormControl variant="standard">
153
+ <InputLabel id="pieceset-label">Pieceset</InputLabel>
154
+ <Select labelId="pieceset-label" sx={{ width: '8em' }} value={opts.pieceset} onChange={evt => this.setDiagramOption({ pieceset: evt.target.value })}>
155
+ {Object.keys(Chessboard.piecesets()).sort().map(pieceset => <MenuItem key={pieceset} value={pieceset}>{pieceset}</MenuItem>)}
156
+ </Select>
157
+ </FormControl>
158
+ </Stack>
159
+ <Box>
160
+ <Typography gutterBottom>Diagram square size</Typography>
161
+ <Slider
162
+ value={opts.squareSize} onChange={(_, newValue) => this.setDiagramOption({ squareSize: newValue as number })}
163
+ min={Chessboard.minSquareSize()} max={Chessboard.maxSquareSize()} step={1} valueLabelDisplay="on" color="primary"
164
+ />
165
+ </Box>
166
+ </>
167
+ );
160
168
  }
161
169
 
162
170
  private renderCustomSymbolSelector() {
@@ -164,14 +172,16 @@ export default class Page extends React.Component<object, PageState> {
164
172
  return undefined;
165
173
  }
166
174
  const symbols = this.state.customSymbols;
167
- return (<>
168
- <TextField variant="standard" sx={{ width: '3em' }} label="King" value={symbols.K} onChange={evt => this.handleCustomSymbolChanged('K', evt.target.value)} />
169
- <TextField variant="standard" sx={{ width: '3em' }} label="Queen" value={symbols.Q} onChange={evt => this.handleCustomSymbolChanged('Q', evt.target.value)} />
170
- <TextField variant="standard" sx={{ width: '3em' }} label="Rook" value={symbols.R} onChange={evt => this.handleCustomSymbolChanged('R', evt.target.value)} />
171
- <TextField variant="standard" sx={{ width: '3em' }} label="Bishop" value={symbols.B} onChange={evt => this.handleCustomSymbolChanged('B', evt.target.value)} />
172
- <TextField variant="standard" sx={{ width: '3em' }} label="Knight" value={symbols.N} onChange={evt => this.handleCustomSymbolChanged('N', evt.target.value)} />
173
- <TextField variant="standard" sx={{ width: '3em' }} label="Pawn" value={symbols.P} onChange={evt => this.handleCustomSymbolChanged('P', evt.target.value)} />
174
- </>);
175
+ return (
176
+ <>
177
+ <TextField variant="standard" sx={{ width: '3em' }} label="King" value={symbols.K} onChange={evt => this.handleCustomSymbolChanged('K', evt.target.value)} />
178
+ <TextField variant="standard" sx={{ width: '3em' }} label="Queen" value={symbols.Q} onChange={evt => this.handleCustomSymbolChanged('Q', evt.target.value)} />
179
+ <TextField variant="standard" sx={{ width: '3em' }} label="Rook" value={symbols.R} onChange={evt => this.handleCustomSymbolChanged('R', evt.target.value)} />
180
+ <TextField variant="standard" sx={{ width: '3em' }} label="Bishop" value={symbols.B} onChange={evt => this.handleCustomSymbolChanged('B', evt.target.value)} />
181
+ <TextField variant="standard" sx={{ width: '3em' }} label="Knight" value={symbols.N} onChange={evt => this.handleCustomSymbolChanged('N', evt.target.value)} />
182
+ <TextField variant="standard" sx={{ width: '3em' }} label="Pawn" value={symbols.P} onChange={evt => this.handleCustomSymbolChanged('P', evt.target.value)} />
183
+ </>
184
+ );
175
185
  }
176
186
 
177
187
  private renderMovetext() {
@@ -44,11 +44,11 @@ import game2 from './game-2.pgn';
44
44
 
45
45
 
46
46
  interface PageState {
47
- pgn: string;
48
- selection: string;
49
- interactionMode: 'none' | 'selectMove';
50
- withPopup: boolean;
51
- withMove: boolean;
47
+ pgn: string,
48
+ selection: string,
49
+ interactionMode: 'none' | 'selectMove',
50
+ withPopup: boolean,
51
+ withMove: boolean,
52
52
  }
53
53
 
54
54
 
@@ -77,21 +77,23 @@ export default class Page extends React.Component<object, PageState> {
77
77
  }
78
78
 
79
79
  private renderControls() {
80
- return (<>
81
- <Stack direction="row" spacing={2} alignItems="center">
82
- <ButtonGroup color="primary" size="small">
83
- <Button onClick={() => this.setState({ pgn: game1, selection: '28b' })}>Game 1</Button>
84
- <Button onClick={() => this.setState({ pgn: game2, selection: '15b' })}>Game 2</Button>
85
- </ButtonGroup>
86
- </Stack>
87
- <Box>
88
- <Typography gutterBottom>Interaction mode</Typography>
89
- <RadioGroup value={this.state.interactionMode} onChange={evt => this.setState({ interactionMode: evt.target.value as PageState['interactionMode'] })}>
90
- <FormControlLabel value="none" control={<Radio color="primary" />} label="None" />
91
- <FormControlLabel value="selectMove" control={<Radio color="primary" />} label="Select moves" />
92
- </RadioGroup>
93
- </Box>
94
- </>);
80
+ return (
81
+ <>
82
+ <Stack direction="row" spacing={2} alignItems="center">
83
+ <ButtonGroup color="primary" size="small">
84
+ <Button onClick={() => this.setState({ pgn: game1, selection: '28b' })}>Game 1</Button>
85
+ <Button onClick={() => this.setState({ pgn: game2, selection: '15b' })}>Game 2</Button>
86
+ </ButtonGroup>
87
+ </Stack>
88
+ <Box>
89
+ <Typography gutterBottom>Interaction mode</Typography>
90
+ <RadioGroup value={this.state.interactionMode} onChange={evt => this.setState({ interactionMode: evt.target.value as PageState['interactionMode'] })}>
91
+ <FormControlLabel value="none" control={<Radio color="primary" />} label="None" />
92
+ <FormControlLabel value="selectMove" control={<Radio color="primary" />} label="Select moves" />
93
+ </RadioGroup>
94
+ </Box>
95
+ </>
96
+ );
95
97
  }
96
98
 
97
99
  private renderMovetext() {
@@ -166,7 +168,7 @@ export default class Page extends React.Component<object, PageState> {
166
168
  const node = game.findById(this.state.selection) as GameNode;
167
169
  return {
168
170
  position: this.state.withMove ? node.positionBefore() : node.position(),
169
- move: this.state.withMove ? node.notation() : undefined,
171
+ move: this.state.withMove ? node.notation() : undefined,
170
172
  csl: node.tag('csl'),
171
173
  cal: node.tag('cal'),
172
174
  };
@@ -48,16 +48,16 @@ const COLOR_ICON_SIZE = 16;
48
48
 
49
49
 
50
50
  interface PageState {
51
- squareSize: number;
52
- coordinateVisible: boolean;
53
- turnVisible: boolean;
54
- colorset: string;
55
- pieceset: string;
56
- moveArrowVisible: boolean;
57
- moveArrowColor: AnnotationColor;
58
- animated: boolean;
59
- playButtonVisible: boolean;
60
- flipButtonVisible: boolean;
51
+ squareSize: number,
52
+ coordinateVisible: boolean,
53
+ turnVisible: boolean,
54
+ colorset: string,
55
+ pieceset: string,
56
+ moveArrowVisible: boolean,
57
+ moveArrowColor: AnnotationColor,
58
+ animated: boolean,
59
+ playButtonVisible: boolean,
60
+ flipButtonVisible: boolean,
61
61
  }
62
62
 
63
63
 
@@ -90,50 +90,58 @@ export default class Page extends React.Component<object, PageState> {
90
90
  }
91
91
 
92
92
  private renderControls() {
93
- return (<>
94
- <Stack direction="row" spacing={2} alignItems="center">
95
- <FormControlLabel label="Show play/stop button"
96
- control={<Switch checked={this.state.playButtonVisible} onChange={() => this.setState({ playButtonVisible: !this.state.playButtonVisible })} color="primary" />}
97
- />
98
- <FormControlLabel label="Show flip button"
99
- control={<Switch checked={this.state.flipButtonVisible} onChange={() => this.setState({ flipButtonVisible: !this.state.flipButtonVisible })} color="primary" />}
100
- />
101
- <FormControlLabel label="Show coordinates"
102
- control={<Switch checked={this.state.coordinateVisible} onChange={() => this.setState({ coordinateVisible: !this.state.coordinateVisible })} color="primary" />}
103
- />
104
- <FormControlLabel label="Show turn"
105
- control={<Switch checked={this.state.turnVisible} onChange={() => this.setState({ turnVisible: !this.state.turnVisible })} color="primary" />}
106
- />
107
- <FormControlLabel label="Animated"
108
- control={<Switch checked={this.state.animated} onChange={() => this.setState({ animated: !this.state.animated })} color="primary" />}
109
- />
110
- </Stack>
111
- <Box>
112
- <Typography gutterBottom>Square size</Typography>
113
- <Slider
114
- value={this.state.squareSize} onChange={(_, newValue) => this.setState({ squareSize: newValue as number })}
115
- min={Chessboard.minSquareSize()} max={Chessboard.maxSquareSize()} step={1} valueLabelDisplay="on" color="primary"
116
- />
117
- </Box>
118
- <Stack direction="row" spacing={2} alignItems="center">
119
- <FormControl variant="standard">
120
- <InputLabel id="colorset-label">Colorset</InputLabel>
121
- <Select labelId="colorset-label" sx={{ width: '8em' }} value={this.state.colorset} onChange={evt => this.setState({ colorset: evt.target.value })}>
122
- {Object.keys(Chessboard.colorsets()).sort().map(colorset => <MenuItem key={colorset} value={colorset}>{colorset}</MenuItem>)}
123
- </Select>
124
- </FormControl>
125
- <FormControl variant="standard">
126
- <InputLabel id="pieceset-label">Pieceset</InputLabel>
127
- <Select labelId="pieceset-label" sx={{ width: '8em' }} value={this.state.pieceset} onChange={evt => this.setState({ pieceset: evt.target.value })}>
128
- {Object.keys(Chessboard.piecesets()).sort().map(pieceset => <MenuItem key={pieceset} value={pieceset}>{pieceset}</MenuItem>)}
129
- </Select>
130
- </FormControl>
131
- <FormControlLabel label="Show move arrow"
132
- control={<Switch checked={this.state.moveArrowVisible} onChange={() => this.setState({ moveArrowVisible: !this.state.moveArrowVisible })} color="primary" />}
133
- />
134
- {this.renderMoveArrowColorSelector()}
135
- </Stack>
136
- </>);
93
+ return (
94
+ <>
95
+ <Stack direction="row" spacing={2} alignItems="center">
96
+ <FormControlLabel
97
+ label="Show play/stop button"
98
+ control={<Switch checked={this.state.playButtonVisible} onChange={() => this.setState({ playButtonVisible: !this.state.playButtonVisible })} color="primary" />}
99
+ />
100
+ <FormControlLabel
101
+ label="Show flip button"
102
+ control={<Switch checked={this.state.flipButtonVisible} onChange={() => this.setState({ flipButtonVisible: !this.state.flipButtonVisible })} color="primary" />}
103
+ />
104
+ <FormControlLabel
105
+ label="Show coordinates"
106
+ control={<Switch checked={this.state.coordinateVisible} onChange={() => this.setState({ coordinateVisible: !this.state.coordinateVisible })} color="primary" />}
107
+ />
108
+ <FormControlLabel
109
+ label="Show turn"
110
+ control={<Switch checked={this.state.turnVisible} onChange={() => this.setState({ turnVisible: !this.state.turnVisible })} color="primary" />}
111
+ />
112
+ <FormControlLabel
113
+ label="Animated"
114
+ control={<Switch checked={this.state.animated} onChange={() => this.setState({ animated: !this.state.animated })} color="primary" />}
115
+ />
116
+ </Stack>
117
+ <Box>
118
+ <Typography gutterBottom>Square size</Typography>
119
+ <Slider
120
+ value={this.state.squareSize} onChange={(_, newValue) => this.setState({ squareSize: newValue as number })}
121
+ min={Chessboard.minSquareSize()} max={Chessboard.maxSquareSize()} step={1} valueLabelDisplay="on" color="primary"
122
+ />
123
+ </Box>
124
+ <Stack direction="row" spacing={2} alignItems="center">
125
+ <FormControl variant="standard">
126
+ <InputLabel id="colorset-label">Colorset</InputLabel>
127
+ <Select labelId="colorset-label" sx={{ width: '8em' }} value={this.state.colorset} onChange={evt => this.setState({ colorset: evt.target.value })}>
128
+ {Object.keys(Chessboard.colorsets()).sort().map(colorset => <MenuItem key={colorset} value={colorset}>{colorset}</MenuItem>)}
129
+ </Select>
130
+ </FormControl>
131
+ <FormControl variant="standard">
132
+ <InputLabel id="pieceset-label">Pieceset</InputLabel>
133
+ <Select labelId="pieceset-label" sx={{ width: '8em' }} value={this.state.pieceset} onChange={evt => this.setState({ pieceset: evt.target.value })}>
134
+ {Object.keys(Chessboard.piecesets()).sort().map(pieceset => <MenuItem key={pieceset} value={pieceset}>{pieceset}</MenuItem>)}
135
+ </Select>
136
+ </FormControl>
137
+ <FormControlLabel
138
+ label="Show move arrow"
139
+ control={<Switch checked={this.state.moveArrowVisible} onChange={() => this.setState({ moveArrowVisible: !this.state.moveArrowVisible })} color="primary" />}
140
+ />
141
+ {this.renderMoveArrowColorSelector()}
142
+ </Stack>
143
+ </>
144
+ );
137
145
  }
138
146
 
139
147
  private renderMoveArrowColorSelector() {
@@ -36,7 +36,7 @@ import pgn from './game-3.pgn';
36
36
 
37
37
 
38
38
  interface PageState {
39
- nodeId: string;
39
+ nodeId: string,
40
40
  }
41
41
 
42
42
 
@@ -60,21 +60,23 @@ export default class Page extends React.Component<object, PageState> {
60
60
  }
61
61
 
62
62
  private renderControls() {
63
- return (<>
64
- <Typography>
65
- In uncontrolled mode, the current node ID (aka. the current move) of the <code>NavigationBoard</code> component is managed internally.
66
- No additional code is needed to make the navigation buttons work.
67
- </Typography>
68
- <Typography>
69
- In controlled mode, the current node ID is defined by the <code>nodeId</code> attribute, and a callback must be set
70
- on the <code>onNodeIdChanged</code> attribute to respond to clicks on the navigation buttons.
71
- This mode requires more code, as a state variable holding the current node ID must be explicitely managed out of the component,
72
- but it allows to define more complex behaviors (e.g. synchronizing the node ID on the <code>NavigationBoard</code> with another component).
73
- </Typography>
74
- <Typography>
75
- Whether the component is in uncontrolled mode or controlled mode depends on the presence of the <code>nodeId</code> attribute.
76
- </Typography>
77
- </>);
63
+ return (
64
+ <>
65
+ <Typography>
66
+ In uncontrolled mode, the current node ID (aka. the current move) of the <code>NavigationBoard</code> component is managed internally.
67
+ No additional code is needed to make the navigation buttons work.
68
+ </Typography>
69
+ <Typography>
70
+ In controlled mode, the current node ID is defined by the <code>nodeId</code> attribute, and a callback must be set
71
+ on the <code>onNodeIdChanged</code> attribute to respond to clicks on the navigation buttons.
72
+ This mode requires more code, as a state variable holding the current node ID must be explicitely managed out of the component,
73
+ but it allows to define more complex behaviors (e.g. synchronizing the node ID on the <code>NavigationBoard</code> with another component).
74
+ </Typography>
75
+ <Typography>
76
+ Whether the component is in uncontrolled mode or controlled mode depends on the presence of the <code>nodeId</code> attribute.
77
+ </Typography>
78
+ </>
79
+ );
78
80
  }
79
81
 
80
82
  private renderNavigationBoards() {
@@ -107,8 +109,12 @@ export default class Page extends React.Component<object, PageState> {
107
109
  controlledAttributes.push('onNodeIdChanged={nodeId => handleNodeIdChanged(nodeId)}');
108
110
 
109
111
  const pgnDeclaration = 'const pgn = `\n' + pgn.trim() + '`;\n\n';
110
- return <pre className="kokopu-demoCode">{pgnDeclaration + '// Uncontrolled\n' + buildComponentDemoCode('NavigationBoard', uncontrolledAttributes)
111
- + '\n\n// Controlled\n' + buildComponentDemoCode('NavigationBoard', controlledAttributes)}</pre>;
112
+ return (
113
+ <pre className="kokopu-demoCode">
114
+ {pgnDeclaration + '// Uncontrolled\n' + buildComponentDemoCode('NavigationBoard', uncontrolledAttributes)
115
+ + '\n\n// Controlled\n' + buildComponentDemoCode('NavigationBoard', controlledAttributes)}
116
+ </pre>
117
+ );
112
118
  }
113
119
 
114
120
  }
@@ -27,9 +27,6 @@ import Styled from 'react-styleguidist/lib/client/rsg-components/Styled';
27
27
 
28
28
  import './theming.css';
29
29
 
30
-
31
- /* eslint-disable react/prop-types */
32
-
33
30
  const styles = ({ color, fontFamily, fontSize }) => ({
34
31
  logo: {
35
32
  color: color.base,
@@ -41,12 +38,14 @@ const styles = ({ color, fontFamily, fontSize }) => ({
41
38
  });
42
39
 
43
40
  function LogoRenderer({ classes, children }) {
44
- return (<>
45
- <div className="kokopu-logo">
46
- <img src="kokopu-react-logo.png" />
47
- </div>
48
- <h1 className={classes.logo}>{children}</h1>
49
- </>);
41
+ return (
42
+ <>
43
+ <div className="kokopu-logo">
44
+ <img src="kokopu-react-logo.png" />
45
+ </div>
46
+ <h1 className={classes.logo}>{children}</h1>
47
+ </>
48
+ );
50
49
  }
51
50
 
52
51
  export default Styled(styles)(LogoRenderer);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kokopu-react",
3
- "version": "3.3.0",
3
+ "version": "3.3.1",
4
4
  "description": "A React-based library to create and display chessboard and chess-related components.",
5
5
  "keywords": [
6
6
  "chess",
@@ -43,40 +43,42 @@
43
43
  "htmlparser2": "^9.1.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@babel/preset-env": "^7.24.4",
47
- "@babel/preset-react": "^7.24.1",
48
- "@emotion/react": "^11.11.4",
49
- "@emotion/styled": "^11.11.5",
50
- "@mui/material": "^5.15.15",
51
- "@types/react": "^18.2.79",
52
- "@types/react-dom": "^18.2.25",
53
- "@typescript-eslint/eslint-plugin": "^7.7.0",
54
- "@typescript-eslint/parser": "^7.7.0",
55
- "babel-loader": "^9.1.3",
46
+ "@babel/preset-env": "^7.26.0",
47
+ "@babel/preset-react": "^7.25.9",
48
+ "@emotion/react": "^11.13.3",
49
+ "@emotion/styled": "^11.13.0",
50
+ "@eslint/js": "^9.13.0",
51
+ "@mui/material": "^6.1.6",
52
+ "@stylistic/eslint-plugin": "^2.10.1",
53
+ "@types/react": "^18.3.12",
54
+ "@types/react-dom": "^18.3.1",
55
+ "babel-loader": "^9.2.1",
56
56
  "copy-webpack-plugin": "^12.0.2",
57
57
  "copyfiles": "^2.4.1",
58
58
  "coverage-istanbul-loader": "^3.0.5",
59
- "css-loader": "^7.1.1",
60
- "eslint": "^8.57.0",
61
- "eslint-plugin-react": "~7.33.2",
62
- "html-webpack-plugin": "^5.6.0",
59
+ "css-loader": "^7.1.2",
60
+ "eslint": "^9.13.0",
61
+ "eslint-plugin-react": "^7.37.2",
62
+ "globals": "^15.11.0",
63
+ "html-webpack-plugin": "^5.6.3",
63
64
  "img-diff-js": "^0.5.4",
64
- "kokopu": "^4.10.0",
65
- "mocha": "^10.4.0",
65
+ "kokopu": "^4.11.2",
66
+ "mocha": "^10.8.2",
66
67
  "null-loader": "^4.0.1",
67
- "nyc": "^15.1.0",
68
- "react": "^18.2.0",
68
+ "nyc": "^17.1.0",
69
+ "react": "^18.3.1",
69
70
  "react-docgen-typescript": "^2.2.2",
70
- "react-dom": "^18.2.0",
71
- "react-styleguidist": "^13.1.2",
72
- "rimraf": "^5.0.5",
73
- "selenium-webdriver": "^4.19.0",
74
- "ssh2-sftp-client": "^10.0.3",
71
+ "react-dom": "^18.3.1",
72
+ "react-styleguidist": "^13.1.3",
73
+ "rimraf": "^6.0.1",
74
+ "selenium-webdriver": "^4.26.0",
75
+ "ssh2-sftp-client": "^11.0.0",
75
76
  "style-loader": "^4.0.0",
76
77
  "ts-loader": "^9.5.1",
77
- "typescript": "^5.4.5",
78
+ "typescript": "^5.6.3",
79
+ "typescript-eslint": "^8.12.2",
78
80
  "unit.js": "^2.1.1",
79
- "webpack": "^5.91.0",
81
+ "webpack": "^5.96.1",
80
82
  "webpack-cli": "^5.1.4"
81
83
  },
82
84
  "scripts": {
@@ -84,8 +86,8 @@
84
86
  "preunit": "npm run build:lib && webpack --config scripts/test-headless.webpack.config.js && webpack --config scripts/test-graphic.webpack.config.js && rimraf build/graphic_output",
85
87
  "unit": "nyc mocha --enable-source-maps --bail --sort",
86
88
  "test": "npm run lint && npm run unit",
87
- "test_env:start": "docker-compose -p kokopu-react-test-env -f scripts/docker-compose.yml up -d",
88
- "test_env:stop": "docker-compose -p kokopu-react-test-env -f scripts/docker-compose.yml down",
89
+ "test_env:start": "docker compose -p kokopu-react-test-env -f scripts/docker-compose.yml up -d",
90
+ "test_env:stop": "docker compose -p kokopu-react-test-env -f scripts/docker-compose.yml down",
89
91
  "build": "npm run build:lib && npm run build:doc",
90
92
  "build:doc": "rimraf dist/docs && styleguidist build --config scripts/doc.styleguide.config.js && copyfiles -u 2 'doc_src/theming/*.png' dist/docs",
91
93
  "build:lib": "rimraf dist/lib && tsc --outDir dist/lib && copyfiles -u 1 'src/**/*.{css,png,woff,woff2}' dist/lib",
@@ -1,8 +1,6 @@
1
- version: "3.7"
2
-
3
1
  services:
4
2
  web-client:
5
- image: selenium/standalone-firefox:4.19.1-20240402 # https://github.com/SeleniumHQ/docker-selenium to get the latest version
3
+ image: selenium/standalone-firefox:4.25.0-20241024 # https://github.com/SeleniumHQ/docker-selenium to get the latest version
6
4
  shm_size: '2gb'
7
5
  ports:
8
6
  - 4444:4444 # http://localhost:4444/ (driver)