kokopu-react 3.0.1 → 3.1.0

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 (250) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/lib/chessboard/BoardProperties.d.ts +91 -0
  3. package/dist/lib/chessboard/BoardProperties.js +43 -0
  4. package/dist/lib/chessboard/BoardProperties.js.map +1 -0
  5. package/dist/lib/chessboard/Chessboard.css +7 -5
  6. package/dist/lib/chessboard/Chessboard.d.ts +36 -58
  7. package/dist/lib/chessboard/Chessboard.js +33 -97
  8. package/dist/lib/chessboard/Chessboard.js.map +1 -1
  9. package/dist/lib/chessboard/ChessboardImpl.d.ts +22 -0
  10. package/dist/lib/chessboard/ChessboardImpl.js +8 -6
  11. package/dist/lib/chessboard/ChessboardImpl.js.map +1 -1
  12. package/dist/lib/chessboard/Draggable.d.ts +22 -0
  13. package/dist/lib/chessboard/Draggable.js +7 -5
  14. package/dist/lib/chessboard/Draggable.js.map +1 -1
  15. package/dist/lib/chessboard/Motion.d.ts +22 -0
  16. package/dist/lib/chessboard/Motion.js +7 -5
  17. package/dist/lib/chessboard/Motion.js.map +1 -1
  18. package/dist/lib/chessboard/colorsets.d.ts +22 -0
  19. package/dist/lib/chessboard/colorsets.js +7 -5
  20. package/dist/lib/chessboard/colorsets.js.map +1 -1
  21. package/dist/lib/chessboard/piecesets.d.ts +22 -0
  22. package/dist/lib/chessboard/piecesets.js +7 -5
  23. package/dist/lib/chessboard/piecesets.js.map +1 -1
  24. package/dist/lib/errorbox/ErrorBox.css +7 -5
  25. package/dist/lib/errorbox/ErrorBox.d.ts +22 -0
  26. package/dist/lib/errorbox/ErrorBox.js +7 -5
  27. package/dist/lib/errorbox/ErrorBox.js.map +1 -1
  28. package/dist/lib/errorbox/parsing.d.ts +57 -0
  29. package/dist/lib/errorbox/parsing.js +140 -0
  30. package/dist/lib/errorbox/parsing.js.map +1 -0
  31. package/dist/lib/exception.d.ts +22 -0
  32. package/dist/lib/exception.js +7 -5
  33. package/dist/lib/exception.js.map +1 -1
  34. package/dist/lib/i18n.d.ts +27 -0
  35. package/dist/lib/i18n.js +13 -5
  36. package/dist/lib/i18n.js.map +1 -1
  37. package/dist/lib/icons/AnnotationSymbolShape.css +7 -5
  38. package/dist/lib/icons/AnnotationSymbolShape.d.ts +22 -0
  39. package/dist/lib/icons/AnnotationSymbolShape.js +7 -5
  40. package/dist/lib/icons/AnnotationSymbolShape.js.map +1 -1
  41. package/dist/lib/icons/ArrowMarkerIcon.d.ts +22 -0
  42. package/dist/lib/icons/ArrowMarkerIcon.js +7 -5
  43. package/dist/lib/icons/ArrowMarkerIcon.js.map +1 -1
  44. package/dist/lib/icons/ArrowTip.d.ts +22 -0
  45. package/dist/lib/icons/ArrowTip.js +7 -5
  46. package/dist/lib/icons/ArrowTip.js.map +1 -1
  47. package/dist/lib/icons/ChessPieceIcon.d.ts +22 -0
  48. package/dist/lib/icons/ChessPieceIcon.js +7 -5
  49. package/dist/lib/icons/ChessPieceIcon.js.map +1 -1
  50. package/dist/lib/icons/SquareMarkerIcon.d.ts +22 -0
  51. package/dist/lib/icons/SquareMarkerIcon.js +7 -5
  52. package/dist/lib/icons/SquareMarkerIcon.js.map +1 -1
  53. package/dist/lib/icons/TextMarkerIcon.d.ts +22 -0
  54. package/dist/lib/icons/TextMarkerIcon.js +7 -5
  55. package/dist/lib/icons/TextMarkerIcon.js.map +1 -1
  56. package/dist/lib/icons/arrow.css +7 -5
  57. package/dist/lib/index.d.ts +26 -1
  58. package/dist/lib/index.js +9 -5
  59. package/dist/lib/index.js.map +1 -1
  60. package/dist/lib/movetext/Movetext.css +7 -18
  61. package/dist/lib/movetext/Movetext.d.ts +31 -43
  62. package/dist/lib/movetext/Movetext.js +22 -72
  63. package/dist/lib/movetext/Movetext.js.map +1 -1
  64. package/dist/lib/movetext/MovetextImpl.d.ts +29 -28
  65. package/dist/lib/movetext/MovetextImpl.js +22 -99
  66. package/dist/lib/movetext/MovetextImpl.js.map +1 -1
  67. package/dist/lib/movetext/fonts.css +7 -5
  68. package/dist/lib/movetext/htmlFilter.d.ts +22 -0
  69. package/dist/lib/movetext/htmlFilter.js +21 -19
  70. package/dist/lib/movetext/htmlFilter.js.map +1 -1
  71. package/dist/lib/movetext/moveFormatter.d.ts +22 -0
  72. package/dist/lib/movetext/moveFormatter.js +7 -5
  73. package/dist/lib/movetext/moveFormatter.js.map +1 -1
  74. package/dist/lib/navigationboard/NavigationBoard.d.ts +118 -0
  75. package/dist/lib/navigationboard/NavigationBoard.js +112 -0
  76. package/dist/lib/navigationboard/NavigationBoard.js.map +1 -0
  77. package/dist/lib/navigationboard/NavigationField.css +36 -0
  78. package/dist/lib/navigationboard/NavigationField.d.ts +81 -0
  79. package/dist/lib/navigationboard/NavigationField.js +154 -0
  80. package/dist/lib/navigationboard/NavigationField.js.map +1 -0
  81. package/dist/lib/navigationboard/NavigationToolbar.css +51 -0
  82. package/dist/lib/navigationboard/NavigationToolbar.d.ts +41 -0
  83. package/dist/lib/navigationboard/NavigationToolbar.js +124 -0
  84. package/dist/lib/navigationboard/NavigationToolbar.js.map +1 -0
  85. package/dist/lib/sanitization.d.ts +22 -0
  86. package/dist/lib/sanitization.js +7 -5
  87. package/dist/lib/sanitization.js.map +1 -1
  88. package/dist/lib/types.d.ts +22 -0
  89. package/dist/lib/types.js +7 -5
  90. package/dist/lib/types.js.map +1 -1
  91. package/dist/lib/util.d.ts +22 -0
  92. package/dist/lib/util.js +7 -5
  93. package/dist/lib/util.js.map +1 -1
  94. package/doc_src/demo/PageChessboardBase.tsx +7 -5
  95. package/doc_src/demo/PageChessboardInteraction.tsx +32 -22
  96. package/doc_src/demo/PageChessboardMove.tsx +24 -5
  97. package/doc_src/demo/PageChessboardSmallScreens.tsx +7 -5
  98. package/doc_src/demo/PageMovetextBase.tsx +7 -5
  99. package/doc_src/demo/PageMovetextInteraction.tsx +7 -5
  100. package/doc_src/demo/PageNavigationBoardBase.tsx +194 -0
  101. package/doc_src/demo/PageNavigationBoardUncontrolledVsControlled.tsx +114 -0
  102. package/doc_src/demo/decs.d.ts +7 -5
  103. package/doc_src/demo/demo.css +7 -5
  104. package/doc_src/demo/game-3.pgn +10 -0
  105. package/doc_src/demo/util.ts +7 -5
  106. package/doc_src/examples/Movetext.md +1 -1
  107. package/doc_src/examples/NavigationBoard.md +15 -0
  108. package/doc_src/theming/LogoRenderer.js +7 -5
  109. package/doc_src/theming/theming.css +7 -5
  110. package/package.json +27 -26
  111. package/scripts/doc.styleguide.config.js +19 -7
  112. package/scripts/docker-compose.yml +3 -3
  113. package/scripts/test-graphic.webpack.config.js +7 -5
  114. package/scripts/test-headless.webpack.config.js +7 -5
  115. package/src/chessboard/BoardProperties.ts +131 -0
  116. package/src/chessboard/Chessboard.css +7 -5
  117. package/src/chessboard/Chessboard.tsx +48 -175
  118. package/src/chessboard/ChessboardImpl.tsx +7 -5
  119. package/src/chessboard/Draggable.tsx +7 -5
  120. package/src/chessboard/Motion.tsx +7 -5
  121. package/src/chessboard/colorsets.ts +7 -5
  122. package/src/chessboard/piecesets.ts +7 -5
  123. package/src/decs.d.ts +7 -5
  124. package/src/errorbox/ErrorBox.css +7 -5
  125. package/src/errorbox/ErrorBox.tsx +7 -5
  126. package/src/errorbox/parsing.tsx +158 -0
  127. package/src/exception.ts +7 -5
  128. package/src/i18n.ts +14 -5
  129. package/src/icons/AnnotationSymbolShape.css +7 -5
  130. package/src/icons/AnnotationSymbolShape.tsx +7 -5
  131. package/src/icons/ArrowMarkerIcon.tsx +7 -5
  132. package/src/icons/ArrowTip.tsx +7 -5
  133. package/src/icons/ChessPieceIcon.tsx +7 -5
  134. package/src/icons/SquareMarkerIcon.tsx +7 -5
  135. package/src/icons/TextMarkerIcon.tsx +7 -5
  136. package/src/icons/arrow.css +7 -5
  137. package/src/index.ts +12 -6
  138. package/src/movetext/Movetext.css +7 -18
  139. package/src/movetext/Movetext.tsx +27 -90
  140. package/src/movetext/MovetextImpl.tsx +35 -120
  141. package/src/movetext/fonts.css +7 -5
  142. package/src/movetext/htmlFilter.tsx +7 -5
  143. package/src/movetext/moveFormatter.tsx +7 -5
  144. package/src/navigationboard/NavigationBoard.tsx +231 -0
  145. package/src/navigationboard/NavigationField.css +36 -0
  146. package/src/navigationboard/NavigationField.tsx +185 -0
  147. package/src/navigationboard/NavigationToolbar.css +51 -0
  148. package/src/navigationboard/NavigationToolbar.tsx +174 -0
  149. package/src/sanitization.ts +7 -5
  150. package/src/types.ts +7 -5
  151. package/src/util.ts +7 -5
  152. package/test/01_types.js +7 -5
  153. package/test/02_chessboard_util.js +7 -5
  154. package/test/03_error_box_graphic.js +7 -5
  155. package/test/04_icons_graphic.js +7 -5
  156. package/test/05_chessboard_graphic.js +9 -5
  157. package/test/06_chessboard_animation.js +7 -5
  158. package/test/07_chessboard_interaction.js +7 -5
  159. package/test/08_chessboard_play_moves.js +7 -5
  160. package/test/09_chessboard_small_screens.js +28 -5
  161. package/test/10_movetext_graphic.js +12 -5
  162. package/test/11_movetext_interaction.js +19 -13
  163. package/test/12_navigation_board.js +168 -0
  164. package/test/common/graphic.js +7 -5
  165. package/test/graphic_references/05_chessboard_graphic/move/illegal_null-move.png +0 -0
  166. package/test/graphic_references/05_chessboard_graphic/move/null-move.png +0 -0
  167. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_bottom_component.png +0 -0
  168. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/default_top_component.png +0 -0
  169. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_bottom_component.png +0 -0
  170. package/test/graphic_references/09_chessboard_small_screens/top_bottom_components/reduced_top_component.png +0 -0
  171. package/test/graphic_references/10_movetext_graphic/format_move/format_text.png +0 -0
  172. package/test/graphic_references/10_movetext_graphic/options/wrong_piece_symbol_value.png +0 -0
  173. package/test/graphic_references/11_movetext_interaction/select_moves/click_on_unselected_without_callback.png +0 -0
  174. package/test/graphic_references/12_navigation_board/controlled/default.png +0 -0
  175. package/test/graphic_references/12_navigation_board/controlled/forbidden_navigation_0.png +0 -0
  176. package/test/graphic_references/12_navigation_board/controlled/forbidden_navigation_1.png +0 -0
  177. package/test/graphic_references/12_navigation_board/controlled/invalid_node_id.png +0 -0
  178. package/test/graphic_references/12_navigation_board/controlled/no_callback_defined_0.png +0 -0
  179. package/test/graphic_references/12_navigation_board/controlled/no_callback_defined_1.png +0 -0
  180. package/test/graphic_references/12_navigation_board/controlled/overriding_initial_node_id.png +0 -0
  181. package/test/graphic_references/12_navigation_board/controlled/regular_navigation_0.png +0 -0
  182. package/test/graphic_references/12_navigation_board/controlled/regular_navigation_1.png +0 -0
  183. package/test/graphic_references/12_navigation_board/controlled/regular_navigation_2.png +0 -0
  184. package/test/graphic_references/12_navigation_board/controlled/regular_navigation_3.png +0 -0
  185. package/test/graphic_references/12_navigation_board/error/pgn_parsing_error.png +0 -0
  186. package/test/graphic_references/12_navigation_board/error/wrong_game_type.png +0 -0
  187. package/test/graphic_references/12_navigation_board/theme/custom_1.png +0 -0
  188. package/test/graphic_references/12_navigation_board/theme/custom_2.png +0 -0
  189. package/test/graphic_references/12_navigation_board/theme/large.png +0 -0
  190. package/test/graphic_references/12_navigation_board/theme/small.png +0 -0
  191. package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_beginning_0.png +0 -0
  192. package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_beginning_1.png +0 -0
  193. package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_beginning_2.png +0 -0
  194. package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_end_0.png +0 -0
  195. package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_end_1.png +0 -0
  196. package/test/graphic_references/12_navigation_board/uncontrolled/forbidden_navigation_at_end_2.png +0 -0
  197. package/test/graphic_references/12_navigation_board/uncontrolled/initial_state_at_end.png +0 -0
  198. package/test/graphic_references/12_navigation_board/uncontrolled/initial_state_at_specific_id.png +0 -0
  199. package/test/graphic_references/12_navigation_board/uncontrolled/initial_state_default.png +0 -0
  200. package/test/graphic_references/12_navigation_board/uncontrolled/initial_state_default_with_game_index.png +0 -0
  201. package/test/graphic_references/12_navigation_board/uncontrolled/initial_state_on_null-move.png +0 -0
  202. package/test/graphic_references/12_navigation_board/uncontrolled/navigation_with_keys_0.png +0 -0
  203. package/test/graphic_references/12_navigation_board/uncontrolled/navigation_with_keys_1.png +0 -0
  204. package/test/graphic_references/12_navigation_board/uncontrolled/navigation_with_keys_2.png +0 -0
  205. package/test/graphic_references/12_navigation_board/uncontrolled/navigation_with_keys_3.png +0 -0
  206. package/test/graphic_references/12_navigation_board/uncontrolled/navigation_with_keys_4.png +0 -0
  207. package/test/graphic_references/12_navigation_board/uncontrolled/regular_flipping_0.png +0 -0
  208. package/test/graphic_references/12_navigation_board/uncontrolled/regular_flipping_1.png +0 -0
  209. package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_0.png +0 -0
  210. package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_1.png +0 -0
  211. package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_2.png +0 -0
  212. package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_3.png +0 -0
  213. package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_4.png +0 -0
  214. package/test/graphic_references/12_navigation_board/uncontrolled/regular_navigation_5.png +0 -0
  215. package/test/graphic_test_app/03_error_box_graphic/base.tsx +7 -5
  216. package/test/graphic_test_app/03_error_box_graphic/localization.tsx +7 -5
  217. package/test/graphic_test_app/04_icons_graphic/chess_piece.tsx +7 -5
  218. package/test/graphic_test_app/04_icons_graphic/marker.tsx +7 -5
  219. package/test/graphic_test_app/05_chessboard_graphic/annotations.tsx +7 -5
  220. package/test/graphic_test_app/05_chessboard_graphic/base.tsx +7 -5
  221. package/test/graphic_test_app/05_chessboard_graphic/chess_variants.tsx +7 -5
  222. package/test/graphic_test_app/05_chessboard_graphic/flipped.tsx +7 -5
  223. package/test/graphic_test_app/05_chessboard_graphic/move.tsx +9 -5
  224. package/test/graphic_test_app/05_chessboard_graphic/theme.tsx +7 -5
  225. package/test/graphic_test_app/06_chessboard_animation/base_1.tsx +7 -5
  226. package/test/graphic_test_app/06_chessboard_animation/base_2.tsx +7 -5
  227. package/test/graphic_test_app/06_chessboard_animation/base_3.tsx +7 -5
  228. package/test/graphic_test_app/06_chessboard_animation/on_redraw.tsx +7 -5
  229. package/test/graphic_test_app/07_chessboard_interaction/click_squares.tsx +7 -5
  230. package/test/graphic_test_app/07_chessboard_interaction/edit_arrows.tsx +7 -5
  231. package/test/graphic_test_app/07_chessboard_interaction/error.tsx +7 -5
  232. package/test/graphic_test_app/07_chessboard_interaction/move_pieces.tsx +7 -5
  233. package/test/graphic_test_app/08_chessboard_play_moves/base.tsx +7 -5
  234. package/test/graphic_test_app/08_chessboard_play_moves/promotions.tsx +7 -5
  235. package/test/graphic_test_app/09_chessboard_small_screens/base.tsx +7 -5
  236. package/test/graphic_test_app/09_chessboard_small_screens/top_bottom_components.tsx +48 -0
  237. package/test/graphic_test_app/10_movetext_graphic/base.tsx +7 -5
  238. package/test/graphic_test_app/10_movetext_graphic/error.tsx +7 -5
  239. package/test/graphic_test_app/10_movetext_graphic/format_move.tsx +31 -0
  240. package/test/graphic_test_app/10_movetext_graphic/html.tsx +7 -5
  241. package/test/graphic_test_app/10_movetext_graphic/options.tsx +8 -5
  242. package/test/graphic_test_app/11_movetext_interaction/error.tsx +7 -5
  243. package/test/graphic_test_app/11_movetext_interaction/select_moves.tsx +8 -5
  244. package/test/graphic_test_app/12_navigation_board/controlled.tsx +43 -0
  245. package/test/graphic_test_app/12_navigation_board/error.tsx +34 -0
  246. package/test/graphic_test_app/12_navigation_board/theme.tsx +38 -0
  247. package/test/graphic_test_app/12_navigation_board/uncontrolled.tsx +56 -0
  248. package/test/graphic_test_app/common/decs.d.ts +7 -5
  249. package/test/graphic_test_app/common/test_app.css +7 -5
  250. package/test/graphic_test_app/common/test_app.tsx +7 -5
