kokopu-react 3.3.0 → 3.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (441) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/lib/chessboard/BoardProperties.d.ts +1 -1
  3. package/dist/lib/chessboard/BoardProperties.js +1 -1
  4. package/dist/lib/chessboard/Chessboard.css +1 -1
  5. package/dist/lib/chessboard/Chessboard.d.ts +3 -3
  6. package/dist/lib/chessboard/Chessboard.js +4 -3
  7. package/dist/lib/chessboard/Chessboard.js.map +1 -1
  8. package/dist/lib/chessboard/ChessboardImpl.d.ts +1 -1
  9. package/dist/lib/chessboard/ChessboardImpl.js +2 -2
  10. package/dist/lib/chessboard/ChessboardImpl.js.map +1 -1
  11. package/dist/lib/chessboard/Draggable.d.ts +1 -1
  12. package/dist/lib/chessboard/Draggable.js +1 -1
  13. package/dist/lib/chessboard/Draggable.js.map +1 -1
  14. package/dist/lib/chessboard/Motion.d.ts +1 -1
  15. package/dist/lib/chessboard/Motion.js +2 -2
  16. package/dist/lib/chessboard/Motion.js.map +1 -1
  17. package/dist/lib/chessboard/colorsets.d.ts +1 -1
  18. package/dist/lib/chessboard/colorsets.js +1 -1
  19. package/dist/lib/chessboard/piecesets.d.ts +1 -1
  20. package/dist/lib/chessboard/piecesets.js +1 -1
  21. package/dist/lib/errorbox/ErrorBox.css +1 -1
  22. package/dist/lib/errorbox/ErrorBox.d.ts +1 -1
  23. package/dist/lib/errorbox/ErrorBox.js +1 -1
  24. package/dist/lib/errorbox/parsing.d.ts +5 -4
  25. package/dist/lib/errorbox/parsing.js +1 -1
  26. package/dist/lib/exception.d.ts +1 -1
  27. package/dist/lib/exception.js +1 -1
  28. package/dist/lib/i18n.d.ts +1 -1
  29. package/dist/lib/i18n.js +3 -3
  30. package/dist/lib/i18n.js.map +1 -1
  31. package/dist/lib/icons/AnnotationSymbolShape.css +1 -1
  32. package/dist/lib/icons/AnnotationSymbolShape.d.ts +1 -1
  33. package/dist/lib/icons/AnnotationSymbolShape.js +1 -1
  34. package/dist/lib/icons/ArrowMarkerIcon.d.ts +1 -1
  35. package/dist/lib/icons/ArrowMarkerIcon.js +1 -1
  36. package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -1
  37. package/dist/lib/icons/ArrowTip.d.ts +1 -1
  38. package/dist/lib/icons/ArrowTip.js +1 -1
  39. package/dist/lib/icons/ChessPieceIcon.d.ts +2 -5
  40. package/dist/lib/icons/ChessPieceIcon.js +2 -6
  41. package/dist/lib/icons/ChessPieceIcon.js.map +1 -1
  42. package/dist/lib/icons/SquareMarkerIcon.d.ts +2 -5
  43. package/dist/lib/icons/SquareMarkerIcon.js +2 -6
  44. package/dist/lib/icons/SquareMarkerIcon.js.map +1 -1
  45. package/dist/lib/icons/TextMarkerIcon.d.ts +2 -5
  46. package/dist/lib/icons/TextMarkerIcon.js +2 -6
  47. package/dist/lib/icons/TextMarkerIcon.js.map +1 -1
  48. package/dist/lib/icons/arrow.css +1 -1
  49. package/dist/lib/index.d.ts +1 -1
  50. package/dist/lib/index.js +1 -1
  51. package/dist/lib/movetext/Movetext.css +1 -1
  52. package/dist/lib/movetext/Movetext.d.ts +1 -1
  53. package/dist/lib/movetext/Movetext.js +1 -1
  54. package/dist/lib/movetext/Movetext.js.map +1 -1
  55. package/dist/lib/movetext/MovetextImpl.d.ts +1 -1
  56. package/dist/lib/movetext/MovetextImpl.js +5 -4
  57. package/dist/lib/movetext/MovetextImpl.js.map +1 -1
  58. package/dist/lib/movetext/fonts.css +1 -1
  59. package/dist/lib/movetext/htmlFilter.d.ts +1 -1
  60. package/dist/lib/movetext/htmlFilter.js +2 -2
  61. package/dist/lib/movetext/htmlFilter.js.map +1 -1
  62. package/dist/lib/movetext/moveFormatter.d.ts +1 -1
  63. package/dist/lib/movetext/moveFormatter.js +1 -1
  64. package/dist/lib/navigationboard/NavigationBoard.d.ts +2 -2
  65. package/dist/lib/navigationboard/NavigationBoard.js +3 -3
  66. package/dist/lib/navigationboard/NavigationBoard.js.map +1 -1
  67. package/dist/lib/navigationboard/NavigationButton.d.ts +1 -1
  68. package/dist/lib/navigationboard/NavigationButton.js +1 -1
  69. package/dist/lib/navigationboard/NavigationField.css +1 -1
  70. package/dist/lib/navigationboard/NavigationField.d.ts +1 -1
  71. package/dist/lib/navigationboard/NavigationField.js +2 -2
  72. package/dist/lib/navigationboard/NavigationField.js.map +1 -1
  73. package/dist/lib/navigationboard/NavigationToolbar.css +1 -1
  74. package/dist/lib/navigationboard/NavigationToolbar.d.ts +1 -1
  75. package/dist/lib/navigationboard/NavigationToolbar.js +1 -1
  76. package/dist/lib/navigationboard/NavigationToolbar.js.map +1 -1
  77. package/dist/lib/navigationboard/iconPaths.d.ts +1 -1
  78. package/dist/lib/navigationboard/iconPaths.js +1 -1
  79. package/dist/lib/sanitization.d.ts +1 -1
  80. package/dist/lib/sanitization.js +1 -1
  81. package/dist/lib/types.d.ts +1 -1
  82. package/dist/lib/types.js +1 -1
  83. package/dist/lib/util.d.ts +1 -1
  84. package/dist/lib/util.js +3 -3
  85. package/dist/lib/util.js.map +1 -1
  86. package/doc_src/demo/NavigationBoardWithMoveText.txt +19 -0
  87. package/doc_src/demo/PageChessboardBase.tsx +58 -52
  88. package/doc_src/demo/PageChessboardInteraction.tsx +79 -64
  89. package/doc_src/demo/PageChessboardMove.tsx +36 -31
  90. package/doc_src/demo/PageChessboardSmallScreens.tsx +4 -4
  91. package/doc_src/demo/PageMovetextBase.tsx +92 -82
  92. package/doc_src/demo/PageMovetextInteraction.tsx +28 -28
  93. package/doc_src/demo/PageNavigationBoardBase.tsx +64 -56
  94. package/doc_src/demo/PageNavigationBoardUncontrolledVsControlled.tsx +26 -20
  95. package/doc_src/demo/PageSynchroNavigationBoardMovetext.tsx +115 -0
  96. package/doc_src/demo/decs.d.ts +6 -1
  97. package/doc_src/demo/demo.css +1 -1
  98. package/doc_src/demo/util.ts +1 -1
  99. package/doc_src/theming/LogoRenderer.js +9 -10
  100. package/doc_src/theming/theming.css +1 -1
  101. package/package.json +32 -30
  102. package/scripts/doc.styleguide.config.js +3 -2
  103. package/scripts/docker-compose.yml +1 -3
  104. package/scripts/test-graphic.webpack.config.js +1 -1
  105. package/scripts/test-headless.webpack.config.js +1 -1
  106. package/src/chessboard/BoardProperties.ts +14 -14
  107. package/src/chessboard/Chessboard.css +1 -1
  108. package/src/chessboard/Chessboard.tsx +44 -40
  109. package/src/chessboard/ChessboardImpl.tsx +57 -40
  110. package/src/chessboard/Draggable.tsx +17 -17
  111. package/src/chessboard/Motion.tsx +5 -5
  112. package/src/chessboard/colorsets.ts +1 -1
  113. package/src/chessboard/piecesets.ts +1 -1
  114. package/src/decs.d.ts +1 -1
  115. package/src/errorbox/ErrorBox.css +1 -1
  116. package/src/errorbox/ErrorBox.tsx +6 -6
  117. package/src/errorbox/parsing.tsx +7 -7
  118. package/src/exception.ts +1 -1
  119. package/src/i18n.ts +3 -3
  120. package/src/icons/AnnotationSymbolShape.css +1 -1
  121. package/src/icons/AnnotationSymbolShape.tsx +6 -6
  122. package/src/icons/ArrowMarkerIcon.tsx +9 -5
  123. package/src/icons/ArrowTip.tsx +3 -3
  124. package/src/icons/ChessPieceIcon.tsx +5 -12
  125. package/src/icons/SquareMarkerIcon.tsx +4 -11
  126. package/src/icons/TextMarkerIcon.tsx +5 -12
  127. package/src/icons/arrow.css +1 -1
  128. package/src/index.ts +1 -1
  129. package/src/movetext/Movetext.css +1 -1
  130. package/src/movetext/Movetext.tsx +13 -12
  131. package/src/movetext/MovetextImpl.tsx +36 -30
  132. package/src/movetext/fonts.css +1 -1
  133. package/src/movetext/htmlFilter.tsx +5 -5
  134. package/src/movetext/moveFormatter.tsx +1 -1
  135. package/src/navigationboard/NavigationBoard.tsx +57 -52
  136. package/src/navigationboard/NavigationButton.ts +5 -5
  137. package/src/navigationboard/NavigationField.css +1 -1
  138. package/src/navigationboard/NavigationField.tsx +8 -8
  139. package/src/navigationboard/NavigationToolbar.css +1 -1
  140. package/src/navigationboard/NavigationToolbar.tsx +18 -14
  141. package/src/navigationboard/iconPaths.ts +1 -1
  142. package/src/sanitization.ts +1 -1
  143. package/src/types.ts +27 -27
  144. package/src/util.ts +3 -3
  145. package/test/01_types.js +84 -62
  146. package/test/02_chessboard_util.js +3 -1
  147. package/test/03_error_box_graphic.js +2 -2
  148. package/test/04_icons_graphic.js +1 -1
  149. package/test/05_chessboard_graphic.js +1 -1
  150. package/test/06_chessboard_animation.js +1 -1
  151. package/test/07_chessboard_interaction.js +2 -3
  152. package/test/08_chessboard_play_moves.js +1 -1
  153. package/test/09_chessboard_small_screens.js +1 -1
  154. package/test/10_movetext_graphic.js +1 -1
  155. package/test/11_movetext_interaction.js +1 -1
  156. package/test/12_navigation_board_base.js +1 -1
  157. package/test/13_navigation_board_graphic.js +4 -4
  158. package/test/14_navigation_board_autoplay.js +1 -1
  159. package/test/common/graphic.js +12 -12
  160. package/test/graphic_references/03_error_box_graphic/base/cut_beginning_of_text.png +0 -0
  161. package/test/graphic_references/03_error_box_graphic/base/cut_end_of_text.png +0 -0
  162. package/test/graphic_references/03_error_box_graphic/base/cut_on_line_breaks.png +0 -0
  163. package/test/graphic_references/03_error_box_graphic/base/error_index_not_integer.png +0 -0
  164. package/test/graphic_references/03_error_box_graphic/base/full.png +0 -0
  165. package/test/graphic_references/03_error_box_graphic/base/minimal.png +0 -0
  166. package/test/graphic_references/03_error_box_graphic/base/missing_error_index.png +0 -0
  167. package/test/graphic_references/03_error_box_graphic/base/missing_error_text.png +0 -0
  168. package/test/graphic_references/03_error_box_graphic/base/negative_error_index.png +0 -0
  169. package/test/graphic_references/03_error_box_graphic/base/single_character_text.png +0 -0
  170. package/test/graphic_references/03_error_box_graphic/base/too_large_error_index.png +0 -0
  171. package/test/graphic_references/03_error_box_graphic/localization/default.png +0 -0
  172. package/test/graphic_references/04_icons_graphic/chess_piece/customized_pieceset.png +0 -0
  173. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_multiple_pieces.png +0 -0
  174. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_pieceset.png +0 -0
  175. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_single_piece.png +0 -0
  176. package/test/graphic_references/04_icons_graphic/chess_piece/invalid_size.png +0 -0
  177. package/test/graphic_references/04_icons_graphic/chess_piece/multiple_pieces.png +0 -0
  178. package/test/graphic_references/04_icons_graphic/chess_piece/single_piece.png +0 -0
  179. package/test/graphic_references/04_icons_graphic/marker/colorized_arrow.png +0 -0
  180. package/test/graphic_references/04_icons_graphic/marker/colorized_square.png +0 -0
  181. package/test/graphic_references/04_icons_graphic/marker/colorized_symbol.png +0 -0
  182. package/test/graphic_references/04_icons_graphic/marker/colorized_text.png +0 -0
  183. package/test/graphic_references/04_icons_graphic/marker/default_arrow.png +0 -0
  184. package/test/graphic_references/04_icons_graphic/marker/default_square.png +0 -0
  185. package/test/graphic_references/04_icons_graphic/marker/default_text.png +0 -0
  186. package/test/graphic_references/04_icons_graphic/marker/invalid_arrow_size.png +0 -0
  187. package/test/graphic_references/04_icons_graphic/marker/invalid_square_size.png +0 -0
  188. package/test/graphic_references/04_icons_graphic/marker/invalid_symbol.png +0 -0
  189. package/test/graphic_references/04_icons_graphic/marker/invalid_text_size.png +0 -0
  190. package/test/graphic_references/04_icons_graphic/marker/wrapped_arrow.png +0 -0
  191. package/test/graphic_references/04_icons_graphic/marker/wrapped_square.png +0 -0
  192. package/test/graphic_references/04_icons_graphic/marker/wrapped_symbol.png +0 -0
  193. package/test/graphic_references/04_icons_graphic/marker/wrapped_text.png +0 -0
  194. package/test/graphic_references/05_chessboard_graphic/annotations/overlap.png +0 -0
  195. package/test/graphic_references/05_chessboard_graphic/annotations/overlap_and_flip.png +0 -0
  196. package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates.png +0 -0
  197. package/test/graphic_references/05_chessboard_graphic/annotations/with_coordinates_and_flip.png +0 -0
  198. package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates.png +0 -0
  199. package/test/graphic_references/05_chessboard_graphic/annotations/without_coordinates_and_flip.png +0 -0
  200. package/test/graphic_references/05_chessboard_graphic/base/default.png +0 -0
  201. package/test/graphic_references/05_chessboard_graphic/base/empty.png +0 -0
  202. package/test/graphic_references/05_chessboard_graphic/base/from_fen.png +0 -0
  203. package/test/graphic_references/05_chessboard_graphic/base/from_kokopu_object.png +0 -0
  204. package/test/graphic_references/05_chessboard_graphic/base/parsing_error.png +0 -0
  205. package/test/graphic_references/05_chessboard_graphic/base/wrong_position_type.png +0 -0
  206. package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960.png +0 -0
  207. package/test/graphic_references/05_chessboard_graphic/chess_variants/chess960_with_move.png +0 -0
  208. package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant.png +0 -0
  209. package/test/graphic_references/05_chessboard_graphic/chess_variants/invalid_variant_with_fen.png +0 -0
  210. package/test/graphic_references/05_chessboard_graphic/chess_variants/special_code.png +0 -0
  211. package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_with_std_initial_position.png +0 -0
  212. package/test/graphic_references/05_chessboard_graphic/chess_variants/variant_without_std_initial_position.png +0 -0
  213. package/test/graphic_references/05_chessboard_graphic/flipped/default.png +0 -0
  214. package/test/graphic_references/05_chessboard_graphic/flipped/empty.png +0 -0
  215. package/test/graphic_references/05_chessboard_graphic/flipped/from_fen.png +0 -0
  216. package/test/graphic_references/05_chessboard_graphic/flipped/from_kokopu_object.png +0 -0
  217. package/test/graphic_references/05_chessboard_graphic/flipped/parsing_error.png +0 -0
  218. package/test/graphic_references/05_chessboard_graphic/move/capture.png +0 -0
  219. package/test/graphic_references/05_chessboard_graphic/move/castling_move.png +0 -0
  220. package/test/graphic_references/05_chessboard_graphic/move/default.png +0 -0
  221. package/test/graphic_references/05_chessboard_graphic/move/en-passant.png +0 -0
  222. package/test/graphic_references/05_chessboard_graphic/move/illegal_null-move.png +0 -0
  223. package/test/graphic_references/05_chessboard_graphic/move/no_move_arrow.png +0 -0
  224. package/test/graphic_references/05_chessboard_graphic/move/null-move.png +0 -0
  225. package/test/graphic_references/05_chessboard_graphic/move/parsing_error.png +0 -0
  226. package/test/graphic_references/05_chessboard_graphic/move/promotion.png +0 -0
  227. package/test/graphic_references/05_chessboard_graphic/move/with_forced_move_arrow_and_flip.png +0 -0
  228. package/test/graphic_references/05_chessboard_graphic/move/wrong_move_arrow_color_type.png +0 -0
  229. package/test/graphic_references/05_chessboard_graphic/move/wrong_move_type.png +0 -0
  230. package/test/graphic_references/05_chessboard_graphic/theme/custom_1.png +0 -0
  231. package/test/graphic_references/05_chessboard_graphic/theme/custom_2.png +0 -0
  232. package/test/graphic_references/05_chessboard_graphic/theme/custom_3.png +0 -0
  233. package/test/graphic_references/05_chessboard_graphic/theme/custom_4.png +0 -0
  234. package/test/graphic_references/05_chessboard_graphic/theme/custom_5.png +0 -0
  235. package/test/graphic_references/05_chessboard_graphic/theme/custom_6.png +0 -0
  236. package/test/graphic_references/05_chessboard_graphic/theme/default.png +0 -0
  237. package/test/graphic_references/05_chessboard_graphic/theme/large.png +0 -0
  238. package/test/graphic_references/05_chessboard_graphic/theme/small.png +0 -0
  239. package/test/graphic_references/05_chessboard_graphic/theme/wrong_colorset.png +0 -0
  240. package/test/graphic_references/05_chessboard_graphic/theme/wrong_pieceset.png +0 -0
  241. package/test/graphic_references/05_chessboard_graphic/theme/wrong_square_size_type.png +0 -0
  242. package/test/graphic_references/06_chessboard_animation/base_1/capture.png +0 -0
  243. package/test/graphic_references/06_chessboard_animation/base_1/castling_move.png +0 -0
  244. package/test/graphic_references/06_chessboard_animation/base_1/en-passant.png +0 -0
  245. package/test/graphic_references/06_chessboard_animation/base_1/move_1.png +0 -0
  246. package/test/graphic_references/06_chessboard_animation/base_1/move_2.png +0 -0
  247. package/test/graphic_references/06_chessboard_animation/base_1/promotion.png +0 -0
  248. package/test/graphic_references/06_chessboard_animation/base_2/capture.png +0 -0
  249. package/test/graphic_references/06_chessboard_animation/base_2/castling_move.png +0 -0
  250. package/test/graphic_references/06_chessboard_animation/base_2/en-passant.png +0 -0
  251. package/test/graphic_references/06_chessboard_animation/base_2/move_1.png +0 -0
  252. package/test/graphic_references/06_chessboard_animation/base_2/move_2.png +0 -0
  253. package/test/graphic_references/06_chessboard_animation/base_2/promotion.png +0 -0
  254. package/test/graphic_references/06_chessboard_animation/base_3/capture.png +0 -0
  255. package/test/graphic_references/06_chessboard_animation/base_3/castling_move.png +0 -0
  256. package/test/graphic_references/06_chessboard_animation/base_3/en-passant.png +0 -0
  257. package/test/graphic_references/06_chessboard_animation/base_3/move_1.png +0 -0
  258. package/test/graphic_references/06_chessboard_animation/base_3/move_2.png +0 -0
  259. package/test/graphic_references/06_chessboard_animation/base_3/promotion.png +0 -0
  260. package/test/graphic_references/06_chessboard_animation/on_redraw/final_state.png +0 -0
  261. package/test/graphic_references/06_chessboard_animation/on_redraw/initial_state.png +0 -0
  262. package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_1.png +0 -0
  263. package/test/graphic_references/07_chessboard_interaction/edit_arrows/base_2.png +0 -0
  264. package/test/graphic_references/07_chessboard_interaction/edit_arrows/from_==_to.png +0 -0
  265. package/test/graphic_references/07_chessboard_interaction/edit_arrows/out_of_board.png +0 -0
  266. package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_arrow_marker.png +0 -0
  267. package/test/graphic_references/07_chessboard_interaction/edit_arrows/over_square_marker.png +0 -0
  268. package/test/graphic_references/07_chessboard_interaction/error/edit_color_not_set.png +0 -0
  269. package/test/graphic_references/07_chessboard_interaction/error/wrong_interaction_mode.png +0 -0
  270. package/test/graphic_references/07_chessboard_interaction/move_pieces/after_move.png +0 -0
  271. package/test/graphic_references/07_chessboard_interaction/move_pieces/from_==_to.png +0 -0
  272. package/test/graphic_references/07_chessboard_interaction/move_pieces/move_empty_square.png +0 -0
  273. package/test/graphic_references/07_chessboard_interaction/move_pieces/out_of_board.png +0 -0
  274. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_arrow_marker.png +0 -0
  275. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_empty.png +0 -0
  276. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_1.png +0 -0
  277. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_non-empty_2.png +0 -0
  278. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_square_marker.png +0 -0
  279. package/test/graphic_references/07_chessboard_interaction/move_pieces/over_text_marker.png +0 -0
  280. package/test/graphic_references/08_chessboard_play_moves/base/castling_move.png +0 -0
  281. package/test/graphic_references/08_chessboard_play_moves/base/chess960_ambiguous_king_move.png +0 -0
  282. package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_1.png +0 -0
  283. package/test/graphic_references/08_chessboard_play_moves/base/chess960_castling_move_2.png +0 -0
  284. package/test/graphic_references/08_chessboard_play_moves/base/chess960_non-kxr_castling.png +0 -0
  285. package/test/graphic_references/08_chessboard_play_moves/base/from_==_to.png +0 -0
  286. package/test/graphic_references/08_chessboard_play_moves/base/illegal_move.png +0 -0
  287. package/test/graphic_references/08_chessboard_play_moves/base/illegal_position.png +0 -0
  288. package/test/graphic_references/08_chessboard_play_moves/base/out_of_board.png +0 -0
  289. package/test/graphic_references/08_chessboard_play_moves/base/regular_move_1.png +0 -0
  290. package/test/graphic_references/08_chessboard_play_moves/base/regular_move_2.png +0 -0
  291. package/test/graphic_references/08_chessboard_play_moves/base/wrong_color_moved.png +0 -0
  292. package/test/graphic_references/08_chessboard_play_moves/promotions/antichess_promotion.png +0 -0
  293. package/test/graphic_references/08_chessboard_play_moves/promotions/cancel_promotion.png +0 -0
  294. package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_1.png +0 -0
  295. package/test/graphic_references/08_chessboard_play_moves/promotions/regular_promotion_2.png +0 -0
  296. package/test/graphic_references/09_chessboard_small_screens/base/default.png +0 -0
  297. package/test/graphic_references/09_chessboard_small_screens/base/invalid_limits.png +0 -0
  298. package/test/graphic_references/09_chessboard_small_screens/base/width_690.png +0 -0
  299. package/test/graphic_references/09_chessboard_small_screens/base/width_700.png +0 -0
  300. package/test/graphic_references/09_chessboard_small_screens/base/width_710.png +0 -0
  301. package/test/graphic_references/09_chessboard_small_screens/base/width_720.png +0 -0
  302. package/test/graphic_references/09_chessboard_small_screens/base/width_730.png +0 -0
  303. package/test/graphic_references/09_chessboard_small_screens/base/width_740.png +0 -0
  304. package/test/graphic_references/09_chessboard_small_screens/base/width_750.png +0 -0
  305. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_bottom_component.png +0 -0
  306. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_top_component.png +0 -0
  307. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_bottom_component.png +0 -0
  308. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_top_component.png +0 -0
  309. package/test/graphic_references/10_movetext_graphic/base/game_1.png +0 -0
  310. package/test/graphic_references/10_movetext_graphic/base/game_2.png +0 -0
  311. package/test/graphic_references/10_movetext_graphic/base/game_3.png +0 -0
  312. package/test/graphic_references/10_movetext_graphic/base/game_4.png +0 -0
  313. package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_1.png +0 -0
  314. package/test/graphic_references/10_movetext_graphic/error/pgn_parsing_error_2.png +0 -0
  315. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_1.png +0 -0
  316. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_2.png +0 -0
  317. package/test/graphic_references/10_movetext_graphic/error/wrong_game_index_type.png +0 -0
  318. package/test/graphic_references/10_movetext_graphic/error/wrong_game_type.png +0 -0
  319. package/test/graphic_references/10_movetext_graphic/format_move/format_text.png +0 -0
  320. package/test/graphic_references/10_movetext_graphic/html/filtered_tags_and_attributes.png +0 -0
  321. package/test/graphic_references/10_movetext_graphic/html/html_in_comments.png +0 -0
  322. package/test/graphic_references/10_movetext_graphic/html/html_in_headers.png +0 -0
  323. package/test/graphic_references/10_movetext_graphic/options/custom_piece_symbols.png +0 -0
  324. package/test/graphic_references/10_movetext_graphic/options/figurine_piece_symbols_and_diagram_options.png +0 -0
  325. package/test/graphic_references/10_movetext_graphic/options/hidden_diagrams.png +0 -0
  326. package/test/graphic_references/10_movetext_graphic/options/localized_piece_symbols.png +0 -0
  327. package/test/graphic_references/10_movetext_graphic/options/other_diagram_options.png +0 -0
  328. package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_1.png +0 -0
  329. package/test/graphic_references/10_movetext_graphic/options/wrong_diagram_options_2.png +0 -0
  330. package/test/graphic_references/10_movetext_graphic/options/wrong_piece_symbol_value.png +0 -0
  331. package/test/graphic_references/11_movetext_interaction/error/wrong_interaction_mode.png +0 -0
  332. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_disabled.png +0 -0
  333. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected.png +0 -0
  334. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected_without_callback.png +0 -0
  335. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_with_variations.png +0 -0
  336. package/test/graphic_references/12_navigation_board_base/controlled/default.png +0 -0
  337. package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_0.png +0 -0
  338. package/test/graphic_references/12_navigation_board_base/controlled/forbidden_navigation_1.png +0 -0
  339. package/test/graphic_references/12_navigation_board_base/controlled/invalid_node_id.png +0 -0
  340. package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_0.png +0 -0
  341. package/test/graphic_references/12_navigation_board_base/controlled/no_callback_defined_1.png +0 -0
  342. package/test/graphic_references/12_navigation_board_base/controlled/overriding_initial_node_id.png +0 -0
  343. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_0.png +0 -0
  344. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_1.png +0 -0
  345. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_2.png +0 -0
  346. package/test/graphic_references/12_navigation_board_base/controlled/regular_navigation_3.png +0 -0
  347. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_0.png +0 -0
  348. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_1.png +0 -0
  349. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_beginning_2.png +0 -0
  350. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_0.png +0 -0
  351. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_1.png +0 -0
  352. package/test/graphic_references/12_navigation_board_base/uncontrolled/forbidden_navigation_at_end_2.png +0 -0
  353. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_end.png +0 -0
  354. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_at_specific_id.png +0 -0
  355. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default.png +0 -0
  356. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_default_with_game_index.png +0 -0
  357. package/test/graphic_references/12_navigation_board_base/uncontrolled/initial_state_on_null-move.png +0 -0
  358. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_0.png +0 -0
  359. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_1.png +0 -0
  360. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_2.png +0 -0
  361. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_3.png +0 -0
  362. package/test/graphic_references/12_navigation_board_base/uncontrolled/navigation_with_keys_4.png +0 -0
  363. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_0.png +0 -0
  364. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_flipping_1.png +0 -0
  365. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_0.png +0 -0
  366. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_1.png +0 -0
  367. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_2.png +0 -0
  368. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_3.png +0 -0
  369. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_4.png +0 -0
  370. package/test/graphic_references/12_navigation_board_base/uncontrolled/regular_navigation_5.png +0 -0
  371. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_1.png +0 -0
  372. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/error_2.png +0 -0
  373. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/multiple_buttons.png +0 -0
  374. package/test/graphic_references/13_navigation_board_graphic/additional_buttons/single_button.png +0 -0
  375. package/test/graphic_references/13_navigation_board_graphic/error/pgn_parsing_error.png +0 -0
  376. package/test/graphic_references/13_navigation_board_graphic/error/wrong_game_type.png +0 -0
  377. package/test/graphic_references/13_navigation_board_graphic/theme/custom_1.png +0 -0
  378. package/test/graphic_references/13_navigation_board_graphic/theme/custom_2.png +0 -0
  379. package/test/graphic_references/13_navigation_board_graphic/theme/large.png +0 -0
  380. package/test/graphic_references/13_navigation_board_graphic/theme/small.png +0 -0
  381. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_acknowledging_is-playing_changes.png +0 -0
  382. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_1_move_not_acknowledging_is-playing_changes.png +0 -0
  383. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_acknowledging_node_changes.png +0 -0
  384. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_2_moves_not_acknowledging_node_changes.png +0 -0
  385. package/test/graphic_references/14_navigation_board_autoplay/controlled/after_reaching_the_end.png +0 -0
  386. package/test/graphic_references/14_navigation_board_autoplay/controlled/already_at_the_end.png +0 -0
  387. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_is-playing_changes.png +0 -0
  388. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_acknowledging_node_changes.png +0 -0
  389. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_at_the_end.png +0 -0
  390. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_close_to_end.png +0 -0
  391. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_is-playing_changes.png +0 -0
  392. package/test/graphic_references/14_navigation_board_autoplay/controlled/initial_state_not_acknowledging_node_changes.png +0 -0
  393. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_after_stop.png +0 -0
  394. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_2_moves_from_beginning_before_stop.png +0 -0
  395. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_after_stop.png +0 -0
  396. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/after_reaching_the_end_before_stop.png +0 -0
  397. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_close_to_end.png +0 -0
  398. package/test/graphic_references/14_navigation_board_autoplay/uncontrolled/initial_state_default.png +0 -0
  399. package/test/graphic_test_app/03_error_box_graphic/base.tsx +19 -7
  400. package/test/graphic_test_app/03_error_box_graphic/localization.tsx +1 -1
  401. package/test/graphic_test_app/04_icons_graphic/chess_piece.tsx +13 -4
  402. package/test/graphic_test_app/04_icons_graphic/marker.tsx +15 -5
  403. package/test/graphic_test_app/05_chessboard_graphic/annotations.tsx +8 -4
  404. package/test/graphic_test_app/05_chessboard_graphic/base.tsx +2 -2
  405. package/test/graphic_test_app/05_chessboard_graphic/chess_variants.tsx +1 -1
  406. package/test/graphic_test_app/05_chessboard_graphic/flipped.tsx +1 -1
  407. package/test/graphic_test_app/05_chessboard_graphic/move.tsx +10 -3
  408. package/test/graphic_test_app/05_chessboard_graphic/theme.tsx +2 -2
  409. package/test/graphic_test_app/06_chessboard_animation/base_1.tsx +1 -1
  410. package/test/graphic_test_app/06_chessboard_animation/base_2.tsx +1 -1
  411. package/test/graphic_test_app/06_chessboard_animation/base_3.tsx +1 -1
  412. package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +9 -7
  413. package/test/graphic_test_app/07_chessboard_interaction/click_squares.tsx +5 -3
  414. package/test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx +5 -3
  415. package/test/graphic_test_app/07_chessboard_interaction/error.tsx +4 -2
  416. package/test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx +5 -3
  417. package/test/graphic_test_app/08_chessboard_play_moves/base.tsx +13 -7
  418. package/test/graphic_test_app/08_chessboard_play_moves/promotions.tsx +13 -4
  419. package/test/graphic_test_app/09_chessboard_small_screens/base.tsx +4 -2
  420. package/test/graphic_test_app/09_chessboard_small_screens/top_bottom_components.tsx +9 -7
  421. package/test/graphic_test_app/10_movetext_graphic/base.tsx +1 -1
  422. package/test/graphic_test_app/10_movetext_graphic/error.tsx +2 -2
  423. package/test/graphic_test_app/10_movetext_graphic/format_move.tsx +1 -1
  424. package/test/graphic_test_app/10_movetext_graphic/html.tsx +1 -1
  425. package/test/graphic_test_app/10_movetext_graphic/options.tsx +17 -7
  426. package/test/graphic_test_app/11_movetext_interaction/error.tsx +5 -2
  427. package/test/graphic_test_app/11_movetext_interaction/select_moves.tsx +1 -1
  428. package/test/graphic_test_app/12_navigation_board_base/controlled.tsx +1 -1
  429. package/test/graphic_test_app/12_navigation_board_base/uncontrolled.tsx +1 -1
  430. package/test/graphic_test_app/13_navigation_board_graphic/additional_buttons.tsx +24 -17
  431. package/test/graphic_test_app/13_navigation_board_graphic/error.tsx +2 -2
  432. package/test/graphic_test_app/13_navigation_board_graphic/theme.tsx +1 -1
  433. package/test/graphic_test_app/14_navigation_board_autoplay/controlled.tsx +35 -19
  434. package/test/graphic_test_app/14_navigation_board_autoplay/uncontrolled.tsx +1 -1
  435. package/test/graphic_test_app/common/decs.d.ts +1 -1
  436. package/test/graphic_test_app/common/test_app.css +1 -1
  437. package/test/graphic_test_app/common/test_app.tsx +5 -5
  438. package/.eslintrc.yml +0 -83
  439. package/test/.eslintrc.yml +0 -8
  440. package/test/graphic_test_app/.eslintrc.yml +0 -3
  441. /package/doc_src/demo/{game-3.pgn → game-short.pgn} +0 -0
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -30,65 +30,65 @@ interface DraggableProps {
30
30
  /**
31
31
  * Initial X coordinate of the handle.
32
32
  */
33
- x: number;
33
+ x: number,
34
34
 
35
35
  /**
36
36
  * Initial Y coordinate of the handle.
37
37
  */
38
- y: number;
38
+ y: number,
39
39
 
40
40
  /**
41
41
  * Width of the handle.
42
42
  */
43
- width: number;
43
+ width: number,
44
44
 
45
45
  /**
46
46
  * Height of the handle.
47
47
  */
48
- height: number;
48
+ height: number,
49
49
 
50
50
  /**
51
51
  * `true` if the handle corresponds to a draggable arrow, `false` if it corresponds to a draggable piece.
52
52
  */
53
- isArrowHandle: boolean;
53
+ isArrowHandle: boolean,
54
54
 
55
55
  /**
56
56
  * Callback invoked when the drag starts. `x0` and `y0` correspond to the coordinates (relative to the hande) at which the drag has been initiated.
57
57
  */
58
- onDragStart?: (x0: number, y0: number) => void;
58
+ onDragStart?: (x0: number, y0: number) => void,
59
59
 
60
60
  /**
61
61
  * Callback invoked during the drag. `dx` and `dy` correspond to the coordinates of the drag translation vector.
62
62
  */
63
- onDrag?: (dx: number, dy: number) => void;
63
+ onDrag?: (dx: number, dy: number) => void,
64
64
 
65
65
  /**
66
66
  * Callback invoked when the drag stops. `dx` and `dy` correspond to the coordinates of the drag translation vector.
67
67
  */
68
- onDragStop?: (dx: number, dy: number) => void;
68
+ onDragStop?: (dx: number, dy: number) => void,
69
69
 
70
70
  /**
71
71
  * Callback invoked when the drag is canceled.
72
72
  */
73
- onDragCanceled?: () => void;
73
+ onDragCanceled?: () => void,
74
74
  }
