kokopu-react 3.2.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 (347) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/lib/chessboard/Chessboard.d.ts +27 -2
  3. package/dist/lib/chessboard/Chessboard.js +38 -18
  4. package/dist/lib/chessboard/Chessboard.js.map +1 -1
  5. package/dist/lib/chessboard/ChessboardImpl.js +1 -1
  6. package/dist/lib/chessboard/ChessboardImpl.js.map +1 -1
  7. package/dist/lib/chessboard/Motion.js +1 -1
  8. package/dist/lib/chessboard/Motion.js.map +1 -1
  9. package/dist/lib/i18n.js +2 -2
  10. package/dist/lib/i18n.js.map +1 -1
  11. package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -1
  12. package/dist/lib/icons/ChessPieceIcon.d.ts +1 -4
  13. package/dist/lib/icons/ChessPieceIcon.js +1 -5
  14. package/dist/lib/icons/ChessPieceIcon.js.map +1 -1
  15. package/dist/lib/icons/SquareMarkerIcon.d.ts +1 -4
  16. package/dist/lib/icons/SquareMarkerIcon.js +1 -5
  17. package/dist/lib/icons/SquareMarkerIcon.js.map +1 -1
  18. package/dist/lib/icons/TextMarkerIcon.d.ts +1 -4
  19. package/dist/lib/icons/TextMarkerIcon.js +1 -5
  20. package/dist/lib/icons/TextMarkerIcon.js.map +1 -1
  21. package/dist/lib/index.d.ts +1 -1
  22. package/dist/lib/index.js +1 -1
  23. package/dist/lib/index.js.map +1 -1
  24. package/dist/lib/movetext/Movetext.js.map +1 -1
  25. package/dist/lib/movetext/MovetextImpl.js +4 -3
  26. package/dist/lib/movetext/MovetextImpl.js.map +1 -1
  27. package/dist/lib/movetext/htmlFilter.js +1 -1
  28. package/dist/lib/movetext/htmlFilter.js.map +1 -1
  29. package/dist/lib/navigationboard/NavigationBoard.d.ts +37 -8
  30. package/dist/lib/navigationboard/NavigationBoard.js +67 -22
  31. package/dist/lib/navigationboard/NavigationBoard.js.map +1 -1
  32. package/dist/lib/navigationboard/NavigationButton.d.ts +13 -1
  33. package/dist/lib/navigationboard/NavigationButton.js +32 -0
  34. package/dist/lib/navigationboard/NavigationButton.js.map +1 -1
  35. package/dist/lib/navigationboard/NavigationField.js +1 -1
  36. package/dist/lib/navigationboard/NavigationField.js.map +1 -1
  37. package/dist/lib/navigationboard/NavigationToolbar.d.ts +9 -2
  38. package/dist/lib/navigationboard/NavigationToolbar.js +34 -1
  39. package/dist/lib/navigationboard/NavigationToolbar.js.map +1 -1
  40. package/dist/lib/util.js +2 -2
  41. package/dist/lib/util.js.map +1 -1
  42. package/doc_src/demo/PageChessboardBase.tsx +57 -51
  43. package/doc_src/demo/PageChessboardInteraction.tsx +78 -63
  44. package/doc_src/demo/PageChessboardMove.tsx +35 -30
  45. package/doc_src/demo/PageChessboardSmallScreens.tsx +3 -3
  46. package/doc_src/demo/PageMovetextBase.tsx +91 -81
  47. package/doc_src/demo/PageMovetextInteraction.tsx +23 -21
  48. package/doc_src/demo/PageNavigationBoardBase.tsx +62 -54
  49. package/doc_src/demo/PageNavigationBoardUncontrolledVsControlled.tsx +24 -18
  50. package/doc_src/theming/LogoRenderer.js +8 -9
  51. package/package.json +30 -28
  52. package/scripts/docker-compose.yml +1 -3
  53. package/src/chessboard/BoardProperties.ts +13 -13
  54. package/src/chessboard/Chessboard.tsx +106 -46
  55. package/src/chessboard/ChessboardImpl.tsx +58 -41
  56. package/src/chessboard/Draggable.tsx +15 -15
  57. package/src/chessboard/Motion.tsx +4 -4
  58. package/src/errorbox/ErrorBox.tsx +5 -5
  59. package/src/errorbox/parsing.tsx +6 -6
  60. package/src/i18n.ts +2 -2
  61. package/src/icons/AnnotationSymbolShape.tsx +5 -5
  62. package/src/icons/ArrowMarkerIcon.tsx +8 -4
  63. package/src/icons/ArrowTip.tsx +2 -2
  64. package/src/icons/ChessPieceIcon.tsx +4 -11
  65. package/src/icons/SquareMarkerIcon.tsx +3 -10
  66. package/src/icons/TextMarkerIcon.tsx +4 -11
  67. package/src/index.ts +1 -1
  68. package/src/movetext/Movetext.tsx +11 -10
  69. package/src/movetext/MovetextImpl.tsx +34 -28
  70. package/src/movetext/htmlFilter.tsx +4 -4
  71. package/src/navigationboard/NavigationBoard.tsx +150 -58
  72. package/src/navigationboard/NavigationButton.ts +47 -5
  73. package/src/navigationboard/NavigationField.tsx +6 -6
  74. package/src/navigationboard/NavigationToolbar.tsx +62 -15
  75. package/src/types.ts +26 -26
  76. package/src/util.ts +2 -2
  77. package/test/01_types.js +83 -61
  78. package/test/02_chessboard_util.js +79 -1
  79. package/test/03_error_box_graphic.js +1 -1
  80. package/test/07_chessboard_interaction.js +1 -2
  81. package/test/13_navigation_board_graphic.js +3 -3
  82. package/test/common/graphic.js +11 -11
  83. package/test/graphic_references/03_error_box_graphic/base/cut_beginning_of_text.png +0 -0
  84. package/test/graphic_references/03_error_box_graphic/base/cut_end_of_text.png +0 -0
  85. package/test/graphic_references/03_error_box_graphic/base/cut_on_line_breaks.png +0 -0
  86. package/test/graphic_references/03_error_box_graphic/base/error_index_not_integer.png +0 -0
  87. package/test/graphic_references/03_error_box_graphic/base/full.png +0 -0
  88. package/test/graphic_references/03_error_box_graphic/base/minimal.png +0 -0
  89. package/test/graphic_references/03_error_box_graphic/base/missing_error_index.png +0 -0
  90. package/test/graphic_references/03_error_box_graphic/base/missing_error_text.png +0 -0
  91. package/test/graphic_references/03_error_box_graphic/base/negative_error_index.png +0 -0
  92. package/test/graphic_references/03_error_box_graphic/base/single_character_text.png +0 -0
  93. package/test/graphic_references/03_error_box_graphic/base/too_large_error_index.png +0 -0
  94. package/test/graphic_references/03_error_box_graphic/localization/default.png +0 -0
  95. package/test/graphic_references/04_icons_graphic/chess_piece/customized_pieceset.png +0 -0
  96. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_multiple_pieces.png +0 -0
  97. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_pieceset.png +0 -0
  98. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_single_piece.png +0 -0
  99. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_size.png +0 -0
  100. package/test/graphic_references/04_icons_graphic/chess_piece/multiple_pieces.png +0 -0
  101. package/test/graphic_references/04_icons_graphic/chess_piece/single_piece.png +0 -0
  102. package/test/graphic_references/04_icons_graphic/marker/colorized_arrow.png +0 -0
  103. package/test/graphic_references/04_icons_graphic/marker/colorized_square.png +0 -0
  104. package/test/graphic_references/04_icons_graphic/marker/colorized_symbol.png +0 -0
  105. package/test/graphic_references/04_icons_graphic/marker/colorized_text.png +0 -0
  106. package/test/graphic_references/04_icons_graphic/marker/default_arrow.png +0 -0
  107. package/test/graphic_references/04_icons_graphic/marker/default_square.png +0 -0
  108. package/test/graphic_references/04_icons_graphic/marker/default_text.png +0 -0
  109. package/test/graphic_references/04_icons_graphic/marker/invalid_arrow_size.png +0 -0
  110. package/test/graphic_references/04_icons_graphic/marker/invalid_square_size.png +0 -0
  111. package/test/graphic_references/04_icons_graphic/marker/invalid_symbol.png +0 -0
  112. package/test/graphic_references/04_icons_graphic/marker/invalid_text_size.png +0 -0
  113. package/test/graphic_references/04_icons_graphic/marker/wrapped_arrow.png +0 -0
  114. package/test/graphic_references/04_icons_graphic/marker/wrapped_square.png +0 -0
  115. package/test/graphic_references/04_icons_graphic/marker/wrapped_symbol.png +0 -0
  116. package/test/graphic_references/04_icons_graphic/marker/wrapped_text.png +0 -0
  117. package/test/graphic_references/05_chessboard_graphic/annotations/overlap.png +0 -0
  118. package/test/graphic_references/05_chessboard_graphic/annotations/overlap_and_flip.png +0 -0
  119. package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates.png +0 -0
  120. package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates_and_flip.png +0 -0
  121. package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates.png +0 -0
  122. package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates_and_flip.png +0 -0
  123. package/test/graphic_references/05_chessboard_graphic/base/default.png +0 -0
  124. package/test/graphic_references/05_chessboard_graphic/base/empty.png +0 -0
  125. package/test/graphic_references/05_chessboard_graphic/base/from_fen.png +0 -0
  126. package/test/graphic_references/05_chessboard_graphic/base/from_kokopu_object.png +0 -0
  127. package/test/graphic_references/05_chessboard_graphic/base/parsing_error.png +0 -0
  128. package/test/graphic_references/05_chessboard_graphic/base/wrong_position_type.png +0 -0
  129. package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960.png +0 -0
  130. package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960_with_move.png +0 -0
  131. package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant.png +0 -0
  132. package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant_with_fen.png +0 -0
  133. package/test/graphic_references/05_chessboard_graphic/chess_variants/special_code.png +0 -0
  134. package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_with_std_initial_position.png +0 -0
  135. package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_without_std_initial_position.png +0 -0
  136. package/test/graphic_references/05_chessboard_graphic/flipped/default.png +0 -0
  137. package/test/graphic_references/05_chessboard_graphic/flipped/empty.png +0 -0
  138. package/test/graphic_references/05_chessboard_graphic/flipped/from_fen.png +0 -0
  139. package/test/graphic_references/05_chessboard_graphic/flipped/from_kokopu_object.png +0 -0
  140. package/test/graphic_references/05_chessboard_graphic/flipped/parsing_error.png +0 -0
  141. package/test/graphic_references/05_chessboard_graphic/move/capture.png +0 -0
  142. package/test/graphic_references/05_chessboard_graphic/move/castling_move.png +0 -0
  143. package/test/graphic_references/05_chessboard_graphic/move/default.png +0 -0
  144. package/test/graphic_references/05_chessboard_graphic/move/en-passant.png +0 -0
  145. package/test/graphic_references/05_chessboard_graphic/move/illegal_null-move.png +0 -0
  146. package/test/graphic_references/05_chessboard_graphic/move/no_move_arrow.png +0 -0
  147. package/test/graphic_references/05_chessboard_graphic/move/null-move.png +0 -0
  148. package/test/graphic_references/05_chessboard_graphic/move/parsing_error.png +0 -0
  149. package/test/graphic_references/05_chessboard_graphic/move/promotion.png +0 -0
  150. package/test/graphic_references/05_chessboard_graphic/move/with_forced_move_arrow_and_flip.png +0 -0
  151. package/test/graphic_references/05_chessboard_graphic/move/wrong_move_arrow_color_type.png +0 -0
  152. package/test/graphic_references/05_chessboard_graphic/move/wrong_move_type.png +0 -0
  153. package/test/graphic_references/05_chessboard_graphic/theme/custom_1.png +0 -0
  154. package/test/graphic_references/05_chessboard_graphic/theme/custom_2.png +0 -0
  155. package/test/graphic_references/05_chessboard_graphic/theme/custom_3.png +0 -0
  156. package/test/graphic_references/05_chessboard_graphic/theme/custom_4.png +0 -0
  157. package/test/graphic_references/05_chessboard_graphic/theme/custom_5.png +0 -0
  158. package/test/graphic_references/05_chessboard_graphic/theme/custom_6.png +0 -0
  159. package/test/graphic_references/05_chessboard_graphic/theme/default.png +0 -0
  160. package/test/graphic_references/05_chessboard_graphic/theme/large.png +0 -0
  161. package/test/graphic_references/05_chessboard_graphic/theme/small.png +0 -0
  162. package/test/graphic_references/05_chessboard_graphic/theme/wrong_colorset.png +0 -0
  163. package/test/graphic_references/05_chessboard_graphic/theme/wrong_pieceset.png +0 -0
  164. package/test/graphic_references/05_chessboard_graphic/theme/wrong_square_size_type.png +0 -0
  165. package/test/graphic_references/06_chessboard_animation/base_1/capture.png +0 -0
  166. package/test/graphic_references/06_chessboard_animation/base_1/castling_move.png +0 -0
  167. package/test/graphic_references/06_chessboard_animation/base_1/en-passant.png +0 -0
  168. package/test/graphic_references/06_chessboard_animation/base_1/move_1.png +0 -0
  169. package/test/graphic_references/06_chessboard_animation/base_1/move_2.png +0 -0
  170. package/test/graphic_references/06_chessboard_animation/base_1/promotion.png +0 -0
  171. package/test/graphic_references/06_chessboard_animation/base_2/capture.png +0 -0
  172. package/test/graphic_references/06_chessboard_animation/base_2/castling_move.png +0 -0
  173. package/test/graphic_references/06_chessboard_animation/base_2/en-passant.png +0 -0
  174. package/test/graphic_references/06_chessboard_animation/base_2/move_1.png +0 -0
  175. package/test/graphic_references/06_chessboard_animation/base_2/move_2.png +0 -0
  176. package/test/graphic_references/06_chessboard_animation/base_2/promotion.png +0 -0
  177. package/test/graphic_references/06_chessboard_animation/base_3/capture.png +0 -0
  178. package/test/graphic_references/06_chessboard_animation/base_3/castling_move.png +0 -0
  179. package/test/graphic_references/06_chessboard_animation/base_3/en-passant.png +0 -0
  180. package/test/graphic_references/06_chessboard_animation/base_3/move_1.png +0 -0
  181. package/test/graphic_references/06_chessboard_animation/base_3/move_2.png +0 -0
  182. package/test/graphic_references/06_chessboard_animation/base_3/promotion.png +0 -0
  183. package/test/graphic_references/06_chessboard_animation/on_redraw/final_state.png +0 -0
  184. package/test/graphic_references/06_chessboard_animation/on_redraw/initial_state.png +0 -0
  185. package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_1.png +0 -0
  186. package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_2.png +0 -0
  187. package/test/graphic_references/07_chessboard_interaction/edit_arrows/from_==_to.png +0 -0
  188. package/test/graphic_references/07_chessboard_interaction/edit_arrows/out_of_board.png +0 -0
  189. package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_arrow_marker.png +0 -0
  190. package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_square_marker.png +0 -0
  191. package/test/graphic_references/07_chessboard_interaction/error/edit_color_not_set.png +0 -0
  192. package/test/graphic_references/07_chessboard_interaction/error/wrong_interaction_mode.png +0 -0
  193. package/test/graphic_references/07_chessboard_interaction/move_pieces/after_move.png +0 -0
  194. package/test/graphic_references/07_chessboard_interaction/move_pieces/from_==_to.png +0 -0
  195. package/test/graphic_references/07_chessboard_interaction/move_pieces/move_empty_square.png +0 -0
  196. package/test/graphic_references/07_chessboard_interaction/move_pieces/out_of_board.png +0 -0
  197. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_arrow_marker.png +0 -0
  198. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_empty.png +0 -0
  199. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_1.png +0 -0
  200. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_2.png +0 -0
  201. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_square_marker.png +0 -0
  202. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_text_marker.png +0 -0
  203. package/test/graphic_references/08_chessboard_play_moves/base/castling_move.png +0 -0
  204. package/test/graphic_references/08_chessboard_play_moves/base/chess960_ambiguous_king_move.png +0 -0
  205. package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_1.png +0 -0
  206. package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_2.png +0 -0
  207. package/test/graphic_references/08_chessboard_play_moves/base/chess960_non-kxr_castling.png +0 -0
  208. package/test/graphic_references/08_chessboard_play_moves/base/from_==_to.png +0 -0
  209. package/test/graphic_references/08_chessboard_play_moves/base/illegal_move.png +0 -0
  210. package/test/graphic_references/08_chessboard_play_moves/base/illegal_position.png +0 -0
  211. package/test/graphic_references/08_chessboard_play_moves/base/out_of_board.png +0 -0
  212. package/test/graphic_references/08_chessboard_play_moves/base/regular_move_1.png +0 -0
  213. package/test/graphic_references/08_chessboard_play_moves/base/regular_move_2.png +0 -0
  214. package/test/graphic_references/08_chessboard_play_moves/base/wrong_color_moved.png +0 -0
  215. package/test/graphic_references/08_chessboard_play_moves/promotions/antichess_promotion.png +0 -0
  216. package/test/graphic_references/08_chessboard_play_moves/promotions/cancel_promotion.png +0 -0
  217. package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_1.png +0 -0
  218. package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_2.png +0 -0
  219. package/test/graphic_references/09_chessboard_small_screens/base/default.png +0 -0
  220. package/test/graphic_references/09_chessboard_small_screens/base/invalid_limits.png +0 -0
  221. package/test/graphic_references/09_chessboard_small_screens/base/width_690.png +0 -0
  222. package/test/graphic_references/09_chessboard_small_screens/base/width_700.png +0 -0
  223. package/test/graphic_references/09_chessboard_small_screens/base/width_710.png +0 -0
  224. package/test/graphic_references/09_chessboard_small_screens/base/width_720.png +0 -0
  225. package/test/graphic_references/09_chessboard_small_screens/base/width_730.png +0 -0
  226. package/test/graphic_references/09_chessboard_small_screens/base/width_740.png +0 -0
  227. package/test/graphic_references/09_chessboard_small_screens/base/width_750.png +0 -0
  228. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_bottom_component.png +0 -0
  229. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_top_component.png +0 -0
  230. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_bottom_component.png +0 -0
  231. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_top_component.png +0 -0
  232. package/test/graphic_references/10_movetext_graphic/base/game_1.png +0 -0
  233. package/test/graphic_references/10_movetext_graphic/base/game_2.png +0 -0
  234. package/test/graphic_references/10_movetext_graphic/base/game_3.png +0 -0
  235. package/test/graphic_references/10_movetext_graphic/base/game_4.png +0 -0
  236. package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_1.png +0 -0
  237. package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_2.png +0 -0
  238. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_1.png +0 -0
  239. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_2.png +0 -0
  240. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_type.png +0 -0
  241. package/test/graphic_references/10_movetext_graphic/error/wrong_game_type.png +0 -0
  242. package/test/graphic_references/10_movetext_graphic/format_move/format_text.png +0 -0
  243. package/test/graphic_references/10_movetext_graphic/html/filtered_tags_and_attributes.png +0 -0
  244. package/test/graphic_references/10_movetext_graphic/html/html_in_comments.png +0 -0
  245. package/test/graphic_references/10_movetext_graphic/html/html_in_headers.png +0 -0
  246. package/test/graphic_references/10_movetext_graphic/options/custom_piece_symbols.png +0 -0
  247. package/test/graphic_references/10_movetext_graphic/options/figurine_piece_symbols_and_diagram_options.png +0 -0
  248. package/test/graphic_references/10_movetext_graphic/options/hidden_diagrams.png +0 -0
  249. package/test/graphic_references/10_movetext_graphic/options/localized_piece_symbols.png +0 -0
  250. package/test/graphic_references/10_movetext_graphic/options/other_diagram_options.png +0 -0
  251. package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_1.png +0 -0
  252. package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_2.png +0 -0
  253. package/test/graphic_references/10_movetext_graphic/options/wrong_piece_symbol_value.png +0 -0
  254. package/test/graphic_references/11_movetext_interaction/error/wrong_interaction_mode.png +0 -0
  255. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_disabled.png +0 -0
  256. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected.png +0 -0
  257. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected_without_callback.png +0 -0
  258. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_with_variations.png +0 -0
  259. package/test/graphic_references/12_navigation_board_base/controlled/default.png +0 -0
  260. package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_0.png +0 -0
  261. package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_1.png +0 -0
  262. package/test/graphic_references/12_navigation_board_base/controlled/invalid_node_id.png +0 -0
  263. package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_0.png +0 -0
  264. package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_1.png +0 -0
  265. package/test/graphic_references/12_navigation_board_base/controlled/overriding_initial_node_id.png +0 -0
  266. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_0.png +0 -0
  267. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_1.png +0 -0
  268. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_2.png +0 -0
  269. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_3.png +0 -0
  270. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_0.png +0 -0
  271. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_1.png +0 -0
  272. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_2.png +0 -0
  273. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_0.png +0 -0
  274. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_1.png +0 -0
  275. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_2.png +0 -0
  276. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_end.png +0 -0
  277. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_specific_id.png +0 -0
  278. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default.png +0 -0
  279. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default_with_game_index.png +0 -0
  280. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_on_null-move.png +0 -0
  281. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_0.png +0 -0
  282. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_1.png +0 -0
  283. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_2.png +0 -0
  284. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_3.png +0 -0
  285. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_4.png +0 -0
  286. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_0.png +0 -0
  287. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_1.png +0 -0
  288. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_0.png +0 -0
  289. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_1.png +0 -0
  290. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_2.png +0 -0
  291. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_3.png +0 -0
  292. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_4.png +0 -0
  293. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_5.png +0 -0
  294. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_1.png +0 -0
  295. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_2.png +0 -0
  296. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/multiple_buttons.png +0 -0
  297. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/single_button.png +0 -0
  298. package/test/graphic_references/13_navigation_board_graphic/error/pgn_parsing_error.png +0 -0
  299. package/test/graphic_references/13_navigation_board_graphic/error/wrong_game_type.png +0 -0
  300. package/test/graphic_references/13_navigation_board_graphic/theme/custom_1.png +0 -0
  301. package/test/graphic_references/13_navigation_board_graphic/theme/custom_2.png +0 -0
  302. package/test/graphic_references/13_navigation_board_graphic/theme/large.png +0 -0
  303. package/test/graphic_references/13_navigation_board_graphic/theme/small.png +0 -0
  304. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_acknowledging_is-playing_changes.png +0 -0
  305. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_not_acknowledging_is-playing_changes.png +0 -0
  306. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_acknowledging_node_changes.png +0 -0
  307. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_not_acknowledging_node_changes.png +0 -0
  308. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_reaching_the_end.png +0 -0
  309. package/test/graphic_references/14_navigation_board_autoplay/controlled/already_at_the_end.png +0 -0
  310. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_is-playing_changes.png +0 -0
  311. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_node_changes.png +0 -0
  312. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_at_the_end.png +0 -0
  313. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_close_to_end.png +0 -0
  314. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_is-playing_changes.png +0 -0
  315. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_node_changes.png +0 -0
  316. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_after_stop.png +0 -0
  317. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_before_stop.png +0 -0
  318. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_after_stop.png +0 -0
  319. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_before_stop.png +0 -0
  320. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_close_to_end.png +0 -0
  321. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_default.png +0 -0
  322. package/test/graphic_test_app/03_error_box_graphic/base.tsx +18 -6
  323. package/test/graphic_test_app/04_icons_graphic/chess_piece.tsx +12 -3
  324. package/test/graphic_test_app/04_icons_graphic/marker.tsx +14 -4
  325. package/test/graphic_test_app/05_chessboard_graphic/annotations.tsx +7 -3
  326. package/test/graphic_test_app/05_chessboard_graphic/base.tsx +1 -1
  327. package/test/graphic_test_app/05_chessboard_graphic/move.tsx +9 -2
  328. package/test/graphic_test_app/05_chessboard_graphic/theme.tsx +1 -1
  329. package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +8 -6
  330. package/test/graphic_test_app/07_chessboard_interaction/click_squares.tsx +4 -2
  331. package/test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx +4 -2
  332. package/test/graphic_test_app/07_chessboard_interaction/error.tsx +3 -1
  333. package/test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx +4 -2
  334. package/test/graphic_test_app/08_chessboard_play_moves/base.tsx +12 -6
  335. package/test/graphic_test_app/08_chessboard_play_moves/promotions.tsx +12 -3
  336. package/test/graphic_test_app/09_chessboard_small_screens/base.tsx +3 -1
  337. package/test/graphic_test_app/09_chessboard_small_screens/top_bottom_components.tsx +8 -6
  338. package/test/graphic_test_app/10_movetext_graphic/error.tsx +1 -1
  339. package/test/graphic_test_app/10_movetext_graphic/options.tsx +16 -6
  340. package/test/graphic_test_app/11_movetext_interaction/error.tsx +4 -1
  341. package/test/graphic_test_app/13_navigation_board_graphic/additional_buttons.tsx +24 -17
  342. package/test/graphic_test_app/13_navigation_board_graphic/error.tsx +1 -1
  343. package/test/graphic_test_app/14_navigation_board_autoplay/controlled.tsx +34 -18
  344. package/test/graphic_test_app/common/test_app.tsx +4 -4
  345. package/.eslintrc.yml +0 -83
  346. package/test/.eslintrc.yml +0 -8
  347. package/test/graphic_test_app/.eslintrc.yml +0 -3