@@ -1,3 +1,25 @@
1
+ /*!
2
+ * -------------------------------------------------------------------------- *
3
+ * *
4
+ * Kokopu-React - A React-based library of chess-related components. *
5
+ * <https://www.npmjs.com/package/kokopu-react> *
6
+ * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
7
+ * *
8
+ * Kokopu-React is free software: you can redistribute it and/or *
9
+ * modify it under the terms of the GNU Lesser General Public License *
10
+ * as published by the Free Software Foundation, either version 3 of *
11
+ * the License, or (at your option) any later version. *
12
+ * *
13
+ * Kokopu-React is distributed in the hope that it will be useful, *
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16
+ * GNU Lesser General Public License for more details. *
17
+ * *
18
+ * You should have received a copy of the GNU Lesser General *
19
+ * Public License along with this program. If not, see *
20
+ * <http://www.gnu.org/licenses/>. *
21
+ * *
22
+ * -------------------------------------------------------------------------- */
1
23
  import * as React from 'react';
2
24
  import { AnnotationSymbol } from '../types';
3
25
  export interface TextMarkerIconProps {
@@ -1,14 +1,16 @@
1
- /* -------------------------------------------------------------------------- *
1
+ /*!
2
+ * -------------------------------------------------------------------------- *
2
3
  * *
3
- * This file is part of Kokopu-React, a JavaScript chess library. *
4
- * Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
4
+ * Kokopu-React - A React-based library of chess-related components. *
5
+ * <https://www.npmjs.com/package/kokopu-react> *
6
+ * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
5
7
  * *
6
- * This program is free software: you can redistribute it and/or *
8
+ * Kokopu-React is free software: you can redistribute it and/or *
7
9
  * modify it under the terms of the GNU Lesser General Public License *
8
10
  * as published by the Free Software Foundation, either version 3 of *
9
11
  * the License, or (at your option) any later version. *
10
12
  * *
11
- * This program is distributed in the hope that it will be useful, *
13
+ * Kokopu-React is distributed in the hope that it will be useful, *
12
14
  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
16
  * GNU Lesser General Public License for more details. *
@@ -1 +1 @@
1
- {"version":3,"file":"TextMarkerIcon.js","sourceRoot":"","sources":["../../../src/icons/TextMarkerIcon.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;gFAmBgF;AAGhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAoB,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAElG,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAsBhE,MAAM,YAAY,GAAiC;IAClD,KAAK,EAAE,cAAc;CACrB,CAAC;AAGF;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAuB;IAE1E,uBAAuB;IACvB,IAAI,GAAG,sBAAsB,CAAC,IAAI,EAAE,eAAe,EAAE,eAAe,EAAE,GAAG,EAAE,CAAC,IAAI,eAAe,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3H,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,EAAE;QAChC,MAAM,IAAI,eAAe,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;KACtD;IACD,KAAK,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;IAE9B,wBAAwB;IACxB,MAAM,OAAO,GAAG,OAAO,IAAI,IAAI,IAAI,EAAE,CAAC;IACtC,OAAO,CACN,6BAAK,SAAS,EAAC,uBAAuB,EAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI;QACjF,oBAAC,qBAAqB,IAAC,CAAC,EAAE,IA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AAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI;QACjF,oBAAC,qBAAqB,IAAC,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAI,CACxF,CACN,CAAC;AACH,CAAC;AAED,cAAc,CAAC,YAAY,GAAG,YAAY,CAAC"}
@@ -1,14 +1,16 @@
1
- /* -------------------------------------------------------------------------- *
1
+ /*!
2
+ * -------------------------------------------------------------------------- *
2
3
  * *
3
- * This file is part of Kokopu-React, a JavaScript chess library. *
4
- * Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
4
+ * Kokopu-React - A React-based library of chess-related components. *
5
+ * <https://www.npmjs.com/package/kokopu-react> *
6
+ * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
5
7
  * *
6
- * This program is free software: you can redistribute it and/or *
8
+ * Kokopu-React is free software: you can redistribute it and/or *
7
9
  * modify it under the terms of the GNU Lesser General Public License *
8
10
  * as published by the Free Software Foundation, either version 3 of *
9
11
  * the License, or (at your option) any later version. *
10
12
  * *
11
- * This program is distributed in the hope that it will be useful, *
13
+ * Kokopu-React is distributed in the hope that it will be useful, *
12
14
  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
16
  * GNU Lesser General Public License for more details. *
@@ -1,3 +1,25 @@
1
+ /*!
2
+ * -------------------------------------------------------------------------- *
3
+ * *
4
+ * Kokopu-React - A React-based library of chess-related components. *
5
+ * <https://www.npmjs.com/package/kokopu-react> *
6
+ * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
7
+ * *
8
+ * Kokopu-React is free software: you can redistribute it and/or *
9
+ * modify it under the terms of the GNU Lesser General Public License *
10
+ * as published by the Free Software Foundation, either version 3 of *
11
+ * the License, or (at your option) any later version. *
12
+ * *
13
+ * Kokopu-React is distributed in the hope that it will be useful, *
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16
+ * GNU Lesser General Public License for more details. *
17
+ * *
18
+ * You should have received a copy of the GNU Lesser General *
19
+ * Public License along with this program. If not, see *
20
+ * <http://www.gnu.org/licenses/>. *
21
+ * *
22
+ * -------------------------------------------------------------------------- */
1
23
  export { i18n } from './i18n';
2
24
  export * as exception from './exception';
3
25
  export { ChessPieceIconType, Colorset, Pieceset, PieceSymbolMapping, AnnotationColor, AnnotationSymbol, SquareMarkerSet, TextMarkerSet, ArrowMarkerSet, isChessPieceIconType, isPieceSymbolMapping, isAnnotationColor, isAnnotationSymbol, flattenSquareMarkers, flattenTextMarkers, flattenArrowMarkers, parseSquareMarkers, parseTextMarkers, parseArrowMarkers } from './types';
@@ -6,6 +28,9 @@ export { SquareMarkerIcon, SquareMarkerIconProps } from './icons/SquareMarkerIco
6
28
  export { TextMarkerIcon, TextMarkerIconProps } from './icons/TextMarkerIcon';
7
29
  export { ArrowMarkerIcon, ArrowMarkerIconProps } from './icons/ArrowMarkerIcon';
8
30
  export { ChessPieceIcon, ChessPieceIconProps } from './icons/ChessPieceIcon';
9
- export { Chessboard, ChessboardProps, SmallScreenLimit } from './chessboard/Chessboard';
31
+ export { SmallScreenLimit } from './chessboard/BoardProperties';
32
+ export { Chessboard, ChessboardProps } from './chessboard/Chessboard';
10
33
  export { formatMove, moveFormatter } from './movetext/moveFormatter';
11
34
  export { Movetext, MovetextProps, MoveSelectEventOrigin } from './movetext/Movetext';
35
+ export { firstNodeId, previousNodeId, nextNodeId, lastNodeId } from './navigationboard/NavigationField';
36
+ export { NavigationBoard, NavigationBoardProps } from './navigationboard/NavigationBoard';
package/dist/lib/index.js CHANGED
@@ -1,14 +1,16 @@
1
- /* -------------------------------------------------------------------------- *
1
+ /*!
2
+ * -------------------------------------------------------------------------- *
2
3
  * *
3
- * This file is part of Kokopu-React, a JavaScript chess library. *
4
- * Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
4
+ * Kokopu-React - A React-based library of chess-related components. *
5
+ * <https://www.npmjs.com/package/kokopu-react> *
6
+ * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
5
7
  * *
6
- * This program is free software: you can redistribute it and/or *
8
+ * Kokopu-React is free software: you can redistribute it and/or *
7
9
  * modify it under the terms of the GNU Lesser General Public License *
8
10
  * as published by the Free Software Foundation, either version 3 of *
9
11
  * the License, or (at your option) any later version. *
10
12
  * *
11
- * This program is distributed in the hope that it will be useful, *
13
+ * Kokopu-React is distributed in the hope that it will be useful, *
12
14
  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
16
  * GNU Lesser General Public License for more details. *
@@ -29,4 +31,6 @@ export { ChessPieceIcon } from './icons/ChessPieceIcon';
29
31
  export { Chessboard } from './chessboard/Chessboard';
30
32
  export { formatMove, moveFormatter } from './movetext/moveFormatter';
31
33
  export { Movetext } from './movetext/Movetext';
34
+ export { firstNodeId, previousNodeId, nextNodeId, lastNodeId } from './navigationboard/NavigationField';
35
+ export { NavigationBoard } from './navigationboard/NavigationBoard';
32
36
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;gFAmBgF;AAGhF,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AAEzC,OAAO,EACN,oBAAoB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,mBAAmB,EAChJ,kBAAkB,EAAE,gBAAgB,EAAE,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rE,OAAO,EAAE,QAAQ,EAAwC,MAAM,qBAAqB,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AACxG,OAAO,EAAE,eAAe,EAAwB,MAAM,mCAAmC,CAAC"}
@@ -1,14 +1,16 @@
1
- /* -------------------------------------------------------------------------- *
1
+ /*!
2
+ * -------------------------------------------------------------------------- *
2
3
  * *
3
- * This file is part of Kokopu-React, a JavaScript chess library. *
4
- * Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
4
+ * Kokopu-React - A React-based library of chess-related components. *
5
+ * <https://www.npmjs.com/package/kokopu-react> *
6
+ * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
5
7
  * *
6
- * This program is free software: you can redistribute it and/or *
8
+ * Kokopu-React is free software: you can redistribute it and/or *
7
9
  * modify it under the terms of the GNU Lesser General Public License *
8
10
  * as published by the Free Software Foundation, either version 3 of *
9
11
  * the License, or (at your option) any later version. *
10
12
  * *
11
- * This program is distributed in the hope that it will be useful, *
13
+ * Kokopu-React is distributed in the hope that it will be useful, *
12
14
  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
16
  * GNU Lesser General Public License for more details. *
@@ -106,16 +108,3 @@ div.kokopu-subVariation {
106
108
  text-decoration: underline;
107
109
  cursor: pointer;
108
110
  }
109
-
110
- .kokopu-focusFieldContainer {
111
- position: fixed;
112
- bottom: 0px;
113
- right: 0px;
114
- width: 0px;
115
- height: 0px;
116
- overflow: hidden;
117
- }
118
-
119
- .kokopu-focusField {
120
- position: absolute; /* see #1 */
121
- }
@@ -1,7 +1,29 @@
1
+ /*!
2
+ * -------------------------------------------------------------------------- *
3
+ * *
4
+ * Kokopu-React - A React-based library of chess-related components. *
5
+ * <https://www.npmjs.com/package/kokopu-react> *
6
+ * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
7
+ * *
8
+ * Kokopu-React is free software: you can redistribute it and/or *
9
+ * modify it under the terms of the GNU Lesser General Public License *
10
+ * as published by the Free Software Foundation, either version 3 of *
11
+ * the License, or (at your option) any later version. *
12
+ * *
13
+ * Kokopu-React is distributed in the hope that it will be useful, *
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16
+ * GNU Lesser General Public License for more details. *
17
+ * *
18
+ * You should have received a copy of the GNU Lesser General *
19
+ * Public License along with this program. If not, see *
20
+ * <http://www.gnu.org/licenses/>. *
21
+ * *
22
+ * -------------------------------------------------------------------------- */
1
23
  import * as React from 'react';