75
75
 
76
76
 
77
77
  interface DragData {
78
- originX: number;
79
- originY: number;
78
+ originX: number,
79
+ originY: number,
80
80
  }
81
81
 
82
82
 
83
83
  interface PageCoordinates {
84
- pageX: number;
85
- pageY: number;
84
+ pageX: number,
85
+ pageY: number,
86
86
  }
87
87
 
88
88
 
89
89
  interface ClientCoordinates {
90
- clientX: number;
91
- clientY: number;
90
+ clientX: number,
91
+ clientY: number,
92
92
  }
93
93
 
94
94
 
@@ -97,7 +97,7 @@ interface ClientCoordinates {
97
97
  */
98
98
  export class Draggable extends React.Component<DraggableProps> {
99
99
 
100
- private innerRef: React.RefObject<SVGRectElement> = React.createRef();
100
+ private innerRef = React.createRef<SVGRectElement>();
101
101
  private dragData?: DragData;
102
102
 
103
103
  private mouseDownListener = (evt: MouseEvent) => this.handleMouseDown(evt);
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -32,17 +32,17 @@ interface MotionProps {
32
32
  /**
33
33
  * Duration of the animation. Must be > 0.
34
34
  */
35
- duration: number;
35
+ duration: number,
36
36
 
37
37
  /**
38
38
  * Factory for the content being animated. The animation cursor is guaranteed to be valued between 0 and 1 inclusive.
39
39
  */
40
- children: (cursor: number) => React.ReactNode;
40
+ children: (cursor: number) => React.ReactNode,
41
41
  }
42
42
 
43
43
 
44
44
  interface MotionState {
45
- cursor: number;
45
+ cursor: number,
46
46
  }
47
47
 
48
48
 
@@ -63,7 +63,7 @@ export class Motion extends React.Component<MotionProps, MotionState> {
63
63
  this.cursorStop = 1;
64
64
 
65
65
  // WARNING: this hack exists only for testing purposes. DO NOT USE IT IN PRODUCTION.
66
- const debugCursorStop = window[ /* eslint-disable @typescript-eslint/no-explicit-any */ DEBUG_KEY as any /* eslint-enable @typescript-eslint/no-explicit-any */ ];
66
+ const debugCursorStop = window[/* eslint-disable @typescript-eslint/no-explicit-any */ DEBUG_KEY as any /* eslint-enable */];
67
67
  if (typeof debugCursorStop === 'number' && debugCursorStop >= 0 && debugCursorStop <= 1) {
68
68
  this.cursorStop = debugCursorStop;
69
69
  }
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
package/src/decs.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -40,27 +40,27 @@ export interface ErrorBoxProps {
40
40
  /**
41
41
  * Title of the error box.
42
42
  */
43
- title: string;
43
+ title: string,
44
44
 
45
45
  /**
46
46
  * Additional message providing details about the error.
47
47
  */
48
- message: string;
48
+ message: string,
49
49
 
50
50
  /**
51
51
  * Raw text whose processing results in the error.
52
52
  */
53
- text?: string;
53
+ text?: string,
54
54
 
55
55
  /**
56
56
  * Index of the character within `text` that results in the error.
57
57
  */
58
- errorIndex?: number;
58
+ errorIndex?: number,
59
59
 
60
60
  /**
61
61
  * Index (1-based) of the line in which is the character that results in the error.
62
62
  */
63
- lineNumber?: number;
63
+ lineNumber?: number,
64
64
  }
65
65
 
66
66
 
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -36,8 +36,8 @@ import { ErrorBox } from './ErrorBox';
36
36
  * Try to interpret the given object as a chess position.
37
37
  */
38
38
  export function parsePosition(position: Position | string, componentName: string):
39
- { error: true, errorBox: JSX.Element } | { error: false, position: Position }
40
- {
39
+ { error: true, errorBox: React.JSX.Element } | { error: false, position: Position } {
40
+
41
41
  if (position instanceof Position) {
42
42
  return { error: false, position: position };
43
43
  }
@@ -84,8 +84,8 @@ function splitGameVariantAndFEN(position: string): { variant: GameVariant, fen:
84
84
  * Try to interpret the given object `move` as a move descriptor based on the given position.
85
85
  */
86
86
  export function parseMove(position: Position, move: MoveDescriptor | string | undefined, componentName: string):
87
- { error: true, errorBox: JSX.Element } | { error: false, type: 'none' | 'null-move' } | { error: false, type: 'regular', move: MoveDescriptor }
88
- {
87
+ { error: true, errorBox: React.JSX.Element } | { error: false, type: 'none' | 'null-move' } | { error: false, type: 'regular', move: MoveDescriptor } {
88
+
89
89
  if (move === undefined || move === null) {
90
90
  return { error: false, type: 'none' };
91
91
  }
@@ -126,8 +126,8 @@ export function parseMove(position: Position, move: MoveDescriptor | string | un
126
126
  * Try to interpret the given object as a chess game.
127
127
  */
128
128
  export function parseGame(game: Game | Database | string, gameIndex: number, componentName: string):
129
- { error: true, errorBox: JSX.Element } | { error: false, game: Game }
130
- {
129
+ { error: true, errorBox: React.JSX.Element } | { error: false, game: Game } {
130
+
131
131
  if (game instanceof Game) {
132
132
  return { error: false, game: game };
133
133
  }
package/src/exception.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
package/src/i18n.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -27,7 +27,7 @@
27
27
  */
28
28
  export namespace i18n {
29
29
 
30
- /* eslint-disable prefer-const */
30
+ /* eslint-disable prefer-const, @stylistic/indent */
31
31
  // WARNING: all those constants must be declared with "let" to allow them to be re-defined if necessary by consumer codes.
32
32
 
33
33
  // Error box
@@ -46,7 +46,7 @@ export let TOOLTIP_PLAY_STOP = 'Play/stop the game';
46
46
  export let TOOLTIP_FLIP = 'Flip the board';
47
47
 
48
48
  // Movetext
49
- export let PIECE_SYMBOLS = { 'K':'K', 'Q':'Q', 'R':'R', 'B':'B', 'N':'N', 'P':'P' };
49
+ export let PIECE_SYMBOLS = { K: 'K', Q: 'Q', R: 'R', B: 'B', N: 'N', P: 'P' };
50
50
  export let ANNOTATED_BY = 'Annotated by {0}';
51
51
  export let INVALID_PGN_ERROR_TITLE = 'Invalid PGN string.';
52
52
 
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -38,27 +38,27 @@ interface AnnotationSymbolShapeProps {
38
38
  /**
39
39
  * X-coordinate of the center of the symbol.
40
40
  */
41
- x: number;
41
+ x: number,
42
42
 
43
43
  /**
44
44
  * Y-coordinate of the center of the symbol.
45
45
  */
46
- y: number;
46
+ y: number,
47
47
 
48
48
  /**
49
49
  * Size of the symbol (i.e. size of square in which the symbol is rendered).
50
50
  */
51
- size: number;
51
+ size: number,
52
52
 
53
53
  /**
54
54
  * Symbol code.
55
55
  */
56
- symbol: AnnotationSymbol;
56
+ symbol: AnnotationSymbol,
57
57
 
58
58
  /**
59
59
  * [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) to use to colorize the shape (for example: `'green'`, `'#ff0000'`...).
60
60
  */
61
- color: string;
61
+ color: string,
62
62
  }
63
63
 
64
64
 
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -41,12 +41,12 @@ export interface ArrowMarkerIconProps {
41
41
  /**
42
42
  * Width and height (in pixels) of the icon.
43
43
  */
44
- size: number;
44
+ size: number,
45
45
 
46
46
  /**
47
47
  * [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) to use to colorize the icon (for example: `'green'`, `'#ff0000'`...).
48
48
  */
49
- color: string;
49
+ color: string,
50
50
  }
51
51
 
52
52
 
@@ -75,8 +75,12 @@ export class ArrowMarkerIcon extends React.Component<ArrowMarkerIconProps> {
75
75
  <defs>
76
76
  <ArrowTip id={this.arrowTipId} color={this.props.color} />
77
77
  </defs>
78
- <line className="kokopu-arrow" x1={halfThickness} y1={size / 2} x2={size - halfThickness * 3} y2={size / 2} stroke={color}
79
- strokeWidth={halfThickness * 2} markerEnd={`url(#${this.arrowTipId})`} />
78
+ <line
79
+ className="kokopu-arrow"
80
+ x1={halfThickness} y1={size / 2} x2={size - halfThickness * 3} y2={size / 2}
81
+ stroke={color} strokeWidth={halfThickness * 2}
82
+ markerEnd={`url(#${this.arrowTipId})`}
83
+ />
80
84
  </svg>
81
85
  );
82
86
  }
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -30,12 +30,12 @@ interface ArrowTipProps {
30
30
  /**
31
31
  * ID of the element.
32
32
  */
33
- id: string;
33
+ id: string,
34
34
 
35
35
  /**
36
36
  * [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) to use to colorize the shape (for example: `'green'`, `'#ff0000'`...).
37
37
  */
38
- color: string;
38
+ color: string,
39
39
  }
40
40
 
41
41
 
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -35,29 +35,24 @@ export interface ChessPieceIconProps {
35
35
  /**
36
36
  * Width and height (in pixels) of each chess piece icon.
37
37
  */
38
- size: number;
38
+ size: number,
39
39
 
40
40
  /**
41
41
  * Chess piece(s) to display.
42
42
  */
43
- type: ChessPieceIconType | ChessPieceIconType[];
43
+ type: ChessPieceIconType | ChessPieceIconType[],
44
44
 
45
45
  /**
46
46
  * Piece theme ID. Must be a property of `Chessboard.piecesets()`.
47
47
  */
48
- pieceset: string;
48
+ pieceset?: string,
49
49
  }
50
50
 
51
51
 
52
- const defaultProps: Partial<ChessPieceIconProps> = {
53
- pieceset: DEFAULT_PIECESET,
54
- };
55
-
56
-
57
52
  /**
58
53
  * SVG icon representing a colored chess piece, or a list of colored chess pieces.
59
54
  */
60
- export function ChessPieceIcon({ size, type, pieceset }: ChessPieceIconProps) {
55
+ export function ChessPieceIcon({ size, type, pieceset = DEFAULT_PIECESET }: ChessPieceIconProps) {
61
56
 
62
57
  // Sanitize the inputs.
63
58
  size = sanitizeBoundedInteger(size, MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, () => new IllegalArgument('ChessPieceIcon', 'size'));
@@ -77,8 +72,6 @@ export function ChessPieceIcon({ size, type, pieceset }: ChessPieceIconProps) {
77
72
  );
78
73
  }
79
74
 
80
- ChessPieceIcon.defaultProps = defaultProps;
81
-
82
75
 
83
76
  /**
84
77
  * Sanitization method for the small-screen limits parameter.
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -36,24 +36,19 @@ export interface SquareMarkerIconProps {
36
36
  /**
37
37
  * Width and height (in pixels) of the icon.
38
38
  */
39
- size: number;
39
+ size: number,
40
40
 
41
41
  /**
42
42
  * [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) to use to colorize the icon (for example: `'green'`, `'#ff0000'`...).
43
43
  */
44
- color: string;
44
+ color?: string,
45
45
  }
46
46
 
47
47
 
48
- const defaultProps: Partial<SquareMarkerIconProps> = {
49
- color: 'currentcolor',
50
- };
51
-
52
-
53
48
  /**
54
49
  * SVG icon representing a square marker.
55
50
  */
56
- export function SquareMarkerIcon({ size, color }: SquareMarkerIconProps) {
51
+ export function SquareMarkerIcon({ size, color = 'currentcolor' }: SquareMarkerIconProps) {
57
52
 
58
53
  // Sanitize the inputs.
59
54
  size = sanitizeBoundedInteger(size, MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, () => new IllegalArgument('SquareMarkerIcon', 'size'));
@@ -68,5 +63,3 @@ export function SquareMarkerIcon({ size, color }: SquareMarkerIconProps) {
68
63
  </svg>
69
64
  );
70
65
  }
71
-
72
- SquareMarkerIcon.defaultProps = defaultProps;
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -36,29 +36,24 @@ export interface TextMarkerIconProps {
36
36
  /**
37
37
  * Width and height (in pixels) of the icon.
38
38
  */
39
- size: number;
39
+ size: number,
40
40
 
41
41
  /**
42
42
  * Symbol to represent on the icon.
43
43
  */
44
- symbol: AnnotationSymbol;
44
+ symbol: AnnotationSymbol,
45
45
 
46
46
  /**
47
47
  * [CSS color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) to use to colorize the icon (for example: `'green'`, `'#ff0000'`...).
48
48
  */
49
- color: string;
49
+ color?: string,
50
50
  }
51
51
 
52
52
 
53
- const defaultProps: Partial<TextMarkerIconProps> = {
54
- color: 'currentcolor',
55
- };
56
-
57
-
58
53
  /**
59
54
  * SVG icon representing a text marker.
60
55
  */
61
- export function TextMarkerIcon({ size, symbol, color }: TextMarkerIconProps) {
56
+ export function TextMarkerIcon({ size, symbol, color = 'currentcolor' }: TextMarkerIconProps) {
62
57
 
63
58
  // Sanitize the inputs.
64
59
  size = sanitizeBoundedInteger(size, MIN_SQUARE_SIZE, MAX_SQUARE_SIZE, () => new IllegalArgument('TextMarkerIcon', 'size'));
@@ -75,5 +70,3 @@ export function TextMarkerIcon({ size, symbol, color }: TextMarkerIconProps) {
75
70
  </svg>
76
71
  );
77
72
  }
78
-
79
- TextMarkerIcon.defaultProps = defaultProps;
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
package/src/index.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *
@@ -3,7 +3,7 @@
3
3
  * *
4
4
  * Kokopu-React - A React-based library of chess-related components. *
5
5
  * <https://www.npmjs.com/package/kokopu-react> *
6
- * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
6
+ * Copyright (C) 2021-2025 Yoann Le Montagner <yo35 -at- melix.net> *
7
7
  * *
8
8
  * Kokopu-React is free software: you can redistribute it and/or *
9
9
  * modify it under the terms of the GNU Lesser General Public License *