@@ -48,14 +48,14 @@ const ARROW_MARKERS = 'Gd3b6,Rf3d6,Yh3f6';
48
48
 
49
49
 
50
50
  interface PageState {
51
- position: string;
52
- flipped: boolean;
53
- squareSize: number;
54
- coordinateVisible: boolean;
55
- turnVisible: boolean;
56
- annotationVisible: boolean;
57
- colorset: string;
58
- pieceset: string;
51
+ position: string,
52
+ flipped: boolean,
53
+ squareSize: number,
54
+ coordinateVisible: boolean,
55
+ turnVisible: boolean,
56
+ annotationVisible: boolean,
57
+ colorset: string,
58
+ pieceset: string,
59
59
  }
60
60
 
61
61
 
@@ -86,49 +86,55 @@ export default class Page extends React.Component<object, PageState> {
86
86
  }
87
87
 
88
88
  private renderControls() {
89
- return (<>
90
- <Stack direction="row" spacing={2} alignItems="center">
91
- <FormControlLabel label="Flip"
92
- control={<Switch checked={this.state.flipped} onChange={() => this.setState({ flipped: !this.state.flipped })} color="primary" />}
93
- />
94
- <FormControlLabel label="Show coordinates"
95
- control={<Switch checked={this.state.coordinateVisible} onChange={() => this.setState({ coordinateVisible: !this.state.coordinateVisible })} color="primary" />}
96
- />
97
- <FormControlLabel label="Show turn"
98
- control={<Switch checked={this.state.turnVisible} onChange={() => this.setState({ turnVisible: !this.state.turnVisible })} color="primary" />}
99
- />
100
- <FormControlLabel label="Show annotations"
101
- control={<Switch checked={this.state.annotationVisible} onChange={() => this.setState({ annotationVisible: !this.state.annotationVisible })} color="primary" />}
102
- />
103
- </Stack>
104
- <Box>
105
- <Typography gutterBottom>Square size</Typography>
106
- <Slider
107
- value={this.state.squareSize} onChange={(_, newValue) => this.setState({ squareSize: newValue as number })}
108
- min={Chessboard.minSquareSize()} max={Chessboard.maxSquareSize()} step={1} valueLabelDisplay="on" color="primary"
109
- />
110
- </Box>
111
- <Stack direction="row" spacing={2} alignItems="center">
112
- <FormControl variant="standard">
113
- <InputLabel id="colorset-label">Colorset</InputLabel>
114
- <Select labelId="colorset-label" sx={{ width: '8em' }} value={this.state.colorset} onChange={evt => this.setState({ colorset: evt.target.value })}>
115
- {Object.keys(Chessboard.colorsets()).sort().map(colorset => <MenuItem key={colorset} value={colorset}>{colorset}</MenuItem>)}
116
- </Select>
117
- </FormControl>
118
- <FormControl variant="standard">
119
- <InputLabel id="pieceset-label">Pieceset</InputLabel>
120
- <Select labelId="pieceset-label" sx={{ width: '8em' }} value={this.state.pieceset} onChange={evt => this.setState({ pieceset: evt.target.value })}>
121
- {Object.keys(Chessboard.piecesets()).sort().map(pieceset => <MenuItem key={pieceset} value={pieceset}>{pieceset}</MenuItem>)}
122
- </Select>
123
- </FormControl>
124
- <ButtonGroup color="primary" size="small">
125
- <Button onClick={() => this.setState({ position: 'empty' })}>Clear</Button>
126
- <Button onClick={() => this.setState({ position: 'start' })}>Reset</Button>
127
- <Button onClick={() => this.setState({ position: '8/8/8/8/8/4k3/q7/4K3 b - - 0 1' })}>Set FEN</Button>
128
- <Button onClick={() => this.setState({ position: 'I\'m an invalid FEN string' })}>Set ill-formed FEN</Button>
129
- </ButtonGroup>
130
- </Stack>
131
- </>);
89
+ return (
90
+ <>
91
+ <Stack direction="row" spacing={2} alignItems="center">
92
+ <FormControlLabel
93
+ label="Flip"
94
+ control={<Switch checked={this.state.flipped} onChange={() => this.setState({ flipped: !this.state.flipped })} color="primary" />}
95
+ />
96
+ <FormControlLabel
97
+ label="Show coordinates"
98
+ control={<Switch checked={this.state.coordinateVisible} onChange={() => this.setState({ coordinateVisible: !this.state.coordinateVisible })} color="primary" />}
99
+ />
100
+ <FormControlLabel
101
+ label="Show turn"
102
+ control={<Switch checked={this.state.turnVisible} onChange={() => this.setState({ turnVisible: !this.state.turnVisible })} color="primary" />}
103
+ />
104
+ <FormControlLabel
105
+ label="Show annotations"
106
+ control={<Switch checked={this.state.annotationVisible} onChange={() => this.setState({ annotationVisible: !this.state.annotationVisible })} color="primary" />}
107
+ />
108
+ </Stack>
109
+ <Box>
110
+ <Typography gutterBottom>Square size</Typography>
111
+ <Slider
112
+ value={this.state.squareSize} onChange={(_, newValue) => this.setState({ squareSize: newValue as number })}
113
+ min={Chessboard.minSquareSize()} max={Chessboard.maxSquareSize()} step={1} valueLabelDisplay="on" color="primary"
114
+ />
115
+ </Box>
116
+ <Stack direction="row" spacing={2} alignItems="center">
117
+ <FormControl variant="standard">
118
+ <InputLabel id="colorset-label">Colorset</InputLabel>
119
+ <Select labelId="colorset-label" sx={{ width: '8em' }} value={this.state.colorset} onChange={evt => this.setState({ colorset: evt.target.value })}>
120
+ {Object.keys(Chessboard.colorsets()).sort().map(colorset => <MenuItem key={colorset} value={colorset}>{colorset}</MenuItem>)}
121
+ </Select>
122
+ </FormControl>
123
+ <FormControl variant="standard">
124
+ <InputLabel id="pieceset-label">Pieceset</InputLabel>
125
+ <Select labelId="pieceset-label" sx={{ width: '8em' }} value={this.state.pieceset} onChange={evt => this.setState({ pieceset: evt.target.value })}>
126
+ {Object.keys(Chessboard.piecesets()).sort().map(pieceset => <MenuItem key={pieceset} value={pieceset}>{pieceset}</MenuItem>)}
127
+ </Select>
128
+ </FormControl>
129
+ <ButtonGroup color="primary" size="small">
130
+ <Button onClick={() => this.setState({ position: 'empty' })}>Clear</Button>
131
+ <Button onClick={() => this.setState({ position: 'start' })}>Reset</Button>
132
+ <Button onClick={() => this.setState({ position: '8/8/8/8/8/4k3/q7/4K3 b - - 0 1' })}>Set FEN</Button>
133
+ <Button onClick={() => this.setState({ position: 'I\'m an invalid FEN string' })}>Set ill-formed FEN</Button>
134
+ </ButtonGroup>
135
+ </Stack>
136
+ </>
137
+ );
132
138
  }