2
24
  import { Database, Game } from 'kokopu';
3
25
  import { PieceSymbolMapping } from '../types';
4
- import { ChessboardProps } from '../chessboard/Chessboard';
26
+ import { StaticBoardGraphicProps } from '../chessboard/BoardProperties';
5
27
  import './Movetext.css';
6
28
  /**
7
29
  * Origin of a "move-selected" event in {@link Movetext}. See {@link MovetextProps.onMoveSelected} for more details.
@@ -9,7 +31,7 @@ import './Movetext.css';
9
31
  export type MoveSelectEventOrigin = 'key-first' | 'key-previous' | 'key-next' | 'key-last' | 'key-exit' | 'click';
10
32
  export interface MovetextProps {
11
33
  /**
12
- * Displayed position. Can be a [kokopu.Game](https://kokopu.yo35.org/docs/current/classes/Game.html) object,
34
+ * Displayed game. Can be a [kokopu.Game](https://kokopu.yo35.org/docs/current/classes/Game.html) object,
13
35
  * a [kokopu.Database](https://kokopu.yo35.org/docs/current/classes/Database.html) object,
14
36
  * or a [PGN string](https://en.wikipedia.org/wiki/Portable_Game_Notation).
15
37
  */
@@ -23,14 +45,8 @@ export interface MovetextProps {
23
45
  /**
24
46
  * Options applicable to the diagrams in the comments. See [Chessboard](#/Components/Chessboard) for more details about each option.
25
47
  */
26
- diagramOptions: {
27
- flipped?: ChessboardProps['flipped'];
28
- squareSize?: ChessboardProps['squareSize'];
29
- coordinateVisible?: ChessboardProps['coordinateVisible'];
30
- turnVisible?: ChessboardProps['turnVisible'];
31
- colorset?: ChessboardProps['colorset'];
32
- pieceset?: ChessboardProps['pieceset'];
33
- smallScreenLimits?: ChessboardProps['smallScreenLimits'];
48
+ diagramOptions: Partial<StaticBoardGraphicProps> & {
49
+ flipped?: boolean;
34
50
  };
35
51
  /**
36
52
  * Symbols to use for the chess pieces. See {@link moveFormatter}.
@@ -45,7 +61,7 @@ export interface MovetextProps {
45
61
  */
46
62
  headerVisible: boolean;
47
63
  /**
48
- * ID of the selected move (or `'start'` for the beginning of the main variation).
64
+ * ID of the selected move (or `'start'`/`'end'` for the beginning/end of the main variation).
49
65
  * Use [kokopu.Node#id](https://kokopu.yo35.org/docs/current/classes/Node.html#id) to get the ID of a game move.
50
66
  */
51
67
  selection?: string;
@@ -92,47 +108,19 @@ export declare class Movetext extends React.Component<MovetextProps> {
92
108
  */
93
109
  focus(): void;
94
110
  /**
95
- * Return the ID of the main variation in the given chess game.
96
- * If the given selection corresponds already at the main variation, `undefined` is returned.
97
- *
98
- * This corresponds to the operation performed when the user presses key "home" on a `Movetext` component.
99
- *
100
- * @param game - Considered chess game.
101
- * @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
102
- * @public
111
+ * @deprecated
103
112
  */
104
113
  static firstNodeId(game: Game, selection: string): string | undefined;
105
114
  /**
106
- * Return the ID of the node immediately preceding the given selection in the given chess game.
107
- * If no such node exists, `undefined` is returned.
108
- *
109
- * This corresponds to the operation performed when the user presses key "arrow left" on a `Movetext` component.
110
- *
111
- * @param game - Considered chess game.
112
- * @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
113
- * @public
115
+ * @deprecated
114
116
  */
115
117
  static previousNodeId(game: Game, selection: string): string | undefined;
116
118
  /**
117
- * Return the ID of the node immediately following the given selection in the given chess game.
118
- * If no such node exists, `undefined` is returned.
119
- *
120
- * This corresponds to the operation performed when the user presses key "arrow right" on a `Movetext` component.
121
- *
122
- * @param game - Considered chess game.
123
- * @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
124
- * @public
119
+ * @deprecated
125
120
  */
126
121
  static nextNodeId(game: Game, selection: string): string | undefined;
127
122
  /**
128
- * Return the ID of the node at then end of the variation in which lies the given selection in the given chess game.
129
- * If the selection is already at the end its variation, `undefined` is returned.
130
- *
131
- * This corresponds to the operation performed when the user presses key "end" on a `Movetext` component.
132
- *
133
- * @param game - Considered chess game.
134
- * @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
135
- * @public
123
+ * @deprecated
136
124
  */
137
125
  static lastNodeId(game: Game, selection: string): string | undefined;
138
126
  }
@@ -1,14 +1,16 @@
1
- /* -------------------------------------------------------------------------- *
1
+ /*!
2
+ * -------------------------------------------------------------------------- *
2
3
  * *
3
- * This file is part of Kokopu-React, a JavaScript chess library. *
4
- * Copyright (C) 2021-2023 Yoann Le Montagner <yo35 -at- melix.net> *
4
+ * Kokopu-React - A React-based library of chess-related components. *
5
+ * <https://www.npmjs.com/package/kokopu-react> *
6
+ * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
5
7
  * *
6
- * This program is free software: you can redistribute it and/or *
8
+ * Kokopu-React is free software: you can redistribute it and/or *
7
9
  * modify it under the terms of the GNU Lesser General Public License *
8
10
  * as published by the Free Software Foundation, either version 3 of *
9
11
  * the License, or (at your option) any later version. *
10
12
  * *
11
- * This program is distributed in the hope that it will be useful, *
13
+ * Kokopu-React is distributed in the hope that it will be useful, *
12
14
  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13
15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14
16
  * GNU Lesser General Public License for more details. *
@@ -19,13 +21,13 @@
19
21
  * *
20
22
  * -------------------------------------------------------------------------- */
21
23
  import * as React from 'react';
22
- import { exception as kokopuException, Database, Game, pgnRead } from 'kokopu';
24
+ import { Game } from 'kokopu';
23
25
  import { IllegalArgument } from '../exception';
24
- import { i18n } from '../i18n';
25
26
  import { sanitizeString, sanitizeBoolean, sanitizeOptional } from '../sanitization';
26
- import { ErrorBox } from '../errorbox/ErrorBox';
27
+ import { parseGame } from '../errorbox/parsing';
28
+ import { firstNodeId as firstNodeIdImpl, previousNodeId as previousNodeIdImpl, nextNodeId as nextNodeIdImpl, lastNodeId as lastNodeIdImpl } from '../navigationboard/NavigationField';
27
29
  import { moveFormatter } from './moveFormatter';
28
- import { MovetextImpl, firstNodeIdImpl, previousNodeIdImpl, nextNodeIdImpl, lastNodeIdImpl } from './MovetextImpl';
30
+ import { MovetextImpl } from './MovetextImpl';
29
31
  import './Movetext.css';
30
32
  /**
31
33
  * Display a chess game, i.e. the headers (name of the players, event, etc.), the moves, and all the related annotations if any (comments, variations, NAGs...).
@@ -37,9 +39,9 @@ export class Movetext extends React.Component {
37
39
  }
38
40
  render() {
39
41
  // Validate the game and game-index attributes.
40
- const info = parseGame(this.props.game, this.props.gameIndex);
42
+ const info = parseGame(this.props.game, this.props.gameIndex, 'Movetext');
41
43
  if (info.error) {
42
- return (React.createElement(ErrorBox, { title: i18n.INVALID_PGN_ERROR_TITLE, message: info.pgnException.message, text: info.pgnException.pgn, errorIndex: info.pgnException.index, lineNumber: info.pgnException.lineNumber }));
44
+ return info.errorBox;
43
45
  }
44
46
  // Validate the appearance attributes.
45
47
  if (typeof this.props.diagramOptions !== 'object' || this.props.diagramOptions === null) {
@@ -70,59 +72,36 @@ export class Movetext extends React.Component {
70
72
  */
71
73
  focus() {
72
74
  const movetextImpl = this.implRef.current;
75
+ // istanbul ignore else
73
76
  if (movetextImpl) {
74
77
  movetextImpl.focus();
75
78
  }
76
79
  }
77
80
  /**
78
- * Return the ID of the main variation in the given chess game.
79
- * If the given selection corresponds already at the main variation, `undefined` is returned.
80
- *
81
- * This corresponds to the operation performed when the user presses key "home" on a `Movetext` component.
82
- *
83
- * @param game - Considered chess game.
84
- * @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
85
- * @public
81
+ * @deprecated
86
82
  */
83
+ // istanbul ignore next
87
84
  static firstNodeId(game, selection) {
88
85
  return firstNodeIdImpl(game, selection);
89
86
  }
90
87
  /**
91
- * Return the ID of the node immediately preceding the given selection in the given chess game.
92
- * If no such node exists, `undefined` is returned.
93
- *
94
- * This corresponds to the operation performed when the user presses key "arrow left" on a `Movetext` component.
95
- *
96
- * @param game - Considered chess game.
97
- * @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
98
- * @public
88
+ * @deprecated
99
89
  */
90
+ // istanbul ignore next
100
91
  static previousNodeId(game, selection) {
101
92
  return previousNodeIdImpl(game, selection);
102
93
  }
103
94
  /**
104
- * Return the ID of the node immediately following the given selection in the given chess game.
105
- * If no such node exists, `undefined` is returned.
106
- *
107
- * This corresponds to the operation performed when the user presses key "arrow right" on a `Movetext` component.
108
- *
109
- * @param game - Considered chess game.
110
- * @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
111
- * @public
95
+ * @deprecated
112
96
  */
97
+ // istanbul ignore next
113
98
  static nextNodeId(game, selection) {
114
99
  return nextNodeIdImpl(game, selection);
115
100
  }
116
101
  /**
117
- * Return the ID of the node at then end of the variation in which lies the given selection in the given chess game.
118
- * If the selection is already at the end its variation, `undefined` is returned.
119
- *
120
- * This corresponds to the operation performed when the user presses key "end" on a `Movetext` component.
121
- *
122
- * @param game - Considered chess game.
123
- * @param selection - ID of the selected move (or `'start'` for the beginning of the main variation).
124
- * @public
102
+ * @deprecated
125
103
  */
104
+ // istanbul ignore next
126
105
  static lastNodeId(game, selection) {
127
106
  return lastNodeIdImpl(game, selection);
128
107
  }
@@ -135,33 +114,4 @@ Movetext.defaultProps = {
135
114
  diagramVisible: true,
136
115
  headerVisible: true,
137
116
  };
138
- /**
139
- * Try to interpret the given object as a chess game.
140
- */
141
- function parseGame(game, gameIndex) {
142
- if (game instanceof Game) {
143
- return { error: false, game: game };
144
- }
145
- else if (game instanceof Database || typeof game === 'string') {
146
- if (!Number.isInteger(gameIndex) || gameIndex < 0) {
147
- throw new IllegalArgument('Movetext', 'gameIndex');
148
- }
149
- try {
150
- const result = game instanceof Database ? game.game(gameIndex) : pgnRead(game, gameIndex);
151
- return { error: false, game: result };
152
- }
153
- catch (e) {
154
- // istanbul ignore else
155
- if (e instanceof kokopuException.InvalidPGN) {
156
- return { error: true, pgnException: e };
157
- }
158
- else {
159
- throw e;
160
- }
161
- }
162
- }
163
- else {
164
- throw new IllegalArgument('Movetext', 'game');
165
- }
166
- }
167
117
  //# sourceMappingURL=Movetext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Movetext.js","sourceRoot":"","sources":["../../../src/movetext/Movetext.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;gFAmBgF;AAGhF,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,SAAS,IAAI,eAAe,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,QAAQ,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAIpF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEnH,OAAO,gBAAgB,CAAC;AAmFxB;;GAEG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK,CAAC,SAAwB;IAA5D;;QAWS,YAAO,GAAkC,KAAK,CAAC,SAAS,EAAE,CAAC;IAmHpE,CAAC;IAjHA,MAAM;QAEL,+CAA+C;QAC/C,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI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,CAAC,cAAc,CAAC,IAAU,EAAE,SAAiB;QAClD,OAAO,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAC5C,CAAC;IAED;;OAEG;IACH,uBAAuB;IACvB,MAAM,CAAC,UAAU,CAAC,IAAU,EAAE,SAAiB;QAC9C,OAAO,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;IAED;;OAEG;IACH,uBAAuB;IACvB,MAAM,CAAC,UAAU,CAAC,IAAU,EAAE,SAAiB;QAC9C,OAAO,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;;AA9FM,qBAAY,GAAG;IACrB,IAAI,EAAE,IAAI,IAAI,EAAE;IAChB,SAAS,EAAE,CAAC;IACZ,cAAc,EAAE,EAAE;IAClB,YAAY,EAAE,QAAQ;IACtB,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,IAAI;CACnB,AAPkB,CAOjB"}
@@ -1,17 +1,33 @@
1
+ /*!
2
+ * -------------------------------------------------------------------------- *
3
+ * *
4
+ * Kokopu-React - A React-based library of chess-related components. *
5
+ * <https://www.npmjs.com/package/kokopu-react> *
6
+ * Copyright (C) 2021-2024 Yoann Le Montagner <yo35 -at- melix.net> *
7
+ * *
8
+ * Kokopu-React is free software: you can redistribute it and/or *
9
+ * modify it under the terms of the GNU Lesser General Public License *
10
+ * as published by the Free Software Foundation, either version 3 of *
11
+ * the License, or (at your option) any later version. *
12
+ * *
13
+ * Kokopu-React is distributed in the hope that it will be useful, *
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16
+ * GNU Lesser General Public License for more details. *
17
+ * *
18
+ * You should have received a copy of the GNU Lesser General *
19
+ * Public License along with this program. If not, see *
20
+ * <http://www.gnu.org/licenses/>. *
21
+ * *
22
+ * -------------------------------------------------------------------------- */
1
23
  import * as React from 'react';
2
24
  import { Game } from 'kokopu';
3
- import { ChessboardProps } from '../chessboard/Chessboard';
25
+ import { StaticBoardGraphicProps } from '../chessboard/BoardProperties';
4
26
  import './Movetext.css';
5
27
  interface MovetextImplProps {
6
28
  game: Game;
7
- diagramOptions: {
8
- flipped?: ChessboardProps['flipped'];
9
- squareSize?: ChessboardProps['squareSize'];
10
- coordinateVisible?: ChessboardProps['coordinateVisible'];
11
- turnVisible?: ChessboardProps['turnVisible'];
12
- colorset?: ChessboardProps['colorset'];
13
- pieceset?: ChessboardProps['pieceset'];
14
- smallScreenLimits?: ChessboardProps['smallScreenLimits'];
29
+ diagramOptions: Partial<StaticBoardGraphicProps> & {
30
+ flipped?: boolean;
15
31
  };
16
32
  moveFormatter: (notation: string) => React.ReactNode;
17
33
  diagramVisible: boolean;
@@ -26,7 +42,7 @@ interface MovetextImplProps {
26
42
  * This implementation assumes that all the parameter sanitization has been performed beforehand.
27
43
  */
28
44
  export declare class MovetextImpl extends React.Component<MovetextImplProps> {
29
- private focusFieldRef;
45
+ private navigationFieldRef;
30
46
  render(): React.JSX.Element;
31
47
  private renderHeaders;
32
48
  /**
@@ -45,7 +61,7 @@ export declare class MovetextImpl extends React.Component<MovetextImplProps> {
45
61
  * Header containing the annotator information.
46
62
  */
47
63
  private renderAnnotatorHeader;
48
- private renderFocusField;
64
+ private renderNavigationField;
49
65
  private renderBody;
50
66
  /**
51
67
  * Render the given variation and its sub-variations, recursively.
@@ -60,7 +76,8 @@ export declare class MovetextImpl extends React.Component<MovetextImplProps> {
60
76
  */
61
77
  private renderComment;
62
78
  private extractComment;
63
- private handleKeyDownInFocusField;
79
+ private handleNavigationPressed;
80
+ private handleExitPressed;
64
81
  private fireMoveSelected;
65
82
  private handleNodeClicked;
66
83
  /**
@@ -68,20 +85,4 @@ export declare class MovetextImpl extends React.Component<MovetextImplProps> {
68
85
  */
69
86
  focus(): void;
70
87
  }
71
- /**
72
- * See {@link Movetext.firstNodeId}.
73
- */
74
- export declare function firstNodeIdImpl(game: Game, selection: string): string | undefined;
75
- /**
76
- * See {@link Movetext.previousNodeId}.
77
- */
78
- export declare function previousNodeIdImpl(game: Game, selection: string): string | undefined;
79
- /**
80
- * See {@link Movetext.nextNodeId}.
81
- */
82
- export declare function nextNodeIdImpl(game: Game, selection: string): string | undefined;
83
- /**
84
- * See {@link Movetext.lastNodeId}.
85
- */
86
- export declare function lastNodeIdImpl(game: Game, selection: string): string | undefined;
87
88
  export {};