133
139
 
134
140
  private renderChessboard() {
@@ -52,17 +52,17 @@ const DEFAULT_FEN = 'rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1';
52
52
 
53
53
 
54
54
  interface PageState {
55
- position: Position;
56
- flipped: boolean;
57
- interactionMode: 'none' | 'addRemovePieces' | 'movePieces' | 'playMoves' | 'editSquareMarkers' | 'editTextMarkers' | 'editArrowMarkers';
58
- pieceEditMode: ColoredPiece;
59
- squareMarkerColor: AnnotationColor;
60
- textMarkerColor: AnnotationColor;
61
- textMarkerSymbol: AnnotationSymbol;
62
- arrowMarkerColor: AnnotationColor;
63
- squareMarkers: SquareMarkerSet;
64
- textMarkers: TextMarkerSet;
65
- arrowMarkers: ArrowMarkerSet;
55
+ position: Position,
56
+ flipped: boolean,
57
+ interactionMode: 'none' | 'addRemovePieces' | 'movePieces' | 'playMoves' | 'editSquareMarkers' | 'editTextMarkers' | 'editArrowMarkers',
58
+ pieceEditMode: ColoredPiece,
59
+ squareMarkerColor: AnnotationColor,
60
+ textMarkerColor: AnnotationColor,
61
+ textMarkerSymbol: AnnotationSymbol,
62
+ arrowMarkerColor: AnnotationColor,
63
+ squareMarkers: SquareMarkerSet,
64
+ textMarkers: TextMarkerSet,
65
+ arrowMarkers: ArrowMarkerSet,
66
66
  }
67
67
 
68
68
 
@@ -96,53 +96,68 @@ export default class Page extends React.Component<object, PageState> {
96
96
  }
97
97
 
98
98
  private renderControls() {
99
- return (<>
100
- <Stack direction="row" spacing={2} alignItems="center">
101
- <FormControlLabel label="Flip"
102
- control={<Switch checked={this.state.flipped} onChange={() => this.setState({ flipped: !this.state.flipped })} color="primary" />}
103
- />
104
- <Button color="primary" size="small" variant="contained" onClick={() => this.handleTurnClicked(oppositeColor(this.state.position.turn()))}>
105
- Change turn
106
- </Button>
107
- <ButtonGroup color="primary" size="small">
108
- <Button onClick={() => this.setState({ position: new Position('empty') })}>Clear</Button>
109
- <Button onClick={() => this.setState({ position: new Position() })}>Reset</Button>
110
- </ButtonGroup>
111
- </Stack>
112
- <Box>
113
- <Typography gutterBottom>Interaction mode</Typography>
114
- <RadioGroup value={this.state.interactionMode} onChange={evt => this.setState({ interactionMode: evt.target.value as PageState['interactionMode'] })}>
115
- <FormControlLabel value="none" control={<Radio color="primary" />} label="None" />
116
- <FormControlLabel value="addRemovePieces" control={<Radio color="primary" />} label={
117
- <Stack direction="row" spacing={2} alignItems="center">
118
- <span>Add/remove pieces</span>
119
- {this.renderPieceSelector()}
120
- </Stack>
121
- } />
122
- <FormControlLabel value="movePieces" control={<Radio color="primary" />} label="Move pieces" />
123
- <FormControlLabel value="playMoves" control={<Radio color="primary" />} label="Move pieces (obeying chess rules)" />
124
- <FormControlLabel value="editSquareMarkers" control={<Radio color="primary" />} label={
125
- <Stack direction="row" spacing={2} alignItems="center">
126
- <span>Edit square annotations</span>
127
- {this.renderMarkerColorSelector('editSquareMarkers', this.state.squareMarkerColor, newColor => this.handleSquareMarkerColorChanged(newColor))}
128
- </Stack>
129
- } />
130
- <FormControlLabel value="editTextMarkers" control={<Radio color="primary" />} label={
131
- <Stack direction="row" spacing={2} alignItems="center">
132
- <span>Edit text annotations</span>
133
- {this.renderMarkerColorSelector('editTextMarkers', this.state.textMarkerColor, newColor => this.handleTextMarkerColorChanged(newColor))}
134
- {this.renderTextMarkerSymbolSelector()}
135
- </Stack>
136
- } />
137
- <FormControlLabel value="editArrowMarkers" control={<Radio color="primary" />} label={
138
- <Stack direction="row" spacing={2} alignItems="center">
139
- <span>Edit arrow annotations</span>
140
- {this.renderMarkerColorSelector('editArrowMarkers', this.state.arrowMarkerColor, newColor => this.handleArrowMarkerColorChanged(newColor))}
141
- </Stack>
142
- } />
143
- </RadioGroup>
144
- </Box>
145
- </>);
99
+ return (
100
+ <>
101
+ <Stack direction="row" spacing={2} alignItems="center">
102
+ <FormControlLabel
103
+ label="Flip"
104
+ control={<Switch checked={this.state.flipped} onChange={() => this.setState({ flipped: !this.state.flipped })} color="primary" />}
105
+ />
106
+ <Button color="primary" size="small" variant="contained" onClick={() => this.handleTurnClicked(oppositeColor(this.state.position.turn()))}>
107
+ Change turn
108
+ </Button>
109
+ <ButtonGroup color="primary" size="small">
110
+ <Button onClick={() => this.setState({ position: new Position('empty') })}>Clear</Button>
111
+ <Button onClick={() => this.setState({ position: new Position() })}>Reset</Button>
112
+ </ButtonGroup>
113
+ </Stack>
114
+ <Box>
115
+ <Typography gutterBottom>Interaction mode</Typography>
116
+ <RadioGroup value={this.state.interactionMode} onChange={evt => this.setState({ interactionMode: evt.target.value as PageState['interactionMode'] })}>
117
+ <FormControlLabel value="none" control={<Radio color="primary" />} label="None" />
118
+ <FormControlLabel
119
+ value="addRemovePieces" control={<Radio color="primary" />}
120
+ label={(
121
+ <Stack direction="row" spacing={2} alignItems="center">
122
+ <span>Add/remove pieces</span>
123
+ {this.renderPieceSelector()}
124
+ </Stack>
125
+ )}
126
+ />
127
+ <FormControlLabel value="movePieces" control={<Radio color="primary" />} label="Move pieces" />
128
+ <FormControlLabel value="playMoves" control={<Radio color="primary" />} label="Move pieces (obeying chess rules)" />
129
+ <FormControlLabel
130
+ value="editSquareMarkers" control={<Radio color="primary" />}
131
+ label={(
132
+ <Stack direction="row" spacing={2} alignItems="center">
133
+ <span>Edit square annotations</span>
134
+ {this.renderMarkerColorSelector('editSquareMarkers', this.state.squareMarkerColor, newColor => this.handleSquareMarkerColorChanged(newColor))}
135
+ </Stack>
136
+ )}
137
+ />
138
+ <FormControlLabel
139
+ value="editTextMarkers" control={<Radio color="primary" />}
140
+ label={(
141
+ <Stack direction="row" spacing={2} alignItems="center">
142
+ <span>Edit text annotations</span>
143
+ {this.renderMarkerColorSelector('editTextMarkers', this.state.textMarkerColor, newColor => this.handleTextMarkerColorChanged(newColor))}
144
+ {this.renderTextMarkerSymbolSelector()}
145
+ </Stack>
146
+ )}
147
+ />
148
+ <FormControlLabel
149
+ value="editArrowMarkers" control={<Radio color="primary" />}
150
+ label={(
151
+ <Stack direction="row" spacing={2} alignItems="center">
152
+ <span>Edit arrow annotations</span>
153
+ {this.renderMarkerColorSelector('editArrowMarkers', this.state.arrowMarkerColor, newColor => this.handleArrowMarkerColorChanged(newColor))}
154
+ </Stack>
155
+ )}
156
+ />
157
+ </RadioGroup>
158
+ </Box>
159
+ </>
160
+ );
146
161
  }
147
162
 
148
163
  private renderPieceSelector() {
@@ -176,7 +191,7 @@ export default class Page extends React.Component<object, PageState> {
176
191
  if (this.state.interactionMode !== 'editTextMarkers') {
177
192
  return undefined;
178
193
  }
179
- const availableSymbols = [ 'plus', 'times', 'dot', 'circle' ].concat([...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789']);
194
+ const availableSymbols = [ 'plus', 'times', 'dot', 'circle' ].concat([ ...'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' ]);
180
195
  return (
181
196
  <Select variant="standard" value={this.state.textMarkerSymbol} onChange={evt => this.setState({ textMarkerSymbol: evt.target.value as AnnotationSymbol })}>
182
197
  {availableSymbols.map(mode => <MenuItem key={mode} value={mode}>{mode}</MenuItem>)}
@@ -326,7 +341,7 @@ export default class Page extends React.Component<object, PageState> {
326
341
  const newArrowMarkers = { ...this.state.arrowMarkers };
327
342
  const key = from + to as SquareCouple;
328
343
  if (newArrowMarkers[key] === this.state.arrowMarkerColor) {
329
- delete newArrowMarkers[key];
344
+ delete newArrowMarkers[key]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
330
345
  }
331
346
  else {
332
347
  newArrowMarkers[key] = this.state.arrowMarkerColor;
@@ -338,7 +353,7 @@ export default class Page extends React.Component<object, PageState> {
338
353
  if (this.state.interactionMode === 'editSquareMarkers') {
339
354
  const newSquareMarkers = { ...this.state.squareMarkers };
340
355
  if (newSquareMarkers[sq] === this.state.squareMarkerColor) {
341
- delete newSquareMarkers[sq];
356
+ delete newSquareMarkers[sq]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
342
357
  }
343
358
  else {
344
359
  newSquareMarkers[sq] = this.state.squareMarkerColor;
@@ -348,12 +363,12 @@ export default class Page extends React.Component<object, PageState> {
348
363
  else if (this.state.interactionMode === 'editTextMarkers') {
349
364
  const newTextMarkers = { ...this.state.textMarkers };
350
365
  if (newTextMarkers[sq] && newTextMarkers[sq]!.color === this.state.textMarkerColor && newTextMarkers[sq]!.symbol === this.state.textMarkerSymbol) {
351
- delete newTextMarkers[sq];
366
+ delete newTextMarkers[sq]; // eslint-disable-line @typescript-eslint/no-dynamic-delete
352
367
  }
353
368
  else {
354
369
  newTextMarkers[sq] = { color: this.state.textMarkerColor, symbol: this.state.textMarkerSymbol };
355
370
  }
356
- this.setState({ textMarkers: newTextMarkers });
371
+ this.setState({ textMarkers: newTextMarkers });
357
372
  }
358
373
  else if (this.state.interactionMode === 'addRemovePieces') {
359
374
  const newPosition = new Position(this.state.position);
@@ -44,14 +44,14 @@ const COLOR_ICON_SIZE = 16;
44
44
 
45
45
 
46
46
  interface PageState {
47
- position: Position;
48
- positionAfter: Position | null; // non-null only if a valid move has been played
49
- flipped: boolean;
50
- moveArrowVisible: boolean;
51
- moveArrowColor: AnnotationColor;
52
- animated: boolean;
53
- editedMove: string;
54
- playedMove: string;
47
+ position: Position,
48
+ positionAfter: Position | null, // non-null only if a valid move has been played
49
+ flipped: boolean,
50
+ moveArrowVisible: boolean,
51
+ moveArrowColor: AnnotationColor,
52
+ animated: boolean,
53
+ editedMove: string,
54
+ playedMove: string,
55
55
  }
56
56
 
57
57
 
@@ -85,28 +85,33 @@ export default class Page extends React.Component<object, PageState> {
85
85
  }
86
86
 
87
87
  private renderControls() {
88
- return (<>
89
- <Stack direction="row" spacing={2} alignItems="center">
90
- <FormControlLabel label="Flip"
91
- control={<Switch checked={this.state.flipped} onChange={() => this.setState({ flipped: !this.state.flipped })} color="primary" />}
92
- />
93
- <FormControlLabel label="Animation" disabled={!this.state.positionAfter}
94
- control={<Switch checked={this.state.animated} onChange={() => this.setState({ animated: !this.state.animated })} color="primary" />}
95
- />
96
- <FormControlLabel label="Show move arrow" disabled={!this.state.positionAfter}
97
- control={<Switch checked={this.state.moveArrowVisible} onChange={() => this.setState({ moveArrowVisible: !this.state.moveArrowVisible })} color="primary" />}
98
- />
99
- {this.renderColorSelector()}
100
- </Stack>
101
- <Stack direction="row" spacing={2} alignItems="center">
102
- <TextField label="Move" variant="standard" value={this.state.editedMove} onChange={evt => this.setState({ editedMove: evt.target.value })} />
103
- <Button color="primary" size="small" variant="contained" onClick={() => this.handlePlayClicked()}>Play</Button>
104
- <ButtonGroup color="primary" size="small">
105
- <Button onClick={() => this.handlePositionChanged(new Position('empty'))}>Clear</Button>
106
- <Button onClick={() => this.handlePositionChanged(new Position())}>Reset</Button>
107
- </ButtonGroup>
108
- </Stack>
109
- </>);
88
+ return (
89
+ <>
90
+ <Stack direction="row" spacing={2} alignItems="center">
91
+ <FormControlLabel
92
+ label="Flip"
93
+ control={<Switch checked={this.state.flipped} onChange={() => this.setState({ flipped: !this.state.flipped })} color="primary" />}
94
+ />
95
+ <FormControlLabel
96
+ label="Animation" disabled={!this.state.positionAfter}
97
+ control={<Switch checked={this.state.animated} onChange={() => this.setState({ animated: !this.state.animated })} color="primary" />}
98
+ />
99
+ <FormControlLabel
100
+ label="Show move arrow" disabled={!this.state.positionAfter}
101
+ control={<Switch checked={this.state.moveArrowVisible} onChange={() => this.setState({ moveArrowVisible: !this.state.moveArrowVisible })} color="primary" />}
102
+ />
103
+ {this.renderColorSelector()}
104
+ </Stack>
105
+ <Stack direction="row" spacing={2} alignItems="center">
106
+ <TextField label="Move" variant="standard" value={this.state.editedMove} onChange={evt => this.setState({ editedMove: evt.target.value })} />
107
+ <Button color="primary" size="small" variant="contained" onClick={() => this.handlePlayClicked()}>Play</Button>
108
+ <ButtonGroup color="primary" size="small">
109
+ <Button onClick={() => this.handlePositionChanged(new Position('empty'))}>Clear</Button>
110
+ <Button onClick={() => this.handlePositionChanged(new Position())}>Reset</Button>
111
+ </ButtonGroup>
112
+ </Stack>
113
+ </>
114
+ );
110
115
  }
111
116
 
112
117
  private renderColorSelector() {
@@ -35,9 +35,9 @@ import './demo.css';
35
35
 
36
36
 
37
37
  interface PageState {
38
- squareSize: number;
39
- windowWidth: number;
40
- limits: SmallScreenLimit[];
38
+ squareSize: number,
39
+ windowWidth: number,
40
+ limits: SmallScreenLimit[],
41
41
  }
42
42
 
43
43